diff --git a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DmpToPublicApiDmpListingMapper.java b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanListingMapper.java similarity index 96% rename from backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DmpToPublicApiDmpListingMapper.java rename to backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanListingMapper.java index 671948f26..5292dc8e0 100644 --- a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DmpToPublicApiDmpListingMapper.java +++ b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanListingMapper.java @@ -11,7 +11,7 @@ import java.sql.Date; import java.util.Objects; @Component -public class DmpToPublicApiDmpListingMapper { +public class PlanToPublicApiPlanListingMapper { public DataManagementPlanPublicListingModel toPublicListingModel(Dmp dmp, PublicApiProperties.ReferenceTypeMapConfig config) { DataManagementPlanPublicListingModel model = new DataManagementPlanPublicListingModel(); diff --git a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DmpToPublicApiDmpMapper.java b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanMapper.java similarity index 95% rename from backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DmpToPublicApiDmpMapper.java rename to backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanMapper.java index 49bef6619..4db1bf1f0 100644 --- a/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/DmpToPublicApiDmpMapper.java +++ b/backend/core/src/main/java/org/opencdmp/model/mapper/publicapi/PlanToPublicApiPlanMapper.java @@ -19,11 +19,11 @@ import java.util.List; import java.util.Objects; @Component -public class DmpToPublicApiDmpMapper { +public class PlanToPublicApiPlanMapper { private final DescriptionToPublicApiDatasetMapper descriptionToPublicApiDatasetMapper; - public DmpToPublicApiDmpMapper(DescriptionToPublicApiDatasetMapper descriptionToPublicApiDatasetMapper) { + public PlanToPublicApiPlanMapper(DescriptionToPublicApiDatasetMapper descriptionToPublicApiDatasetMapper) { this.descriptionToPublicApiDatasetMapper = descriptionToPublicApiDatasetMapper; } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicApiStaticHelpers.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicApiStaticHelpers.java index f1599ddd4..a586e20e6 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicApiStaticHelpers.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicApiStaticHelpers.java @@ -2,7 +2,7 @@ package org.opencdmp.controllers.publicapi; public final class PublicApiStaticHelpers { - public static final class Dmp { + public static final class Plan { public static final String getPagedNotes = "The json response is of type **ResponseItem>** containing the following properties:\n" + "
    " + diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java index 394ac0cc9..0415d2cfe 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDatasetsDescriptionDocumentation.java @@ -30,7 +30,7 @@ import org.opencdmp.model.dmp.Dmp; import org.opencdmp.model.dmpreference.DmpReference; import org.opencdmp.model.mapper.publicapi.DescriptionToPublicApiDatasetListingMapper; import org.opencdmp.model.mapper.publicapi.DescriptionToPublicApiDatasetMapper; -import org.opencdmp.model.mapper.publicapi.DmpToPublicApiDmpListingMapper; +import org.opencdmp.model.mapper.publicapi.PlanToPublicApiPlanListingMapper; import org.opencdmp.model.publicapi.listingmodels.DatasetPublicListingModel; import org.opencdmp.model.publicapi.overviewmodels.DatasetPublicModel; import org.opencdmp.model.reference.Reference; @@ -76,7 +76,7 @@ public class PublicDatasetsDescriptionDocumentation { private final PublicApiProperties config; - private final DmpToPublicApiDmpListingMapper dmpToPublicApiDmpListingMapper; + private final PlanToPublicApiPlanListingMapper planToPublicApiPlanListingMapper; @Autowired public PublicDatasetsDescriptionDocumentation( @@ -84,14 +84,14 @@ public class PublicDatasetsDescriptionDocumentation { BuilderFactory builderFactory, MessageSource messageSource, DescriptionToPublicApiDatasetMapper descriptionToPublicApiDatasetMapper, - DescriptionToPublicApiDatasetListingMapper descriptionToPublicApiDatasetListingMapper, PublicApiProperties config, DmpToPublicApiDmpListingMapper dmpToPublicApiDmpListingMapper) { + DescriptionToPublicApiDatasetListingMapper descriptionToPublicApiDatasetListingMapper, PublicApiProperties config, PlanToPublicApiPlanListingMapper planToPublicApiPlanListingMapper) { this.queryFactory = queryFactory; this.builderFactory = builderFactory; this.messageSource = messageSource; this.descriptionToPublicApiDatasetMapper = descriptionToPublicApiDatasetMapper; this.descriptionToPublicApiDatasetListingMapper = descriptionToPublicApiDatasetListingMapper; this.config = config; - this.dmpToPublicApiDmpListingMapper = dmpToPublicApiDmpListingMapper; + this.planToPublicApiPlanListingMapper = planToPublicApiPlanListingMapper; } @Operation(summary = "This method is used to get a listing of public datasets.", description = PublicApiStaticHelpers.Description.getPagedNotes) @@ -136,7 +136,7 @@ public class PublicDatasetsDescriptionDocumentation { DmpLookup dmpLookup = getDmpLookup(); Dmp dmp = this.builderFactory.builder(DmpBuilder.class).build(dmpLookup.getProject(), dmpQuery.firstAs(dmpLookup.getProject())); - DatasetPublicModel dataset = this.descriptionToPublicApiDatasetMapper.toPublicModel(model, this.dmpToPublicApiDmpListingMapper.toPublicListingModel(dmp, this.config.getReferenceTypeMap()), this.config.getReferenceTypeMap()); + DatasetPublicModel dataset = this.descriptionToPublicApiDatasetMapper.toPublicModel(model, this.planToPublicApiPlanListingMapper.toPublicListingModel(dmp, this.config.getReferenceTypeMap()), this.config.getReferenceTypeMap()); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(dataset)); } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDmpsDocumentation.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicPlansDocumentation.java similarity index 79% rename from backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDmpsDocumentation.java rename to backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicPlansDocumentation.java index 9dc7f0b9d..1f1eb1093 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicDmpsDocumentation.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/PublicPlansDocumentation.java @@ -14,7 +14,7 @@ import jakarta.validation.Valid; import org.jetbrains.annotations.NotNull; import org.opencdmp.authorization.AuthorizationFlags; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.controllers.publicapi.request.dmp.DataManagmentPlanPublicTableRequest; +import org.opencdmp.controllers.publicapi.request.plan.DataManagmentPlanPublicTableRequest; import org.opencdmp.controllers.publicapi.response.DataTableData; import org.opencdmp.controllers.publicapi.types.ApiMessageCode; import org.opencdmp.controllers.publicapi.types.ResponseItem; @@ -26,8 +26,8 @@ import org.opencdmp.model.builder.dmp.DmpBuilder; import org.opencdmp.model.dmp.Dmp; import org.opencdmp.model.dmpblueprint.Section; import org.opencdmp.model.dmpreference.DmpReference; -import org.opencdmp.model.mapper.publicapi.DmpToPublicApiDmpListingMapper; -import org.opencdmp.model.mapper.publicapi.DmpToPublicApiDmpMapper; +import org.opencdmp.model.mapper.publicapi.PlanToPublicApiPlanListingMapper; +import org.opencdmp.model.mapper.publicapi.PlanToPublicApiPlanMapper; import org.opencdmp.model.publicapi.listingmodels.DataManagementPlanPublicListingModel; import org.opencdmp.model.publicapi.overviewmodels.DataManagementPlanPublicModel; import org.opencdmp.model.reference.Definition; @@ -60,9 +60,9 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; @RestController @CrossOrigin @RequestMapping("/api/public/dmps") -public class PublicDmpsDocumentation { +public class PublicPlansDocumentation { - private static final Logger logger = LoggerFactory.getLogger(PublicDmpsDocumentation.class); + private static final Logger logger = LoggerFactory.getLogger(PublicPlansDocumentation.class); private final QueryFactory queryFactory; @@ -70,54 +70,54 @@ public class PublicDmpsDocumentation { private final MessageSource messageSource; - private final DmpToPublicApiDmpMapper dmpToPublicApiDmpMapper; + private final PlanToPublicApiPlanMapper planToPublicApiPlanMapper; private final PublicApiProperties config; - private final DmpToPublicApiDmpListingMapper dmpToPublicApiDmpListingMapper; + private final PlanToPublicApiPlanListingMapper planToPublicApiPlanListingMapper; @Autowired - public PublicDmpsDocumentation( - QueryFactory queryFactory, - BuilderFactory builderFactory, - MessageSource messageSource, - DmpToPublicApiDmpMapper dmpToPublicApiDmpMapper, PublicApiProperties config, - DmpToPublicApiDmpListingMapper dmpToPublicApiDmpListingMapper) { + public PublicPlansDocumentation( + QueryFactory queryFactory, + BuilderFactory builderFactory, + MessageSource messageSource, + PlanToPublicApiPlanMapper planToPublicApiPlanMapper, PublicApiProperties config, + PlanToPublicApiPlanListingMapper planToPublicApiPlanListingMapper) { this.queryFactory = queryFactory; this.builderFactory = builderFactory; this.messageSource = messageSource; - this.dmpToPublicApiDmpMapper = dmpToPublicApiDmpMapper; + this.planToPublicApiPlanMapper = planToPublicApiPlanMapper; this.config = config; - this.dmpToPublicApiDmpListingMapper = dmpToPublicApiDmpListingMapper; + this.planToPublicApiPlanListingMapper = planToPublicApiPlanListingMapper; } - @Operation(summary = "This method is used to get a listing of public dmps.", description = PublicApiStaticHelpers.Dmp.getPagedNotes) + @Operation(summary = "This method is used to get a listing of public dmps.", description = PublicApiStaticHelpers.Plan.getPagedNotes) @io.swagger.v3.oas.annotations.responses.ApiResponses(@ApiResponse( responseCode = "200", description = """ The following example is generated using: a) body: *{"criteria": {},"length": 2,"offset": 0,"orderings": {"fields": []} }* b) fieldsGroup: listing""", - content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = @ExampleObject(PublicApiStaticHelpers.Dmp.getPagedResponseExample)) + content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = @ExampleObject(PublicApiStaticHelpers.Plan.getPagedResponseExample)) )) @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity>> getPaged( - @Valid @RequestBody @io.swagger.v3.oas.annotations.parameters.RequestBody(description = PublicApiStaticHelpers.Dmp.getPagedRequestBodyDescription) DataManagmentPlanPublicTableRequest dmpTableRequest, - @RequestParam @Parameter(description = PublicApiStaticHelpers.Dmp.getPagedRequestParamDescription, example = "listing") String fieldsGroup + @Valid @RequestBody @io.swagger.v3.oas.annotations.parameters.RequestBody(description = PublicApiStaticHelpers.Plan.getPagedRequestBodyDescription) DataManagmentPlanPublicTableRequest dmpTableRequest, + @RequestParam @Parameter(description = PublicApiStaticHelpers.Plan.getPagedRequestParamDescription, example = "listing") String fieldsGroup ) throws Exception { - DmpLookup lookup = getDmpLookup(fieldsGroup, dmpTableRequest); + DmpLookup lookup = getPlanLookup(fieldsGroup, dmpTableRequest); DmpQuery query = lookup.enrich(this.queryFactory).authorize(EnumSet.of(AuthorizationFlags.Public)).isActive(IsActive.Active); long count = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(EnumSet.of(AuthorizationFlags.Public)).isActive(IsActive.Active).count(); List data = query.collectAs(lookup.getProject()); List models = this.builderFactory.builder(DmpBuilder.class).build(lookup.getProject(), data); DataTableData dataTableData = new DataTableData<>(); - dataTableData.setData(models.stream().map(x-> this.dmpToPublicApiDmpListingMapper.toPublicListingModel(x, this.config.getReferenceTypeMap())).toList()); + dataTableData.setData(models.stream().map(x-> this.planToPublicApiPlanListingMapper.toPublicListingModel(x, this.config.getReferenceTypeMap())).toList()); dataTableData.setTotalCount(count); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataTableData)); } @NotNull - private static DmpLookup getDmpLookup(String fieldsGroup, DataManagmentPlanPublicTableRequest request) { + private static DmpLookup getPlanLookup(String fieldsGroup, DataManagmentPlanPublicTableRequest request) { BaseFieldSet fieldSet = new BaseFieldSet(); Set fields; if ("listing".equals(fieldsGroup)) { @@ -157,18 +157,18 @@ public class PublicDmpsDocumentation { return lookup; } - @Operation(summary = "This method is used to get the overview of a public dmp.", description = PublicApiStaticHelpers.Dmp.getOverviewSinglePublicNotes) + @Operation(summary = "This method is used to get the overview of a public dmp.", description = PublicApiStaticHelpers.Plan.getOverviewSinglePublicNotes) @io.swagger.v3.oas.annotations.responses.ApiResponses(@ApiResponse( responseCode = "200", description = "The following example is generated using id: *e9a73d77-adfa-4546-974f-4a4a623b53a8*", - content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = @ExampleObject(PublicApiStaticHelpers.Dmp.getOverviewSinglePublicResponseExample)) + content = @Content(mediaType = APPLICATION_JSON_VALUE, examples = @ExampleObject(PublicApiStaticHelpers.Plan.getOverviewSinglePublicResponseExample)) )) @RequestMapping(method = RequestMethod.GET, value = "/{id}", produces = "application/json") public @ResponseBody ResponseEntity> getOverviewSinglePublic( @PathVariable @Parameter(description = "fetch the dmp with the given id", example = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") String id ) { - BaseFieldSet dmpFieldSet = new BaseFieldSet(); - Set dmpFields = Set.of( + BaseFieldSet planFieldSet = new BaseFieldSet(); + Set planFields = Set.of( Dmp._id, Dmp._label, Dmp._description, @@ -191,16 +191,16 @@ public class PublicDmpsDocumentation { Dmp._updatedAt, Dmp._finalizedAt ); - dmpFieldSet.setFields(dmpFields); + planFieldSet.setFields(planFields); DmpQuery query = this.queryFactory.query(DmpQuery.class).disableTracking().authorize(EnumSet.of(AuthorizationFlags.Public)).ids(UUID.fromString(id)).isActive(IsActive.Active); - Dmp model = this.builderFactory.builder(DmpBuilder.class).build(dmpFieldSet, query.firstAs(dmpFieldSet)); + Dmp model = this.builderFactory.builder(DmpBuilder.class).build(planFieldSet, query.firstAs(planFieldSet)); if (model == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale())); EntityDoiQuery entityDoiQuery = this.queryFactory.query(EntityDoiQuery.class).disableTracking().entityIds(UUID.fromString(id)).isActive(IsActive.Active); BaseFieldSet templateFieldSet = new BaseFieldSet(); - DmpDescriptionTemplateQuery dmpDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().dmpIds(UUID.fromString(id)).isActive(IsActive.Active); - List descriptionTemplates = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).build(templateFieldSet, dmpDescriptionTemplateQuery.collectAs(templateFieldSet)); - DataManagementPlanPublicModel dataManagementPlan = this.dmpToPublicApiDmpMapper.toPublicModel(model, entityDoiQuery.collect(), descriptionTemplates, this.config.getReferenceTypeMap()); + DmpDescriptionTemplateQuery planDescriptionTemplateQuery = this.queryFactory.query(DmpDescriptionTemplateQuery.class).disableTracking().dmpIds(UUID.fromString(id)).isActive(IsActive.Active); + List planDescriptionTemplates = this.builderFactory.builder(DmpDescriptionTemplateBuilder.class).build(templateFieldSet, planDescriptionTemplateQuery.collectAs(templateFieldSet)); + DataManagementPlanPublicModel dataManagementPlan = this.planToPublicApiPlanMapper.toPublicModel(model, entityDoiQuery.collect(), planDescriptionTemplates, this.config.getReferenceTypeMap()); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(dataManagementPlan)); } diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/plan/DataManagementPlanPublicCriteria.java similarity index 98% rename from backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java rename to backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/plan/DataManagementPlanPublicCriteria.java index a8b6ec6a1..2e3b86942 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/dmp/DataManagementPlanPublicCriteria.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/criteria/plan/DataManagementPlanPublicCriteria.java @@ -1,4 +1,4 @@ -package org.opencdmp.controllers.publicapi.criteria.dmp; +package org.opencdmp.controllers.publicapi.criteria.plan; import org.opencdmp.controllers.publicapi.criteria.Criteria; import org.opencdmp.data.DmpEntity; diff --git a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/plan/DataManagmentPlanPublicTableRequest.java similarity index 97% rename from backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java rename to backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/plan/DataManagmentPlanPublicTableRequest.java index fd2f14423..75f1d4c9e 100644 --- a/backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/dmp/DataManagmentPlanPublicTableRequest.java +++ b/backend/web/src/main/java/org/opencdmp/controllers/publicapi/request/plan/DataManagmentPlanPublicTableRequest.java @@ -1,8 +1,8 @@ -package org.opencdmp.controllers.publicapi.request.dmp; +package org.opencdmp.controllers.publicapi.request.plan; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.controllers.publicapi.QueryableList; -import org.opencdmp.controllers.publicapi.criteria.dmp.DataManagementPlanPublicCriteria; +import org.opencdmp.controllers.publicapi.criteria.plan.DataManagementPlanPublicCriteria; import org.opencdmp.controllers.publicapi.query.PaginationService; import org.opencdmp.controllers.publicapi.query.definition.TableQuery; import org.opencdmp.controllers.publicapi.types.FieldSelectionType;