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

This commit is contained in:
Sofia Papacharalampous 2024-04-08 11:00:55 +03:00
commit 8d2d936a73
17 changed files with 40 additions and 66 deletions

View File

@ -14,7 +14,7 @@ COPY annotation /build/annotation/
COPY annotation-web /build/annotation-web/
COPY settings.xml /root/.m2/settings.xml
RUN rm -f /build/annotation-web/src/main/resources/config/app.env
RUN rm -f /build/annotation-web/src/main/resources/config/*-dev.yml
RUN rm -f /build/annotation-web/src/main/resources/config/*-devel.yml
RUN rm -f /build/annotation-web/src/main/resources/logging/*.xml
RUN rm -f /build/annotation-web/src/main/resources/certificates/*.crt

View File

@ -14,7 +14,7 @@ COPY core /build/core/
COPY web /build/web/
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
RUN rm -f /build/web/src/main/resources/logging/*.xml
WORKDIR /build/
@ -33,6 +33,6 @@ ARG REVISION
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
COPY --from=build-stage /build/web/target/web-${REVISION}.jar /app.jar
COPY --from=build-stage /build/web/target/web-${REVISION}.jar /app/app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROFILE}", "-Dspring.config.additional-location=/files/config/", "-cp", "/app/app.jar", "-Dloader.path=/files/repo-jars", "org.springframework.boot.loader.PropertiesLauncher"]
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROFILE}", "-Dspring.config.additional-location=file:/config/", "-jar", "/app/app.jar"]

View File

@ -10,14 +10,15 @@ ENV server_username=$MAVEN_ACCOUNT_USR
ENV server_password=$MAVEN_ACCOUNT_PSW
COPY pom.xml /build/
COPY core /build/core
#COPY elastic /build/elastic/
COPY core /build/core/
COPY web /build/web/
COPY settings.xml /root/.m2/settings.xml
RUN rm -f /build/web/src/main/resources/config/*-dev.yml
RUN rm -f /build/web/src/main/resources/config/*-devel.yml
RUN rm -f /build/web/src/main/resources/logging/*.xml
WORKDIR /build/
#RUN mvn package -q
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline
# Build project
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package
@ -29,6 +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/app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROFILE}", "-Dspring.config.additional-location=/files/config/", "-cp", "/app/app.jar", "-Dloader.path=/files/repo-jars", "org.springframework.boot.loader.PropertiesLauncher"]
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROFILE}", "-Dspring.config.additional-location=file:/config/", "-jar", "/app/app.jar"]

View File

@ -3,6 +3,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core</artifactId>
<version>${revision}</version>
<packaging>${packaging.type}</packaging>
<parent>
<groupId>eu.eudat</groupId>
<artifactId>dmp-backend</artifactId>
@ -10,17 +15,14 @@
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>eu.eudat</groupId>
<artifactId>core</artifactId>
<version>${revision}</version>
<packaging>${packaging.type}</packaging>
<properties>
<java.version>21</java.version>
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>1.0.0-SNAPSHOT</revision>
<packaging.type>jar</packaging.type>
</properties>
<dependencies>

View File

@ -28,8 +28,6 @@ public class SectionEntity{
@XmlElementWrapper(name = "fieldSets")
@XmlElement(name = "fieldSet")
private List<FieldSetEntity> fieldSets;
@XmlAttribute(name="multiplicity")
private Boolean multiplicity;
public String getId() {
return id;
@ -103,14 +101,6 @@ public class SectionEntity{
this.numbering = numbering;
}
public Boolean getMultiplicity() {
return multiplicity;
}
public void setMultiplicity(Boolean multiplicity) {
this.multiplicity = multiplicity;
}
public List<FieldEntity> getAllField(){
List<FieldEntity> fieldEntities = new ArrayList<>();
if (this.getFieldSets() != null){

View File

@ -53,7 +53,6 @@ public class SectionCommonModelBuilder extends BaseCommonModelBuilder<SectionMod
m.setDescription(d.getDescription());
m.setOrdinal(d.getOrdinal());
m.setDefaultVisibility(d.isDefaultVisibility());
m.setMultiplicity(d.getMultiplicity());
m.setNumbering(d.getNumbering());
m.setTitle(d.getTitle());
m.setExtendedDescription(d.getExtendedDescription());

View File

@ -54,7 +54,6 @@ public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
if (fields.hasField(this.asIndexer(Section._description))) m.setDescription(d.getDescription());
if (fields.hasField(this.asIndexer(Section._ordinal))) m.setOrdinal(d.getOrdinal());
if (fields.hasField(this.asIndexer(Section._defaultVisibility))) m.setDefaultVisibility(d.isDefaultVisibility());
if (fields.hasField(this.asIndexer(Section._multiplicity))) m.setMultiplicity(d.getMultiplicity());
if (fields.hasField(this.asIndexer(Section._numbering))) m.setNumbering(d.getNumbering());
if (fields.hasField(this.asIndexer(Section._title))) m.setTitle(d.getTitle());
if (fields.hasField(this.asIndexer(Section._extendedDescription))) m.setExtendedDescription(d.getExtendedDescription());

View File

@ -14,9 +14,6 @@ public class Section {
public final static String _defaultVisibility = "defaultVisibility";
private Boolean defaultVisibility;
public final static String _multiplicity = "multiplicity";
private Boolean multiplicity;
public final static String _numbering = "numbering";
private String numbering; //TODO maybe remove
@ -59,14 +56,6 @@ public class Section {
this.defaultVisibility = defaultVisibility;
}
public Boolean getMultiplicity() {
return multiplicity;
}
public void setMultiplicity(Boolean multiplicity) {
this.multiplicity = multiplicity;
}
public String getNumbering() {
return numbering;
}

View File

@ -19,7 +19,6 @@ public class DescriptionSectionToDatasetSectionMapper {
model.setOrdinal(section.getOrdinal());
model.setTitle(section.getTitle());
model.setSections(section.getSections().stream().map(x-> this.toPublicModel(x, page)).toList());
model.setMultiplicity(section.getMultiplicity());
model.setDefaultVisibility(section.getDefaultVisibility());
model.setNumbering(section.getNumbering());
model.setPage("page_" + page);

View File

@ -232,14 +232,6 @@ public class ReferencePersist {
@Override
protected List<Specification> specifications(ReferencePersist item) {
return Arrays.asList(
this.spec()
.iff(() -> this.isValidGuid(item.getId()))
.must(() -> this.isValidHash(item.getHash()))
.failOn(ReferencePersist._hash).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._hash}, LocaleContextHolder.getLocale())),
this.spec()
.iff(() -> !this.isValidGuid(item.getId()))
.must(() -> !this.isValidHash(item.getHash()))
.failOn(ReferencePersist._hash).failWith(messageSource.getMessage("Validation_OverPosting", new Object[]{}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getLabel()))
.failOn(ReferencePersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ReferencePersist._label}, LocaleContextHolder.getLocale())),

View File

@ -28,10 +28,6 @@ public class SectionPersist {
public static final String _defaultVisibility = "defaultVisibility";
private Boolean multiplicity = null;
public static final String _multiplicity = "multiplicity";
private String title = null;
public static final String _title = "title";
@ -72,13 +68,6 @@ public class SectionPersist {
this.defaultVisibility = defaultVisibility;
}
public Boolean getMultiplicity() {
return multiplicity;
}
public void setMultiplicity(Boolean multiplicity) {
this.multiplicity = multiplicity;
}
public String getTitle() {
return title;
@ -145,9 +134,6 @@ public class SectionPersist {
this.spec()
.must(() -> !this.isNull(item.getDefaultVisibility()))
.failOn(SectionPersist._defaultVisibility).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._defaultVisibility}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isNull(item.getMultiplicity()))
.failOn(SectionPersist._multiplicity).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._multiplicity}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getTitle()))
.failOn(SectionPersist._title).failWith(messageSource.getMessage("Validation_Required", new Object[]{SectionPersist._title}, LocaleContextHolder.getLocale())),

View File

@ -560,6 +560,7 @@ public class DescriptionServiceImpl implements DescriptionService {
if (referenceEntity == null){
referenceEntity = new ReferenceEntity();
referenceEntity.setId(UUID.randomUUID());
referenceEntity.setLabel(referencePersist.getLabel());
referenceEntity.setIsActive(IsActive.Active);
referenceEntity.setCreatedAt(Instant.now());
referenceEntity.setTypeId(fieldEntity.getReferenceTypeId());

View File

@ -316,7 +316,6 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
data.setDescription(persist.getDescription());
data.setOrdinal(persist.getOrdinal());
data.setDefaultVisibility(persist.getDefaultVisibility());
data.setMultiplicity(persist.getMultiplicity());
data.setTitle(persist.getTitle());
if (!this.conventionService.isListNullOrEmpty(persist.getSections())) {
@ -329,14 +328,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, persist.getMultiplicity()));
data.getFieldSets().add(this.buildFieldSetEntity(fieldSetPersist));
}
}
return data;
}
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSetPersist persist, Boolean multiplicity) throws InvalidApplicationException {
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSetPersist persist) throws InvalidApplicationException {
FieldSetEntity data = new FieldSetEntity();
if (persist == null)
return data;
@ -348,7 +347,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
data.setNumbering(persist.getNumbering());
data.setAdditionalInformation(persist.getAdditionalInformation());
data.setExtendedDescription(persist.getExtendedDescription());
if (persist.getMultiplicity() != null && multiplicity)
if (persist.getMultiplicity() != null)
data.setMultiplicity(this.buildMultiplicityEntity(persist.getMultiplicity()));
data.setHasCommentField(persist.getHasCommentField());

View File

@ -4,6 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>eu.eudat</groupId>
<artifactId>dmp-backend</artifactId>
<name>OpenDMP Backend Parent</name>
<version>${revision}</version>
<packaging>pom</packaging>
@ -293,6 +294,19 @@
</property>
</activation>
</profile>
<profile>
<id>cite-dev</id>
<repositories>
<repository>
<id>cite-maven</id>
<name>CITE Maven Repository</name>
<url>https://crepo.cite.gr/repository/cite-maven/</url>
</repository>
</repositories>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
</project>

View File

@ -4,7 +4,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dmp-backend</groupId>
<artifactId>web</artifactId>
<version>${revision}</version>
<packaging>${packaging.type}</packaging>
@ -22,6 +21,7 @@
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<revision>1.0.0-SNAPSHOT</revision>
<packaging.type>jar</packaging.type>
</properties>
<dependencies>

View File

@ -166,7 +166,6 @@ public class PublicDatasetsDescriptionDocumentation {
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._description),
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._extendedDescription),
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._title),
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._multiplicity),
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._numbering),
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._ordinal),
String.join(".", Description._descriptionTemplate, DescriptionTemplate._definition, Definition._pages, Page._sections, Section._sections),

View File

@ -124,8 +124,9 @@ export class ReferenceService {
filterFn: (searchQuery: string, data?: any) => this.searchWithDefinition(this.buildAutocompleteSearchLookup(typeId, searchQuery)).pipe(map(x => x)),
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteSearchSelectedItemsLookup([typeId], null, null, null, [selectedItem])).pipe(map(x => x.items[0])),
displayFn: (item: Reference) => item.label,
subtitleFn: (item: Reference) => item?.sourceType === ReferenceSourceType.External ? this.language.instant('REFERENCE-FIELD-COMPONENT.EXTERNAL-SOURCE') + ': ' + item.source : this.language.instant('REFERENCE-FIELD-COMPONENT.INTERNAL-SOURCE'),
titleFn: (item: Reference) => item.label,
valueAssign: (item: Reference) => item.id,
valueAssign: (item: Reference) => item,
};
};