diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/ActiveStatus.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/ActiveStatus.java deleted file mode 100644 index 918b7b193..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/ActiveStatus.java +++ /dev/null @@ -1,27 +0,0 @@ -package eu.eudat.commons.enums.old.notification; - -public enum ActiveStatus { - ACTIVE(0), - INACTIVE(1); - - private int status; - - ActiveStatus(int status) { - this.status = status; - } - - public int getStatus() { - return status; - } - - public ActiveStatus fromInteger(int status) { - switch (status) { - case 0: - return ACTIVE; - case 1: - return INACTIVE; - default: - throw new RuntimeException("Unsupported Active Status"); - } - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/ContactType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/ContactType.java deleted file mode 100644 index fc1db82b3..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/ContactType.java +++ /dev/null @@ -1,24 +0,0 @@ -package eu.eudat.commons.enums.old.notification; - -public enum ContactType { - EMAIL(0); - - private int type; - - ContactType(int type) { - this.type = type; - } - - public int getType() { - return type; - } - - public ContactType fromInteger(int type) { - switch (type) { - case 0: - return EMAIL; - default: - throw new RuntimeException("Unsupported Contact Type"); - } - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/NotificationType.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/NotificationType.java deleted file mode 100644 index a87cd100c..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/NotificationType.java +++ /dev/null @@ -1,39 +0,0 @@ -package eu.eudat.commons.enums.old.notification; - -public enum NotificationType { - DMP_MODIFIED(0), - DATASET_MODIFIED(1), - DMP_PUBLISH(2), - DMP_FINALISED(3), - DMP_MODIFIED_FINALISED(4), - DATASET_MODIFIED_FINALISED(5); - - private int type; - - NotificationType(int type) { - this.type = type; - } - - public int getType() { - return type; - } - - public NotificationType fromInteger(int type) { - switch (type) { - case 0: - return DMP_MODIFIED; - case 1: - return DATASET_MODIFIED; - case 2: - return DMP_PUBLISH; - case 3: - return DMP_FINALISED; - case 4: - return DMP_MODIFIED_FINALISED; - case 5: - return DATASET_MODIFIED_FINALISED; - default: - throw new RuntimeException("Unsupported Notification Type"); - } - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/NotifyState.java b/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/NotifyState.java deleted file mode 100644 index c9f320e66..000000000 --- a/dmp-backend/core/src/main/java/eu/eudat/commons/enums/old/notification/NotifyState.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.eudat.commons.enums.old.notification; - -public enum NotifyState { - PENDING(0), - PROCESSING(1), - SENDING(2), - SUCCEEDED(3), - ERROR(4); - - private int state; - - NotifyState(int state) { - this.state = state; - } - - public int getState() { - return state; - } - - public NotifyState fromInteger(int state) { - switch (state) { - case 0: - return PENDING; - case 1: - return PROCESSING; - case 2: - return SENDING; - case 3: - return SUCCEEDED; - case 4: - return ERROR; - default: - throw new RuntimeException("Unsupported Notify State"); - } - } -} diff --git a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/notification/NotificationIntegrationEvent.java b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/notification/NotificationIntegrationEvent.java index e39375d9a..2270b4be9 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/notification/NotificationIntegrationEvent.java +++ b/dmp-backend/core/src/main/java/eu/eudat/integrationevent/outbox/notification/NotificationIntegrationEvent.java @@ -1,7 +1,6 @@ package eu.eudat.integrationevent.outbox.notification; import eu.eudat.commons.enums.notification.NotificationContactType; -import eu.eudat.commons.enums.old.notification.NotificationType; import eu.eudat.integrationevent.TrackedEvent; import java.util.UUID; diff --git a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/NotificationCriteria.java b/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/NotificationCriteria.java deleted file mode 100644 index 1ed4c3b0d..000000000 --- a/dmp-backend/data/src/main/java/eu/eudat/data/dao/criteria/NotificationCriteria.java +++ /dev/null @@ -1,26 +0,0 @@ -package eu.eudat.data.dao.criteria; - -import eu.eudat.commons.enums.old.notification.ActiveStatus; -import eu.eudat.commons.enums.old.notification.NotifyState; - -public class NotificationCriteria { - - private ActiveStatus isActive; - private NotifyState notifyState; - - public ActiveStatus getIsActive() { - return isActive; - } - - public void setIsActive(ActiveStatus isActive) { - this.isActive = isActive; - } - - public NotifyState getNotifyState() { - return notifyState; - } - - public void setNotifyState(NotifyState notifyState) { - this.notifyState = notifyState; - } -} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java index 62ba48bca..63dc03155 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataManagementPlanManager.java @@ -12,10 +12,6 @@ import eu.eudat.data.*; import eu.eudat.data.dao.criteria.*; import eu.eudat.data.dao.entities.*; import eu.eudat.data.old.*; -import eu.eudat.commons.enums.old.notification.ActiveStatus; -import eu.eudat.commons.enums.old.notification.ContactType; -import eu.eudat.commons.enums.old.notification.NotificationType; -import eu.eudat.commons.enums.old.notification.NotifyState; import eu.eudat.data.query.items.table.dataset.DatasetTableRequest; import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem; import eu.eudat.data.query.items.table.dmp.DataManagementPlanTableRequest; @@ -94,12 +90,12 @@ public class DataManagementPlanManager { private static final Logger logger = LoggerFactory.getLogger(DataManagementPlanManager.class); private final ObjectMapper objectMapper; - private final Map notificationPaths = Stream.of(new Object[][] { - {NotificationType.DMP_MODIFIED, "/plans/edit"}, - {NotificationType.DMP_PUBLISH, "/plans/publicEdit"}, - {NotificationType.DMP_FINALISED, "/plans/edit"}, - {NotificationType.DMP_MODIFIED_FINALISED, "/plans/edit"} - }).collect(Collectors.toMap(data -> (NotificationType) data[0], data -> (String) data[1])); +// private final Map notificationPaths = Stream.of(new Object[][] { +// {NotificationType.DMP_MODIFIED, "/plans/edit"}, +// {NotificationType.DMP_PUBLISH, "/plans/publicEdit"}, +// {NotificationType.DMP_FINALISED, "/plans/edit"}, +// {NotificationType.DMP_MODIFIED_FINALISED, "/plans/edit"} +// }).collect(Collectors.toMap(data -> (NotificationType) data[0], data -> (String) data[1])); private ApiContext apiContext; private DatasetManager datasetManager; @@ -624,9 +620,9 @@ public class DataManagementPlanManager { if (setNotification) { if (newDmp.getStatus().equals(DmpStatus.Finalized.getValue())) { - this.sendNotification(newDmp, user, NotificationType.DMP_MODIFIED); + this.sendNotification(newDmp, user/*, NotificationType.DMP_MODIFIED*/); } else { - this.sendNotification(newDmp, user, NotificationType.DMP_MODIFIED_FINALISED); + this.sendNotification(newDmp, user/*, , NotificationType.DMP_MODIFIED_FINALISED*/); } } @@ -1222,7 +1218,7 @@ public class DataManagementPlanManager { // }); }); UserEntity user = this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first(); - sendNotification(dmp, user, NotificationType.DMP_PUBLISH); + sendNotification(dmp, user/*, , NotificationType.DMP_PUBLISH*/); } @Transactional @@ -1308,7 +1304,7 @@ public class DataManagementPlanManager { // dmp.setUsers(new HashSet<>(apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), dmpId)).toList())); //TODO //this.updateIndex(dmp); //TODO UserEntity user = this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).first(); - sendNotification(dmp, user, NotificationType.DMP_FINALISED); + sendNotification(dmp, user/*, , NotificationType.DMP_FINALISED*/); metricsManager.decreaseValue(MetricNames.DMP, 1, MetricNames.DRAFT); metricsManager.increaseValue(MetricNames.DMP, 1, MetricNames.FINALIZED); //this.updateDatasetsIndex(indexDescriptionEntities); //TODO @@ -2668,7 +2664,7 @@ public class DataManagementPlanManager { * Misc * */ - private void sendNotification(DmpEntity dmp, UserEntity user, NotificationType notificationType) throws InvalidApplicationException { + private void sendNotification(DmpEntity dmp, UserEntity user/*, NotificationType notificationType*/) throws InvalidApplicationException { List userDMPS = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmp.getId()).collect(); for (DmpUserEntity userDMP : userDMPS) { if (!userDMP.getUserId().equals(user.getId())) { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java index bf4c95568..4a83e1363 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetManager.java @@ -13,16 +13,13 @@ import eu.eudat.commons.scope.user.UserScope; import eu.eudat.data.*; import eu.eudat.data.dao.criteria.*; import eu.eudat.data.dao.entities.DatasetDao; -import eu.eudat.commons.enums.old.notification.ActiveStatus; -import eu.eudat.commons.enums.old.notification.ContactType; -import eu.eudat.commons.enums.old.notification.NotificationType; -import eu.eudat.commons.enums.old.notification.NotifyState; import eu.eudat.data.old.*; import eu.eudat.data.query.items.table.dataset.DatasetPublicTableRequest; import eu.eudat.data.query.items.table.dataset.DatasetTableRequest; import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem; import eu.eudat.exceptions.security.ForbiddenException; import eu.eudat.exceptions.security.UnauthorisedException; +import eu.eudat.file.transformer.enums.old.notification.NotificationType; import eu.eudat.logic.builders.BuilderFactory; import eu.eudat.logic.builders.entity.UserInfoBuilder; import eu.eudat.logic.proxy.config.configloaders.ConfigLoader; @@ -30,7 +27,6 @@ import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.services.forms.VisibilityRuleService; import eu.eudat.logic.services.forms.VisibilityRuleServiceImpl; import eu.eudat.logic.services.operations.DatabaseRepository; -import eu.eudat.model.UserContactInfo; import eu.eudat.model.file.FileEnvelope; import eu.eudat.logic.utilities.documents.types.ParagraphStyle; import eu.eudat.logic.utilities.documents.word.WordBuilder; @@ -43,18 +39,15 @@ import eu.eudat.models.data.datasetImport.DatasetImportPagedDatasetProfile; import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel; import eu.eudat.models.data.datasetwizard.DatasetWizardModel; import eu.eudat.models.data.dmp.AssociatedProfile; -import eu.eudat.models.data.dmp.DataManagementPlan; import eu.eudat.models.data.helpers.common.DataTableData; import eu.eudat.models.data.listingmodels.DatasetListingModel; import eu.eudat.models.data.user.composite.PagedDatasetProfile; import eu.eudat.query.DescriptionTemplateQuery; import eu.eudat.query.DmpDescriptionTemplateQuery; import eu.eudat.query.DmpUserQuery; -import eu.eudat.query.UserContactInfoQuery; import eu.eudat.queryable.QueryableList; import eu.eudat.types.MetricNames; import gr.cite.commons.web.authz.service.AuthorizationService; -import gr.cite.tools.data.query.Ordering; import gr.cite.tools.data.query.QueryFactory; import org.apache.poi.xwpf.extractor.XWPFWordExtractor; import org.apache.poi.xwpf.usermodel.XWPFDocument; @@ -102,10 +95,10 @@ import java.util.stream.Stream; public class DatasetManager { private static final Logger logger = LoggerFactory.getLogger(DatasetManager.class); - private final Map notificationPaths = Stream.of(new Object[][] { - {NotificationType.DATASET_MODIFIED, "/datasets/edit"}, - {NotificationType.DATASET_MODIFIED_FINALISED, "/datasets/edit"} - }).collect(Collectors.toMap(data -> (NotificationType) data[0], data -> (String) data[1])); +// private final Map notificationPaths = Stream.of(new Object[][] { +// {NotificationType.DATASET_MODIFIED, "/datasets/edit"}, +// {NotificationType.DATASET_MODIFIED_FINALISED, "/datasets/edit"} +// }).collect(Collectors.toMap(data -> (NotificationType) data[0], data -> (String) data[1])); private ApiContext apiContext; private DatabaseRepository databaseRepository; @@ -676,9 +669,9 @@ public class DatasetManager { //updateTags(descriptionEntity1, datasetWizardModel.getTags()); //TODO if (sendNotification) { if (descriptionEntity1.getStatus() != DescriptionStatus.Finalized) { - this.sendNotification(descriptionEntity1, dmp1, userInfo, NotificationType.DATASET_MODIFIED); + this.sendNotification(descriptionEntity1, dmp1, userInfo, null/*NotificationType.DATASET_MODIFIED*/); } else { - this.sendNotification(descriptionEntity1, dmp1, userInfo, NotificationType.DATASET_MODIFIED_FINALISED); + this.sendNotification(descriptionEntity1, dmp1, userInfo, null/*NotificationType.DATASET_MODIFIED_FINALISED*/); } }