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

This commit is contained in:
Efstratios Giannopoulos 2024-02-21 18:37:53 +02:00
commit bc5f394ece
28 changed files with 499 additions and 44 deletions

View File

@ -23,6 +23,10 @@ public class OutboxIntegrationEvent extends IntegrationEvent {
public static final String USER_REMOVE = "USER_REMOVE"; public static final String USER_REMOVE = "USER_REMOVE";
public static final String DMP_TOUCH = "DMP_TOUCH";
public static final String DESCRIPTION_TOUCH = "DESCRIPTION_TOUCH";
public static final String WHAT_YOU_KNOW_ABOUT_ME_COMPLETED = "WHAT_YOU_KNOW_ABOUT_ME_COMPLETED"; public static final String WHAT_YOU_KNOW_ABOUT_ME_COMPLETED = "WHAT_YOU_KNOW_ABOUT_ME_COMPLETED";
public static final String GENERATE_FILE = "GENERATE_FILE"; public static final String GENERATE_FILE = "GENERATE_FILE";

View File

@ -19,6 +19,10 @@ public class OutboxProperties {
private final String userTouchTopic; private final String userTouchTopic;
private final String dmpTouchTopic;
private final String descriptionTouchTopic;
private final String notifyTopic; private final String notifyTopic;
private final String forgetMeCompletedTopic; private final String forgetMeCompletedTopic;
@ -32,8 +36,8 @@ public class OutboxProperties {
String tenantRemovalTopic, String tenantRemovalTopic,
String tenantReactivationTopic, String tenantReactivationTopic,
String tenantUserInviteTopic, String tenantUserInviteTopic,
String userRemovalTopic, String userRemovalTopic,
String userTouchTopic, String userTouchTopic, String dmpTouchTopic, String descriptionTouchTopic,
String notifyTopic, String notifyTopic,
String forgetMeCompletedTopic, String forgetMeCompletedTopic,
String whatYouKnowAboutMeCompletedTopic, String whatYouKnowAboutMeCompletedTopic,
@ -46,6 +50,8 @@ public class OutboxProperties {
this.tenantUserInviteTopic = tenantUserInviteTopic; this.tenantUserInviteTopic = tenantUserInviteTopic;
this.userRemovalTopic = userRemovalTopic; this.userRemovalTopic = userRemovalTopic;
this.userTouchTopic = userTouchTopic; this.userTouchTopic = userTouchTopic;
this.dmpTouchTopic = dmpTouchTopic;
this.descriptionTouchTopic = descriptionTouchTopic;
this.notifyTopic = notifyTopic; this.notifyTopic = notifyTopic;
this.forgetMeCompletedTopic = forgetMeCompletedTopic; this.forgetMeCompletedTopic = forgetMeCompletedTopic;
this.whatYouKnowAboutMeCompletedTopic = whatYouKnowAboutMeCompletedTopic; this.whatYouKnowAboutMeCompletedTopic = whatYouKnowAboutMeCompletedTopic;
@ -80,6 +86,14 @@ public class OutboxProperties {
return userTouchTopic; return userTouchTopic;
} }
public String getDmpTouchTopic() {
return dmpTouchTopic;
}
public String getDescriptionTouchTopic() {
return descriptionTouchTopic;
}
public String getNotifyTopic() { public String getNotifyTopic() {
return notifyTopic; return notifyTopic;
} }

View File

@ -407,6 +407,14 @@ public class OutboxRepositoryImpl implements OutboxRepository {
routingKey = this.outboxProperties.getUserTouchTopic(); routingKey = this.outboxProperties.getUserTouchTopic();
break; break;
} }
case OutboxIntegrationEvent.DMP_TOUCH: {
routingKey = this.outboxProperties.getDmpTouchTopic();
break;
}
case OutboxIntegrationEvent.DESCRIPTION_TOUCH: {
routingKey = this.outboxProperties.getDescriptionTouchTopic();
break;
}
case OutboxIntegrationEvent.FORGET_ME_COMPLETED: { case OutboxIntegrationEvent.FORGET_ME_COMPLETED: {
routingKey = this.outboxProperties.getForgetMeCompletedTopic(); routingKey = this.outboxProperties.getForgetMeCompletedTopic();
break; break;

View File

@ -0,0 +1,102 @@
package eu.eudat.integrationevent.outbox.descriptiontouched;
import eu.eudat.commons.enums.DescriptionStatus;
import eu.eudat.integrationevent.TrackedEvent;
import eu.eudat.model.persist.descriptionproperties.PropertyDefinitionPersist;
import java.util.List;
import java.util.UUID;
public class DescriptionTouchedIntegrationEvent extends TrackedEvent {
private UUID id;
private String label;
private UUID dmpId;
private UUID dmpDescriptionTemplateId;
private UUID descriptionTemplateId;
private DescriptionStatus status;
private String description;
private PropertyDefinitionPersist properties;
private List<String> tags;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public UUID getDmpId() {
return dmpId;
}
public void setDmpId(UUID dmpId) {
this.dmpId = dmpId;
}
public UUID getDmpDescriptionTemplateId() {
return dmpDescriptionTemplateId;
}
public void setDmpDescriptionTemplateId(UUID dmpDescriptionTemplateId) {
this.dmpDescriptionTemplateId = dmpDescriptionTemplateId;
}
public UUID getDescriptionTemplateId() {
return descriptionTemplateId;
}
public void setDescriptionTemplateId(UUID descriptionTemplateId) {
this.descriptionTemplateId = descriptionTemplateId;
}
public DescriptionStatus getStatus() {
return status;
}
public void setStatus(DescriptionStatus status) {
this.status = status;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public PropertyDefinitionPersist getProperties() {
return properties;
}
public void setProperties(PropertyDefinitionPersist properties) {
this.properties = properties;
}
public List<String> getTags() {
return tags;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
}

View File

@ -0,0 +1,23 @@
package eu.eudat.integrationevent.outbox.descriptiontouched;
import eu.eudat.model.persist.DescriptionPersist;
public interface DescriptionTouchedIntegrationEventHandler {
void handle(DescriptionTouchedIntegrationEvent event);
static DescriptionTouchedIntegrationEvent buildEventFromPersistModel(DescriptionPersist persist) {
DescriptionTouchedIntegrationEvent event = new DescriptionTouchedIntegrationEvent();
event.setId(persist.getId());
event.setLabel(persist.getLabel());
event.setDmpId(persist.getDmpId());
event.setDmpDescriptionTemplateId(persist.getDmpDescriptionTemplateId());
event.setDescriptionTemplateId(persist.getDescriptionTemplateId());
event.setStatus(persist.getStatus());
event.setDescription(persist.getDescription());
event.setProperties(persist.getProperties());
event.setTags(persist.getTags());
return event;
}
}

View File

@ -0,0 +1,34 @@
package eu.eudat.integrationevent.outbox.descriptiontouched;
import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent;
import eu.eudat.integrationevent.outbox.OutboxService;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DescriptionTouchedIntegrationEventHandlerImpl implements DescriptionTouchedIntegrationEventHandler {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DescriptionTouchedIntegrationEventHandlerImpl.class));
private final OutboxService outboxService;
public DescriptionTouchedIntegrationEventHandlerImpl(OutboxService outboxService) {
this.outboxService = outboxService;
}
@Override
public void handle(DescriptionTouchedIntegrationEvent event) {
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
message.setMessageId(UUID.randomUUID());
message.setType(OutboxIntegrationEvent.DESCRIPTION_TOUCH);
message.setEvent(event);
this.outboxService.publish(message);
}
}

View File

@ -0,0 +1,116 @@
package eu.eudat.integrationevent.outbox.dmptouched;
import eu.eudat.commons.enums.DmpAccessType;
import eu.eudat.commons.enums.DmpStatus;
import eu.eudat.integrationevent.TrackedEvent;
import eu.eudat.model.persist.DmpDescriptionTemplatePersist;
import eu.eudat.model.persist.dmpproperties.DmpBlueprintValuePersist;
import eu.eudat.model.persist.dmpproperties.DmpContactPersist;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public class DmpTouchedIntegrationEvent extends TrackedEvent {
private UUID id;
private String label;
private DmpStatus status;
private List<DmpContactPersist> contacts;
private Map<UUID, DmpBlueprintValuePersist> dmpBlueprintValues;
private String description;
private String language;
private UUID blueprint;
private DmpAccessType accessType;
private List<DmpDescriptionTemplatePersist> descriptionTemplates;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public DmpStatus getStatus() {
return status;
}
public void setStatus(DmpStatus status) {
this.status = status;
}
public List<DmpContactPersist> getContacts() {
return contacts;
}
public void setContacts(List<DmpContactPersist> contacts) {
this.contacts = contacts;
}
public Map<UUID, DmpBlueprintValuePersist> getDmpBlueprintValues() {
return dmpBlueprintValues;
}
public void setDmpBlueprintValues(Map<UUID, DmpBlueprintValuePersist> dmpBlueprintValues) {
this.dmpBlueprintValues = dmpBlueprintValues;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public UUID getBlueprint() {
return blueprint;
}
public void setBlueprint(UUID blueprint) {
this.blueprint = blueprint;
}
public DmpAccessType getAccessType() {
return accessType;
}
public void setAccessType(DmpAccessType accessType) {
this.accessType = accessType;
}
public List<DmpDescriptionTemplatePersist> getDescriptionTemplates() {
return descriptionTemplates;
}
public void setDescriptionTemplates(List<DmpDescriptionTemplatePersist> descriptionTemplates) {
this.descriptionTemplates = descriptionTemplates;
}
}

View File

@ -0,0 +1,24 @@
package eu.eudat.integrationevent.outbox.dmptouched;
import eu.eudat.model.persist.DmpPersist;
public interface DmpTouchedIntegrationEventHandler {
void handle(DmpTouchedIntegrationEvent event);
static DmpTouchedIntegrationEvent buildEventFromPersistModel(DmpPersist persist) {
DmpTouchedIntegrationEvent event = new DmpTouchedIntegrationEvent();
event.setId(persist.getId());
event.setLabel(persist.getLabel());
event.setStatus(persist.getStatus());
event.setContacts(persist.getProperties().getContacts());
event.setDmpBlueprintValues(persist.getProperties().getDmpBlueprintValues());
event.setDescription(persist.getDescription());
event.setLanguage(persist.getLanguage());
event.setBlueprint(persist.getBlueprint());
event.setAccessType(persist.getAccessType());
event.setDescriptionTemplates(persist.getDescriptionTemplates());
return event;
}
}

View File

@ -0,0 +1,35 @@
package eu.eudat.integrationevent.outbox.dmptouched;
import eu.eudat.integrationevent.outbox.OutboxIntegrationEvent;
import eu.eudat.integrationevent.outbox.OutboxService;
import eu.eudat.integrationevent.outbox.tenantremoval.TenantRemovalIntegrationEventHandlerImpl;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.UUID;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DmpTouchedIntegrationEventHandlerImpl implements DmpTouchedIntegrationEventHandler {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(DmpTouchedIntegrationEventHandlerImpl.class));
private final OutboxService outboxService;
public DmpTouchedIntegrationEventHandlerImpl(OutboxService outboxService) {
this.outboxService = outboxService;
}
@Override
public void handle(DmpTouchedIntegrationEvent event) {
OutboxIntegrationEvent message = new OutboxIntegrationEvent();
message.setMessageId(UUID.randomUUID());
message.setType(OutboxIntegrationEvent.DMP_TOUCH);
message.setEvent(event);
this.outboxService.publish(message);
}
}

View File

@ -2,7 +2,13 @@ package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ReferenceTypeDataEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.ReferenceTypeBuilder;
import eu.eudat.model.builder.dmpblueprintdefinition.ReferenceFieldBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ReferenceTypeData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ReferenceTypeData;
import eu.eudat.model.dmpblueprintdefinition.ReferenceTypeField;
import eu.eudat.query.ReferenceTypeQuery;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -15,9 +21,14 @@ import org.springframework.stereotype.Component;
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ReferenceTypeDataBuilder extends BaseFieldDataBuilder<ReferenceTypeData, ReferenceTypeDataEntity> { public class ReferenceTypeDataBuilder extends BaseFieldDataBuilder<ReferenceTypeData, ReferenceTypeDataEntity> {
private final QueryFactory queryFactory;
private final BuilderFactory builderFactory;
@Autowired @Autowired
public ReferenceTypeDataBuilder(ConventionService conventionService) { public ReferenceTypeDataBuilder(ConventionService conventionService, QueryFactory queryFactory, BuilderFactory builderFactory) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(ReferenceTypeDataBuilder.class))); super(conventionService, new LoggerService(LoggerFactory.getLogger(ReferenceTypeDataBuilder.class)));
this.queryFactory = queryFactory;
this.builderFactory = builderFactory;
} }
protected ReferenceTypeData getInstance() { protected ReferenceTypeData getInstance() {
@ -26,6 +37,8 @@ public class ReferenceTypeDataBuilder extends BaseFieldDataBuilder<ReferenceType
@Override @Override
protected void buildChild(FieldSet fields, ReferenceTypeDataEntity d, ReferenceTypeData m) { protected void buildChild(FieldSet fields, ReferenceTypeDataEntity d, ReferenceTypeData m) {
if (fields.hasField(this.asIndexer(ReferenceTypeData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect()); if (fields.hasField(this.asIndexer(ReferenceTypeData._multipleSelect))) m.setMultipleSelect(d.getMultipleSelect());
if (fields.hasField(this.asIndexer(ReferenceTypeData._referenceTypeId))) m.setReferenceTypeId(d.getReferenceTypeId());
FieldSet referenceTypeFields = fields.extractPrefixed(this.asPrefix(ReferenceTypeData._referenceType));
if (d.getReferenceTypeId() != null && !referenceTypeFields.isEmpty() ) m.setReferenceType(this.builderFactory.builder(ReferenceTypeBuilder.class).build(referenceTypeFields, this.queryFactory.query(ReferenceTypeQuery.class).ids(d.getReferenceTypeId()).first())); //TODO: Optimize
} }
} }

View File

@ -1,13 +1,15 @@
package eu.eudat.model.descriptiontemplatedefinition.fielddata; package eu.eudat.model.descriptiontemplatedefinition.fielddata;
import eu.eudat.model.ReferenceType;
import java.util.UUID; import java.util.UUID;
public class ReferenceTypeData extends BaseFieldData { public class ReferenceTypeData extends BaseFieldData {
private Boolean multipleSelect; private Boolean multipleSelect;
public final static String _multipleSelect = "multipleSelect"; public final static String _multipleSelect = "multipleSelect";
private UUID referenceTypeId; private ReferenceType referenceType;
public final static String _referenceTypeId = "referenceTypeId"; public final static String _referenceType = "referenceType";
public Boolean getMultipleSelect() { public Boolean getMultipleSelect() {
return multipleSelect; return multipleSelect;
} }
@ -15,11 +17,11 @@ public class ReferenceTypeData extends BaseFieldData {
this.multipleSelect = multipleSelect; this.multipleSelect = multipleSelect;
} }
public UUID getReferenceTypeId() { public ReferenceType getReferenceType() {
return referenceTypeId; return referenceType;
} }
public void setReferenceTypeId(UUID referenceTypeId) { public void setReferenceType(ReferenceType referenceType) {
this.referenceTypeId = referenceTypeId; this.referenceType = referenceType;
} }
} }

View File

@ -20,6 +20,8 @@ import eu.eudat.data.*;
import eu.eudat.errorcode.ErrorThesaurusProperties; import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.DescriptionTouchedEvent; import eu.eudat.event.DescriptionTouchedEvent;
import eu.eudat.event.EventBroker; import eu.eudat.event.EventBroker;
import eu.eudat.integrationevent.outbox.descriptiontouched.DescriptionTouchedIntegrationEvent;
import eu.eudat.integrationevent.outbox.descriptiontouched.DescriptionTouchedIntegrationEventHandler;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent; import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler; import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
import eu.eudat.model.*; import eu.eudat.model.*;
@ -94,22 +96,22 @@ public class DescriptionServiceImpl implements DescriptionService {
private final ValidatorFactory validatorFactory; private final ValidatorFactory validatorFactory;
private final StorageFileProperties storageFileConfig; private final StorageFileProperties storageFileConfig;
private final StorageFileService storageFileService; private final StorageFileService storageFileService;
private final DescriptionTouchedIntegrationEventHandler descriptionTouchedIntegrationEventHandler;
@Autowired @Autowired
public DescriptionServiceImpl( public DescriptionServiceImpl(
EntityManager entityManager, EntityManager entityManager,
AuthorizationService authorizationService, AuthorizationService authorizationService,
DeleterFactory deleterFactory, DeleterFactory deleterFactory,
BuilderFactory builderFactory, BuilderFactory builderFactory,
ConventionService conventionService, ConventionService conventionService,
ErrorThesaurusProperties errors, ErrorThesaurusProperties errors,
MessageSource messageSource, MessageSource messageSource,
EventBroker eventBroker, EventBroker eventBroker,
QueryFactory queryFactory, QueryFactory queryFactory,
JsonHandlingService jsonHandlingService, JsonHandlingService jsonHandlingService,
UserScope userScope, UserScope userScope,
XmlHandlingService xmlHandlingService, NotifyIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService, ValidatorFactory validatorFactory, StorageFileProperties storageFileConfig, StorageFileService storageFileService) { XmlHandlingService xmlHandlingService, NotifyIntegrationEventHandler eventHandler, NotificationProperties notificationProperties, FileTransformerService fileTransformerService, ElasticService elasticService, ValidatorFactory validatorFactory, StorageFileProperties storageFileConfig, StorageFileService storageFileService, DescriptionTouchedIntegrationEventHandler descriptionTouchedIntegrationEventHandler) {
this.entityManager = entityManager; this.entityManager = entityManager;
this.authorizationService = authorizationService; this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory; this.deleterFactory = deleterFactory;
@ -129,6 +131,7 @@ public class DescriptionServiceImpl implements DescriptionService {
this.validatorFactory = validatorFactory; this.validatorFactory = validatorFactory;
this.storageFileConfig = storageFileConfig; this.storageFileConfig = storageFileConfig;
this.storageFileService = storageFileService; this.storageFileService = storageFileService;
this.descriptionTouchedIntegrationEventHandler = descriptionTouchedIntegrationEventHandler;
} }
//region Persist //region Persist
@ -202,6 +205,8 @@ public class DescriptionServiceImpl implements DescriptionService {
//this.deleteOldFilesAndAddNew(datasetWizardModel, userInfo); //TODO //this.deleteOldFilesAndAddNew(datasetWizardModel, userInfo); //TODO
this.eventBroker.emit(new DescriptionTouchedEvent(data.getId())); this.eventBroker.emit(new DescriptionTouchedEvent(data.getId()));
this.descriptionTouchedIntegrationEventHandler.handle(DescriptionTouchedIntegrationEventHandler.buildEventFromPersistModel(model));
this.elasticService.persistDescription(data); this.elasticService.persistDescription(data);
return this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Description._id), data); return this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Description._id), data);
} }

View File

@ -23,6 +23,7 @@ import eu.eudat.data.*;
import eu.eudat.errorcode.ErrorThesaurusProperties; import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.DmpTouchedEvent; import eu.eudat.event.DmpTouchedEvent;
import eu.eudat.event.EventBroker; import eu.eudat.event.EventBroker;
import eu.eudat.integrationevent.outbox.dmptouched.DmpTouchedIntegrationEventHandler;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent; import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler; import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
import eu.eudat.model.*; import eu.eudat.model.*;
@ -120,6 +121,8 @@ public class DmpServiceImpl implements DmpService {
private final ElasticService elasticService; private final ElasticService elasticService;
private final DmpTouchedIntegrationEventHandler dmpTouchedIntegrationEventHandler;
@Autowired @Autowired
public DmpServiceImpl( public DmpServiceImpl(
EntityManager entityManager, EntityManager entityManager,
@ -140,7 +143,7 @@ public class DmpServiceImpl implements DmpService {
ActionConfirmationService actionConfirmationService, ActionConfirmationService actionConfirmationService,
FileTransformerService fileTransformerService, FileTransformerService fileTransformerService,
ValidatorFactory validatorFactory, ValidatorFactory validatorFactory,
ElasticService elasticService) { ElasticService elasticService, DmpTouchedIntegrationEventHandler dmpTouchedIntegrationEventHandler) {
this.entityManager = entityManager; this.entityManager = entityManager;
this.authorizationService = authorizationService; this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory; this.deleterFactory = deleterFactory;
@ -160,6 +163,7 @@ public class DmpServiceImpl implements DmpService {
this.actionConfirmationService = actionConfirmationService; this.actionConfirmationService = actionConfirmationService;
this.validatorFactory = validatorFactory; this.validatorFactory = validatorFactory;
this.elasticService = elasticService; this.elasticService = elasticService;
this.dmpTouchedIntegrationEventHandler = dmpTouchedIntegrationEventHandler;
} }
public Dmp persist(DmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException { public Dmp persist(DmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, IOException {
@ -178,6 +182,8 @@ public class DmpServiceImpl implements DmpService {
this.eventBroker.emit(new DmpTouchedEvent(data.getId())); this.eventBroker.emit(new DmpTouchedEvent(data.getId()));
this.dmpTouchedIntegrationEventHandler.handle(DmpTouchedIntegrationEventHandler.buildEventFromPersistModel(model));
this.sendNotification(data); this.sendNotification(data);
this.elasticService.persistDmp(data); this.elasticService.persistDmp(data);

View File

@ -33,6 +33,8 @@ queue:
tenant-user-invite-topic: tenant.invite tenant-user-invite-topic: tenant.invite
user-touch-topic: user.touch user-touch-topic: user.touch
user-removal-topic: user.remove user-removal-topic: user.remove
dmp-touch-topic: dmp.touch
description-touch-topic: description.touch
what-you-know-about-me-completed-topic: whatyouknowaboutme.completed what-you-know-about-me-completed-topic: whatyouknowaboutme.completed
generate-file-topic: generate.file generate-file-topic: generate.file
rabbitmq: rabbitmq:

View File

@ -1,5 +1,5 @@
DO $$DECLARE DO $$DECLARE
this_version CONSTANT varchar := '00.01.050'; this_version CONSTANT varchar := '00.01.048';
BEGIN BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
@ -30,6 +30,6 @@ BEGIN
ON DELETE NO ACTION ON DELETE NO ACTION
); );
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.050', '2024-02-13 12:00:00.000000+02', now(), 'Add tables ant_Tenant and ant_TenantConfiguration.'); INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.048', '2024-02-13 12:00:00.000000+02', now(), 'Add tables ant_Tenant and ant_TenantConfiguration.');
END$$; END$$;

View File

@ -1,5 +1,5 @@
DO $$DECLARE DO $$DECLARE
this_version CONSTANT varchar := '00.01.048'; this_version CONSTANT varchar := '00.01.049';
BEGIN BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
@ -21,12 +21,12 @@ BEGIN
is_active smallint NOT NULL, is_active smallint NOT NULL,
CONSTRAINT "ant_QueryInbox_pkey" PRIMARY KEY (id), CONSTRAINT "ant_QueryInbox_pkey" PRIMARY KEY (id),
CONSTRAINT "ant_QueryInbox_tenant_fkey" FOREIGN KEY (tenant) CONSTRAINT "ant_QueryInbox_tenant_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE REFERENCES public."ant_Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE NO ACTION ON DELETE NO ACTION
NOT VALID NOT VALID
); );
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.048', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_QueueInbox.'); INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.049', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_QueueInbox.');
END$$; END$$;

View File

@ -1,5 +1,5 @@
DO $$DECLARE DO $$DECLARE
this_version CONSTANT varchar := '00.01.049'; this_version CONSTANT varchar := '00.01.050';
BEGIN BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version; PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF; IF FOUND THEN RETURN; END IF;
@ -21,11 +21,11 @@ BEGIN
is_active smallint NOT NULL, is_active smallint NOT NULL,
CONSTRAINT "ant_QueueOutbox_pkey" PRIMARY KEY (id), CONSTRAINT "ant_QueueOutbox_pkey" PRIMARY KEY (id),
CONSTRAINT "ant_QueueOutbox_tenant_fkey" FOREIGN KEY (tenant) CONSTRAINT "ant_QueueOutbox_tenant_fkey" FOREIGN KEY (tenant)
REFERENCES public."Tenant" (id) MATCH SIMPLE REFERENCES public."ant_Tenant" (id) MATCH SIMPLE
ON UPDATE NO ACTION ON UPDATE NO ACTION
ON DELETE NO ACTION ON DELETE NO ACTION
); );
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.049', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_QueueOutbox.'); INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.050', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_QueueOutbox.');
END$$; END$$;

View File

@ -0,0 +1,22 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.01.055';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE IF NOT EXISTS public."ant_Annotation"
(
"id" uuid NOT NULL,
"entity_id" uuid NOT NULL,
"entity_type" character varying(512) COLLATE pg_catalog."default" NOT NULL,
"anchor" character varying(512) COLLATE pg_catalog."default",
"payload" text COLLATE pg_catalog."default",
"created_at" timestamp without time zone NOT NULL,
"updated_at" timestamp without time zone NOT NULL,
"is_active" smallint NOT NULL,
CONSTRAINT "ant_Annotation_pkey" PRIMARY KEY (id)
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.055', '2024-02-20 12:00:00.000000+02', now(), 'Add table ant_Annotation.');
END$$;

View File

@ -0,0 +1,24 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.01.056';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
CREATE TABLE IF NOT EXISTS public."ant_EntityUser"
(
"id" uuid NOT NULL,
"entity_id" uuid NOT NULL,
"user_id" uuid NOT NULL,
"created_at" timestamp without time zone NOT NULL,
"updated_at" timestamp without time zone NOT NULL,
"is_active" smallint NOT NULL,
CONSTRAINT "ant_EntityUser_pkey" PRIMARY KEY (id),
CONSTRAINT "ant_EntityUser_user_fkey" FOREIGN KEY ("user_id")
REFERENCES public."ant_User" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
);
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.056', '2024-02-20 12:00:00.000000+02', now(), 'Add table ant_EntityUser.');
END$$;

View File

@ -6,6 +6,7 @@ import { UserDescriptionTemplateRole } from "@app/core/common/enum/user-descript
import { BaseEntity } from "@common/base/base-entity.model"; import { BaseEntity } from "@common/base/base-entity.model";
import { Guid } from "@common/types/guid"; import { Guid } from "@common/types/guid";
import { DescriptionTemplateType } from "../description-template-type/description-template-type"; import { DescriptionTemplateType } from "../description-template-type/description-template-type";
import { ReferenceType } from "../reference-type/reference-type";
import { User } from "../user/user"; import { User } from "../user/user";
@ -108,7 +109,7 @@ export interface DescriptionTemplateExternalDatasetData extends DescriptionTempl
} }
export interface DescriptionTemplateReferenceTypeData extends DescriptionTemplateLabelAndMultiplicityData { export interface DescriptionTemplateReferenceTypeData extends DescriptionTemplateLabelAndMultiplicityData {
referenceTypeId?: Guid; referenceType?: ReferenceType;
} }
export interface DescriptionTemplateRadioBoxData extends DescriptionTemplateBaseFieldData { export interface DescriptionTemplateRadioBoxData extends DescriptionTemplateBaseFieldData {

View File

@ -43,6 +43,7 @@ export interface DescriptionField {
textListValue: string[]; textListValue: string[];
dateValue: Date; dateValue: Date;
externalIdentifier?: DescriptionExternalIdentifier; externalIdentifier?: DescriptionExternalIdentifier;
references: Reference[];
} }
export interface DescriptionExternalIdentifier { export interface DescriptionExternalIdentifier {

View File

@ -1184,7 +1184,7 @@ export class DescriptionTemplateReferenceTypeDataEditorModel extends Description
fromModel(item: DescriptionTemplateReferenceTypeData): DescriptionTemplateReferenceTypeDataEditorModel { fromModel(item: DescriptionTemplateReferenceTypeData): DescriptionTemplateReferenceTypeDataEditorModel {
if (item) { if (item) {
super.fromModel(item); super.fromModel(item);
this.referenceTypeId = item.referenceTypeId; this.referenceTypeId = item.referenceType?.id;
} }
return this; return this;
} }

View File

@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplateType } from '@app/core/model/description-template-type/description-template-type'; import { DescriptionTemplateType } from '@app/core/model/description-template-type/description-template-type';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelAndMultiplicityData, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { BaseEditorResolver } from '@common/base/base-editor.resolver'; import { BaseEditorResolver } from '@common/base/base-editor.resolver';
@ -72,7 +73,8 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.value)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.value)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateLabelAndMultiplicityData>(x => x.multipleSelect)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateLabelAndMultiplicityData>(x => x.multipleSelect)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalDatasetData>(x => x.type)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalDatasetData>(x => x.type)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateReferenceTypeData>(x => x.referenceTypeId)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateReferenceTypeData>(x => x.referenceType), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateReferenceTypeData>(x => x.referenceType), nameof<ReferenceType>(x => x.name)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.maxFileSizeInMB)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.maxFileSizeInMB)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.label)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.label)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.value)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.value)].join('.'),

View File

@ -225,6 +225,7 @@ export class DescriptionPropertyDefinitionEditorModel implements DescriptionProp
textListValue: undefined, textListValue: undefined,
dateValue: undefined, dateValue: undefined,
externalIdentifier: undefined, externalIdentifier: undefined,
references: undefined
}); });
}) })
fieldSetValue.items = [{ fieldSetValue.items = [{
@ -429,8 +430,8 @@ export class DescriptionFieldEditorModel implements DescriptionFieldPersist {
this.textListValue = item.textListValue; this.textListValue = item.textListValue;
this.dateValue = item.dateValue; this.dateValue = item.dateValue;
//TODO: refactor reference type //TODO: refactor reference type
//this.references = descriptionReferences?.filter(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active).map(x => x.reference); // this.references = descriptionReferences?.filter(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active).map(x => x.reference);
//this.reference = descriptionReferences?.find(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active)?.reference; // this.reference = descriptionReferences?.find(x => x.data?.fieldId == descriptionTemplateField?.id && x.isActive == IsActive.Active)?.reference;
this.externalIdentifier = new DescriptionExternalIdentifierEditorModel(this.validationErrorModel).fromModel(item.externalIdentifier); this.externalIdentifier = new DescriptionExternalIdentifierEditorModel(this.validationErrorModel).fromModel(item.externalIdentifier);
} }
return this; return this;

View File

@ -1,9 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateExternalDatasetData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateReferenceTypeData, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData, DescriptionTemplateSelectOption, DescriptionTemplateUploadData, DescriptionTemplateUploadOption } from '@app/core/model/description-template/description-template';
import { Description, DescriptionExternalIdentifier, DescriptionField, DescriptionPropertyDefinition, DescriptionPropertyDefinitionFieldSet, DescriptionPropertyDefinitionFieldSetItem, DescriptionReference, DescriptionTag } from '@app/core/model/description/description'; import { Description, DescriptionExternalIdentifier, DescriptionField, DescriptionPropertyDefinition, DescriptionPropertyDefinitionFieldSet, DescriptionPropertyDefinitionFieldSetItem, DescriptionReference, DescriptionTag } from '@app/core/model/description/description';
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp'; import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference'; import { Reference } from '@app/core/model/reference/reference';
import { Tag } from '@app/core/model/tag/tag'; import { Tag } from '@app/core/model/tag/tag';
import { DescriptionService } from '@app/core/services/description/description.service'; import { DescriptionService } from '@app/core/services/description/description.service';
@ -101,7 +102,8 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalDatasetData>(x => x.type)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalDatasetData>(x => x.type)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.maxFileSizeInMB)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.maxFileSizeInMB)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.label)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.label)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateUploadData>(x => x.types), nameof<DescriptionTemplateUploadOption>(x => x.value)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateReferenceTypeData>(x => x.referenceType), nameof<ReferenceType>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateReferenceTypeData>(x => x.referenceType), nameof<ReferenceType>(x => x.name)].join('.'),
] ]
} }

View File

@ -16,12 +16,12 @@
</mat-form-field> </mat-form-field>
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REFERENCE_TYPES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REFERENCE_TYPES" class="col-12">
<!-- <ng-container *ngIf="field.data.multipleSelect"> <ng-container *ngIf="field.data.multipleSelect">
<app-reference-field-component [form]="propertiesFormGroup?.get(field.id).get('references')" [label]="field.label" [placeholder]="(field.data.label | translate) + (isRequired ? ' *': '')" [referenceType]="field." [multiple]="true" [required]="isRequired" hint="{{ 'TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT' | translate }}"></app-reference-field-component> <app-reference-field-component [form]="propertiesFormGroup?.get(field.id).get('references')" [label]="field.label" [placeholder]="(field.data.label | translate) + (isRequired ? ' *': '')" [referenceType]="field.data.referenceType" [multiple]="true" [required]="isRequired" hint="{{ 'TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT' | translate }}"></app-reference-field-component>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multipleSelect)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-reference-field-component [form]="propertiesFormGroup?.get(field.id).get('reference')" [label]="field.label" [placeholder]="(field.data.label | translate) + (isRequired ? ' *': '')" [referenceType]="field." [multiple]="false" [required]="isRequired" hint="{{ 'TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT' | translate }}"></app-reference-field-component> <app-reference-field-component [form]="propertiesFormGroup?.get(field.id).get('reference')" [label]="field.label" [placeholder]="(field.data.label | translate) + (isRequired ? ' *': '')" [referenceType]="field.data.referenceType" [multiple]="false" [required]="isRequired" hint="{{ 'TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT' | translate }}"></app-reference-field-component>
</ng-container> --> </ng-container>
</div> </div>
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12">
<div class="row"> <div class="row">

View File

@ -6,6 +6,14 @@
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-hint *ngIf="hint">{{hint}}</mat-hint> <mat-hint *ngIf="hint">{{hint}}</mat-hint>
</mat-form-field> </mat-form-field>
<mat-form-field class="w-100" *ngIf="singleAutoCompleteSearchConfiguration">
<mat-label>{{label ?? referenceType?.name}}</mat-label>
<app-single-auto-complete placeholder="{{ placeholder ?? referenceType?.name}}" [formControl]="form" [configuration]="singleAutoCompleteSearchConfiguration" [required]="required">
</app-single-auto-complete>
<mat-error *ngIf="form.hasError('backendError')">{{form.getError('backendError').message}}</mat-error>
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-hint *ngIf="hint">{{hint}}</mat-hint>
</mat-form-field>
<div class="mb-4"> <div class="mb-4">
<span *ngIf="!form.disabled" class="not-found">{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}}</span> <span *ngIf="!form.disabled" class="not-found">{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}}</span>
<span *ngIf="!form.disabled" class="insert-manually" (click)="addReference($event)">{{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}}</span> <span *ngIf="!form.disabled" class="insert-manually" (click)="addReference($event)">{{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}}</span>

View File

@ -4,6 +4,7 @@ import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { ReferenceService } from '@app/core/services/reference/reference.service'; import { ReferenceService } from '@app/core/services/reference/reference.service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { BaseComponent } from '@common/base/base.component'; import { BaseComponent } from '@common/base/base.component';
@Component({ @Component({
@ -22,6 +23,7 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
@Input() placeholder: string; @Input() placeholder: string;
multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration; multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration;
singleAutoCompleteSearchConfiguration: SingleAutoCompleteConfiguration;
constructor( constructor(
private referenceService: ReferenceService, private referenceService: ReferenceService,
@ -29,7 +31,11 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
) { super(); } ) { super(); }
ngOnInit() { ngOnInit() {
this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id); if (this.multiple) {
this.multipleAutoCompleteSearchConfiguration = this.referenceService.getMultipleAutoCompleteSearchConfiguration(this.referenceType.id);
} else {
this.singleAutoCompleteSearchConfiguration = this.referenceService.getSingleAutocompleteSearchConfiguration(this.referenceType.id);
}
} }
addReference() { addReference() {