added notification-plugin in the module

This commit is contained in:
Francesco Mangiacrapa 2024-01-19 13:06:37 +01:00
parent b2d48aa780
commit cccad98c12
4 changed files with 43 additions and 23 deletions

View File

@ -27,6 +27,13 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-smartgears-bom</artifactId>
<version>${gcube-smartgears-bom-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.gcube.application.cms</groupId> <groupId>org.gcube.application.cms</groupId>
<artifactId>cms-plugin-framework</artifactId> <artifactId>cms-plugin-framework</artifactId>
<version>${plugin-framework-version}</version> <version>${plugin-framework-version}</version>

View File

@ -9,7 +9,6 @@ import org.bson.Document;
import org.gcube.application.cms.cataloguebinding.doaction.BindingAction; import org.gcube.application.cms.cataloguebinding.doaction.BindingAction;
import org.gcube.application.cms.implementations.utils.UserUtils; import org.gcube.application.cms.implementations.utils.UserUtils;
import org.gcube.application.cms.plugins.EventListenerPluginInterface; import org.gcube.application.cms.plugins.EventListenerPluginInterface;
import org.gcube.application.cms.plugins.InitializablePlugin;
import org.gcube.application.cms.plugins.events.EventListener; import org.gcube.application.cms.plugins.events.EventListener;
import org.gcube.application.cms.plugins.events.EventManager; import org.gcube.application.cms.plugins.events.EventManager;
import org.gcube.application.cms.plugins.events.EventManager.Event; import org.gcube.application.cms.plugins.events.EventManager.Event;

View File

@ -3,28 +3,42 @@ package org.gcube.application.cms.notifications;
import org.gcube.application.cms.plugins.implementations.AbstractPlugin; import org.gcube.application.cms.plugins.implementations.AbstractPlugin;
import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor; import org.gcube.application.geoportal.common.model.plugins.PluginDescriptor;
import com.vdurmont.semver4j.Semver;
public class NotificationsPlugin extends AbstractPlugin { public class NotificationsPlugin extends AbstractPlugin {
public static final PluginDescriptor DESCRIPTOR = new PluginDescriptor(NotificationsPlugin.class.getName(),
"Notification");
@Override static {
public PluginDescriptor getDescriptor() { DESCRIPTOR.setVersion(new Semver("1.0.0"));
/* DESCRIPTOR.setDescription("Manage the notification from Geoportal engine");
Should basically perform something like }
curl --location --request POST 'https://api.dev.d4science.org/social-networking-library-ws/rest/2/notifications/catalogue' \
--header 'Content-Type: application/json' \ @Override
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJSSklZNEpoNF9qdDdvNmREY0NlUDFfS1l0akcxVExXVW9oMkQ2Tzk1bFNBIn0.eyJleHAiOjE2NTEyMzY2MzgsImlhdCI6MTY1MTIzNjMzOCwiYXV0aF90aW1lIjoxNjUxMjM2MzM0LCJqdGkiOiI5OGE5NjliMy04N2EzLTRiZWYtOWQ1Yi0yYTUwMmM5YWNmZTEiLCJpc3MiOiJodHRwczovL2FjY291bnRzLmRldi5kNHNjaWVuY2Uub3JnL2F1dGgvcmVhbG1zL2Q0c2NpZW5jZSIsImF1ZCI6IiUyRmdjdWJlJTJGZGV2c2VjJTJGZGV2VlJFIiwic3ViIjoiNmE4MmY1ODctYzgwZS00OWUzLTg4YzYtYzExN2U5ZDhkM2Y3IiwidHlwIjoiQmVhcmVyIiwiYXpwIjoibmV4dC5kNHNjaWVuY2Uub3JnIiwic2Vzc2lvbl9zdGF0ZSI6IjA2NzQ2ZDNkLTExNjYtNGVjMC1hZWZmLTBiY2Q2YTEzMTI0MiIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiLyoiXSwicmVzb3VyY2VfYWNjZXNzIjp7ImNvbmR1Y3Rvci1zZXJ2ZXIiOnsicm9sZXMiOlsiY29uZHVjdG9yLW1hbmFnZXIiXX0sIiUyRmdjdWJlJTJGZGV2c2VjJTJGZGV2VlJFIjp7InJvbGVzIjpbIkRhdGEtTWFuYWdlciIsIlZSRS1NYW5hZ2VyIiwiTWVtYmVyIl19fSwiYXV0aG9yaXphdGlvbiI6eyJwZXJtaXNzaW9ucyI6W3sicnNpZCI6IjU3Mjg1NTEwLTM5MzktNGRlNy04ZmMxLWUzYTlkM2NjZTI4MSIsInJzbmFtZSI6IkRlZmF1bHQgUmVzb3VyY2UifV19LCJzY29wZSI6ImVtYWlsIHByb2ZpbGUiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwibmFtZSI6Ik1hc3NpbWlsaWFuIEFzc2FudGUiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJtYXNzaW1pbGlhbm8uYXNzYW50ZSIsImdpdmVuX25hbWUiOiJNYXNzaW1pbGlhbiIsImxvY2FsZSI6ImVuIiwiZmFtaWx5X25hbWUiOiJBc3NhbnRlIiwiZW1haWwiOiJtYXNzaW1pbGlhbm8uYXNzYW50ZUBpc3RpLmNuci5pdCJ9.b7TBRgsW0__3kl2H_ljcL7fSI9I1QaIqQq0Y7S90bWHtkRvmPkPyzWuGq9hhyN1kRg52Ue_3tEEDEkGgtceBEoZ0RAbpppkum7AJvjX6tKHF79k7wpnbxl7ED65VZFk0EazfC2w_n0WvPHQsb67zdwFeZk97G0pbjsVxYUBrhmnEMtXNzmAWaC0cc_-DriE5BBn3DjuWnaxXDxp3DB74YZoJmYR9HYN94c7Y0IV1XZxGFXLZ8V7UTfcJrGqulhF7HU79jd8hccZniam3NEfTZV-knJ4uEnupRHfMLBhnn1MGzxYFPN1xPIPgwiLSvRef7lK2sjI_bi6GAcT0sg5zwA' \ public PluginDescriptor getDescriptor() {
--data-raw ' {
"idsToNotify" : ["leonardo.candela", "luca.frosini"], /*
"itemId" : "Conversational search dataset with labels", * Should basically perform something like curl --location --request POST
"notifyText" : "published the test item '\''Conversational search dataset with labels'\''", * 'https://api.dev.d4science.org/social-networking-library-ws/rest/2/
"itemURL" : "https://data.d4science.org/ctlg/ResourceCatalogue/conversational_dataset_with_labels", * notifications/catalogue' \ --header 'Content-Type: application/json' \
"idsAsGroup" : false, * --header 'Authorization: Bearer
"type" : "ITEM_PUBLISHED" * eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIi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lcm5hbWUiOiJtYXNzaW1pbGlhbm8uYXNzYW50ZSIsImdpdmVuX25hbWUiOiJNYXNzaW1pbGlhbiIsImxvY2FsZSI6ImVuIiwiZmFtaWx5X25hbWUiOiJBc3NhbnRlIiwiZW1haWwiOiJtYXNzaW1pbGlhbm8uYXNzYW50ZUBpc3RpLmNuci5pdCJ9
* .
* b7TBRgsW0__3kl2H_ljcL7fSI9I1QaIqQq0Y7S90bWHtkRvmPkPyzWuGq9hhyN1kRg52Ue_3tEEDEkGgtceBEoZ0RAbpppkum7AJvjX6tKHF79k7wpnbxl7ED65VZFk0EazfC2w_n0WvPHQsb67zdwFeZk97G0pbjsVxYUBrhmnEMtXNzmAWaC0cc_
* -
return null; * DriE5BBn3DjuWnaxXDxp3DB74YZoJmYR9HYN94c7Y0IV1XZxGFXLZ8V7UTfcJrGqulhF7HU79jd8hccZniam3NEfTZV
} * -knJ4uEnupRHfMLBhnn1MGzxYFPN1xPIPgwiLSvRef7lK2sjI_bi6GAcT0sg5zwA' \
* --data-raw ' { "idsToNotify" : ["leonardo.candela", "luca.frosini"], "itemId"
* : "Conversational search dataset with labels", "notifyText" :
* "published the test item '\''Conversational search dataset with labels'\''",
* "itemURL" :
* "https://data.d4science.org/ctlg/ResourceCatalogue/conversational_dataset_with_labels",
* "idsAsGroup" : false, "type" : "ITEM_PUBLISHED" }
*/
return DESCRIPTOR;
}
} }

View File

@ -97,8 +97,8 @@
<module>default-lc-managers</module> <module>default-lc-managers</module>
<module>sdi-plugins</module> <module>sdi-plugins</module>
<module>catalogue-binding-plugin</module> <module>catalogue-binding-plugin</module>
<module>notifications-plugins</module>
<!-- <module>notifications-plugins</module> -->
<!-- <module>dataminer-plugins</module> --> <!-- <module>dataminer-plugins</module> -->
<!-- <module>images-plugin</module> --> <!-- <module>images-plugin</module> -->
<!-- <module>ckan-plugin</module> --> <!-- <module>ckan-plugin</module> -->