rename sourceType to referenceSourceType
This commit is contained in:
parent
92c165e904
commit
9d3cc9e3d2
|
@ -4,14 +4,14 @@ import eu.eudat.data.converters.enums.DatabaseEnum;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
public enum SourceType implements DatabaseEnum<Short> {
|
||||
public enum ReferenceSourceType implements DatabaseEnum<Short> {
|
||||
|
||||
Internal((short) 0),
|
||||
External((short) 1);
|
||||
|
||||
private final Short value;
|
||||
|
||||
SourceType(Short value) {
|
||||
ReferenceSourceType(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -20,9 +20,9 @@ public enum SourceType implements DatabaseEnum<Short> {
|
|||
return value;
|
||||
}
|
||||
|
||||
private static final Map<Short, SourceType> map = EnumUtils.getEnumValueMap(SourceType.class);
|
||||
private static final Map<Short, ReferenceSourceType> map = EnumUtils.getEnumValueMap(ReferenceSourceType.class);
|
||||
|
||||
public static SourceType of(Short i) {
|
||||
public static ReferenceSourceType of(Short i) {
|
||||
return map.get(i);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.configurations.referencetype;
|
||||
|
||||
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
|
||||
import eu.eudat.model.referencedefinition.Field;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||
|
||||
|
@ -18,7 +19,7 @@ public class ReferenceTypeProperties {
|
|||
private Map<String, List<ReferenceTypeField>> project;
|
||||
private Map<String, List<ReferenceTypeField>> organisation;
|
||||
private Map<String, List<ReferenceTypeField>> dataset;
|
||||
private Map<String, List<ReferenceTypeField>> dataRepository;
|
||||
private Map<String, List<Field>> dataRepository;
|
||||
private Map<String, List<ReferenceTypeField>> pubRepository;
|
||||
private Map<String, List<ReferenceTypeField>> journal;
|
||||
private Map<String, List<ReferenceTypeField>> publication;
|
||||
|
@ -30,7 +31,7 @@ public class ReferenceTypeProperties {
|
|||
Map<String, List<ReferenceTypeField>> researcher, Map<String, List<ReferenceTypeField>> service,
|
||||
Map<String, List<ReferenceTypeField>> registry, Map<String, List<ReferenceTypeField>> project,
|
||||
Map<String, List<ReferenceTypeField>> organisation, Map<String, List<ReferenceTypeField>> dataset,
|
||||
Map<String, List<ReferenceTypeField>> dataRepository, Map<String, List<ReferenceTypeField>> pubRepository,
|
||||
Map<String, List<Field>> dataRepository, Map<String, List<ReferenceTypeField>> pubRepository,
|
||||
Map<String, List<ReferenceTypeField>> journal, Map<String, List<ReferenceTypeField>> publication,
|
||||
Map<String, List<ReferenceTypeField>> licence, Map<String, List<ReferenceTypeField>> taxonomy) {
|
||||
this.grant = grant;
|
||||
|
@ -113,11 +114,11 @@ public class ReferenceTypeProperties {
|
|||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public Map<String, List<ReferenceTypeField>> getDataRepository() {
|
||||
public Map<String, List<Field>> getDataRepository() {
|
||||
return dataRepository;
|
||||
}
|
||||
|
||||
public void setDataRepository(Map<String, List<ReferenceTypeField>> dataRepository) {
|
||||
public void setDataRepository(Map<String, List<Field>> dataRepository) {
|
||||
this.dataRepository = dataRepository;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ package eu.eudat.data;
|
|||
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||
import eu.eudat.data.converters.enums.ReferenceSourceTypeConverter;
|
||||
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
|
||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||
import jakarta.persistence.*;
|
||||
|
@ -51,7 +52,8 @@ public class ReferenceEntity {
|
|||
public static final String _source = "source";
|
||||
|
||||
@Column(name = "source_type", nullable = false)
|
||||
private SourceType sourceType;
|
||||
@Convert(converter = ReferenceSourceTypeConverter.class)
|
||||
private ReferenceSourceType referenceSourceType;
|
||||
public static final String _sourceType = "sourceType";
|
||||
|
||||
@Column(name = "is_active", nullable = false)
|
||||
|
@ -135,12 +137,12 @@ public class ReferenceEntity {
|
|||
this.source = source;
|
||||
}
|
||||
|
||||
public SourceType getSourceType() {
|
||||
return sourceType;
|
||||
public ReferenceSourceType getReferenceSourceType() {
|
||||
return referenceSourceType;
|
||||
}
|
||||
|
||||
public void setSourceType(SourceType sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
public void setReferenceSourceType(ReferenceSourceType referenceSourceType) {
|
||||
this.referenceSourceType = referenceSourceType;
|
||||
}
|
||||
|
||||
public IsActive getIsActive() {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.data.converters.enums;
|
||||
|
||||
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
@Converter
|
||||
public class ReferenceSourceTypeConverter extends DatabaseEnumConverter<ReferenceSourceType, Short>{
|
||||
public ReferenceSourceType of(Short i) {
|
||||
return ReferenceSourceType.of(i);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package eu.eudat.data.converters.enums;
|
||||
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
@Converter
|
||||
public class SourceTypeConverter extends DatabaseEnumConverter<SourceType, Short>{
|
||||
public SourceType of(Short i) {
|
||||
return SourceType.of(i);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package eu.eudat.model;
|
|||
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||
import eu.eudat.model.referencedefinition.Definition;
|
||||
|
||||
import java.time.Instant;
|
||||
|
@ -35,7 +35,7 @@ public class Reference {
|
|||
private String source;
|
||||
public static final String _source = "source";
|
||||
|
||||
private SourceType sourceType;
|
||||
private ReferenceSourceType referenceSourceType;
|
||||
public static final String _sourceType = "sourceType";
|
||||
|
||||
private IsActive isActive;
|
||||
|
@ -117,12 +117,12 @@ public class Reference {
|
|||
this.source = source;
|
||||
}
|
||||
|
||||
public SourceType getSourceType() {
|
||||
return sourceType;
|
||||
public ReferenceSourceType getReferenceSourceType() {
|
||||
return referenceSourceType;
|
||||
}
|
||||
|
||||
public void setSourceType(SourceType sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
public void setReferenceSourceType(ReferenceSourceType referenceSourceType) {
|
||||
this.referenceSourceType = referenceSourceType;
|
||||
}
|
||||
|
||||
public IsActive getIsActive() {
|
||||
|
|
|
@ -78,7 +78,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity>{
|
|||
if (fields.hasField(this.asIndexer(Reference._abbreviation))) m.setAbbreviation(d.getAbbreviation());
|
||||
if (fields.hasField(this.asIndexer(Reference._description))) m.setDescription(d.getDescription());
|
||||
if (fields.hasField(this.asIndexer(Reference._source))) m.setSource(d.getSource());
|
||||
if (fields.hasField(this.asIndexer(Reference._sourceType))) m.setSourceType(d.getSourceType());
|
||||
if (fields.hasField(this.asIndexer(Reference._sourceType))) m.setReferenceSourceType(d.getReferenceSourceType());
|
||||
if (fields.hasField(this.asIndexer(Reference._type))) m.setType(d.getType());
|
||||
// if (!userInfoFields.isEmpty() && d.getCreatedBy() != null){
|
||||
// //ToDo
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.model.persist;
|
||||
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||
import eu.eudat.commons.validation.FieldNotNullIfOtherSet;
|
||||
import eu.eudat.commons.validation.ValidEnum;
|
||||
import eu.eudat.commons.validation.ValidId;
|
||||
|
@ -44,7 +44,7 @@ public class ReferencePersist {
|
|||
private String source;
|
||||
|
||||
@ValidEnum(message = "{validation.empty}")
|
||||
private SourceType sourceType;
|
||||
private ReferenceSourceType referenceSourceType;
|
||||
|
||||
//private UserInfoPersist createdBy; ToDo
|
||||
|
||||
|
@ -113,11 +113,11 @@ public class ReferencePersist {
|
|||
this.source = source;
|
||||
}
|
||||
|
||||
public SourceType getSourceType() {
|
||||
return sourceType;
|
||||
public ReferenceSourceType getReferenceSourceType() {
|
||||
return referenceSourceType;
|
||||
}
|
||||
|
||||
public void setSourceType(SourceType sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
public void setReferenceSourceType(ReferenceSourceType referenceSourceType) {
|
||||
this.referenceSourceType = referenceSourceType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package eu.eudat.query;
|
|||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.data.ReferenceEntity;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
|
@ -30,7 +30,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
|
||||
private Collection<IsActive> isActives;
|
||||
|
||||
private Collection<SourceType> sourceTypes;
|
||||
private Collection<ReferenceSourceType> referenceSourceTypes;
|
||||
|
||||
private Collection<ReferenceType> referenceTypes;
|
||||
|
||||
|
@ -103,18 +103,18 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ReferenceQuery sourceTypes(SourceType value) {
|
||||
this.sourceTypes = List.of(value);
|
||||
public ReferenceQuery referenceSourceTypes(ReferenceSourceType value) {
|
||||
this.referenceSourceTypes = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReferenceQuery sourceTypes(SourceType... value) {
|
||||
this.sourceTypes = Arrays.asList(value);
|
||||
public ReferenceQuery referenceSourceTypes(ReferenceSourceType... value) {
|
||||
this.referenceSourceTypes = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReferenceQuery sourceTypes(Collection<SourceType> values) {
|
||||
this.sourceTypes = values;
|
||||
public ReferenceQuery referenceSourceTypes(Collection<ReferenceSourceType> values) {
|
||||
this.referenceSourceTypes = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.excludedIds) || this.isEmpty(this.referenceTypes) || this.isEmpty(this.sourceTypes);
|
||||
return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.excludedIds) || this.isEmpty(this.referenceTypes) || this.isEmpty(this.referenceSourceTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,9 +165,9 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
if (this.sourceTypes != null) {
|
||||
CriteriaBuilder.In<SourceType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._sourceType));
|
||||
for (SourceType item : this.sourceTypes)
|
||||
if (this.referenceSourceTypes != null) {
|
||||
CriteriaBuilder.In<ReferenceSourceType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._sourceType));
|
||||
for (ReferenceSourceType item : this.referenceSourceTypes)
|
||||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
item.setAbbreviation(QueryBase.convertSafe(tuple, columns, ReferenceEntity._abbreviation, String.class));
|
||||
item.setReference(QueryBase.convertSafe(tuple, columns, ReferenceEntity._reference, String.class));
|
||||
item.setSource(QueryBase.convertSafe(tuple, columns, ReferenceEntity._source, String.class));
|
||||
item.setSourceType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._sourceType, SourceType.class));
|
||||
item.setReferenceSourceType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._sourceType, ReferenceSourceType.class));
|
||||
item.setType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._type, ReferenceType.class));
|
||||
item.setCreatedBy(QueryBase.convertSafe(tuple, columns, ReferenceEntity._createdBy, UUID.class));
|
||||
return item;
|
||||
|
|
|
@ -2,7 +2,7 @@ package eu.eudat.query.lookup;
|
|||
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||
import eu.eudat.query.ReferenceQuery;
|
||||
import gr.cite.tools.data.query.Lookup;
|
||||
import gr.cite.tools.data.query.QueryFactory;
|
||||
|
@ -17,7 +17,7 @@ public class ReferenceLookup extends Lookup {
|
|||
|
||||
private List<IsActive> isActive;
|
||||
|
||||
private Collection<SourceType> sourceTypes;
|
||||
private Collection<ReferenceSourceType> referenceSourceTypes;
|
||||
|
||||
private Collection<ReferenceType> referenceTypes;
|
||||
|
||||
|
@ -57,12 +57,12 @@ public class ReferenceLookup extends Lookup {
|
|||
this.excludedIds = excludeIds;
|
||||
}
|
||||
|
||||
public Collection<SourceType> getSourceTypes() {
|
||||
return sourceTypes;
|
||||
public Collection<ReferenceSourceType> getReferenceSourceTypes() {
|
||||
return referenceSourceTypes;
|
||||
}
|
||||
|
||||
public void setSourceTypes(Collection<SourceType> sourceTypes) {
|
||||
this.sourceTypes = sourceTypes;
|
||||
public void setReferenceSourceTypes(Collection<ReferenceSourceType> referenceSourceTypes) {
|
||||
this.referenceSourceTypes = referenceSourceTypes;
|
||||
}
|
||||
|
||||
public Collection<ReferenceType> getReferenceTypes() {
|
||||
|
@ -78,7 +78,7 @@ public class ReferenceLookup extends Lookup {
|
|||
if (this.like != null) query.like(this.like);
|
||||
if (this.isActive != null) query.isActive(this.isActive);
|
||||
if (this.referenceTypes != null) query.referenceTypes(this.referenceTypes);
|
||||
if (this.sourceTypes != null) query.sourceTypes(this.sourceTypes);
|
||||
if (this.referenceSourceTypes != null) query.referenceSourceTypes(this.referenceSourceTypes);
|
||||
if (this.ids != null) query.ids(this.ids);
|
||||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ public class ReferenceService {
|
|||
data.setReference(model.getReference());
|
||||
data.setAbbreviation(model.getAbbreviation());
|
||||
data.setSource(model.getSource());
|
||||
data.setReferenceSourceType(model.getReferenceSourceType());
|
||||
|
||||
if (isUpdate) this.entityManager.merge(data);
|
||||
else this.entityManager.persist(data);
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
export enum ReferenceSourceType {
|
||||
Internal = 0,
|
||||
External = 1
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
export enum SourceType {
|
||||
Internal = 0,
|
||||
External = 1
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
import { ReferenceType } from "@app/core/common/enum/reference-type";
|
||||
import { IsActive } from "@app/core/common/enum/is-active.enum";
|
||||
import { SourceType } from "@app/core/common/enum/source-type";
|
||||
import { ReferenceSourceType } from "@app/core/common/enum/reference-source-type";
|
||||
import { UUID } from "crypto";
|
||||
import { DmpModel } from "../dmp/dmp";
|
||||
import { ReferenceFieldDataType } from "@app/core/common/enum/reference-field-data-type";
|
||||
|
@ -14,7 +14,7 @@ export interface Reference {
|
|||
reference: string;
|
||||
abbreviation: string;
|
||||
source: string;
|
||||
sourceType: SourceType;
|
||||
referenceSourceType: ReferenceSourceType;
|
||||
isActive: IsActive;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
|
@ -70,7 +70,7 @@ export interface ReferencePersist {
|
|||
reference: string;
|
||||
abbreviation: string;
|
||||
source: string;
|
||||
sourceType: SourceType;
|
||||
referenceSourceType: ReferenceSourceType;
|
||||
}
|
||||
|
||||
export interface DefinitionPersist {
|
||||
|
|
Loading…
Reference in New Issue