Merge branch 'dmp-refactoring' of code-repo.d4science.org:MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Efstratios Giannopoulos 2024-04-05 14:13:42 +03:00
commit 6a89feb31b
5 changed files with 23 additions and 19 deletions

View File

@ -10,12 +10,11 @@ ENV server_username=$MAVEN_ACCOUNT_USR
ENV server_password=$MAVEN_ACCOUNT_PSW
COPY pom.xml /build/
#COPY data /build/data/
#COPY elastic /build/elastic/
#COPY logging /build/logging/
#COPY queryable /build/queryable/
COPY core /build/core/
COPY web /build/web/
RUN rm -f /build/web/src/main/resources/config/*-dev.yml
COPY settings.xml /root/.m2/settings.xml
RUN rm -f /build/web/src/main/resources/config/*-devel.yml
RUN rm -f /build/annotation-web/src/main/resources/logging/*.xml
WORKDIR /build/
@ -31,7 +30,9 @@ WORKDIR /app
ARG PROFILE
ARG REVISION
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
COPY --from=build-stage /build/web/target/web-${REVISION}.jar /app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom" ,"-Dspring.profiles.active=${PROFILE}","-jar","/app.jar"]
ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Djava.security.egd=file:/dev/./urandom" ,"-Dspring.profiles.active=${PROFILE}","-jar","/app.jar"]

View File

@ -14,6 +14,7 @@ import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
import eu.eudat.query.DescriptionQuery;
import eu.eudat.query.DmpDescriptionTemplateQuery;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.validation.ValidatorFactory;
import gr.cite.tools.validation.specification.Specification;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.MessageSource;
@ -25,7 +26,6 @@ import javax.management.InvalidApplicationException;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class DescriptionPersist {
@ -157,13 +157,16 @@ public class DescriptionPersist {
private final TenantEntityManager entityManager;
private final XmlHandlingService xmlHandlingService;
private final QueryFactory queryFactory;
private final ValidatorFactory validatorFactory;
protected DescriptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, TenantEntityManager entityManager, XmlHandlingService xmlHandlingService, QueryFactory queryFactory) {
protected DescriptionPersistValidator(ConventionService conventionService, ErrorThesaurusProperties errors, MessageSource messageSource, TenantEntityManager entityManager, XmlHandlingService xmlHandlingService, QueryFactory queryFactory, ValidatorFactory validatorFactory) {
super(conventionService, errors);
this.messageSource = messageSource;
this.entityManager = entityManager;
this.xmlHandlingService = xmlHandlingService;
this.queryFactory = queryFactory;
this.validatorFactory = validatorFactory;
}
@Override
@ -220,12 +223,12 @@ public class DescriptionPersist {
.failOn(DescriptionPersist._properties).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionPersist._properties}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> this.isDescriptionTemplateMaxMultiplicityValid(finalDmpBlueprintEntity, item.getDmpId(), item.getDmpDescriptionTemplateId(), this.isValidGuid(item.getId())))
.failOn(DescriptionPersist._descriptionTemplateId).failWith(messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicity", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale()))
// this.refSpec()
// .iff(() -> !this.isNull(item.getProperties()))
// .on(DescriptionPersist._properties)
// .over(item.getProperties())
// .using(() -> this.validatorFactory.validator(PropertyDefinitionPersist.PropertyDefinitionPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition))
.failOn(DescriptionPersist._descriptionTemplateId).failWith(messageSource.getMessage("Validation.InvalidDescriptionTemplateMultiplicity", new Object[]{DescriptionPersist._descriptionTemplateId}, LocaleContextHolder.getLocale())),
this.refSpec()
.iff(() -> item.getStatus() == DescriptionStatus.Finalized)
.on(DescriptionPersist._properties)
.over(item.getProperties())
.using(() -> this.validatorFactory.validator(PropertyDefinitionPersist.PropertyDefinitionPersistValidator.class).setStatus(item.getStatus()).withDefinition(definition))
// this.navSpec()
// .iff(() -> !this.isNull(item.getTags()))
// .on(DescriptionPersist._tags)

View File

@ -813,7 +813,7 @@ public class DescriptionServiceImpl implements DescriptionService {
if (descriptionTemplateEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{data.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
persist.setLabel(data.getLabel());
persist.setStatus(data.getStatus());
persist.setStatus(DescriptionStatus.Finalized);
persist.setDescription(data.getDescription());
persist.setDescriptionTemplateId(data.getDescriptionTemplateId());
persist.setDmpId(data.getDmpId());

View File

@ -329,14 +329,14 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
if (!this.conventionService.isListNullOrEmpty(persist.getFieldSets())) {
data.setFieldSets(new ArrayList<>());
for (FieldSetPersist fieldSetPersist : persist.getFieldSets()) {
data.getFieldSets().add(this.buildFieldSetEntity(fieldSetPersist));
data.getFieldSets().add(this.buildFieldSetEntity(fieldSetPersist, persist.getMultiplicity()));
}
}
return data;
}
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSetPersist persist) throws InvalidApplicationException {
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSetPersist persist, Boolean multiplicity) throws InvalidApplicationException {
FieldSetEntity data = new FieldSetEntity();
if (persist == null)
return data;
@ -348,7 +348,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
data.setNumbering(persist.getNumbering());
data.setAdditionalInformation(persist.getAdditionalInformation());
data.setExtendedDescription(persist.getExtendedDescription());
if (persist.getMultiplicity() != null)
if (persist.getMultiplicity() != null && multiplicity)
data.setMultiplicity(this.buildMultiplicityEntity(persist.getMultiplicity()));
data.setHasCommentField(persist.getHasCommentField());

View File

@ -125,7 +125,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
this.dmp.descriptions = data.descriptions.filter(x => x.isActive === IsActive.Active && x.status !== DescriptionStatus.Canceled);
}
}
this.dmp.entityDois = data.entityDois.filter(x => x.isActive === IsActive.Active);
if (data.entityDois && data.entityDois.length > 0) this.dmp.entityDois = data.entityDois.filter(x => x.isActive === IsActive.Active);
this.selectedBlueprint = data.blueprint;
this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]);
if (!this.hasDoi()) {