diff --git a/backend/core/pom.xml b/backend/core/pom.xml
index ed69c9b3c..5860e512b 100644
--- a/backend/core/pom.xml
+++ b/backend/core/pom.xml
@@ -51,12 +51,12 @@
org.opencdmp
repositorydepositbase
- 2.0.15
+ 2.0.16
org.opencdmp
common-models
- 0.0.18
+ 0.0.19
gr.cite
@@ -66,7 +66,7 @@
org.opencdmp
file-transformer-base
- 0.0.23
+ 0.0.24
gr.cite
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/PlanUserCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/PlanUserCommonModelBuilder.java
index b14524959..27d945528 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/PlanUserCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/PlanUserCommonModelBuilder.java
@@ -5,8 +5,8 @@ import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.enums.DmpUserRole;
-import org.opencdmp.commonmodels.models.DmpUserModel;
+import org.opencdmp.commonmodels.enums.PlanUserRole;
+import org.opencdmp.commonmodels.models.PlanUserModel;
import org.opencdmp.commonmodels.models.UserModel;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.convention.ConventionService;
@@ -24,7 +24,7 @@ import java.util.stream.Collectors;
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PlanUserCommonModelBuilder extends BaseCommonModelBuilder {
+public class PlanUserCommonModelBuilder extends BaseCommonModelBuilder {
private final BuilderFactory builderFactory;
@@ -47,7 +47,7 @@ public class PlanUserCommonModelBuilder extends BaseCommonModelBuilder> buildInternal(List data) throws MyApplicationException {
+ protected List> buildInternal(List data) throws MyApplicationException {
this.logger.debug("building for {} items ", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null)
return new ArrayList<>();
@@ -55,14 +55,14 @@ public class PlanUserCommonModelBuilder extends BaseCommonModelBuilder userItemsMap = this.collectUsers(data);
- List> models = new ArrayList<>();
+ List> models = new ArrayList<>();
for (PlanUserEntity d : data) {
- DmpUserModel m = new DmpUserModel();
+ PlanUserModel m = new PlanUserModel();
switch (d.getRole()){
- case Viewer -> m.setRole(DmpUserRole.Viewer);
- case Owner -> m.setRole(DmpUserRole.Owner);
- case DescriptionContributor -> m.setRole(DmpUserRole.DescriptionContributor);
- case Reviewer -> m.setRole(DmpUserRole.Reviewer);
+ case Viewer -> m.setRole(PlanUserRole.Viewer);
+ case Owner -> m.setRole(PlanUserRole.Owner);
+ case DescriptionContributor -> m.setRole(PlanUserRole.DescriptionContributor);
+ case Reviewer -> m.setRole(PlanUserRole.Reviewer);
default -> throw new MyApplicationException("unrecognized type " + d.getRole().getValue());
}
if (userItemsMap != null && userItemsMap.containsKey(d.getUserId())) m.setUser(userItemsMap.get(d.getUserId()));
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/DescriptionCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/DescriptionCommonModelBuilder.java
index 6afc75412..1abf5fe1e 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/DescriptionCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/description/DescriptionCommonModelBuilder.java
@@ -9,7 +9,7 @@ import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.commonmodels.enums.DescriptionStatus;
import org.opencdmp.commonmodels.models.description.DescriptionModel;
import org.opencdmp.commonmodels.models.descriptiotemplate.DescriptionTemplateModel;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
+import org.opencdmp.commonmodels.models.plan.PlanModel;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.XmlHandlingService;
import org.opencdmp.commons.types.description.PropertyDefinitionEntity;
@@ -87,7 +87,7 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder();
Map descriptionTemplates = this.collectDescriptionTemplates(data);
- Map plans = this.collectPlans(data);
+ Map plans = this.collectPlans(data);
Map definitionEntityMap = this.collectDescriptionTemplateDefinitions(data);
Map planDescriptionTemplateSections = this.collectPlanDescriptionTemplateSections(data);
@@ -106,7 +106,7 @@ public class DescriptionCommonModelBuilder extends BaseCommonModelBuilder collectPlans(List data) throws MyApplicationException {
+ private Map collectPlans(List data) throws MyApplicationException {
if (data.isEmpty())
return null;
- this.logger.debug("checking related - {}", DmpModel.class.getSimpleName());
+ this.logger.debug("checking related - {}", PlanModel.class.getSimpleName());
- Map itemMap;
+ Map itemMap;
PlanQuery q = this.queryFactory.query(PlanQuery.class).authorize(this.authorize).disableTracking().ids(data.stream().map(DescriptionEntity::getPlanId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(PlanCommonModelBuilder.class).setRepositoryId(this.repositoryId).useSharedStorage(this.useSharedStorage).setDisableDescriptions(true).authorize(this.authorize).asForeignKey(q, PlanEntity::getId);
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/fielddata/BaseFieldDataCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/fielddata/BaseFieldDataCommonModelBuilder.java
index e35b93f53..522655302 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/fielddata/BaseFieldDataCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/descriptiontemplate/fielddata/BaseFieldDataCommonModelBuilder.java
@@ -53,7 +53,7 @@ public abstract class BaseFieldDataCommonModelBuilder m.setFieldType(FieldType.SELECT);
case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION);
case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX);
- case INTERNAL_ENTRIES_PLANS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DMPS);
+ case INTERNAL_ENTRIES_PLANS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_PlANS);
case INTERNAL_ENTRIES_DESCRIPTIONS -> m.setFieldType(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS);
case CHECK_BOX -> m.setFieldType(FieldType.CHECK_BOX);
case FREE_TEXT -> m.setFieldType(FieldType.FREE_TEXT);
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanBlueprintValueCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanBlueprintValueCommonModelBuilder.java
index 827519b3a..c4bfa6684 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanBlueprintValueCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanBlueprintValueCommonModelBuilder.java
@@ -1,7 +1,7 @@
package org.opencdmp.model.builder.commonmodels.plan;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.models.dmp.DmpBlueprintValueModel;
+import org.opencdmp.commonmodels.models.plan.PlanBlueprintValueModel;
import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType;
import org.opencdmp.commons.enums.PlanBlueprintFieldCategory;
import org.opencdmp.commons.types.plan.PlanBlueprintValueEntity;
@@ -26,7 +26,7 @@ import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PlanBlueprintValueCommonModelBuilder extends BaseCommonModelBuilder {
+public class PlanBlueprintValueCommonModelBuilder extends BaseCommonModelBuilder {
private EnumSet authorize = EnumSet.of(AuthorizationFlags.None);
private DefinitionEntity definition;
@@ -48,17 +48,17 @@ public class PlanBlueprintValueCommonModelBuilder extends BaseCommonModelBuilder
}
@Override
- protected List> buildInternal(List data) throws MyApplicationException {
+ protected List> buildInternal(List data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
- List> models = new ArrayList<>();
+ List> models = new ArrayList<>();
for (PlanBlueprintValueEntity d : data) {
FieldEntity fieldEntity = this.definition != null ? this.definition.getFieldById(d.getFieldId()).stream().findFirst().orElse(null) : null;
if (fieldEntity != null && fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)) {
ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity;
- DmpBlueprintValueModel m = new DmpBlueprintValueModel();
+ PlanBlueprintValueModel m = new PlanBlueprintValueModel();
m.setFieldId(d.getFieldId());
if (extraFieldEntity != null && PlanBlueprintExtraFieldDataType.isDateType(extraFieldEntity.getType())){
m.setDateValue(d.getDateValue());
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java
index 6d90cbe54..611de965c 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanCommonModelBuilder.java
@@ -7,16 +7,16 @@ import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.fieldset.BaseFieldSet;
import gr.cite.tools.logging.LoggerService;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.enums.DmpAccessType;
-import org.opencdmp.commonmodels.enums.DmpStatus;
-import org.opencdmp.commonmodels.models.DmpUserModel;
+import org.opencdmp.commonmodels.enums.PlanAccessType;
+import org.opencdmp.commonmodels.enums.PlanStatus;
+import org.opencdmp.commonmodels.models.PlanUserModel;
import org.opencdmp.commonmodels.models.EntityDoiModel;
import org.opencdmp.commonmodels.models.FileEnvelopeModel;
import org.opencdmp.commonmodels.models.UserModel;
import org.opencdmp.commonmodels.models.description.DescriptionModel;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
-import org.opencdmp.commonmodels.models.dmpblueprint.DmpBlueprintModel;
-import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceModel;
+import org.opencdmp.commonmodels.models.plan.PlanModel;
+import org.opencdmp.commonmodels.models.planblueprint.PlanBlueprintModel;
+import org.opencdmp.commonmodels.models.planreference.PlanReferenceModel;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.XmlHandlingService;
import org.opencdmp.commons.enums.IsActive;
@@ -46,7 +46,7 @@ import java.util.stream.Collectors;
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PlanCommonModelBuilder extends BaseCommonModelBuilder {
+public class PlanCommonModelBuilder extends BaseCommonModelBuilder {
private final QueryFactory queryFactory;
@@ -103,22 +103,22 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder> buildInternal(List data) throws MyApplicationException {
+ protected List> buildInternal(List data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
- List> models = new ArrayList<>();
+ List> models = new ArrayList<>();
- Map> planReferencesMap = this.collectPlanReferences(data);
- Map> planUsersMap = this.collectPlanUsers(data);
+ Map> planReferencesMap = this.collectPlanReferences(data);
+ Map> planUsersMap = this.collectPlanUsers(data);
Map> descriptionsMap = this.disableDescriptions ? null : this.collectPlanDescriptions(data);
Map> entityDois = this.collectPlanEntityDois(data);
Map creators = this.collectCreators(data);
- Map planBlueprints = this.collectPlanBlueprints(data);
+ Map planBlueprints = this.collectPlanBlueprints(data);
Map definitionEntityMap = this.collectPlanBlueprintDefinitions(data);
for (PlanEntity d : data) {
- DmpModel m = new DmpModel();
+ PlanModel m = new PlanModel();
m.setId(d.getId());
m.setLabel(d.getLabel());
m.setVersion(d.getVersion());
@@ -127,13 +127,13 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder m.setStatus(DmpStatus.Finalized);
- case Draft -> m.setStatus(DmpStatus.Draft);
+ case Finalized -> m.setStatus(PlanStatus.Finalized);
+ case Draft -> m.setStatus(PlanStatus.Draft);
default -> throw new MyApplicationException("unrecognized type " + d.getStatus());
}
if (entityDois != null && !entityDois.isEmpty() && entityDois.containsKey(d.getId())) m.setEntityDois(entityDois.get(d.getId()));
if (creators != null && !creators.isEmpty() && d.getCreatorId() != null && creators.containsKey(d.getCreatorId())) m.setCreator(creators.get(d.getCreatorId()));
- if (planBlueprints != null && !planBlueprints.isEmpty() && d.getBlueprintId() != null && planBlueprints.containsKey(d.getBlueprintId())) m.setDmpBlueprint(planBlueprints.get(d.getBlueprintId()));
+ if (planBlueprints != null && !planBlueprints.isEmpty() && d.getBlueprintId() != null && planBlueprints.containsKey(d.getBlueprintId())) m.setPlanBlueprint(planBlueprints.get(d.getBlueprintId()));
if (d.getProperties() != null){
//TODO Update with the new logic of property definition
PlanPropertiesEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PlanPropertiesEntity.class, d.getProperties());
@@ -145,8 +145,8 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder (short)1) m.setPreviousDOI(this.getPreviousDOI(d.getGroupId(), d.getId()));
switch (d.getAccessType()){
- case Public -> m.setAccessType(DmpAccessType.Public);
- case Restricted -> m.setAccessType(DmpAccessType.Restricted);
+ case Public -> m.setAccessType(PlanAccessType.Public);
+ case Restricted -> m.setAccessType(PlanAccessType.Restricted);
case null -> m.setAccessType(null);
default -> throw new MyApplicationException("unrecognized type " + d.getAccessType());
}
@@ -179,20 +179,20 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder> collectPlanUsers(List data) throws MyApplicationException {
+ private Map> collectPlanUsers(List data) throws MyApplicationException {
this.logger.debug("checking related - {}", PlanUser.class.getSimpleName());
- Map> itemMap;
+ Map> itemMap;
PlanUserQuery query = this.queryFactory.query(PlanUserQuery.class).disableTracking().isActives(IsActive.Active).authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(PlanUserCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, PlanUserEntity::getPlanId);
return itemMap;
}
- private Map> collectPlanReferences(List data) throws MyApplicationException {
+ private Map> collectPlanReferences(List data) throws MyApplicationException {
this.logger.debug("checking related - {}", PlanReference.class.getSimpleName());
- Map> itemMap;
+ Map> itemMap;
PlanReferenceQuery query = this.queryFactory.query(PlanReferenceQuery.class).disableTracking().isActives(IsActive.Active).authorize(this.authorize).planIds(data.stream().map(PlanEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(PlanReferenceCommonModelBuilder.class).authorize(this.authorize).asMasterKey(query, PlanReferenceEntity::getPlanId);
@@ -232,12 +232,12 @@ public class PlanCommonModelBuilder extends BaseCommonModelBuilder collectPlanBlueprints(List data) throws MyApplicationException {
+ private Map collectPlanBlueprints(List data) throws MyApplicationException {
if (data.isEmpty())
return null;
- this.logger.debug("checking related - {}", DmpBlueprintModel.class.getSimpleName());
+ this.logger.debug("checking related - {}", PlanBlueprintModel.class.getSimpleName());
- Map itemMap;
+ Map itemMap;
PlanBlueprintQuery q = this.queryFactory.query(PlanBlueprintQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().filter(x-> x.getBlueprintId() != null).map(PlanEntity::getBlueprintId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(PlanBlueprintCommonModelBuilder.class).authorize(this.authorize).asForeignKey(q, PlanBlueprintEntity::getId);
return itemMap;
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanContactCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanContactCommonModelBuilder.java
index 6de7a490a..43ef72f3f 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanContactCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanContactCommonModelBuilder.java
@@ -5,7 +5,7 @@ import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.models.dmp.DmpContactModel;
+import org.opencdmp.commonmodels.models.plan.PlanContactModel;
import org.opencdmp.commons.types.plan.PlanContactEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
@@ -20,7 +20,7 @@ import java.util.*;
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PlanContactCommonModelBuilder extends BaseCommonModelBuilder {
+public class PlanContactCommonModelBuilder extends BaseCommonModelBuilder {
private EnumSet authorize = EnumSet.of(AuthorizationFlags.None);
private final BuilderFactory builderFactory;
@@ -41,13 +41,13 @@ public class PlanContactCommonModelBuilder extends BaseCommonModelBuilder> buildInternal(List data) throws MyApplicationException {
+ protected List> buildInternal(List data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
- List> models = new ArrayList<>();
+ List> models = new ArrayList<>();
for (PlanContactEntity d : data) {
- DmpContactModel m = new DmpContactModel();
+ PlanContactModel m = new PlanContactModel();
m.setEmail(d.getEmail());
m.setFirstName(d.getFirstName());
m.setLastName(d.getLastName());
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanPropertiesCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanPropertiesCommonModelBuilder.java
index 8c22130f2..a8837c27c 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanPropertiesCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/plan/PlanPropertiesCommonModelBuilder.java
@@ -1,7 +1,7 @@
package org.opencdmp.model.builder.commonmodels.plan;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.models.dmp.DmpPropertiesModel;
+import org.opencdmp.commonmodels.models.plan.PlanPropertiesModel;
import org.opencdmp.commons.types.plan.PlanPropertiesEntity;
import org.opencdmp.commons.types.planblueprint.DefinitionEntity;
import org.opencdmp.convention.ConventionService;
@@ -23,7 +23,7 @@ import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PlanPropertiesCommonModelBuilder extends BaseCommonModelBuilder {
+public class PlanPropertiesCommonModelBuilder extends BaseCommonModelBuilder {
private final BuilderFactory builderFactory;
private EnumSet authorize = EnumSet.of(AuthorizationFlags.None);
private DefinitionEntity definition;
@@ -46,14 +46,14 @@ public class PlanPropertiesCommonModelBuilder extends BaseCommonModelBuilder> buildInternal(List data) throws MyApplicationException {
+ protected List> buildInternal(List data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
- List> models = new ArrayList<>();
+ List> models = new ArrayList<>();
for (PlanPropertiesEntity d : data) {
- DmpPropertiesModel m = new DmpPropertiesModel();
- if (d.getPlanBlueprintValues() != null) m.setDmpBlueprintValues(this.builderFactory.builder(PlanBlueprintValueCommonModelBuilder.class).withDefinition(definition).authorize(this.authorize).build(d.getPlanBlueprintValues()));
+ PlanPropertiesModel m = new PlanPropertiesModel();
+ if (d.getPlanBlueprintValues() != null) m.setPlanBlueprintValues(this.builderFactory.builder(PlanBlueprintValueCommonModelBuilder.class).withDefinition(definition).authorize(this.authorize).build(d.getPlanBlueprintValues()));
if (d.getContacts() != null) m.setContacts(this.builderFactory.builder(PlanContactCommonModelBuilder.class).authorize(this.authorize).build(d.getContacts()));
models.add(new CommonModelBuilderItemResponse<>(m, d));
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java
index 66f93e5d9..bdeb8b9b5 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/DefinitionCommonModelBuilder.java
@@ -1,7 +1,7 @@
package org.opencdmp.model.builder.commonmodels.planblueprint;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.models.dmpblueprint.DefinitionModel;
+import org.opencdmp.commonmodels.models.planblueprint.DefinitionModel;
import org.opencdmp.commons.types.planblueprint.DefinitionEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ExtraFieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ExtraFieldCommonModelBuilder.java
index 51f958091..fab9c830e 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ExtraFieldCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ExtraFieldCommonModelBuilder.java
@@ -1,7 +1,7 @@
package org.opencdmp.model.builder.commonmodels.planblueprint;
-import org.opencdmp.commonmodels.enums.DmpBlueprintExtraFieldDataType;
-import org.opencdmp.commonmodels.models.dmpblueprint.ExtraFieldModel;
+import org.opencdmp.commonmodels.enums.PlanBlueprintExtraFieldDataType;
+import org.opencdmp.commonmodels.models.planblueprint.ExtraFieldModel;
import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity;
import org.opencdmp.convention.ConventionService;
import gr.cite.tools.exception.MyApplicationException;
@@ -26,10 +26,10 @@ public class ExtraFieldCommonModelBuilder extends FieldCommonModelBuilder model.setDataType(DmpBlueprintExtraFieldDataType.Date);
- case Number -> model.setDataType(DmpBlueprintExtraFieldDataType.Number);
- case RichTex -> model.setDataType(DmpBlueprintExtraFieldDataType.RichTex);
- case Text -> model.setDataType(DmpBlueprintExtraFieldDataType.Text);
+ case Date -> model.setDataType(PlanBlueprintExtraFieldDataType.Date);
+ case Number -> model.setDataType(PlanBlueprintExtraFieldDataType.Number);
+ case RichTex -> model.setDataType(PlanBlueprintExtraFieldDataType.RichTex);
+ case Text -> model.setDataType(PlanBlueprintExtraFieldDataType.Text);
default -> throw new MyApplicationException("unrecognized type " + data.getType());
}
return model;
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java
index 9bcbcfcb4..0c4c29d90 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/FieldCommonModelBuilder.java
@@ -1,8 +1,8 @@
package org.opencdmp.model.builder.commonmodels.planblueprint;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory;
-import org.opencdmp.commonmodels.models.dmpblueprint.FieldModel;
+import org.opencdmp.commonmodels.enums.PlanBlueprintFieldCategory;
+import org.opencdmp.commonmodels.models.planblueprint.FieldModel;
import org.opencdmp.commons.types.planblueprint.FieldEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
@@ -51,9 +51,9 @@ public abstract class FieldCommonModelBuilder m.setCategory(DmpBlueprintFieldCategory.System);
- case Extra -> m.setCategory(DmpBlueprintFieldCategory.Extra);
- case ReferenceType -> m.setCategory(DmpBlueprintFieldCategory.ReferenceType);
+ case System -> m.setCategory(PlanBlueprintFieldCategory.System);
+ case Extra -> m.setCategory(PlanBlueprintFieldCategory.Extra);
+ case ReferenceType -> m.setCategory(PlanBlueprintFieldCategory.ReferenceType);
default -> throw new MyApplicationException("unrecognized type " + d.getCategory());
}
m.setPlaceholder(d.getPlaceholder());
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/PlanBlueprintCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/PlanBlueprintCommonModelBuilder.java
index 6ca616e34..51eab96b7 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/PlanBlueprintCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/PlanBlueprintCommonModelBuilder.java
@@ -1,8 +1,8 @@
package org.opencdmp.model.builder.commonmodels.planblueprint;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.enums.DmpBlueprintStatus;
-import org.opencdmp.commonmodels.models.dmpblueprint.DmpBlueprintModel;
+import org.opencdmp.commonmodels.enums.PlanBlueprintStatus;
+import org.opencdmp.commonmodels.models.planblueprint.PlanBlueprintModel;
import org.opencdmp.commons.XmlHandlingService;
import org.opencdmp.commons.types.planblueprint.DefinitionEntity;
import org.opencdmp.convention.ConventionService;
@@ -25,7 +25,7 @@ import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PlanBlueprintCommonModelBuilder extends BaseCommonModelBuilder {
+public class PlanBlueprintCommonModelBuilder extends BaseCommonModelBuilder {
private final BuilderFactory builderFactory;
private final XmlHandlingService xmlHandlingService;
@@ -44,21 +44,21 @@ public class PlanBlueprintCommonModelBuilder extends BaseCommonModelBuilder> buildInternal(List data) throws MyApplicationException {
+ protected List> buildInternal(List data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
- List> models = new ArrayList<>();
+ List> models = new ArrayList<>();
for (PlanBlueprintEntity d : data) {
- DmpBlueprintModel m = new DmpBlueprintModel();
+ PlanBlueprintModel m = new PlanBlueprintModel();
m.setId(d.getId());
m.setLabel(d.getLabel());
m.setGroupId(d.getGroupId());
switch (d.getStatus()){
- case Finalized -> m.setStatus(DmpBlueprintStatus.Finalized);
- case Draft -> m.setStatus(DmpBlueprintStatus.Draft);
+ case Finalized -> m.setStatus(PlanBlueprintStatus.Finalized);
+ case Draft -> m.setStatus(PlanBlueprintStatus.Draft);
default -> throw new MyApplicationException("unrecognized type " + d.getStatus());
}
if (d.getDefinition() != null){
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ReferenceTypeFieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ReferenceTypeFieldCommonModelBuilder.java
index 2a3fce7ca..23415bb95 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ReferenceTypeFieldCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/ReferenceTypeFieldCommonModelBuilder.java
@@ -2,7 +2,7 @@ package org.opencdmp.model.builder.commonmodels.planblueprint;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
-import org.opencdmp.commonmodels.models.dmpblueprint.ReferenceTypeFieldModel;
+import org.opencdmp.commonmodels.models.planblueprint.ReferenceTypeFieldModel;
import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.model.builder.commonmodels.ReferenceTypeCommonModelBuilder;
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java
index 5dba895b3..908ec57f6 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SectionCommonModelBuilder.java
@@ -1,7 +1,7 @@
package org.opencdmp.model.builder.commonmodels.planblueprint;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.models.dmpblueprint.SectionModel;
+import org.opencdmp.commonmodels.models.planblueprint.SectionModel;
import org.opencdmp.commons.enums.PlanBlueprintFieldCategory;
import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity;
import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity;
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SystemFieldCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SystemFieldCommonModelBuilder.java
index ab6cb0b9f..f6da49afd 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SystemFieldCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planblueprint/SystemFieldCommonModelBuilder.java
@@ -1,7 +1,7 @@
package org.opencdmp.model.builder.commonmodels.planblueprint;
-import org.opencdmp.commonmodels.enums.DmpBlueprintSystemFieldType;
-import org.opencdmp.commonmodels.models.dmpblueprint.SystemFieldModel;
+import org.opencdmp.commonmodels.enums.PlanBlueprintSystemFieldType;
+import org.opencdmp.commonmodels.models.planblueprint.SystemFieldModel;
import org.opencdmp.commons.types.planblueprint.SystemFieldEntity;
import org.opencdmp.convention.ConventionService;
import gr.cite.tools.exception.MyApplicationException;
@@ -26,12 +26,12 @@ public class SystemFieldCommonModelBuilder extends FieldCommonModelBuilder model.setSystemFieldType(DmpBlueprintSystemFieldType.AccessRights);
- case Contact -> model.setSystemFieldType(DmpBlueprintSystemFieldType.Contact);
- case Description -> model.setSystemFieldType(DmpBlueprintSystemFieldType.Description);
- case Language -> model.setSystemFieldType(DmpBlueprintSystemFieldType.Language);
- case Title -> model.setSystemFieldType(DmpBlueprintSystemFieldType.Title);
- case User -> model.setSystemFieldType(DmpBlueprintSystemFieldType.User);
+ case AccessRights -> model.setSystemFieldType(PlanBlueprintSystemFieldType.AccessRights);
+ case Contact -> model.setSystemFieldType(PlanBlueprintSystemFieldType.Contact);
+ case Description -> model.setSystemFieldType(PlanBlueprintSystemFieldType.Description);
+ case Language -> model.setSystemFieldType(PlanBlueprintSystemFieldType.Language);
+ case Title -> model.setSystemFieldType(PlanBlueprintSystemFieldType.Title);
+ case User -> model.setSystemFieldType(PlanBlueprintSystemFieldType.User);
default -> throw new MyApplicationException("unrecognized type " + data.getType());
}
return model;
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceCommonModelBuilder.java
index 5adacde97..93a09be40 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceCommonModelBuilder.java
@@ -5,7 +5,7 @@ import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceModel;
+import org.opencdmp.commonmodels.models.planreference.PlanReferenceModel;
import org.opencdmp.commonmodels.models.reference.ReferenceModel;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.types.planreference.PlanReferenceDataEntity;
@@ -27,7 +27,7 @@ import java.util.stream.Collectors;
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PlanReferenceCommonModelBuilder extends BaseCommonModelBuilder {
+public class PlanReferenceCommonModelBuilder extends BaseCommonModelBuilder {
private final BuilderFactory builderFactory;
private final QueryFactory queryFactory;
@@ -50,14 +50,14 @@ public class PlanReferenceCommonModelBuilder extends BaseCommonModelBuilder> buildInternal(List data) throws MyApplicationException {
+ protected List> buildInternal(List data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
Map referenceModelMap = this.collectReferences(data);
- List> models = new ArrayList<>();
+ List> models = new ArrayList<>();
for (PlanReferenceEntity d : data) {
- DmpReferenceModel m = new DmpReferenceModel();
+ PlanReferenceModel m = new PlanReferenceModel();
m.setId(d.getId());
if (d.getData() != null){
PlanReferenceDataEntity definition = this.jsonHandlingService.fromJsonSafe(PlanReferenceDataEntity.class, d.getData());
diff --git a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceDataCommonModelBuilder.java b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceDataCommonModelBuilder.java
index 746572554..cda48995a 100644
--- a/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceDataCommonModelBuilder.java
+++ b/backend/core/src/main/java/org/opencdmp/model/builder/commonmodels/planreference/PlanReferenceDataCommonModelBuilder.java
@@ -1,7 +1,7 @@
package org.opencdmp.model.builder.commonmodels.planreference;
import org.opencdmp.authorization.AuthorizationFlags;
-import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceDataModel;
+import org.opencdmp.commonmodels.models.planreference.PlanReferenceDataModel;
import org.opencdmp.commons.types.planreference.PlanReferenceDataEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.model.builder.commonmodels.BaseCommonModelBuilder;
@@ -22,7 +22,7 @@ import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public class PlanReferenceDataCommonModelBuilder extends BaseCommonModelBuilder {
+public class PlanReferenceDataCommonModelBuilder extends BaseCommonModelBuilder {
private final BuilderFactory builderFactory;
private EnumSet authorize = EnumSet.of(AuthorizationFlags.None);
@@ -40,13 +40,13 @@ public class PlanReferenceDataCommonModelBuilder extends BaseCommonModelBuilder<
}
@Override
- protected List> buildInternal(List data) throws MyApplicationException {
+ protected List> buildInternal(List data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
- List> models = new ArrayList<>();
+ List> models = new ArrayList<>();
for (PlanReferenceDataEntity d : data) {
- DmpReferenceDataModel m = new DmpReferenceDataModel();
+ PlanReferenceDataModel m = new PlanReferenceDataModel();
m.setBlueprintFieldId(d.getBlueprintFieldId());
models.add(new CommonModelBuilderItemResponse<>(m, d));
}
diff --git a/backend/core/src/main/java/org/opencdmp/service/deposit/DepositClientImpl.java b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositClientImpl.java
index 33b345917..8ff3959e1 100644
--- a/backend/core/src/main/java/org/opencdmp/service/deposit/DepositClientImpl.java
+++ b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositClientImpl.java
@@ -2,7 +2,7 @@ package org.opencdmp.service.deposit;
import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
+import org.opencdmp.commonmodels.models.plan.PlanModel;
import org.opencdmp.depositbase.repository.DepositClient;
import org.opencdmp.depositbase.repository.DepositConfiguration;
import org.slf4j.LoggerFactory;
@@ -21,9 +21,9 @@ public class DepositClientImpl implements DepositClient {
@Override
- public String deposit(DmpModel dmpDepositModel, String repositoryAccessToken) throws Exception {
- logger.debug(new MapLogEntry("deposit").And("dmpDepositModel", dmpDepositModel));
- return this.depositClient.post().uri("", uriBuilder -> uriBuilder.queryParam("authToken", repositoryAccessToken).build()).bodyValue(dmpDepositModel).exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(String.class)).block();
+ public String deposit(PlanModel planDepositModel, String repositoryAccessToken) throws Exception {
+ logger.debug(new MapLogEntry("deposit").And("planDepositModel", planDepositModel));
+ return this.depositClient.post().uri("", uriBuilder -> uriBuilder.queryParam("authToken", repositoryAccessToken).build()).bodyValue(planDepositModel).exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(String.class)).block();
}
@Override
diff --git a/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java
index fcbd448dd..26c68fda4 100644
--- a/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java
+++ b/backend/core/src/main/java/org/opencdmp/service/deposit/DepositServiceImpl.java
@@ -17,7 +17,7 @@ import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.authorization.Permission;
import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver;
import org.opencdmp.commonmodels.models.FileEnvelopeModel;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
+import org.opencdmp.commonmodels.models.plan.PlanModel;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.commons.enums.StorageType;
@@ -311,7 +311,7 @@ public class DepositServiceImpl implements DepositService {
}
//GK: Fifth Transform them to the DepositModel
- DmpModel depositModel = this.builderFactory.builder(PlanCommonModelBuilder.class).useSharedStorage(depositClient.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.AllExceptPublic)
+ PlanModel depositModel = this.builderFactory.builder(PlanCommonModelBuilder.class).useSharedStorage(depositClient.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.AllExceptPublic)
.setRepositoryId(planDepositModel.getRepositoryId()).setPdfFile(pdfEnvelope).setRdaJsonFile(jsonEnvelope).build(planEntity);
diff --git a/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java
index 4b1ac610a..6718c6787 100644
--- a/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java
+++ b/backend/core/src/main/java/org/opencdmp/service/descriptiontemplate/DescriptionTemplateServiceImpl.java
@@ -1187,7 +1187,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
case SELECT -> fieldType = FieldType.SELECT;
case BOOLEAN_DECISION -> fieldType = FieldType.BOOLEAN_DECISION;
case RADIO_BOX -> fieldType = FieldType.RADIO_BOX;
- case INTERNAL_ENTRIES_DMPS -> fieldType = FieldType.INTERNAL_ENTRIES_PLANS;
+ case INTERNAL_ENTRIES_PlANS -> fieldType = FieldType.INTERNAL_ENTRIES_PLANS;
case INTERNAL_ENTRIES_DESCRIPTIONS -> fieldType = FieldType.INTERNAL_ENTRIES_DESCRIPTIONS;
case CHECK_BOX -> fieldType = FieldType.CHECK_BOX;
case FREE_TEXT -> fieldType = FieldType.FREE_TEXT;
diff --git a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerRepository.java b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerRepository.java
index 035949b8d..f0af05a4e 100644
--- a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerRepository.java
+++ b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerRepository.java
@@ -4,13 +4,13 @@ import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry;
import org.opencdmp.commonmodels.models.FileEnvelopeModel;
import org.opencdmp.commonmodels.models.description.DescriptionModel;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
+import org.opencdmp.commonmodels.models.plan.PlanModel;
import org.opencdmp.filetransformerbase.interfaces.FileTransformerClient;
import org.opencdmp.filetransformerbase.interfaces.FileTransformerConfiguration;
import org.opencdmp.filetransformerbase.models.misc.DescriptionImportModel;
-import org.opencdmp.filetransformerbase.models.misc.DmpImportModel;
+import org.opencdmp.filetransformerbase.models.misc.PlanImportModel;
import org.opencdmp.filetransformerbase.models.misc.PreprocessingDescriptionModel;
-import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel;
+import org.opencdmp.filetransformerbase.models.misc.PreprocessingPlanModel;
import org.slf4j.LoggerFactory;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.web.reactive.function.client.WebClient;
@@ -27,17 +27,17 @@ public class FileTransformerRepository implements FileTransformerClient {
}
@Override
- public FileEnvelopeModel exportDmp(DmpModel dmpModel, String format) {
- logger.debug(new MapLogEntry("exportDmp").And("format", format).And("dmpModel", dmpModel));
- return this.transformerClient.post().uri("/export/dmp", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(dmpModel)
+ public FileEnvelopeModel exportPlan(PlanModel planModel, String format) {
+ logger.debug(new MapLogEntry("exportPlan").And("format", format).And("planModel", planModel));
+ return this.transformerClient.post().uri("/export/plan", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(planModel)
.exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(FileEnvelopeModel.class)).block();
}
@Override
- public DmpModel importDmp(DmpImportModel dmpImportModel) {
- logger.debug(new MapLogEntry("importDmp").And("fileEnvelope", dmpImportModel.getFile()));
- return this.transformerClient.post().uri("/import/dmp").bodyValue(dmpImportModel)
- .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(DmpModel.class)).block();
+ public PlanModel importPlan(PlanImportModel planImportModel) {
+ logger.debug(new MapLogEntry("importPlan").And("fileEnvelope", planImportModel.getFile()));
+ return this.transformerClient.post().uri("/import/plan").bodyValue(planImportModel)
+ .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(PlanModel.class)).block();
}
@Override
@@ -62,10 +62,10 @@ public class FileTransformerRepository implements FileTransformerClient {
}
@Override
- public PreprocessingDmpModel preprocessingDmp(FileEnvelopeModel fileEnvelopeModel) {
- logger.debug(new MapLogEntry("preprocessingDmp").And("fileEnvelope", fileEnvelopeModel));
- return this.transformerClient.post().uri("/preprocessing/dmp").bodyValue(fileEnvelopeModel)
- .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(PreprocessingDmpModel.class)).block();
+ public PreprocessingPlanModel preprocessingPlan(FileEnvelopeModel fileEnvelopeModel) {
+ logger.debug(new MapLogEntry("preprocessingPlan").And("fileEnvelope", fileEnvelopeModel));
+ return this.transformerClient.post().uri("/preprocessing/plan").bodyValue(fileEnvelopeModel)
+ .exchangeToMono(mono -> mono.statusCode().isError() ? mono.createException().flatMap(Mono::error) : mono.bodyToMono(PreprocessingPlanModel.class)).block();
}
@Override
diff --git a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerService.java b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerService.java
index 766acf1db..4aaf45cb8 100644
--- a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerService.java
+++ b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerService.java
@@ -1,8 +1,8 @@
package org.opencdmp.service.filetransformer;
import jakarta.xml.bind.JAXBException;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
-import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel;
+import org.opencdmp.commonmodels.models.plan.PlanModel;
+import org.opencdmp.filetransformerbase.models.misc.PreprocessingPlanModel;
import org.opencdmp.model.file.RepositoryFileFormat;
import org.opencdmp.model.persist.PlanCommonModelConfig;
@@ -24,7 +24,7 @@ public interface FileTransformerService {
org.opencdmp.model.file.FileEnvelope exportDescription(UUID descriptionId, String repositoryId, String format) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException;
- DmpModel importPlan(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException;
+ PlanModel importPlan(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException;
- PreprocessingDmpModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException;
+ PreprocessingPlanModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException;
}
diff --git a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java
index 03e1cbeec..c9e63b715 100644
--- a/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java
+++ b/backend/core/src/main/java/org/opencdmp/service/filetransformer/FileTransformerServiceImpl.java
@@ -19,8 +19,8 @@ import org.opencdmp.authorization.Permission;
import org.opencdmp.commonmodels.models.FileEnvelopeModel;
import org.opencdmp.commonmodels.models.description.DescriptionModel;
import org.opencdmp.commonmodels.models.descriptiotemplate.DescriptionTemplateModel;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
-import org.opencdmp.commonmodels.models.dmpblueprint.DmpBlueprintModel;
+import org.opencdmp.commonmodels.models.plan.PlanModel;
+import org.opencdmp.commonmodels.models.planblueprint.PlanBlueprintModel;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.enums.IsActive;
import org.opencdmp.commons.enums.StorageType;
@@ -36,8 +36,8 @@ import org.opencdmp.data.TenantConfigurationEntity;
import org.opencdmp.event.TenantConfigurationTouchedEvent;
import org.opencdmp.filetransformerbase.interfaces.FileTransformerConfiguration;
import org.opencdmp.filetransformerbase.models.misc.DescriptionImportModel;
-import org.opencdmp.filetransformerbase.models.misc.DmpImportModel;
-import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel;
+import org.opencdmp.filetransformerbase.models.misc.PlanImportModel;
+import org.opencdmp.filetransformerbase.models.misc.PreprocessingPlanModel;
import org.opencdmp.model.StorageFile;
import org.opencdmp.model.builder.commonmodels.description.DescriptionCommonModelBuilder;
import org.opencdmp.model.builder.commonmodels.descriptiontemplate.DescriptionTemplateCommonModelBuilder;
@@ -259,10 +259,10 @@ public class FileTransformerServiceImpl implements FileTransformerService {
if (repository == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{format, FileTransformerRepository.class.getSimpleName()}, LocaleContextHolder.getLocale()));
//GK: Second get the Target Data Management Plan
PlanQuery query = this.queryFactory.query(PlanQuery.class).disableTracking().authorize(AuthorizationFlags.All).ids(planId);
- DmpModel dmpFileTransformerModel = this.builderFactory.builder(PlanCommonModelBuilder.class).useSharedStorage(repository.getConfiguration().isUseSharedStorage()).setRepositoryId(repository.getConfiguration().getFileTransformerId()).authorize(AuthorizationFlags.AllExceptPublic).build(query.first());
- if (dmpFileTransformerModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planId, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale()));
+ PlanModel planFileTransformerModel = this.builderFactory.builder(PlanCommonModelBuilder.class).useSharedStorage(repository.getConfiguration().isUseSharedStorage()).setRepositoryId(repository.getConfiguration().getFileTransformerId()).authorize(AuthorizationFlags.AllExceptPublic).build(query.first());
+ if (planFileTransformerModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planId, Plan.class.getSimpleName()}, LocaleContextHolder.getLocale()));
- FileEnvelopeModel fileEnvelope = repository.exportDmp(dmpFileTransformerModel, format);
+ FileEnvelopeModel fileEnvelope = repository.exportPlan(planFileTransformerModel, format);
org.opencdmp.model.file.FileEnvelope result = new org.opencdmp.model.file.FileEnvelope();
byte[] data = repository.getConfiguration().isUseSharedStorage() ? this.storageFileService.readByFileRefAsBytesSafe(fileEnvelope.getFileRef(), StorageType.Transformer) : fileEnvelope.getFile();
@@ -313,7 +313,7 @@ public class FileTransformerServiceImpl implements FileTransformerService {
}
@Override
- public DmpModel importPlan(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException {
+ public PlanModel importPlan(PlanCommonModelConfig planCommonModelConfig) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException, JAXBException {
this.authorizationService.authorizeForce(Permission.NewPlan);
StorageFileEntity tempFile = this.queryFactory.query(StorageFileQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(planCommonModelConfig.getFileId()).first();
@@ -325,11 +325,11 @@ public class FileTransformerServiceImpl implements FileTransformerService {
if (repository == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planCommonModelConfig.getRepositoryId(), FileTransformerRepository.class.getSimpleName()}, LocaleContextHolder.getLocale()));
PlanBlueprintQuery planBlueprintQuery = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(planCommonModelConfig.getBlueprintId());
- DmpBlueprintModel dmpBlueprintModel = this.builderFactory.builder(PlanBlueprintCommonModelBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(planBlueprintQuery.first());
- if (dmpBlueprintModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planCommonModelConfig.getBlueprintId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
+ PlanBlueprintModel planBlueprintModel = this.builderFactory.builder(PlanBlueprintCommonModelBuilder.class).authorize(AuthorizationFlags.AllExceptPublic).build(planBlueprintQuery.first());
+ if (planBlueprintModel == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{planCommonModelConfig.getBlueprintId(), PlanBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
- DmpImportModel dmpImportModel = new DmpImportModel();
- dmpImportModel.setBlueprintModel(dmpBlueprintModel);
+ PlanImportModel planImportModel = new PlanImportModel();
+ planImportModel.setBlueprintModel(planBlueprintModel);
if (!this.conventionService.isListNullOrEmpty(planCommonModelConfig.getDescriptions())){
List descriptionTemplateEntities = this.queryFactory.query(DescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(planCommonModelConfig.getDescriptions().stream().map(x -> x.getTemplateId()).distinct().collect(Collectors.toList())).collect();
@@ -351,7 +351,7 @@ public class FileTransformerServiceImpl implements FileTransformerService {
}
}
- dmpImportModel.setDescriptions(descriptionImportModels);
+ planImportModel.setDescriptions(descriptionImportModels);
}
String originalFileName = tempFile.getName() + (tempFile.getExtension().startsWith(".") ? "" : ".") + tempFile.getExtension();
@@ -374,13 +374,13 @@ public class FileTransformerServiceImpl implements FileTransformerService {
fileEnvelope.setFileRef(storageFile.getFileRef());
}
- dmpImportModel.setFile(fileEnvelope);
+ planImportModel.setFile(fileEnvelope);
- return repository.importDmp(dmpImportModel);
+ return repository.importPlan(planImportModel);
}
@Override
- public PreprocessingDmpModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException {
+ public PreprocessingPlanModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException {
this.authorizationService.authorizeForce(Permission.NewPlan);
StorageFileEntity tempFile = this.queryFactory.query(StorageFileQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).ids(fileId).first();
@@ -411,7 +411,7 @@ public class FileTransformerServiceImpl implements FileTransformerService {
fileEnvelope.setFileRef(storageFile.getFileRef());
}
- return repository.preprocessingDmp(fileEnvelope);
+ return repository.preprocessingPlan(fileEnvelope);
}
}
diff --git a/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java b/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java
index df39a64b4..71c39bf35 100644
--- a/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java
+++ b/backend/core/src/main/java/org/opencdmp/service/plan/PlanService.java
@@ -7,7 +7,7 @@ import gr.cite.tools.exception.MyValidationException;
import gr.cite.tools.fieldset.FieldSet;
import jakarta.xml.bind.JAXBException;
import org.opencdmp.commons.types.plan.importexport.PlanImportExport;
-import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel;
+import org.opencdmp.filetransformerbase.models.misc.PreprocessingPlanModel;
import org.opencdmp.model.PlanUser;
import org.opencdmp.model.PlanValidationResult;
import org.opencdmp.model.plan.Plan;
@@ -61,5 +61,5 @@ public interface PlanService {
Plan importJson(PlanCommonModelConfig planCommonModelConfig, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException;
- PreprocessingDmpModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException;
+ PreprocessingPlanModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException;
}
diff --git a/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java
index e40b3f5e8..485112522 100644
--- a/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java
+++ b/backend/core/src/main/java/org/opencdmp/service/plan/PlanServiceImpl.java
@@ -21,19 +21,19 @@ import org.jetbrains.annotations.NotNull;
import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.authorization.Permission;
import org.opencdmp.authorization.authorizationcontentresolver.AuthorizationContentResolver;
-import org.opencdmp.commonmodels.models.DmpUserModel;
+import org.opencdmp.commonmodels.models.PlanUserModel;
import org.opencdmp.commonmodels.models.UserModel;
import org.opencdmp.commonmodels.models.description.DescriptionModel;
-import org.opencdmp.commonmodels.models.dmp.DmpBlueprintValueModel;
-import org.opencdmp.commonmodels.models.dmp.DmpContactModel;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
-import org.opencdmp.commonmodels.models.dmp.DmpPropertiesModel;
-import org.opencdmp.commonmodels.models.dmpblueprint.ExtraFieldModel;
-import org.opencdmp.commonmodels.models.dmpblueprint.FieldModel;
-import org.opencdmp.commonmodels.models.dmpblueprint.ReferenceTypeFieldModel;
-import org.opencdmp.commonmodels.models.dmpblueprint.SectionModel;
-import org.opencdmp.commonmodels.models.dmpdescriptiontemplate.DmpDescriptionTemplateModel;
-import org.opencdmp.commonmodels.models.dmpreference.DmpReferenceModel;
+import org.opencdmp.commonmodels.models.plan.PlanBlueprintValueModel;
+import org.opencdmp.commonmodels.models.plan.PlanContactModel;
+import org.opencdmp.commonmodels.models.plan.PlanModel;
+import org.opencdmp.commonmodels.models.plan.PlanPropertiesModel;
+import org.opencdmp.commonmodels.models.planblueprint.ExtraFieldModel;
+import org.opencdmp.commonmodels.models.planblueprint.FieldModel;
+import org.opencdmp.commonmodels.models.planblueprint.ReferenceTypeFieldModel;
+import org.opencdmp.commonmodels.models.planblueprint.SectionModel;
+import org.opencdmp.commonmodels.models.plandescriptiontemplate.PlanDescriptionTemplateModel;
+import org.opencdmp.commonmodels.models.planreference.PlanReferenceModel;
import org.opencdmp.commonmodels.models.reference.ReferenceModel;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.XmlHandlingService;
@@ -64,7 +64,7 @@ import org.opencdmp.data.*;
import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.event.PlanTouchedEvent;
import org.opencdmp.event.EventBroker;
-import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel;
+import org.opencdmp.filetransformerbase.models.misc.PreprocessingPlanModel;
import org.opencdmp.integrationevent.outbox.annotationentityremoval.AnnotationEntityRemovalIntegrationEventHandler;
import org.opencdmp.integrationevent.outbox.annotationentitytouch.AnnotationEntityTouchedIntegrationEventHandler;
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
@@ -931,7 +931,7 @@ public class PlanServiceImpl implements PlanService {
if (persist.getPlanBlueprintValues() != null && !persist.getPlanBlueprintValues().isEmpty()){
data.setPlanBlueprintValues(new ArrayList<>());
for (PlanBlueprintValuePersist fieldValuePersist: persist.getPlanBlueprintValues().values()) {
- if (!this.conventionService.isNullOrEmpty(fieldValuePersist.getFieldValue()) || fieldValuePersist.getDateValue() != null || fieldValuePersist.getNumberValue() != null) data.getPlanBlueprintValues().add(this.buildDmpBlueprintValueEntity(fieldValuePersist, definition));
+ if (!this.conventionService.isNullOrEmpty(fieldValuePersist.getFieldValue()) || fieldValuePersist.getDateValue() != null || fieldValuePersist.getNumberValue() != null) data.getPlanBlueprintValues().add(this.buildPlanBlueprintValueEntity(fieldValuePersist, definition));
}
}
return data;
@@ -947,7 +947,7 @@ public class PlanServiceImpl implements PlanService {
return data;
}
- private @NotNull PlanBlueprintValueEntity buildDmpBlueprintValueEntity(PlanBlueprintValuePersist persist, org.opencdmp.commons.types.planblueprint.DefinitionEntity definition){
+ private @NotNull PlanBlueprintValueEntity buildPlanBlueprintValueEntity(PlanBlueprintValuePersist persist, org.opencdmp.commons.types.planblueprint.DefinitionEntity definition){
PlanBlueprintValueEntity data = new PlanBlueprintValueEntity();
if (persist == null || definition == null) return data;
@@ -1266,11 +1266,11 @@ public class PlanServiceImpl implements PlanService {
persist.setAccessType(data.getAccessType());
persist.setLanguage(data.getLanguage());
- List dmpUserEntities = this.queryFactory.query(PlanUserQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(data.getId()).isActives(IsActive.Active).collect();
+ List planUserEntities = this.queryFactory.query(PlanUserQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(data.getId()).isActives(IsActive.Active).collect();
- if (!this.conventionService.isListNullOrEmpty(dmpUserEntities)){
+ if (!this.conventionService.isListNullOrEmpty(planUserEntities)){
persist.setUsers(new ArrayList<>());
- for (PlanUserEntity user: dmpUserEntities) {
+ for (PlanUserEntity user: planUserEntities) {
persist.getUsers().add(this.buildPlanUserPersist(user));
}
}
@@ -1279,10 +1279,10 @@ public class PlanServiceImpl implements PlanService {
org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, planBlueprintEntity.getDefinition());
- List dmpDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(data.getId()).isActive(IsActive.Active).collect();
- if (!this.conventionService.isListNullOrEmpty(dmpDescriptionTemplateEntities)){
+ List planDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).planIds(data.getId()).isActive(IsActive.Active).collect();
+ if (!this.conventionService.isListNullOrEmpty(planDescriptionTemplateEntities)){
persist.setDescriptionTemplates(new ArrayList<>());
- for (PlanDescriptionTemplateEntity descriptionTemplateEntity: dmpDescriptionTemplateEntities) {
+ for (PlanDescriptionTemplateEntity descriptionTemplateEntity: planDescriptionTemplateEntities) {
persist.getDescriptionTemplates().add(this.buildPlanDescriptionTemplatePersists(descriptionTemplateEntity));
}
}
@@ -2053,14 +2053,14 @@ public class PlanServiceImpl implements PlanService {
//region Import RDA JSON
- public PreprocessingDmpModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException {
+ public PreprocessingPlanModel preprocessingPlan(UUID fileId, String repositoryId) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, IOException {
return this.fileTransformerService.preprocessingPlan(fileId, repositoryId);
}
public Plan importJson(PlanCommonModelConfig planCommonModelConfig, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, InvalidApplicationException, IOException, InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException, ParserConfigurationException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
logger.debug(new MapLogEntry("import data").And("file id", planCommonModelConfig.getFileId()).And("label", planCommonModelConfig.getLabel()).And("fields", fields));
- DmpModel model = this.fileTransformerService.importPlan(planCommonModelConfig);
+ PlanModel model = this.fileTransformerService.importPlan(planCommonModelConfig);
if (model == null) throw new MyNotFoundException("Plan Import Error");
PlanPersist persist = new PlanPersist();
@@ -2093,10 +2093,10 @@ public class PlanServiceImpl implements PlanService {
return plan;
}
- private List commonModelPlanDescriptionTemplatesToPersist(DmpModel commonModel){
+ private List commonModelPlanDescriptionTemplatesToPersist(PlanModel commonModel){
if (!this.conventionService.isListNullOrEmpty(commonModel.getDescriptionTemplates())) {
List descriptionTemplates = new ArrayList<>();
- for (DmpDescriptionTemplateModel descriptionTemplate : commonModel.getDescriptionTemplates()) {
+ for (PlanDescriptionTemplateModel descriptionTemplate : commonModel.getDescriptionTemplates()) {
descriptionTemplates.add(this.commonModelPlanDescriptionTemplateToPersist(descriptionTemplate));
}
return descriptionTemplates.stream().filter(Objects::nonNull).toList();
@@ -2104,7 +2104,7 @@ public class PlanServiceImpl implements PlanService {
return null;
}
- private PlanDescriptionTemplatePersist commonModelPlanDescriptionTemplateToPersist(DmpDescriptionTemplateModel commonModel) {
+ private PlanDescriptionTemplatePersist commonModelPlanDescriptionTemplateToPersist(PlanDescriptionTemplateModel commonModel) {
if (commonModel == null)
return null;
@@ -2116,21 +2116,21 @@ public class PlanServiceImpl implements PlanService {
return persist;
}
- private UUID commonModelPlanBlueprintToPersist(DmpModel planXml) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
- if (planXml.getDmpBlueprint() != null){
- PlanBlueprintEntity planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(planXml.getDmpBlueprint().getId()).first();
- if (planBlueprintEntity == null) planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().groupIds(planXml.getDmpBlueprint().getGroupId()).versionStatuses(PlanBlueprintVersionStatus.Current).isActive(IsActive.Active).statuses(PlanBlueprintStatus.Finalized).first();
+ private UUID commonModelPlanBlueprintToPersist(PlanModel planXml) throws JAXBException, InvalidApplicationException, ParserConfigurationException, IOException, TransformerException, InstantiationException, IllegalAccessException, SAXException {
+ if (planXml.getPlanBlueprint() != null){
+ PlanBlueprintEntity planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().ids(planXml.getPlanBlueprint().getId()).first();
+ if (planBlueprintEntity == null) planBlueprintEntity = this.queryFactory.query(PlanBlueprintQuery.class).disableTracking().groupIds(planXml.getPlanBlueprint().getGroupId()).versionStatuses(PlanBlueprintVersionStatus.Current).isActive(IsActive.Active).statuses(PlanBlueprintStatus.Finalized).first();
if (planBlueprintEntity != null){
return planBlueprintEntity.getId();
} else {
- PlanBlueprint persisted = this.planBlueprintService.importCommonModel(planXml.getDmpBlueprint(), new BaseFieldSet().ensure(PlanBlueprint._label).ensure(PlanBlueprint._hash));
+ PlanBlueprint persisted = this.planBlueprintService.importCommonModel(planXml.getPlanBlueprint(), new BaseFieldSet().ensure(PlanBlueprint._label).ensure(PlanBlueprint._hash));
return persisted.getId();
}
}
return null;
}
- private PlanPropertiesPersist commonModelPlanPropertiesToPersist(DmpModel commonModel) {
+ private PlanPropertiesPersist commonModelPlanPropertiesToPersist(PlanModel commonModel) {
if (commonModel == null || commonModel.getProperties() == null) return null;
PlanPropertiesPersist persist = new PlanPropertiesPersist();
@@ -2140,10 +2140,10 @@ public class PlanServiceImpl implements PlanService {
return persist;
}
- private List commonModelToPlanContactPersist(DmpPropertiesModel commonModel){
+ private List commonModelToPlanContactPersist(PlanPropertiesModel commonModel){
if (!this.conventionService.isListNullOrEmpty(commonModel.getContacts())) {
List contacts = new ArrayList<>();
- for (DmpContactModel contact : commonModel.getContacts()) {
+ for (PlanContactModel contact : commonModel.getContacts()) {
contacts.add(this.commonModelPlanContactToPersist(contact));
}
return contacts;
@@ -2151,27 +2151,27 @@ public class PlanServiceImpl implements PlanService {
return null;
}
- private Map commonModelToPlanBlueprintValuePersist(DmpModel commonModel){
- if (commonModel.getDmpBlueprint() != null && commonModel.getDmpBlueprint().getDefinition() != null && !this.conventionService.isListNullOrEmpty(commonModel.getDmpBlueprint().getDefinition().getSections())) {
+ private Map commonModelToPlanBlueprintValuePersist(PlanModel commonModel){
+ if (commonModel.getPlanBlueprint() != null && commonModel.getPlanBlueprint().getDefinition() != null && !this.conventionService.isListNullOrEmpty(commonModel.getPlanBlueprint().getDefinition().getSections())) {
Map planBlueprintValues = new HashMap<>();
- List sections = commonModel.getDmpBlueprint().getDefinition().getSections();
+ List sections = commonModel.getPlanBlueprint().getDefinition().getSections();
if (!this.conventionService.isListNullOrEmpty(sections)){
for (SectionModel section : sections) {
if (!this.conventionService.isListNullOrEmpty(section.getFields())){
for (FieldModel field : section.getFields()) {
// reference
- if (field.getCategory().equals(org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.ReferenceType)){
+ if (field.getCategory().equals(org.opencdmp.commonmodels.enums.PlanBlueprintFieldCategory.ReferenceType)){
ReferenceTypeFieldModel referenceField = (ReferenceTypeFieldModel) field;
- List dmpReferencesByField = commonModel.getReferences().stream().filter(x -> x.getData() != null && x.getData().getBlueprintFieldId().equals(referenceField.getId())).collect(Collectors.toList());
- if (!this.conventionService.isListNullOrEmpty(dmpReferencesByField)){
- planBlueprintValues.put(referenceField.getId(), this.commonModelPlanReferenceFieldToPlanBlueprintValuePersist(referenceField, dmpReferencesByField));
+ List planReferencesByField = commonModel.getReferences().stream().filter(x -> x.getData() != null && x.getData().getBlueprintFieldId().equals(referenceField.getId())).collect(Collectors.toList());
+ if (!this.conventionService.isListNullOrEmpty(planReferencesByField)){
+ planBlueprintValues.put(referenceField.getId(), this.commonModelPlanReferenceFieldToPlanBlueprintValuePersist(referenceField, planReferencesByField));
}
} else {
// custom fields
- if (field.getCategory().equals(org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.Extra) && commonModel.getProperties() != null && !this.conventionService.isListNullOrEmpty(commonModel.getProperties().getDmpBlueprintValues())){
- DmpBlueprintValueModel dmpBlueprintValueModel = commonModel.getProperties().getDmpBlueprintValues().stream().filter(x -> x.getFieldId().equals(field.getId())).findFirst().orElse(null);
+ if (field.getCategory().equals(org.opencdmp.commonmodels.enums.PlanBlueprintFieldCategory.Extra) && commonModel.getProperties() != null && !this.conventionService.isListNullOrEmpty(commonModel.getProperties().getPlanBlueprintValues())){
+ PlanBlueprintValueModel planBlueprintValueModel = commonModel.getProperties().getPlanBlueprintValues().stream().filter(x -> x.getFieldId().equals(field.getId())).findFirst().orElse(null);
ExtraFieldModel extraFieldModel = (ExtraFieldModel) field;
- if (dmpBlueprintValueModel != null) planBlueprintValues.put(dmpBlueprintValueModel.getFieldId(), this.commonModelPlanBlueprintValueToPersist(dmpBlueprintValueModel, extraFieldModel));
+ if (planBlueprintValueModel != null) planBlueprintValues.put(planBlueprintValueModel.getFieldId(), this.commonModelPlanBlueprintValueToPersist(planBlueprintValueModel, extraFieldModel));
}
}
}
@@ -2183,7 +2183,7 @@ public class PlanServiceImpl implements PlanService {
return null;
}
- private PlanBlueprintValuePersist commonModelPlanReferenceFieldToPlanBlueprintValuePersist(ReferenceTypeFieldModel model, List planReferences) {
+ private PlanBlueprintValuePersist commonModelPlanReferenceFieldToPlanBlueprintValuePersist(ReferenceTypeFieldModel model, List planReferences) {
if (model == null || this.conventionService.isListNullOrEmpty(planReferences) || model.getReferenceType() == null)
return null;
@@ -2196,7 +2196,7 @@ public class PlanServiceImpl implements PlanService {
persist.setFieldId(model.getId());
if (model.getMultipleSelect()){
List references = new ArrayList<>();
- for (DmpReferenceModel planReference : planReferences) {
+ for (PlanReferenceModel planReference : planReferences) {
references.add(this.commonPlanReferenceToReferencePersist(planReference.getReference(), referenceTypeEntity));
}
persist.setReferences(references);
@@ -2239,7 +2239,7 @@ public class PlanServiceImpl implements PlanService {
return persist;
}
- private PlanBlueprintValuePersist commonModelPlanBlueprintValueToPersist(DmpBlueprintValueModel commonModel, ExtraFieldModel extraFieldModel) {
+ private PlanBlueprintValuePersist commonModelPlanBlueprintValueToPersist(PlanBlueprintValueModel commonModel, ExtraFieldModel extraFieldModel) {
if (commonModel == null || extraFieldModel == null)
return null;
PlanBlueprintValuePersist persist = new PlanBlueprintValuePersist();
@@ -2255,22 +2255,22 @@ public class PlanServiceImpl implements PlanService {
return persist;
}
- private List commonModelToPlanUsersPersist(DmpModel commonModel){
+ private List commonModelToPlanUsersPersist(PlanModel commonModel){
if (!this.conventionService.isListNullOrEmpty(commonModel.getUsers())) {
- List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(commonModel.getUsers().stream().map(DmpUserModel::getUser).filter(Objects::nonNull).map(UserModel::getId).filter(Objects::nonNull).distinct().toList()).isActive(IsActive.Active).collect();
+ List users = this.queryFactory.query(UserQuery.class).disableTracking().ids(commonModel.getUsers().stream().map(PlanUserModel::getUser).filter(Objects::nonNull).map(UserModel::getId).filter(Objects::nonNull).distinct().toList()).isActive(IsActive.Active).collect();
List userIds = users == null ? new ArrayList<>() : users.stream().map(UserEntity::getId).collect(Collectors.toList());
- List dmpUsers = new ArrayList<>();
- for (DmpUserModel user : commonModel.getUsers()) {
- dmpUsers.add(this.commonModelPlanUserToPersist(user, userIds));
+ List planUsers = new ArrayList<>();
+ for (PlanUserModel user : commonModel.getUsers()) {
+ planUsers.add(this.commonModelPlanUserToPersist(user, userIds));
}
- return dmpUsers;
+ return planUsers;
}
return null;
}
- private PlanUserPersist commonModelPlanUserToPersist(DmpUserModel commonModel, List userIds) {
+ private PlanUserPersist commonModelPlanUserToPersist(PlanUserModel commonModel, List userIds) {
if (commonModel == null)
return null;
@@ -2293,7 +2293,7 @@ public class PlanServiceImpl implements PlanService {
return null;
}
- private PlanContactPersist commonModelPlanContactToPersist(DmpContactModel commonModel) {
+ private PlanContactPersist commonModelPlanContactToPersist(PlanContactModel commonModel) {
if (commonModel == null)
return null;
diff --git a/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java
index d0c96d1e1..6f7b48a0e 100644
--- a/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java
+++ b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintService.java
@@ -7,7 +7,7 @@ import gr.cite.tools.exception.MyNotFoundException;
import gr.cite.tools.exception.MyValidationException;
import gr.cite.tools.fieldset.FieldSet;
import jakarta.xml.bind.JAXBException;
-import org.opencdmp.commonmodels.models.dmpblueprint.DmpBlueprintModel;
+import org.opencdmp.commonmodels.models.planblueprint.PlanBlueprintModel;
import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType;
import org.opencdmp.commons.types.planblueprint.importexport.BlueprintImportExport;
import org.opencdmp.data.PlanBlueprintEntity;
@@ -43,5 +43,5 @@ public interface PlanBlueprintService {
PlanBlueprint importXml(BlueprintImportExport planBlueprintDefinition, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException;
PlanBlueprint importXml(byte[] bytes, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException;
- PlanBlueprint importCommonModel(DmpBlueprintModel planBlueprintModel, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException;
+ PlanBlueprint importCommonModel(PlanBlueprintModel planBlueprintModel, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException;
}
diff --git a/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java
index 722357d2c..ec1bc973f 100644
--- a/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java
+++ b/backend/core/src/main/java/org/opencdmp/service/planblueprint/PlanBlueprintServiceImpl.java
@@ -18,7 +18,7 @@ import jakarta.xml.bind.JAXBException;
import org.jetbrains.annotations.NotNull;
import org.opencdmp.authorization.AuthorizationFlags;
import org.opencdmp.authorization.Permission;
-import org.opencdmp.commonmodels.models.dmpblueprint.*;
+import org.opencdmp.commonmodels.models.planblueprint.*;
import org.opencdmp.commons.XmlHandlingService;
import org.opencdmp.commons.enums.*;
import org.opencdmp.commons.scope.tenant.TenantScope;
@@ -809,7 +809,7 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService {
//region Import Common Model
@Override
- public PlanBlueprint importCommonModel(DmpBlueprintModel planBlueprintModel, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException {
+ public PlanBlueprint importCommonModel(PlanBlueprintModel planBlueprintModel, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException {
logger.debug(new MapLogEntry("import data").And("planBlueprintModel", planBlueprintModel).And("fields", fields));
this.authorizationService.authorizeForce(Permission.ImportPlanBlueprint);
@@ -872,13 +872,13 @@ public class PlanBlueprintServiceImpl implements PlanBlueprintService {
persist.setHasTemplates(commonModel.getHasTemplates());
List planBlueprintFieldModels = new LinkedList<>();
if (!this.conventionService.isListNullOrEmpty(commonModel.getFields())) {
- for (SystemFieldModel systemField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.System.equals(x.getCategory())).map(x-> (SystemFieldModel)x).toList()) {
+ for (SystemFieldModel systemField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.PlanBlueprintFieldCategory.System.equals(x.getCategory())).map(x-> (SystemFieldModel)x).toList()) {
planBlueprintFieldModels.add(this.commonModelSystemFieldToPersist(systemField));
}
- for (ReferenceTypeFieldModel referenceField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldModel)x).toList()) {
+ for (ReferenceTypeFieldModel referenceField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.PlanBlueprintFieldCategory.ReferenceType.equals(x.getCategory())).map(x-> (ReferenceTypeFieldModel)x).toList()) {
planBlueprintFieldModels.add(this.commonModelReferenceFieldToPersist(referenceField));
}
- for (ExtraFieldModel extraField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.DmpBlueprintFieldCategory.Extra.equals(x.getCategory())).map(x-> (ExtraFieldModel)x).toList()) {
+ for (ExtraFieldModel extraField : commonModel.getFields().stream().filter(x-> org.opencdmp.commonmodels.enums.PlanBlueprintFieldCategory.Extra.equals(x.getCategory())).map(x-> (ExtraFieldModel)x).toList()) {
planBlueprintFieldModels.add(this.commonExtraFieldToPersist(extraField));
}
}
diff --git a/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java b/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java
index bd83e4e7d..21dd17228 100644
--- a/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java
+++ b/backend/web/src/main/java/org/opencdmp/controllers/PlanController.java
@@ -30,7 +30,7 @@ import org.opencdmp.controllers.swagger.annotation.OperationWithTenantHeader;
import org.opencdmp.controllers.swagger.annotation.Swagger400;
import org.opencdmp.controllers.swagger.annotation.Swagger404;
import org.opencdmp.controllers.swagger.annotation.SwaggerCommonErrorResponses;
-import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel;
+import org.opencdmp.filetransformerbase.models.misc.PreprocessingPlanModel;
import org.opencdmp.model.DescriptionsToBeFinalized;
import org.opencdmp.model.PlanUser;
import org.opencdmp.model.PlanValidationResult;
@@ -499,17 +499,17 @@ public class PlanController {
@OperationWithTenantHeader(summary = "Preprocess a plan from a json file", description = "",
responses = @ApiResponse(description = "OK", responseCode = "200", content = @Content(
schema = @Schema(
- implementation = PreprocessingDmpModel.class
+ implementation = PreprocessingPlanModel.class
))
))
@Transactional
- public PreprocessingDmpModel preprocessing(
+ public PreprocessingPlanModel preprocessing(
@RequestParam("fileId") UUID fileId,
@RequestParam("repositoryId") String repositoryId
) throws InvalidAlgorithmParameterException, JAXBException, NoSuchPaddingException, IllegalBlockSizeException, InvalidApplicationException, IOException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
logger.debug(new MapLogEntry("preprocessing plan" + Plan.class.getSimpleName()).And("transformerId", repositoryId).And("fileId", fileId));
- PreprocessingDmpModel model = this.planService.preprocessingPlan(fileId, repositoryId);
+ PreprocessingPlanModel model = this.planService.preprocessingPlan(fileId, repositoryId);
this.auditService.track(AuditableAction.Plan_Import, Map.ofEntries(
new AbstractMap.SimpleEntry("transformerId", repositoryId),
diff --git a/dmp-migration-tool/data/src/main/java/eu/old/eudat/data/entities/DMPProfile.java b/dmp-migration-tool/data/src/main/java/eu/old/eudat/data/entities/DMPProfile.java
index d8ccbdb4b..17165af0b 100644
--- a/dmp-migration-tool/data/src/main/java/eu/old/eudat/data/entities/DMPProfile.java
+++ b/dmp-migration-tool/data/src/main/java/eu/old/eudat/data/entities/DMPProfile.java
@@ -14,7 +14,7 @@ import java.util.UUID;
@Entity
-@Table(name = "\"DmpBlueprint\"")
+@Table(name = "\"PlanBlueprint\"")
public class DMPProfile implements DataEntity {
public enum Status {
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java
index 172310e31..c7473824c 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetMigrationService.java
@@ -1,7 +1,6 @@
package eu.old.eudat.migration;
import eu.old.eudat.data.entities.DMP;
-import eu.old.eudat.elastic.entities.Tag;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.XmlHandlingService;
import org.opencdmp.commons.enums.*;
@@ -9,12 +8,12 @@ import org.opencdmp.commons.types.description.*;
import org.opencdmp.commons.types.descriptionreference.DescriptionReferenceDataEntity;
import org.opencdmp.commons.types.descriptiontemplate.FieldSetEntity;
import org.opencdmp.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity;
-import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity;
+import org.opencdmp.commons.types.planblueprint.DefinitionEntity;
import org.opencdmp.commons.types.externalfetcher.ExternalFetcherApiSourceConfigurationEntity;
import org.opencdmp.commons.types.referencetype.ReferenceTypeDefinitionEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.data.*;
-import org.opencdmp.model.dmp.Dmp;
+import org.opencdmp.model.plan.Plan;
import org.opencdmp.model.reference.Reference;
import org.opencdmp.model.referencetype.ReferenceType;
import org.opencdmp.query.*;
@@ -48,7 +47,7 @@ import java.util.stream.Stream;
@Service
public class DatasetMigrationService {
- private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpDatasetProfileMigrationService.class));
+ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DatasetMigrationService.class));
private final DatabaseRepository databaseRepository;
private final JsonHandlingService jsonHandlingService;
private final QueryFactory queryFactory;
@@ -96,11 +95,11 @@ public class DatasetMigrationService {
if (items != null && !items.isEmpty()) {
logger.debug("Migrate Dataset " + page * PageSize + " of " + total);
- List dmpBlueprints = this.queryFactory.query(DmpBlueprintQuery.class).ids(items.stream().map(x-> x.getDmp().getProfile().getId()).distinct().toList()).collect();
- Map dmpBlueprintsMap = new HashMap<>();
- for (DmpBlueprintEntity dmpBlueprint : dmpBlueprints) {
- DefinitionEntity definitionEntity = this.xmlHandlingService.fromXml(DefinitionEntity.class, dmpBlueprint.getDefinition());
- dmpBlueprintsMap.put(dmpBlueprint.getId(), definitionEntity);
+ List planBlueprints = this.queryFactory.query(PlanBlueprintQuery.class).ids(items.stream().map(x-> x.getDmp().getProfile().getId()).distinct().toList()).collect();
+ Map planBlueprintsMap = new HashMap<>();
+ for (PlanBlueprintEntity planBlueprint : planBlueprints) {
+ DefinitionEntity definitionEntity = this.xmlHandlingService.fromXml(DefinitionEntity.class, planBlueprint.getDefinition());
+ planBlueprintsMap.put(planBlueprint.getId(), definitionEntity);
}
List changeTemplateToH2020 = Stream.of("0c82f2ce-5ff7-4ca9-a500-9f3062adf550",
"7acd3b36-e598-459c-8170-87c51ac80efb",
@@ -118,8 +117,8 @@ public class DatasetMigrationService {
UUID horizon2020UUID = UUID.fromString("6ddde24b-e7a0-477f-a2cd-0a8fad915dc8");
UUID horizonGroupId = UUID.fromString("3689bcce-405a-4d55-9854-669597b79c0a");
- List dmpDescriptionTemplateEntities = this.queryFactory.query(DmpDescriptionTemplateQuery.class).dmpIds(items.stream().map(x-> x.getDmp().getId()).distinct().toList()).collect();
- Map creatorsByDmp = this.queryFactory.query(DmpQuery.class).ids(items.stream().map(x-> x.getDmp().getId()).distinct().toList()).collectAs(new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._creator)).stream().collect(Collectors.toMap(DmpEntity::getId, DmpEntity::getCreatorId));
+ List planDescriptionTemplateEntities = this.queryFactory.query(PlanDescriptionTemplateQuery.class).planIds(items.stream().map(x-> x.getDmp().getId()).distinct().toList()).collect();
+ Map creatorsByPlan = this.queryFactory.query(PlanQuery.class).ids(items.stream().map(x-> x.getDmp().getId()).distinct().toList()).collectAs(new BaseFieldSet().ensure(Plan._id).ensure(Plan._creator)).stream().collect(Collectors.toMap(PlanEntity::getId, PlanEntity::getCreatorId));
List profileIds = new ArrayList<>(items.stream().map(x -> x.getProfile().getId()).distinct().toList());
profileIds.add(horizon2020UUID);
@@ -137,7 +136,7 @@ public class DatasetMigrationService {
profileGroupId = horizonGroupId;
}
- DefinitionEntity definition = dmpBlueprintsMap.getOrDefault(item.getDmp().getProfile().getId(), null);
+ DefinitionEntity definition = planBlueprintsMap.getOrDefault(item.getDmp().getProfile().getId(), null);
if (definition == null || definition.getSections() == null || definition.getSections().size() <= item.getDmpSectionIndex()) {
throw new MyApplicationException("Migrate Dataset " + item.getId() + " cannot found section id for section " + item.getDmpSectionIndex());
@@ -147,10 +146,10 @@ public class DatasetMigrationService {
throw new MyApplicationException("Migrate Dataset " + item.getId() + " cannot found section id for section " + item.getDmpSectionIndex());
}
- List itemDescriptionTemplates = this.getOrCreateDmpDescriptionTemplateEntity(item, sectionId, profileGroupId, dmpDescriptionTemplateEntities);
+ List itemDescriptionTemplates = this.getOrCreatePlanDescriptionTemplateEntity(item, sectionId, profileGroupId, planDescriptionTemplateEntities);
if (itemDescriptionTemplates.size() > 1) {
- throw new MyApplicationException("Migrate Dataset " + item.getId() + " multiple DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
+ throw new MyApplicationException("Migrate Dataset " + item.getId() + " multiple PlanDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
}
DescriptionEntity data = new DescriptionEntity();
@@ -159,11 +158,11 @@ public class DatasetMigrationService {
if (item.getCreator() != null) {
data.setCreatedById(item.getCreator().getId());
} else {
- data.setCreatedById(creatorsByDmp.getOrDefault(item.getDmp().getId(), null));
+ data.setCreatedById(creatorsByPlan.getOrDefault(item.getDmp().getId(), null));
}
- data.setDmpId(item.getDmp().getId());
+ data.setPlanId(item.getDmp().getId());
data.setLabel(item.getLabel());
- data.setDmpDescriptionTemplateId(itemDescriptionTemplates.getFirst().getId());
+ data.setPlanDescriptionTemplateId(itemDescriptionTemplates.getFirst().getId());
data.setDescriptionTemplateId(profileId);
data.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
data.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
@@ -196,16 +195,16 @@ public class DatasetMigrationService {
} while (items != null && !items.isEmpty() && !TestMode);
}
- private List getOrCreateDmpDescriptionTemplateEntity(Dataset item, UUID sectionId, UUID groupId, List dmpDescriptionTemplateEntities){
- List itemDescriptionTemplates = dmpDescriptionTemplateEntities.stream().filter(x-> x.getDescriptionTemplateGroupId().equals(groupId) && x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId)).toList();
+ private List getOrCreatePlanDescriptionTemplateEntity(Dataset item, UUID sectionId, UUID groupId, List dmpDescriptionTemplateEntities){
+ List itemDescriptionTemplates = dmpDescriptionTemplateEntities.stream().filter(x-> x.getDescriptionTemplateGroupId().equals(groupId) && x.getPlanId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId)).toList();
if (itemDescriptionTemplates.isEmpty()) {
boolean isDeleted = item.getStatus().equals(Dataset.Status.CANCELED.getValue()) ||item.getStatus().equals(Dataset.Status.DELETED.getValue()) || item.getDmp().getStatus().equals(DMP.DMPStatus.DELETED.getValue());
- if (!isDeleted) logger.warn("Migrate Dataset " + item.getId() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
- if (dmpDescriptionTemplateEntities.stream().anyMatch(x -> x.getDmpId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId))) {
- DmpDescriptionTemplateEntity dmpDescriptionTemplateEntity = new DmpDescriptionTemplateEntity();
+ if (!isDeleted) logger.warn("Migrate Dataset " + item.getId() + " cannot found PlanDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
+ if (dmpDescriptionTemplateEntities.stream().anyMatch(x -> x.getPlanId().equals(item.getDmp().getId()) && x.getSectionId().equals(sectionId))) {
+ PlanDescriptionTemplateEntity dmpDescriptionTemplateEntity = new PlanDescriptionTemplateEntity();
dmpDescriptionTemplateEntity.setId(UUID.randomUUID());
dmpDescriptionTemplateEntity.setDescriptionTemplateGroupId(groupId);
- dmpDescriptionTemplateEntity.setDmpId(item.getDmp().getId());
+ dmpDescriptionTemplateEntity.setPlanId(item.getDmp().getId());
dmpDescriptionTemplateEntity.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
dmpDescriptionTemplateEntity.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
dmpDescriptionTemplateEntity.setSectionId(sectionId);
@@ -214,7 +213,7 @@ public class DatasetMigrationService {
this.entityManager.flush();
itemDescriptionTemplates = List.of(dmpDescriptionTemplateEntity);
} else {
- throw new MyApplicationException("Migrate Dataset " + item.getId() + " " + item.getLabel() + " cannot found DmpDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
+ throw new MyApplicationException("Migrate Dataset " + item.getId() + " " + item.getLabel() + " cannot found PlanDescriptionTemplateEntity for section " + item.getDmpSectionIndex());
}
}
return itemDescriptionTemplates;
@@ -327,10 +326,10 @@ public class DatasetMigrationService {
keyParts = newKey.split("_");
}
}
- String fieldSetId = "";
- String groupId = "";
+ String fieldSetId;
+ String groupId;
int ordinal = Integer.MIN_VALUE;
- String fieldId = "";
+ String fieldId;
if (keyParts.length == 4) {
fieldSetId = keyParts[0].trim();
@@ -405,7 +404,7 @@ public class DatasetMigrationService {
propertyDefinitionEntity.getFieldSets().put(currentFieldSet.getId().trim(), propertyDefinitionFieldSetEntity);
}
- PropertyDefinitionFieldSetItemEntity propertyDefinitionFieldSetItemEntity = null;
+ PropertyDefinitionFieldSetItemEntity propertyDefinitionFieldSetItemEntity;
if (this.conventionService.isListNullOrEmpty(propertyDefinitionFieldSetEntity.getItems())){
propertyDefinitionFieldSetItemEntity = new PropertyDefinitionFieldSetItemEntity();
propertyDefinitionFieldSetItemEntity.setFields(new HashMap<>());
@@ -427,7 +426,7 @@ public class DatasetMigrationService {
propertyDefinitionEntity.getFieldSets().put(currentFieldSet.getId().trim(), propertyDefinitionFieldSetEntity);
}
- PropertyDefinitionFieldSetItemEntity propertyDefinitionFieldSetItemEntity = null;
+ PropertyDefinitionFieldSetItemEntity propertyDefinitionFieldSetItemEntity;
if (this.conventionService.isListNullOrEmpty(propertyDefinitionFieldSetEntity.getItems())){
propertyDefinitionFieldSetItemEntity = new PropertyDefinitionFieldSetItemEntity();
propertyDefinitionFieldSetItemEntity.setFields(new HashMap<>());
@@ -509,7 +508,7 @@ public class DatasetMigrationService {
}
}
- case INTERNAL_ENTRIES_DMPS -> throw new MyApplicationException("Found INTERNAL_ENTRIES_DMPS into description");
+ case INTERNAL_ENTRIES_PLANS -> throw new MyApplicationException("Found INTERNAL_ENTRIES_DMPS into description");
case INTERNAL_ENTRIES_DESCRIPTIONS -> throw new MyApplicationException("Found INTERNAL_ENTRIES_DMPS into description");
case VALIDATION -> throw new MyApplicationException("Found VALIDATION into description");
case REFERENCE_TYPES -> {
@@ -603,7 +602,7 @@ public class DatasetMigrationService {
if (this.conventionService.isListNullOrEmpty(referenceTypeDefinition.getSources())) throw new MyApplicationException("Could not find reference source for reference : " + this.jsonHandlingService.toJsonSafe(textValue));
//if (referenceTypeDefinition.getSources().size() > 1) throw new MyApplicationException("Multiple reference source for reference : " + this.jsonHandlingService.toJsonSafe(textValue));
String source = referenceTypeDefinition.getSources().getFirst().getKey();
- String[] parts = null;
+ String[] parts;
if (textValue.startsWith("[\"")){
parts = migrationTools.tryParseJsonAsObjectString(String[].class, textValue);
} else{
@@ -623,7 +622,7 @@ public class DatasetMigrationService {
items.add(ref);
}
if (items.isEmpty()) break;
- references = items.toArray(new Map[items.size()]);
+ references = items.toArray(new Map[0]);
}
}
}
@@ -686,7 +685,7 @@ public class DatasetMigrationService {
items.add(ref);
}
if (items.isEmpty()) break;
- references = items.toArray(new Map[items.size()]);
+ references = items.toArray(new Map[0]);
}
}
if (references == null && (ReferenceTypeIds.Datasets.equals(referenceTypeDataEntity.getReferenceTypeId())
@@ -697,7 +696,7 @@ public class DatasetMigrationService {
if (textValue.equals("[\".\"]")){
break;
} else if (!textValue.contains("{")) {
- String[] parts = null;
+ String[] parts;
if (textValue.startsWith("[\"")){
parts = migrationTools.tryParseJsonAsObjectString(String[].class, textValue);
} else{
@@ -719,7 +718,7 @@ public class DatasetMigrationService {
items.add(ref);
}
if (items.isEmpty()) break;
- references = items.toArray(new Map[items.size()]);
+ references = items.toArray(new Map[0]);
}
}
}
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetReferenceMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetReferenceMigrationService.java
index a79208988..2be33ac70 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetReferenceMigrationService.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DatasetReferenceMigrationService.java
@@ -17,7 +17,7 @@ import java.util.UUID;
@Service
public class DatasetReferenceMigrationService {
- private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpDatasetProfileMigrationService.class));
+ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DatasetReferenceMigrationService.class));
private final DatabaseRepository databaseRepository;
private static final int PageSize = 500;
private final EntityManager entityManager;
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DescriptionTemplateXmlMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DescriptionTemplateXmlMigrationService.java
index f2bbb9c62..13f390b6b 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DescriptionTemplateXmlMigrationService.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DescriptionTemplateXmlMigrationService.java
@@ -304,7 +304,7 @@ public class DescriptionTemplateXmlMigrationService {
if (renderStyle.equals("internalDmpEntities")){
switch (((InternalDmpEntitiesData>)persist).getType()){
case "dmps":
- return this.buildLabelAndMultiplicityDataEntity(persist.getLabel(), ((DMPsAutoCompleteData)persist).getMultiAutoComplete(),FieldType.INTERNAL_ENTRIES_DMPS);
+ return this.buildLabelAndMultiplicityDataEntity(persist.getLabel(), ((DMPsAutoCompleteData)persist).getMultiAutoComplete(),FieldType.INTERNAL_ENTRIES_PLANS);
case "datasets":
return this.buildLabelAndMultiplicityDataEntity(persist.getLabel(), ((DatasetsAutoCompleteData)persist).getMultiAutoComplete(),FieldType.INTERNAL_ENTRIES_DESCRIPTIONS);
case "researchers":
@@ -439,7 +439,7 @@ public class DescriptionTemplateXmlMigrationService {
case UPLOAD -> throw new NotSupportedException("Upload validator not supported");
case TAGS -> throw new NotSupportedException("Tags validator not supported");
- case INTERNAL_ENTRIES_DMPS -> throw new NotSupportedException("INTERNAL_ENTRIES_DMPS validator not supported for description template " + descriptionTemplateId);
+ case INTERNAL_ENTRIES_PLANS -> throw new NotSupportedException("INTERNAL_ENTRIES_PLANS validator not supported for description template " + descriptionTemplateId);
case INTERNAL_ENTRIES_DESCRIPTIONS -> throw new NotSupportedException("INTERNAL_ENTRIES_DESCRIPTIONS validator not supported for description template " + descriptionTemplateId);
case REFERENCE_TYPES -> throw new NotSupportedException("REFERENCE_TYPES validator not supported for description template " + descriptionTemplateId);
default -> throw new MyApplicationException("unrecognized type " + fieldType);
@@ -493,7 +493,7 @@ public class DescriptionTemplateXmlMigrationService {
case UPLOAD -> throw new NotSupportedException("Upload validator not supported");
case TAGS -> throw new NotSupportedException("Tags validator not supported");
- case INTERNAL_ENTRIES_DMPS -> throw new NotSupportedException("INTERNAL_ENTRIES_DMPS validator not supported");
+ case INTERNAL_ENTRIES_PLANS -> throw new NotSupportedException("INTERNAL_ENTRIES_PLANS validator not supported");
case INTERNAL_ENTRIES_DESCRIPTIONS -> throw new NotSupportedException("INTERNAL_ENTRIES_DESCRIPTIONS validator not supported");
case REFERENCE_TYPES -> throw new NotSupportedException("REFERENCE_TYPES validator not supported");
default -> throw new MyApplicationException("unrecognized type " + fieldType);
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/FunderMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/FunderMigrationService.java
index 4f538f9b7..5173ab480 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/FunderMigrationService.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/FunderMigrationService.java
@@ -1,10 +1,7 @@
package eu.old.eudat.migration;
import org.opencdmp.commons.enums.IsActive;
-import org.opencdmp.commons.enums.ReferenceFieldDataType;
import org.opencdmp.commons.enums.ReferenceSourceType;
-import org.opencdmp.commons.types.reference.DefinitionEntity;
-import org.opencdmp.commons.types.reference.FieldEntity;
import org.opencdmp.data.ReferenceEntity;
import eu.old.eudat.data.dao.entities.FunderDao;
import eu.old.eudat.data.entities.Funder;
@@ -14,7 +11,6 @@ import jakarta.persistence.EntityManager;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpBlueprintXmlMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanBlueprintXmlMigrationService.java
similarity index 73%
rename from dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpBlueprintXmlMigrationService.java
rename to dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanBlueprintXmlMigrationService.java
index f59b1c224..e157593af 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpBlueprintXmlMigrationService.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanBlueprintXmlMigrationService.java
@@ -1,16 +1,16 @@
package eu.old.eudat.migration;
import org.opencdmp.commons.XmlHandlingService;
-import org.opencdmp.commons.enums.DmpBlueprintExtraFieldDataType;
-import org.opencdmp.commons.enums.DmpBlueprintFieldCategory;
-import org.opencdmp.commons.enums.DmpBlueprintSystemFieldType;
-import org.opencdmp.commons.types.dmpblueprint.*;
+import org.opencdmp.commons.enums.PlanBlueprintExtraFieldDataType;
+import org.opencdmp.commons.enums.PlanBlueprintFieldCategory;
+import org.opencdmp.commons.enums.PlanBlueprintSystemFieldType;
+import org.opencdmp.commons.types.planblueprint.*;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.data.DescriptionTemplateEntity;
-import org.opencdmp.data.DmpBlueprintEntity;
-import org.opencdmp.model.dmpblueprint.DmpBlueprint;
+import org.opencdmp.data.PlanBlueprintEntity;
+import org.opencdmp.model.planblueprint.PlanBlueprint;
import org.opencdmp.query.DescriptionTemplateQuery;
-import org.opencdmp.query.DmpBlueprintQuery;
+import org.opencdmp.query.PlanBlueprintQuery;
import eu.old.eudat.logic.utilities.builders.XmlBuilder;
import eu.old.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.*;
import eu.old.eudat.models.data.entities.xmlmodels.dmpprofiledefinition.types.FieldCategory;
@@ -36,9 +36,9 @@ import java.io.IOException;
import java.util.*;
@Service
-public class DmpBlueprintXmlMigrationService {
+public class PlanBlueprintXmlMigrationService {
- private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpBlueprintXmlMigrationService.class));
+ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanBlueprintXmlMigrationService.class));
private final EntityManager entityManager;
private final ConventionService conventionService;
private final XmlHandlingService xmlHandlingService;
@@ -47,7 +47,7 @@ public class DmpBlueprintXmlMigrationService {
private static final int PageSize = 500;
private static final boolean TestMode = false;
- public DmpBlueprintXmlMigrationService(EntityManager entityManager, ConventionService conventionService, XmlHandlingService xmlHandlingService, QueryFactory queryFactory) {
+ public PlanBlueprintXmlMigrationService(EntityManager entityManager, ConventionService conventionService, XmlHandlingService xmlHandlingService, QueryFactory queryFactory) {
this.entityManager = entityManager;
this.conventionService = conventionService;
this.xmlHandlingService = xmlHandlingService;
@@ -55,31 +55,31 @@ public class DmpBlueprintXmlMigrationService {
}
public void migrate() throws IOException, NoSuchFieldException, IllegalAccessException, JAXBException, ParserConfigurationException, InstantiationException, SAXException, InvalidApplicationException, TransformerException {
- long total = this.queryFactory.query(DmpBlueprintQuery.class).count();
- logger.debug("Migrate DmpBlueprint Total : " + total);
+ long total = this.queryFactory.query(PlanBlueprintQuery.class).count();
+ logger.debug("Migrate PlanBlueprint Total : " + total);
int page = 0;
- List items;
+ List items;
List descriptionTemplateEntities = this.queryFactory.query(DescriptionTemplateQuery.class).collectAs(new BaseFieldSet().ensure(org.opencdmp.model.descriptiontemplate.DescriptionTemplate._id).ensure(org.opencdmp.model.descriptiontemplate.DescriptionTemplate._groupId));
Map descriptionTemplateGroupMap = new HashMap<>();
for (DescriptionTemplateEntity descriptionTemplateEntity: descriptionTemplateEntities) {
descriptionTemplateGroupMap.put(descriptionTemplateEntity.getId(), descriptionTemplateEntity.getGroupId());
}
do {
- DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class);
- query.setOrder(new Ordering().addDescending(DmpBlueprint._createdAt));
+ PlanBlueprintQuery query = this.queryFactory.query(PlanBlueprintQuery.class);
+ query.setOrder(new Ordering().addDescending(PlanBlueprint._createdAt));
query.setPage(new Paging(page * PageSize, PageSize));
items = query.collect();
if (items != null && !items.isEmpty()) {
- logger.debug("Migrate DmpBlueprint " + page * PageSize + " of " + total);
+ logger.debug("Migrate PlanBlueprint " + page * PageSize + " of " + total);
- for (DmpBlueprintEntity item : items) {
+ for (PlanBlueprintEntity item : items) {
if (this.conventionService.isNullOrEmpty(item.getDefinition())) continue;
Document document = XmlBuilder.fromXml(item.getDefinition());
if (document == null){
- logger.error("Migrate DmpBlueprint " + item.getId() + " failed read xml");
+ logger.error("Migrate PlanBlueprint " + item.getId() + " failed read xml");
continue;
}
@@ -94,8 +94,8 @@ public class DmpBlueprintXmlMigrationService {
} while (items != null && !items.isEmpty() && !TestMode);
}
- private @NotNull org.opencdmp.commons.types.dmpblueprint.DefinitionEntity buildDefinitionEntity(DataManagementPlanBlueprint dataManagementPlanBlueprint, Map descriptionTemplateGroupMap ) {
- org.opencdmp.commons.types.dmpblueprint.DefinitionEntity data = new DefinitionEntity();
+ private @NotNull org.opencdmp.commons.types.planblueprint.DefinitionEntity buildDefinitionEntity(DataManagementPlanBlueprint dataManagementPlanBlueprint, Map descriptionTemplateGroupMap ) {
+ org.opencdmp.commons.types.planblueprint.DefinitionEntity data = new DefinitionEntity();
if (dataManagementPlanBlueprint == null)
return data;
if (!this.conventionService.isListNullOrEmpty(dataManagementPlanBlueprint.getSections())) {
@@ -135,13 +135,13 @@ public class DmpBlueprintXmlMigrationService {
return data;
}
- private @NotNull org.opencdmp.commons.types.dmpblueprint.DescriptionTemplateEntity buildDescriptionTemplateEntity(DescriptionTemplate itm, Map descriptionTemplateGroupMap ) {
- org.opencdmp.commons.types.dmpblueprint.DescriptionTemplateEntity data = new org.opencdmp.commons.types.dmpblueprint.DescriptionTemplateEntity();
+ private @NotNull org.opencdmp.commons.types.planblueprint.DescriptionTemplateEntity buildDescriptionTemplateEntity(DescriptionTemplate itm, Map descriptionTemplateGroupMap ) {
+ org.opencdmp.commons.types.planblueprint.DescriptionTemplateEntity data = new org.opencdmp.commons.types.planblueprint.DescriptionTemplateEntity();
if (itm == null)
return data;
UUID groupId = descriptionTemplateGroupMap.getOrDefault(itm.getDescriptionTemplateId(), null);
if (groupId == null){
- logger.error("Migrate DmpBlueprint, DescriptionTemplate " + itm.getDescriptionTemplateId() + " group not found");
+ logger.error("Migrate PlanBlueprint, DescriptionTemplate " + itm.getDescriptionTemplateId() + " group not found");
data.setDescriptionTemplateGroupId(itm.getDescriptionTemplateId());
} else {
data.setDescriptionTemplateGroupId(groupId);
@@ -154,7 +154,7 @@ public class DmpBlueprintXmlMigrationService {
}
- private @NotNull org.opencdmp.commons.types.dmpblueprint.FieldEntity buildFieldEntity(FieldModel itm) {
+ private @NotNull org.opencdmp.commons.types.planblueprint.FieldEntity buildFieldEntity(FieldModel itm) {
if (itm == null)
return new ExtraFieldEntity();
FieldEntity data;
@@ -163,26 +163,26 @@ public class DmpBlueprintXmlMigrationService {
ExtraField extraField = itm.toExtraField();
switch (extraField.getType()){
- case TEXT -> dataTyped.setType(DmpBlueprintExtraFieldDataType.Text);
- case DATE -> dataTyped.setType(DmpBlueprintExtraFieldDataType.Date);
- case NUMBER -> dataTyped.setType(DmpBlueprintExtraFieldDataType.Number);
- case RICH_TEXT -> dataTyped.setType(DmpBlueprintExtraFieldDataType.RichTex);
+ case TEXT -> dataTyped.setType(PlanBlueprintExtraFieldDataType.Text);
+ case DATE -> dataTyped.setType(PlanBlueprintExtraFieldDataType.Date);
+ case NUMBER -> dataTyped.setType(PlanBlueprintExtraFieldDataType.Number);
+ case RICH_TEXT -> dataTyped.setType(PlanBlueprintExtraFieldDataType.RichTex);
default -> throw new MyApplicationException("Type not found " + extraField.getType());
}
dataTyped.setRequired(extraField.getRequired());
data = dataTyped;
- data.setCategory(DmpBlueprintFieldCategory.Extra);
+ data.setCategory(PlanBlueprintFieldCategory.Extra);
} else {
SystemFieldEntity dataTyped = new SystemFieldEntity();
ReferenceTypeFieldEntity referenceTypeFieldEntity = new ReferenceTypeFieldEntity();
SystemField systemField = itm.toSystemField();
switch (systemField.getType()){
- case TEXT -> dataTyped.setType(DmpBlueprintSystemFieldType.Title);
- case HTML_TEXT -> dataTyped.setType(DmpBlueprintSystemFieldType.Description);
- case ACCESS_RIGHTS -> dataTyped.setType(DmpBlueprintSystemFieldType.AccessRights);
- case CONTACT -> dataTyped.setType(DmpBlueprintSystemFieldType.Contact);
- case LANGUAGE -> dataTyped.setType(DmpBlueprintSystemFieldType.Language);
+ case TEXT -> dataTyped.setType(PlanBlueprintSystemFieldType.Title);
+ case HTML_TEXT -> dataTyped.setType(PlanBlueprintSystemFieldType.Description);
+ case ACCESS_RIGHTS -> dataTyped.setType(PlanBlueprintSystemFieldType.AccessRights);
+ case CONTACT -> dataTyped.setType(PlanBlueprintSystemFieldType.Contact);
+ case LANGUAGE -> dataTyped.setType(PlanBlueprintSystemFieldType.Language);
case FUNDER -> {
referenceTypeFieldEntity.setReferenceTypeId(ReferenceTypeIds.Funder);
referenceTypeFieldEntity.setMultipleSelect(false);
@@ -219,11 +219,11 @@ public class DmpBlueprintXmlMigrationService {
if (referenceTypeFieldEntity.getReferenceTypeId() == null){
data = dataTyped;
- data.setCategory(DmpBlueprintFieldCategory.System);
+ data.setCategory(PlanBlueprintFieldCategory.System);
}
else{
data = referenceTypeFieldEntity;
- data.setCategory(DmpBlueprintFieldCategory.ReferenceType);
+ data.setCategory(PlanBlueprintFieldCategory.ReferenceType);
}
}
data.setId(itm.getId());
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpDatasetProfileMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanDatasetProfileMigrationService.java
similarity index 66%
rename from dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpDatasetProfileMigrationService.java
rename to dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanDatasetProfileMigrationService.java
index 9dfaa0320..c69fa7c68 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpDatasetProfileMigrationService.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanDatasetProfileMigrationService.java
@@ -5,10 +5,10 @@ import eu.old.eudat.data.entities.DMP;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.XmlHandlingService;
import org.opencdmp.commons.enums.IsActive;
-import org.opencdmp.data.DmpBlueprintEntity;
-import org.opencdmp.data.DmpDescriptionTemplateEntity;
-import org.opencdmp.query.DmpBlueprintQuery;
-import org.opencdmp.query.DmpDescriptionTemplateQuery;
+import org.opencdmp.data.PlanBlueprintEntity;
+import org.opencdmp.data.PlanDescriptionTemplateEntity;
+import org.opencdmp.query.PlanBlueprintQuery;
+import org.opencdmp.query.PlanDescriptionTemplateQuery;
import eu.old.eudat.data.dao.entities.DmpDatasetProfileDao;
import eu.old.eudat.data.entities.DMPDatasetProfile;
import eu.old.eudat.logic.services.operations.DatabaseRepository;
@@ -25,18 +25,17 @@ import jakarta.xml.bind.JAXBException;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.xml.sax.SAXException;
-import org.opencdmp.commons.types.dmpblueprint.DefinitionEntity;
+import org.opencdmp.commons.types.planblueprint.DefinitionEntity;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
-import java.security.SecureRandom;
import java.time.Instant;
import java.util.*;
@Service
-public class DmpDatasetProfileMigrationService {
+public class PlanDatasetProfileMigrationService {
- private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpDatasetProfileMigrationService.class));
+ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanDatasetProfileMigrationService.class));
private final DatabaseRepository databaseRepository;
private final JsonHandlingService jsonHandlingService;
@@ -46,7 +45,7 @@ public class DmpDatasetProfileMigrationService {
private static final boolean TestMode = false;
private final EntityManager entityManager;
- public DmpDatasetProfileMigrationService(DatabaseRepository databaseRepository, JsonHandlingService jsonHandlingService, QueryFactory queryFactory, XmlHandlingService xmlHandlingService, EntityManager entityManager) {
+ public PlanDatasetProfileMigrationService(DatabaseRepository databaseRepository, JsonHandlingService jsonHandlingService, QueryFactory queryFactory, XmlHandlingService xmlHandlingService, EntityManager entityManager) {
this.databaseRepository = databaseRepository;
this.jsonHandlingService = jsonHandlingService;
this.queryFactory = queryFactory;
@@ -57,18 +56,18 @@ public class DmpDatasetProfileMigrationService {
public void migrate() throws IOException, JAXBException, ParserConfigurationException, InstantiationException, IllegalAccessException, SAXException {
DmpDatasetProfileDao dmpDatasetProfileDao = databaseRepository.getDmpDatasetProfileDao();
long total = dmpDatasetProfileDao.asQueryable().count();
- logger.debug("Migrate DmpDatasetProfile Total : " + total);
+ logger.debug("Migrate PlanDatasetProfile Total : " + total);
int page = 0;
List items;
do {
items = dmpDatasetProfileDao.asQueryable().orderBy((builder, root) -> builder.asc(root.get("ID"))).skip(page * PageSize).take(PageSize).toList();
if (items != null && !items.isEmpty()) {
- logger.debug("Migrate DmpDatasetProfile " + page * PageSize + " of " + total);
+ logger.debug("Migrate PlanDatasetProfile " + page * PageSize + " of " + total);
- List dmpBlueprints = this.queryFactory.query(DmpBlueprintQuery.class).ids(items.stream().map(x-> x.getDmp().getProfile().getId()).distinct().toList()).collect();
+ List dmpBlueprints = this.queryFactory.query(PlanBlueprintQuery.class).ids(items.stream().map(x-> x.getDmp().getProfile().getId()).distinct().toList()).collect();
Map dmpBlueprintsMap = new HashMap<>();
- for (DmpBlueprintEntity dmpBlueprint : dmpBlueprints) {
+ for (PlanBlueprintEntity dmpBlueprint : dmpBlueprints) {
DefinitionEntity definitionEntity = this.xmlHandlingService.fromXml(DefinitionEntity.class, dmpBlueprint.getDefinition());
dmpBlueprintsMap.put(dmpBlueprint.getId(), definitionEntity);
}
@@ -76,35 +75,35 @@ public class DmpDatasetProfileMigrationService {
for (DMPDatasetProfile item : items) {
entityManager.detach(item);
- DmpDatasetProfileData profileData = jsonHandlingService.fromJson(DmpDatasetProfileData.class, item.getData());
+ PlanDatasetProfileData profileData = jsonHandlingService.fromJson(PlanDatasetProfileData.class, item.getData());
if (profileData == null || profileData.dmpSectionIndex == null || profileData.dmpSectionIndex.isEmpty()){
if (profileData != null && item.getDmp() != null && item.getDmp().getProfile() != null && item.getDmp().getProfile().getId() != null && item.getDmp().getProfile().getId().equals(UUID.fromString("86635178-36a6-484f-9057-a934e4eeecd5"))){
profileData.dmpSectionIndex = new ArrayList<>();
profileData.dmpSectionIndex.add(3);
- logger.warn("Migrate DmpDatasetProfile " + item.getId() + " failed no section info set to 3");
+ logger.warn("Migrate PlanDatasetProfile " + item.getId() + " failed no section info set to 3");
} else {
- throw new MyApplicationException("Migrate DmpDatasetProfile " + item.getId() + " failed no section info ");
+ throw new MyApplicationException("Migrate PlanDatasetProfile " + item.getId() + " failed no section info ");
}
}
DefinitionEntity definition = dmpBlueprintsMap.getOrDefault(item.getDmp().getProfile().getId(), null);
if (definition == null){
- throw new MyApplicationException("Migrate DmpDatasetProfile " + item.getId() + " failed blueprint definition not found for blueprint " + item.getDmp().getProfile().getId());
+ throw new MyApplicationException("Migrate PlanDatasetProfile " + item.getId() + " failed blueprint definition not found for blueprint " + item.getDmp().getProfile().getId());
}
for (int sectionIndex: profileData.dmpSectionIndex) {
if (definition.getSections() == null || definition.getSections().size() <= sectionIndex) {
- throw new MyApplicationException("Migrate DmpDatasetProfile " + item.getId() + " cannot found section id for section " + sectionIndex);
+ throw new MyApplicationException("Migrate PlanDatasetProfile " + item.getId() + " cannot found section id for section " + sectionIndex);
}
UUID sectionId = definition.getSections().get(sectionIndex).getId();
if (sectionId == null) {
- throw new MyApplicationException("Migrate DmpDatasetProfile " + item.getId() + " cannot found section id for section " + sectionIndex);
+ throw new MyApplicationException("Migrate PlanDatasetProfile " + item.getId() + " cannot found section id for section " + sectionIndex);
}
- DmpDescriptionTemplateEntity data = new DmpDescriptionTemplateEntity();
+ PlanDescriptionTemplateEntity data = new PlanDescriptionTemplateEntity();
data.setId(UUID.randomUUID());
data.setDescriptionTemplateGroupId(item.getDatasetprofile().getGroupId());
- data.setDmpId(getDmp(item).getId());
+ data.setPlanId(getPlan(item).getId());
data.setCreatedAt(item.getDmp().getCreated() != null ? item.getDmp().getCreated().toInstant() : Instant.now());
data.setUpdatedAt(item.getDmp().getModified() != null ? item.getDmp().getModified().toInstant() : Instant.now());
data.setSectionId(sectionId);
@@ -121,37 +120,37 @@ public class DmpDatasetProfileMigrationService {
removeDuplicates();
}
- private DMP getDmp(DMPDatasetProfile item) {
+ private DMP getPlan(DMPDatasetProfile item) {
return item.getDmp();
}
private void removeDuplicates() {
- logger.debug("Checking for duplicates on DmpDescriptionTemplate table after migration");
+ logger.debug("Checking for duplicates on PlanDescriptionTemplate table after migration");
- DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class);
+ PlanDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(PlanDescriptionTemplateQuery.class);
long total = dmpDescriptionTemplateQuery.count();
logger.debug("Record count to check: {}", total);
CriteriaBuilder b = this.entityManager.getCriteriaBuilder();
CriteriaQuery criteria = b.createQuery(Tuple.class);
- Root root = criteria.from(DmpDescriptionTemplateEntity.class);
- criteria.groupBy(Arrays.asList(root.get(DmpDescriptionTemplateEntity._dmpId), root.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId), root.get(DmpDescriptionTemplateEntity._sectionId)));
- criteria.multiselect(root.get(DmpDescriptionTemplateEntity._dmpId), root.get(DmpDescriptionTemplateEntity._descriptionTemplateGroupId), root.get(DmpDescriptionTemplateEntity._sectionId), b.count(root));
+ Root root = criteria.from(PlanDescriptionTemplateEntity.class);
+ criteria.groupBy(Arrays.asList(root.get(PlanDescriptionTemplateEntity._planId), root.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId), root.get(PlanDescriptionTemplateEntity._sectionId)));
+ criteria.multiselect(root.get(PlanDescriptionTemplateEntity._planId), root.get(PlanDescriptionTemplateEntity._descriptionTemplateGroupId), root.get(PlanDescriptionTemplateEntity._sectionId), b.count(root));
List resultList = this.entityManager.createQuery(criteria).getResultList();
List duplicatesList = resultList.stream().filter(x -> (long) x.get(3) > 1).toList();
- CriteriaDelete delete = b.createCriteriaDelete(DmpDescriptionTemplateEntity.class);
- Root root1 = delete.from(DmpDescriptionTemplateEntity.class);
+ CriteriaDelete delete = b.createCriteriaDelete(PlanDescriptionTemplateEntity.class);
+ Root root1 = delete.from(PlanDescriptionTemplateEntity.class);
for (Tuple duplicate : duplicatesList) {
- List duplicateEntities = dmpDescriptionTemplateQuery
- .dmpIds((UUID) duplicate.get(0))
+ List duplicateEntities = dmpDescriptionTemplateQuery
+ .planIds((UUID) duplicate.get(0))
.descriptionTemplateGroupIds((UUID) duplicate.get(1))
.sectionIds((UUID) duplicate.get(2))
.collect();
- List toDelete = new ArrayList<>(duplicateEntities.stream().map(DmpDescriptionTemplateEntity::getId).toList());
- toDelete.remove(0);
- delete.where(root1.get(DmpDescriptionTemplateEntity._id).in(toDelete));
+ List toDelete = new ArrayList<>(duplicateEntities.stream().map(PlanDescriptionTemplateEntity::getId).toList());
+ toDelete.removeFirst();
+ delete.where(root1.get(PlanDescriptionTemplateEntity._id).in(toDelete));
this.entityManager.createQuery(delete).executeUpdate();
}
@@ -159,7 +158,7 @@ public class DmpDatasetProfileMigrationService {
}
@JsonIgnoreProperties({"validationErrorModel"})
- public static class DmpDatasetProfileData {
+ public static class PlanDatasetProfileData {
private List dmpSectionIndex;
@@ -170,7 +169,6 @@ public class DmpDatasetProfileMigrationService {
public void setDmpSectionIndex(List dmpSectionIndex) {
this.dmpSectionIndex = dmpSectionIndex;
}
-
}
}
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanMigrationService.java
similarity index 76%
rename from dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpMigrationService.java
rename to dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanMigrationService.java
index ad35b0b4d..b328dfb20 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpMigrationService.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanMigrationService.java
@@ -2,25 +2,22 @@ package eu.old.eudat.migration;
import com.fasterxml.jackson.core.JsonProcessingException;
import eu.old.eudat.data.dao.entities.UserInfoDao;
-import org.opencdmp.commonmodels.models.dmp.DmpModel;
-import org.opencdmp.commonmodels.models.dmpblueprint.SectionModel;
import org.opencdmp.commons.JsonHandlingService;
import org.opencdmp.commons.XmlHandlingService;
import org.opencdmp.commons.enums.*;
-import org.opencdmp.commons.types.dmp.DmpBlueprintValueEntity;
-import org.opencdmp.commons.types.dmp.DmpContactEntity;
-import org.opencdmp.commons.types.dmp.DmpPropertiesEntity;
-import org.opencdmp.commons.types.dmpblueprint.ExtraFieldEntity;
-import org.opencdmp.commons.types.dmpblueprint.ReferenceTypeFieldEntity;
-import org.opencdmp.commons.types.dmpblueprint.SectionEntity;
-import org.opencdmp.commons.types.dmpreference.DmpReferenceDataEntity;
+import org.opencdmp.commons.types.plan.PlanBlueprintValueEntity;
+import org.opencdmp.commons.types.plan.PlanContactEntity;
+import org.opencdmp.commons.types.plan.PlanPropertiesEntity;
+import org.opencdmp.commons.types.planblueprint.ExtraFieldEntity;
+import org.opencdmp.commons.types.planblueprint.ReferenceTypeFieldEntity;
+import org.opencdmp.commons.types.planblueprint.SectionEntity;
+import org.opencdmp.commons.types.planreference.PlanReferenceDataEntity;
import org.opencdmp.commons.types.reference.DefinitionEntity;
import org.opencdmp.commons.types.reference.FieldEntity;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.data.*;
-import org.opencdmp.model.dmp.DmpBlueprintValue;
-import org.opencdmp.model.dmpblueprint.DmpBlueprint;
-import org.opencdmp.query.DmpBlueprintQuery;
+import org.opencdmp.model.planblueprint.PlanBlueprint;
+import org.opencdmp.query.PlanBlueprintQuery;
import eu.old.eudat.data.dao.entities.DMPDao;
import eu.old.eudat.data.entities.*;
import eu.old.eudat.logic.services.operations.DatabaseRepository;
@@ -46,9 +43,9 @@ import java.util.*;
import java.util.stream.Collectors;
@Service
-public class DmpMigrationService {
+public class PlanMigrationService {
- private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpMigrationService.class));
+ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanMigrationService.class));
private final DatabaseRepository databaseRepository;
private final JsonHandlingService jsonHandlingService;
private final EntityManager entityManager;
@@ -60,7 +57,7 @@ public class DmpMigrationService {
private static final int PageSize = 500;
private static final boolean TestMode = false;
- public DmpMigrationService(DatabaseRepository databaseRepository, JsonHandlingService jsonHandlingService, EntityManager entityManager, ConventionService conventionService, XmlHandlingService xmlHandlingService, Environment environment, QueryFactory queryFactory) {
+ public PlanMigrationService(DatabaseRepository databaseRepository, JsonHandlingService jsonHandlingService, EntityManager entityManager, ConventionService conventionService, XmlHandlingService xmlHandlingService, Environment environment, QueryFactory queryFactory) {
this.databaseRepository = databaseRepository;
this.jsonHandlingService = jsonHandlingService;
this.entityManager = entityManager;
@@ -74,7 +71,7 @@ public class DmpMigrationService {
UserInfoDao userInfoDao = databaseRepository.getUserInfoDao();
DMPDao dmpDao = databaseRepository.getDmpDao();
long total = dmpDao.asQueryable().count();
- logger.debug("Migrate Dmp Total : " + total);
+ logger.debug("Migrate Plan Total : " + total);
int page = 0;
Map licenseIdByName = new HashMap<>();
@@ -82,54 +79,54 @@ public class DmpMigrationService {
do {
items = dmpDao.asQueryable().orderBy((builder, root) -> builder.asc(root.get("created"))).orderBy((builder, root) -> builder.asc(root.get("ID"))).skip(page * PageSize).take(PageSize).toList();
List finalItems = items;
- List groupDmps = dmpDao.asQueryable().where((builder, root) -> root.get("groupId").in(finalItems.stream().map(DMP::getGroupId).distinct().collect(Collectors.toList()))).toList();
- Map> groupDmpMap = new HashMap<>();
- for (DMP dmp: groupDmps) {
- if (!groupDmpMap.containsKey(dmp.getGroupId())) groupDmpMap.put(dmp.getGroupId(), new ArrayList<>());
- groupDmpMap.get(dmp.getGroupId()).add(dmp);
+ List groupPlans = dmpDao.asQueryable().where((builder, root) -> root.get("groupId").in(finalItems.stream().map(DMP::getGroupId).distinct().collect(Collectors.toList()))).toList();
+ Map> groupPlanMap = new HashMap<>();
+ for (DMP dmp: groupPlans) {
+ if (!groupPlanMap.containsKey(dmp.getGroupId())) groupPlanMap.put(dmp.getGroupId(), new ArrayList<>());
+ groupPlanMap.get(dmp.getGroupId()).add(dmp);
}
Map oldUsers = userInfoDao.asQueryable().toList().stream().collect(Collectors.toMap(UserInfo::getId, x-> x));
if (items != null && !items.isEmpty()) {
- logger.debug("Migrate Dmp " + page * PageSize + " of " + total);
- List dmpBlueprintEntities = this.queryFactory.query(DmpBlueprintQuery.class).ids(items.stream().filter(x-> x.getProfile() != null).map(x-> x.getProfile().getId()).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(DmpBlueprint._definition).ensure(DmpBlueprint._id));
- Map blueprintDefinitionMap = new HashMap<>();
- Map> referenceTypeFieldsByDmpBlueprintId = new HashMap<>();
- for (DmpBlueprintEntity dmpBlueprintEntity : dmpBlueprintEntities) {
- org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXml(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition());
+ logger.debug("Migrate Plan " + page * PageSize + " of " + total);
+ List dmpBlueprintEntities = this.queryFactory.query(PlanBlueprintQuery.class).ids(items.stream().filter(x-> x.getProfile() != null).map(x-> x.getProfile().getId()).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(PlanBlueprint._definition).ensure(PlanBlueprint._id));
+ Map blueprintDefinitionMap = new HashMap<>();
+ Map> referenceTypeFieldsByPlanBlueprintId = new HashMap<>();
+ for (PlanBlueprintEntity dmpBlueprintEntity : dmpBlueprintEntities) {
+ org.opencdmp.commons.types.planblueprint.DefinitionEntity definition = this.xmlHandlingService.fromXml(org.opencdmp.commons.types.planblueprint.DefinitionEntity.class, dmpBlueprintEntity.getDefinition());
blueprintDefinitionMap.put(dmpBlueprintEntity.getId(), definition);
- List referenceTypeFieldEntities = definition.getSections().stream().filter(x-> x.getFields() != null).map(SectionEntity::getFields).flatMap(List::stream).filter(x-> x.getCategory().equals(DmpBlueprintFieldCategory.ReferenceType)).map(x-> (ReferenceTypeFieldEntity)x)
+ List referenceTypeFieldEntities = definition.getSections().stream().filter(x-> x.getFields() != null).map(SectionEntity::getFields).flatMap(List::stream).filter(x-> x.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType)).map(x-> (ReferenceTypeFieldEntity)x)
.filter(x-> x.getReferenceTypeId().equals(ReferenceTypeIds.License) || x.getReferenceTypeId().equals(ReferenceTypeIds.Project) || x.getReferenceTypeId().equals(ReferenceTypeIds.Researcher)
|| x.getReferenceTypeId().equals(ReferenceTypeIds.Grants) || x.getReferenceTypeId().equals(ReferenceTypeIds.Organizations) || x.getReferenceTypeId().equals(ReferenceTypeIds.Funder))
.collect(Collectors.toList());
- referenceTypeFieldsByDmpBlueprintId.put(dmpBlueprintEntity.getId() , referenceTypeFieldEntities);
+ referenceTypeFieldsByPlanBlueprintId.put(dmpBlueprintEntity.getId() , referenceTypeFieldEntities);
}
for (DMP item : items) {
//entityManager.detach(item);
- org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definitionEntity = blueprintDefinitionMap.get(item.getProfile().getId());
+ org.opencdmp.commons.types.planblueprint.DefinitionEntity definitionEntity = blueprintDefinitionMap.get(item.getProfile().getId());
DataManagementPlan model = new DataManagementPlan();
model.fromDataModel(item);
- List itemGroupDmps = groupDmpMap.get(item.getGroupId());
- DMP currentVersionDmp = itemGroupDmps.stream().filter(x-> DmpStatus.Finalized.getValue().equals(x.getStatus())).max(Comparator.comparing(DMP::getVersion)).orElse(null);
+ List itemGroupPlans = groupPlanMap.get(item.getGroupId());
+ DMP currentVersionPlan = itemGroupPlans.stream().filter(x-> PlanStatus.Finalized.getValue().equals(x.getStatus())).max(Comparator.comparing(DMP::getVersion)).orElse(null);
- DmpPropertiesEntity dmpProperties = new DmpPropertiesEntity();
- dmpProperties.setDmpBlueprintValues(new ArrayList<>());
+ PlanPropertiesEntity dmpProperties = new PlanPropertiesEntity();
+ dmpProperties.setPlanBlueprintValues(new ArrayList<>());
dmpProperties.setContacts(new ArrayList<>());
- DmpEntity data = new DmpEntity();
+ PlanEntity data = new PlanEntity();
data.setId(model.getId());
data.setLabel(model.getLabel());
data.setDescription(model.getDescription());
if (model.getCreator() != null && model.getCreator().getId() != null) {
data.setCreatorId(model.getCreator().getId());
} else {
- for (DMP groupDmp: itemGroupDmps) {
- DataManagementPlan groupDmpModel = new DataManagementPlan();
- groupDmpModel.fromDataModel(groupDmp);
- if (groupDmpModel.getCreator() != null) {
- data.setCreatorId(groupDmpModel.getCreator().getId());
+ for (DMP groupPlan: itemGroupPlans) {
+ DataManagementPlan groupPlanModel = new DataManagementPlan();
+ groupPlanModel.fromDataModel(groupPlan);
+ if (groupPlanModel.getCreator() != null) {
+ data.setCreatorId(groupPlanModel.getCreator().getId());
break;
}
}
@@ -139,14 +136,14 @@ public class DmpMigrationService {
}
data.setGroupId(model.getGroupId());
data.setVersion((short) model.getVersion());
- if (currentVersionDmp != null && currentVersionDmp.getId().equals(item.getId())){
- data.setVersionStatus(DmpVersionStatus.Current);
+ if (currentVersionPlan != null && currentVersionPlan.getId().equals(item.getId())){
+ data.setVersionStatus(PlanVersionStatus.Current);
} else {
- if (DmpStatus.Finalized.getValue().equals(item.getStatus())){
- if (currentVersionDmp == null) throw new MyApplicationException("Found Finalized Dmp out of the group ");
- data.setVersionStatus(DmpVersionStatus.Previous);
+ if (PlanStatus.Finalized.getValue().equals(item.getStatus())){
+ if (currentVersionPlan == null) throw new MyApplicationException("Found Finalized Plan out of the group ");
+ data.setVersionStatus(PlanVersionStatus.Previous);
} else {
- data.setVersionStatus(DmpVersionStatus.NotFinalized);
+ data.setVersionStatus(PlanVersionStatus.NotFinalized);
}
}
if (model.getCreated() != null)
@@ -160,16 +157,16 @@ public class DmpMigrationService {
if (model.getExtraProperties().containsKey("language") && model.getExtraProperties().get("language") != null)
data.setLanguage((String) model.getExtraProperties().get("language"));
if (model.getExtraProperties().containsKey("visible") && model.getExtraProperties().get("visible") != null)
- data.setAccessType((boolean) model.getExtraProperties().get("visible") ? DmpAccessType.Public : DmpAccessType.Restricted);
+ data.setAccessType((boolean) model.getExtraProperties().get("visible") ? PlanAccessType.Public : PlanAccessType.Restricted);
if (model.getExtraProperties().containsKey("contact") && model.getExtraProperties().get("contact") != null) {
UserInfo userInfo = oldUsers.getOrDefault(UUID.fromString((String)model.getExtraProperties().get("contact")), null);
if (userInfo != null) {
- DmpContactEntity contactEntity = new DmpContactEntity();
+ PlanContactEntity contactEntity = new PlanContactEntity();
contactEntity.setEmail(userInfo.getEmail());
contactEntity.setFirstName(userInfo.getName());
dmpProperties.getContacts().add(contactEntity);
} else {
- throw new MyApplicationException("Contact not found " + UUID.fromString((String)model.getExtraProperties().get("contact")) + " Dmp " + item.getId());
+ throw new MyApplicationException("Contact not found " + UUID.fromString((String)model.getExtraProperties().get("contact")) + " Plan " + item.getId());
}
}
@@ -183,10 +180,10 @@ public class DmpMigrationService {
}
if (model.getProperties() != null) {
model.getProperties().forEach((key,val) -> {
- DmpBlueprintValueEntity valueEntity = new DmpBlueprintValueEntity();
+ PlanBlueprintValueEntity valueEntity = new PlanBlueprintValueEntity();
valueEntity.setFieldId(UUID.fromString(key));
- org.opencdmp.commons.types.dmpblueprint.FieldEntity fieldEntity = this.getFieldOfId(definitionEntity, valueEntity.getFieldId());
- if (fieldEntity != null && val != null && fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.Extra)){
+ org.opencdmp.commons.types.planblueprint.FieldEntity fieldEntity = this.getFieldOfId(definitionEntity, valueEntity.getFieldId());
+ if (fieldEntity != null && val != null && fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.Extra)){
ExtraFieldEntity extraFieldEntity = (ExtraFieldEntity) fieldEntity;
switch (extraFieldEntity.getType()){
case Date -> {
@@ -204,23 +201,23 @@ public class DmpMigrationService {
} else {
valueEntity.setValue((String) val);
}
- dmpProperties.getDmpBlueprintValues().add(valueEntity);
+ dmpProperties.getPlanBlueprintValues().add(valueEntity);
});
}
if (model.getStatus() == 99) {
data.setIsActive(IsActive.Inactive);
- data.setStatus(DmpStatus.Draft);
+ data.setStatus(PlanStatus.Draft);
} else {
data.setIsActive(IsActive.Active);
- data.setStatus(DmpStatus.of((short) model.getStatus()));
+ data.setStatus(PlanStatus.of((short) model.getStatus()));
}
data.setProperties(jsonHandlingService.toJson(dmpProperties));
- if (data.getAccessType() == null && item.getStatus().equals(DmpStatus.Finalized.getValue())) {
+ if (data.getAccessType() == null && item.getStatus().equals(PlanStatus.Finalized.getValue())) {
logger.warn("AccessType not found set to default for dmp " + item.getId());
- data.setAccessType(item.isPublic() ? DmpAccessType.Public : DmpAccessType.Restricted);
+ data.setAccessType(item.isPublic() ? PlanAccessType.Public : PlanAccessType.Restricted);
}
- if ((data.getLanguage() == null || data.getLanguage().isBlank()) && item.getStatus().equals(DmpStatus.Finalized.getValue())) {
+ if ((data.getLanguage() == null || data.getLanguage().isBlank()) && item.getStatus().equals(PlanStatus.Finalized.getValue())) {
logger.warn("Language not found set to default for dmp " + item.getId());
data.setLanguage("en");
}
@@ -231,13 +228,13 @@ public class DmpMigrationService {
this.entityManager.persist(data);
this.entityManager.flush();
- boolean shouldCreateOwner = item.getUsers() == null || item.getUsers().stream().noneMatch(x-> x.getUser() != null && data.getCreatorId().equals(x.getUser().getId()) && DmpUserRole.Owner.getValue().equals(x.getRole().shortValue()));
+ boolean shouldCreateOwner = item.getUsers() == null || item.getUsers().stream().noneMatch(x-> x.getUser() != null && data.getCreatorId().equals(x.getUser().getId()) && PlanUserRole.Owner.getValue().equals(x.getRole().shortValue()));
if (shouldCreateOwner) {
- DmpUserEntity dmpUserEntity = new DmpUserEntity();
+ PlanUserEntity dmpUserEntity = new PlanUserEntity();
dmpUserEntity.setId(UUID.randomUUID());
- dmpUserEntity.setDmpId(data.getId());
+ dmpUserEntity.setPlanId(data.getId());
dmpUserEntity.setUserId(data.getCreatorId());
- dmpUserEntity.setRole(DmpUserRole.Owner);
+ dmpUserEntity.setRole(PlanUserRole.Owner);
dmpUserEntity.setCreatedAt(data.getCreatedAt());
dmpUserEntity.setUpdatedAt(data.getCreatedAt());
dmpUserEntity.setIsActive(IsActive.Active);
@@ -245,11 +242,11 @@ public class DmpMigrationService {
this.entityManager.flush();
}
- licenseIdByName = this.migrateLicense(item, model, licenseIdByName, referenceTypeFieldsByDmpBlueprintId.getOrDefault(data.getBlueprintId(), null));
- this.migrateOrganizations(item, referenceTypeFieldsByDmpBlueprintId.getOrDefault(data.getBlueprintId(), null));
- this.migrateResearchers(item, referenceTypeFieldsByDmpBlueprintId.getOrDefault(data.getBlueprintId(), null));
- this.migrateProjects(item, referenceTypeFieldsByDmpBlueprintId.getOrDefault(data.getBlueprintId(), null));
- this.migrateGrantAndFunder(item, referenceTypeFieldsByDmpBlueprintId.getOrDefault(data.getBlueprintId(), null));
+ licenseIdByName = this.migrateLicense(item, model, licenseIdByName, referenceTypeFieldsByPlanBlueprintId.getOrDefault(data.getBlueprintId(), null));
+ this.migrateOrganizations(item, referenceTypeFieldsByPlanBlueprintId.getOrDefault(data.getBlueprintId(), null));
+ this.migrateResearchers(item, referenceTypeFieldsByPlanBlueprintId.getOrDefault(data.getBlueprintId(), null));
+ this.migrateProjects(item, referenceTypeFieldsByPlanBlueprintId.getOrDefault(data.getBlueprintId(), null));
+ this.migrateGrantAndFunder(item, referenceTypeFieldsByPlanBlueprintId.getOrDefault(data.getBlueprintId(), null));
}
page++;
@@ -257,11 +254,11 @@ public class DmpMigrationService {
} while (items != null && !items.isEmpty() && !TestMode);
}
- private org.opencdmp.commons.types.dmpblueprint.FieldEntity getFieldOfId(org.opencdmp.commons.types.dmpblueprint.DefinitionEntity definition, UUID fieldId){
+ private org.opencdmp.commons.types.planblueprint.FieldEntity getFieldOfId(org.opencdmp.commons.types.planblueprint.DefinitionEntity definition, UUID fieldId){
if (definition == null || definition.getSections() == null) return null;
for (SectionEntity sectionModel : definition.getSections()){
if (sectionModel.getFields() != null){
- org.opencdmp.commons.types.dmpblueprint.FieldEntity fieldModel = sectionModel.getFields().stream().filter(x-> x.getId().equals(fieldId)).findFirst().orElse(null);
+ org.opencdmp.commons.types.planblueprint.FieldEntity fieldModel = sectionModel.getFields().stream().filter(x-> x.getId().equals(fieldId)).findFirst().orElse(null);
if (fieldModel != null) return fieldModel;
}
}
@@ -281,13 +278,13 @@ public class DmpMigrationService {
}
for (Organisation organisation : organisations) {
- DmpReferenceEntity data = new DmpReferenceEntity();
+ PlanReferenceEntity data = new PlanReferenceEntity();
data.setId(UUID.randomUUID());
- data.setDmpId(item.getId());
+ data.setPlanId(item.getId());
data.setReferenceId(organisation.getId());
data.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
data.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
- data.setData(this.jsonHandlingService.toJsonSafe(this.buildDmpReferenceDataEntity(referenceTypeFieldEntity)));
+ data.setData(this.jsonHandlingService.toJsonSafe(this.buildPlanReferenceDataEntity(referenceTypeFieldEntity)));
data.setIsActive(IsActive.Active);
this.entityManager.persist(data);
}
@@ -304,14 +301,14 @@ public class DmpMigrationService {
throw new MyApplicationException("Migration failed Project field not found " + item.getId());
}
- DmpReferenceEntity data = new DmpReferenceEntity();
+ PlanReferenceEntity data = new PlanReferenceEntity();
data.setId(UUID.randomUUID());
- data.setDmpId(item.getId());
+ data.setPlanId(item.getId());
data.setReferenceId(project.getId());
data.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
data.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
data.setIsActive(IsActive.Active);
- data.setData(this.jsonHandlingService.toJsonSafe(this.buildDmpReferenceDataEntity(referenceTypeFieldEntity)));
+ data.setData(this.jsonHandlingService.toJsonSafe(this.buildPlanReferenceDataEntity(referenceTypeFieldEntity)));
this.entityManager.persist(data);
}
@@ -327,13 +324,13 @@ public class DmpMigrationService {
}
for (Researcher researcher : researchers) {
- DmpReferenceEntity data = new DmpReferenceEntity();
+ PlanReferenceEntity data = new PlanReferenceEntity();
data.setId(UUID.randomUUID());
- data.setDmpId(item.getId());
+ data.setPlanId(item.getId());
data.setReferenceId(researcher.getId());
data.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
data.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
- data.setData(this.jsonHandlingService.toJsonSafe(this.buildDmpReferenceDataEntity(referenceTypeFieldEntity)));
+ data.setData(this.jsonHandlingService.toJsonSafe(this.buildPlanReferenceDataEntity(referenceTypeFieldEntity)));
data.setIsActive(IsActive.Active);
this.entityManager.persist(data);
}
@@ -351,13 +348,13 @@ public class DmpMigrationService {
throw new MyApplicationException("Migration failed Grant field not found " + item.getId());
}
- DmpReferenceEntity data = new DmpReferenceEntity();
+ PlanReferenceEntity data = new PlanReferenceEntity();
data.setId(UUID.randomUUID());
- data.setDmpId(item.getId());
+ data.setPlanId(item.getId());
data.setReferenceId(grant.getId());
data.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
data.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
- data.setData(this.jsonHandlingService.toJsonSafe(this.buildDmpReferenceDataEntity(referenceTypeFieldEntity)));
+ data.setData(this.jsonHandlingService.toJsonSafe(this.buildPlanReferenceDataEntity(referenceTypeFieldEntity)));
data.setIsActive(IsActive.Active);
this.entityManager.persist(data);
if (grant.getFunder() != null){
@@ -365,13 +362,13 @@ public class DmpMigrationService {
if (funderField == null) {
throw new MyApplicationException("Migration failed Funder field not found " + item.getId());
}
- DmpReferenceEntity founder = new DmpReferenceEntity();
+ PlanReferenceEntity founder = new PlanReferenceEntity();
founder.setId(UUID.randomUUID());
- founder.setDmpId(item.getId());
+ founder.setPlanId(item.getId());
founder.setReferenceId(grant.getFunder().getId());
founder.setCreatedAt(item.getCreated() != null ? item.getCreated().toInstant() : Instant.now());
founder.setUpdatedAt(item.getModified() != null ? item.getModified().toInstant() : Instant.now());
- founder.setData(this.jsonHandlingService.toJsonSafe(this.buildDmpReferenceDataEntity(funderField)));
+ founder.setData(this.jsonHandlingService.toJsonSafe(this.buildPlanReferenceDataEntity(funderField)));
founder.setIsActive(IsActive.Active);
this.entityManager.persist(founder);
}
@@ -456,13 +453,13 @@ public class DmpMigrationService {
licenseIdByName.put(licensePid, referenceEntity.getId());
}
- DmpReferenceEntity dmpReferenceEntity = new DmpReferenceEntity();
+ PlanReferenceEntity dmpReferenceEntity = new PlanReferenceEntity();
dmpReferenceEntity.setId(UUID.randomUUID());
- dmpReferenceEntity.setDmpId(item.getId());
+ dmpReferenceEntity.setPlanId(item.getId());
dmpReferenceEntity.setReferenceId(licenseIdByName.get(licensePid));
dmpReferenceEntity.setCreatedAt(Instant.now());
dmpReferenceEntity.setUpdatedAt(Instant.now());
- dmpReferenceEntity.setData(this.jsonHandlingService.toJsonSafe(this.buildDmpReferenceDataEntity(referenceTypeFieldEntity)));
+ dmpReferenceEntity.setData(this.jsonHandlingService.toJsonSafe(this.buildPlanReferenceDataEntity(referenceTypeFieldEntity)));
dmpReferenceEntity.setIsActive(IsActive.Active);
if (!licenseExists) entityManager.persist(referenceEntity);
@@ -473,8 +470,8 @@ public class DmpMigrationService {
return licenseIdByName;
}
- private DmpReferenceDataEntity buildDmpReferenceDataEntity(ReferenceTypeFieldEntity referenceTypeFieldEntity){
- DmpReferenceDataEntity data = new DmpReferenceDataEntity();
+ private PlanReferenceDataEntity buildPlanReferenceDataEntity(ReferenceTypeFieldEntity referenceTypeFieldEntity){
+ PlanReferenceDataEntity data = new PlanReferenceDataEntity();
data.setBlueprintFieldId(referenceTypeFieldEntity.getId());
return data;
}
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpUserMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanUserMigrationService.java
similarity index 81%
rename from dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpUserMigrationService.java
rename to dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanUserMigrationService.java
index bdd808786..1ddf1ff7a 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/DmpUserMigrationService.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/PlanUserMigrationService.java
@@ -1,8 +1,8 @@
package eu.old.eudat.migration;
-import org.opencdmp.commons.enums.DmpUserRole;
+import org.opencdmp.commons.enums.PlanUserRole;
import org.opencdmp.commons.enums.IsActive;
-import org.opencdmp.data.DmpUserEntity;
+import org.opencdmp.data.PlanUserEntity;
import eu.old.eudat.data.dao.entities.UserDmpDao;
import eu.old.eudat.data.entities.UserDMP;
import eu.old.eudat.logic.services.operations.DatabaseRepository;
@@ -15,9 +15,9 @@ import java.time.Instant;
import java.util.List;
@Service
-public class DmpUserMigrationService {
+public class PlanUserMigrationService {
- private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpUserMigrationService.class));
+ private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PlanUserMigrationService.class));
private final DatabaseRepository databaseRepository;
@@ -27,7 +27,7 @@ public class DmpUserMigrationService {
private static final boolean TestMode = false;
- public DmpUserMigrationService(DatabaseRepository databaseRepository, EntityManager entityManager) {
+ public PlanUserMigrationService(DatabaseRepository databaseRepository, EntityManager entityManager) {
this.databaseRepository = databaseRepository;
this.entityManager = entityManager;
}
@@ -46,11 +46,11 @@ public class DmpUserMigrationService {
for (UserDMP item : items) {
//entityManager.detach(item);
- DmpUserEntity data = new DmpUserEntity();
+ PlanUserEntity data = new PlanUserEntity();
data.setId(item.getId());
- data.setDmpId(item.getDmp().getId());
+ data.setPlanId(item.getDmp().getId());
data.setUserId(item.getUser().getId());
- data.setRole(DmpUserRole.of(item.getRole().shortValue()));
+ data.setRole(PlanUserRole.of(item.getRole().shortValue()));
data.setCreatedAt(item.getDmp().getCreated() != null ? item.getDmp().getCreated().toInstant() : Instant.now());
data.setUpdatedAt(item.getDmp().getModified() != null ? item.getDmp().getModified().toInstant() : Instant.now());
data.setIsActive(IsActive.Active);
diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/publicapi/migration/MigrationController.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/publicapi/migration/MigrationController.java
index 091efe744..bfb3555e6 100644
--- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/publicapi/migration/MigrationController.java
+++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/publicapi/migration/MigrationController.java
@@ -26,7 +26,7 @@ import java.net.URISyntaxException;
public class MigrationController {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(MigrationController.class));
- private final DmpMigrationService dmpMigrationService;
+ private final PlanMigrationService planMigrationService;
private final DataRepositoryMigrationService dataRepositoryMigrationService;
private final ExternalDatasetMigrationService externalDatasetMigrationService;
private final FunderMigrationService funderMigrationService;
@@ -37,21 +37,21 @@ public class MigrationController {
private final ServiceMigrationService serviceMigrationService;
private final DatasetMigrationService datasetMigrationService;
private final TagMigrationService tagMigrationService;
- private final DmpDatasetProfileMigrationService dmpDatasetProfileMigrationService;
+ private final PlanDatasetProfileMigrationService planDatasetProfileMigrationService;
private final OrganizationMigrationService organizationMigrationService;
private final DatasetReferenceMigrationService datasetReferenceMigrationService;
private final UserContactInfoMigrationService userContactInfoMigrationService;
- private final DmpUserMigrationService dmpUserMigrationService;
+ private final PlanUserMigrationService planUserMigrationService;
private final UserMigrationService userMigrationService;
- private final DmpBlueprintXmlMigrationService dmpBlueprintXmlMigrationService;
+ private final PlanBlueprintXmlMigrationService planBlueprintXmlMigrationService;
private final DescriptionTemplateXmlMigrationService descriptionTemplateXmlMigrationService;
private final DescriptionTemplateXmlCleanInvalidReferenceTypesService descriptionTemplateXmlCleanInvalidReferenceTypesService;
private final StorageFileMigrationService storageFileMigrationService;
public MigrationController(
- DmpMigrationService dmpMigrationService,
+ PlanMigrationService planMigrationService,
DatasetMigrationService datasetMigrationService,
- DmpDatasetProfileMigrationService dmpDatasetProfileMigrationService,
+ PlanDatasetProfileMigrationService planDatasetProfileMigrationService,
DataRepositoryMigrationService dataRepositoryMigrationService,
ExternalDatasetMigrationService externalDatasetMigrationService,
FunderMigrationService funderMigrationService,
@@ -63,13 +63,13 @@ public class MigrationController {
OrganizationMigrationService organizationMigrationService,
DatasetReferenceMigrationService datasetReferenceMigrationService,
UserContactInfoMigrationService userContactInfoMigrationService,
- DmpUserMigrationService dmpUserMigrationService,
+ PlanUserMigrationService planUserMigrationService,
UserMigrationService userMigrationService,
- DmpBlueprintXmlMigrationService dmpBlueprintXmlMigrationService,
+ PlanBlueprintXmlMigrationService planBlueprintXmlMigrationService,
DescriptionTemplateXmlMigrationService descriptionTemplateXmlMigrationService, DescriptionTemplateXmlCleanInvalidReferenceTypesService descriptionTemplateXmlCleanInvalidReferenceTypesService, StorageFileMigrationService storageFileMigrationService) {
- this.dmpMigrationService = dmpMigrationService;
+ this.planMigrationService = planMigrationService;
this.datasetMigrationService = datasetMigrationService;
- this.dmpDatasetProfileMigrationService = dmpDatasetProfileMigrationService;
+ this.planDatasetProfileMigrationService = planDatasetProfileMigrationService;
this.dataRepositoryMigrationService = dataRepositoryMigrationService;
this.externalDatasetMigrationService = externalDatasetMigrationService;
this.funderMigrationService = funderMigrationService;
@@ -82,9 +82,9 @@ public class MigrationController {
this.organizationMigrationService = organizationMigrationService;
this.datasetReferenceMigrationService = datasetReferenceMigrationService;
this.userContactInfoMigrationService = userContactInfoMigrationService;
- this.dmpUserMigrationService = dmpUserMigrationService;
+ this.planUserMigrationService = planUserMigrationService;
this.userMigrationService = userMigrationService;
- this.dmpBlueprintXmlMigrationService = dmpBlueprintXmlMigrationService;
+ this.planBlueprintXmlMigrationService = planBlueprintXmlMigrationService;
this.descriptionTemplateXmlMigrationService = descriptionTemplateXmlMigrationService;
this.descriptionTemplateXmlCleanInvalidReferenceTypesService = descriptionTemplateXmlCleanInvalidReferenceTypesService;
this.storageFileMigrationService = storageFileMigrationService;
@@ -149,7 +149,7 @@ public class MigrationController {
this.userMigrationService.migrate();
//XML recreate
- this.dmpBlueprintXmlMigrationService.migrate();
+ this.planBlueprintXmlMigrationService.migrate();
this.descriptionTemplateXmlMigrationService.migrate();
logger.info("Completed!!!");
@@ -161,9 +161,9 @@ public class MigrationController {
@Transactional
public boolean step2() throws IOException, JAXBException, ParserConfigurationException, InstantiationException, IllegalAccessException, SAXException, NoSuchFieldException, InvalidApplicationException, TransformerException, URISyntaxException {
//Dmp
- this.dmpMigrationService.migrate();
- this.dmpDatasetProfileMigrationService.migrate();
- this.dmpUserMigrationService.migrate();
+ this.planMigrationService.migrate();
+ this.planDatasetProfileMigrationService.migrate();
+ this.planUserMigrationService.migrate();
logger.info("Completed!!!");
@@ -190,7 +190,7 @@ public class MigrationController {
@GetMapping("dmp-blueprints-xml")
@Transactional
public boolean migrateDmpBlueprint() throws JAXBException, InvalidApplicationException, IOException, ParserConfigurationException, NoSuchFieldException, TransformerException, IllegalAccessException, InstantiationException, SAXException {
- this.dmpBlueprintXmlMigrationService.migrate();
+ this.planBlueprintXmlMigrationService.migrate();
return true;
}
@@ -239,7 +239,7 @@ public class MigrationController {
@GetMapping("dmps")
@Transactional
public boolean migrateDmps() throws IOException, NoSuchFieldException, IllegalAccessException, JAXBException, ParserConfigurationException, InstantiationException, SAXException {
- this.dmpMigrationService.migrate();
+ this.planMigrationService.migrate();
return true;
}
@@ -260,7 +260,7 @@ public class MigrationController {
@GetMapping("dmp-dataset-profiles")
@Transactional
public boolean migrateDmpDatasetProfiles() throws IOException, JAXBException, ParserConfigurationException, InstantiationException, IllegalAccessException, SAXException {
- this.dmpDatasetProfileMigrationService.migrate();
+ this.planDatasetProfileMigrationService.migrate();
return true;
}
@@ -282,7 +282,7 @@ public class MigrationController {
@GetMapping("dmp-users")
@Transactional
public boolean migrateDmpUsers() {
- this.dmpUserMigrationService.migrate();
+ this.planUserMigrationService.migrate();
return true;
}