DescriptionTemplate refactor

This commit is contained in:
Efstratios Giannopoulos 2023-10-30 18:02:20 +02:00
parent 477e4e498e
commit 2b074f268d
37 changed files with 943 additions and 157 deletions

View File

@ -17,7 +17,7 @@ public class RadioBoxDataEntity extends BaseFieldDataEntity<RadioBoxDataEntity>
public FieldType getFieldType() { public FieldType getFieldType() {
return FieldType.RADIO_BOX; return FieldType.RADIO_BOX;
} }
public class Option implements XmlSerializable<Option> { public static class Option implements XmlSerializable<Option> {
private String label; private String label;
private String value; private String value;

View File

@ -18,7 +18,7 @@ public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> {
public FieldType getFieldType() { public FieldType getFieldType() {
return FieldType.UPLOAD; return FieldType.UPLOAD;
} }
public class Option implements XmlSerializable<UploadDataEntity.Option> { public static class Option implements XmlSerializable<UploadDataEntity.Option> {
private String label; private String label;
private String value; private String value;
@ -82,7 +82,7 @@ public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> {
if (data != null) { if (data != null) {
List<Map<String, String>> types = ((Map<String, List<Map<String, String>>>) data).get("types"); List<Map<String, String>> types = ((Map<String, List<Map<String, String>>>) data).get("types");
for (Map<String, String> map : types) { for (Map<String, String> map : types) {
UploadDataEntity.Option newOption = new UploadDataEntity.Option(); UploadDataEntity.Option newOption = new Option();
newOption.setLabel(map.get("label")); newOption.setLabel(map.get("label"));
newOption.setValue(map.get("value")); newOption.setValue(map.get("value"));
this.types.add(newOption); this.types.add(newOption);
@ -130,7 +130,7 @@ public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> {
for (int temp = 0; temp < optionElements.getLength(); temp++) { for (int temp = 0; temp < optionElements.getLength(); temp++) {
Node optionElement = optionElements.item(temp); Node optionElement = optionElements.item(temp);
if (optionElement.getNodeType() == Node.ELEMENT_NODE) { if (optionElement.getNodeType() == Node.ELEMENT_NODE) {
this.types.add(new UploadDataEntity.Option().fromXml((Element) optionElement)); this.types.add(new Option().fromXml((Element) optionElement));
} }
} }
} }

View File

@ -0,0 +1,80 @@
package eu.eudat.data;
import eu.eudat.data.old.UserInfo;
import eu.eudat.data.old.helpers.EntityBinder;
import eu.eudat.queryable.queryableentity.DataEntity;
import jakarta.persistence.*;
import org.hibernate.annotations.GenericGenerator;
import java.util.List;
import java.util.UUID;
@Entity
@Table(name = "\"UserDatasetProfile\"")
public class UserDatasetProfile implements DataEntity<UserDatasetProfile, UUID> {
@Id
@GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "usr")
private UserInfo user;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "\"descriptionTemplate\"")
private DescriptionTemplateEntity descriptionTemplate;
@Column(name = "role")
private Integer role;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public UserInfo getUser() {
return user;
}
public void setUser(UserInfo user) {
this.user = user;
}
public DescriptionTemplateEntity getDatasetProfile() {
return descriptionTemplate;
}
public void setDatasetProfile(DescriptionTemplateEntity descriptionTemplateEntity) {
this.descriptionTemplate = descriptionTemplateEntity;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
@Override
public void update(UserDatasetProfile entity) {
this.role = entity.getRole();
}
@Override
public UUID getKeys() {
return this.id;
}
@Override
public UserDatasetProfile buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
String currentBase = base.isEmpty() ? "" : base + ".";
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
return this;
}
}

View File

@ -29,13 +29,6 @@ public class DescriptionTemplatePersist {
@NotEmpty(message = "{validation.empty}") @NotEmpty(message = "{validation.empty}")
private String description = null; private String description = null;
@NotNull(message = "{validation.empty}")
@ValidId(message = "{validation.invalidid}")
private UUID groupId = null;
@NotNull(message = "{validation.empty}")
private Short version = null;
@NotNull(message = "{validation.empty}") @NotNull(message = "{validation.empty}")
@NotEmpty(message = "{validation.empty}") @NotEmpty(message = "{validation.empty}")
private String language = null; private String language = null;
@ -78,22 +71,6 @@ public class DescriptionTemplatePersist {
this.description = description; this.description = description;
} }
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
public Short getVersion() {
return version;
}
public void setVersion(Short version) {
this.version = version;
}
public String getLanguage() { public String getLanguage() {
return language; return language;
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.service.descriptiontemplate; package eu.eudat.service.descriptiontemplate;
import com.fasterxml.jackson.core.JsonProcessingException;
import eu.eudat.model.DescriptionTemplate; import eu.eudat.model.DescriptionTemplate;
import eu.eudat.model.persist.DescriptionTemplatePersist; import eu.eudat.model.persist.DescriptionTemplatePersist;
import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.exception.MyApplicationException;
@ -7,13 +8,16 @@ import gr.cite.tools.exception.MyForbiddenException;
import gr.cite.tools.exception.MyNotFoundException; import gr.cite.tools.exception.MyNotFoundException;
import gr.cite.tools.exception.MyValidationException; import gr.cite.tools.exception.MyValidationException;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import jakarta.xml.bind.JAXBException;
import javax.management.InvalidApplicationException; import javax.management.InvalidApplicationException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.util.UUID; import java.util.UUID;
public interface DescriptionTemplateService { public interface DescriptionTemplateService {
DescriptionTemplate persist(DescriptionTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException; DescriptionTemplate persist(DescriptionTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException;
void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException; void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException;

View File

@ -1,21 +1,24 @@
package eu.eudat.service.descriptiontemplate; package eu.eudat.service.descriptiontemplate;
import com.fasterxml.jackson.core.JsonProcessingException;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission; import eu.eudat.authorization.Permission;
import eu.eudat.commons.JsonHandlingService; import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.types.descriptiontemplate.*;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.EventBroker;
import eu.eudat.model.DescriptionTemplate; import eu.eudat.model.DescriptionTemplate;
import eu.eudat.model.builder.DescriptionTemplateBuilder; import eu.eudat.model.builder.DescriptionTemplateBuilder;
import eu.eudat.model.deleter.DescriptionTemplateDeleter; import eu.eudat.model.deleter.DescriptionTemplateDeleter;
import eu.eudat.model.persist.DescriptionTemplatePersist; import eu.eudat.model.persist.DescriptionTemplatePersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.*;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.deleter.DeleterFactory; import gr.cite.tools.data.deleter.DeleterFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException; import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.exception.MyForbiddenException; import gr.cite.tools.exception.MyForbiddenException;
import gr.cite.tools.exception.MyNotFoundException; import gr.cite.tools.exception.MyNotFoundException;
@ -25,6 +28,8 @@ import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry; import gr.cite.tools.logging.MapLogEntry;
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManager;
import jakarta.xml.bind.JAXBException;
import org.jetbrains.annotations.NotNull;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
@ -32,7 +37,10 @@ import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.management.InvalidApplicationException; import javax.management.InvalidApplicationException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -48,14 +56,11 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
private final DeleterFactory deleterFactory; private final DeleterFactory deleterFactory;
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
private final ConventionService conventionService; private final ConventionService conventionService;
private final MessageSource messageSource; private final MessageSource messageSource;
private final XmlHandlingService xmlHandlingService;
private final FieldDataHelperServiceProvider fieldDataHelperServiceProvider;
@Autowired @Autowired
public DescriptionTemplateServiceImpl( public DescriptionTemplateServiceImpl(
EntityManager entityManager, EntityManager entityManager,
@ -63,16 +68,20 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
DeleterFactory deleterFactory, DeleterFactory deleterFactory,
BuilderFactory builderFactory, BuilderFactory builderFactory,
ConventionService conventionService, ConventionService conventionService,
MessageSource messageSource) { MessageSource messageSource,
XmlHandlingService xmlHandlingService,
FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
this.entityManager = entityManager; this.entityManager = entityManager;
this.authorizationService = authorizationService; this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory; this.deleterFactory = deleterFactory;
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
this.conventionService = conventionService; this.conventionService = conventionService;
this.messageSource = messageSource; this.messageSource = messageSource;
this.xmlHandlingService = xmlHandlingService;
this.fieldDataHelperServiceProvider = fieldDataHelperServiceProvider;
} }
public DescriptionTemplate persist(DescriptionTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException { public DescriptionTemplate persist(DescriptionTemplatePersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
logger.debug(new MapLogEntry("persisting data descriptionTemplateType").And("model", model).And("fields", fields)); logger.debug(new MapLogEntry("persisting data descriptionTemplateType").And("model", model).And("fields", fields));
this.authorizationService.authorizeForce(Permission.EditDescriptionTemplate); this.authorizationService.authorizeForce(Permission.EditDescriptionTemplate);
@ -82,23 +91,23 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
DescriptionTemplateEntity data; DescriptionTemplateEntity data;
if (isUpdate) { if (isUpdate) {
data = this.entityManager.find(DescriptionTemplateEntity.class, model.getId()); data = this.entityManager.find(DescriptionTemplateEntity.class, model.getId());
if (data == null) if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
} else { } else {
data = new DescriptionTemplateEntity(); data = new DescriptionTemplateEntity();
data.setId(UUID.randomUUID()); data.setId(UUID.randomUUID());
data.setIsActive(IsActive.Active); data.setIsActive(IsActive.Active);
data.setCreatedAt(Instant.now()); data.setCreatedAt(Instant.now());
data.setGroupId(UUID.randomUUID());
data.setVersion((short)1);
} }
data.setDescription(model.getDescription()); data.setDescription(model.getDescription());
data.setLabel(model.getLabel()); data.setLabel(model.getLabel());
data.setGroupId(model.getGroupId());
data.setVersion(model.getVersion());
data.setType(model.getType()); data.setType(model.getType());
data.setLanguage(model.getLanguage()); data.setLanguage(model.getLanguage());
data.setStatus(model.getStatus()); data.setStatus(model.getStatus());
data.setUpdatedAt(Instant.now()); data.setUpdatedAt(Instant.now());
data.setDefinition(this.xmlHandlingService.toXml(this.buildDefinitionEntity(model.getDefinition())));
if (isUpdate) if (isUpdate)
this.entityManager.merge(data); this.entityManager.merge(data);
else else
@ -109,6 +118,135 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(BaseFieldSet.build(fields, DescriptionTemplate._id), data); return this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrPermission).build(BaseFieldSet.build(fields, DescriptionTemplate._id), data);
} }
private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist){
DefinitionEntity data = new DefinitionEntity();
if (persist == null) return data;
if (!this.conventionService.isListNullOrEmpty(persist.getSections())){
data.setSections(new ArrayList<>());
for (SectionPersist sectionPersist: persist.getSections()) {
data.getSections().add(this.buildSectionEntity(sectionPersist));
}
}
if (!this.conventionService.isListNullOrEmpty(persist.getPages())){
data.setPages(new ArrayList<>());
for (PagePersist pagePersist: persist.getPages()) {
data.getPages().add(this.buildPageEntity(pagePersist));
}
}
return data;
}
private @NotNull SectionEntity buildSectionEntity(SectionPersist persist){
SectionEntity data = new SectionEntity();
if (persist == null) return data;
data.setId(persist.getId());
data.setDescription(persist.getDescription());
data.setOrdinal(persist.getOrdinal());
data.setDefaultVisibility(persist.getDefaultVisibility());
data.setMultiplicity(persist.getMultiplicity());
data.setPage(persist.getPage());
data.setTitle(persist.getTitle());
if (!this.conventionService.isListNullOrEmpty(persist.getSections())){
data.setSections(new ArrayList<>());
for (SectionPersist sectionPersist: persist.getSections()) {
data.getSections().add(this.buildSectionEntity(sectionPersist));
}
}
if (!this.conventionService.isListNullOrEmpty(persist.getFieldSets())){
data.setFieldSets(new ArrayList<>());
for (FieldSetPersist fieldSetPersist: persist.getFieldSets()) {
data.getFieldSets().add(this.buildFieldSetEntity(fieldSetPersist));
}
}
return data;
}
private @NotNull FieldSetEntity buildFieldSetEntity(FieldSetPersist persist){
FieldSetEntity data = new FieldSetEntity();
if (persist == null) return data;
data.setId(persist.getId());
data.setDescription(persist.getDescription());
data.setOrdinal(persist.getOrdinal());
data.setTitle(persist.getTitle());
data.setNumbering(persist.getNumbering());
data.setAdditionalInformation(persist.getAdditionalInformation());
data.setTitle(persist.getTitle());
if (persist.getMultiplicity() != null) data.setMultiplicity(this.buildMultiplicityEntity(persist.getMultiplicity()));
data.setHasCommentField(persist.getHasCommentField());
data.setTitle(persist.getTitle());
if (!this.conventionService.isListNullOrEmpty(persist.getFields())){
data.setFields(new ArrayList<>());
for (FieldPersist fieldPersist: persist.getFields()) {
data.getFields().add(this.buildFieldEntity(fieldPersist));
}
}
return data;
}
private @NotNull FieldEntity buildFieldEntity(FieldPersist persist){
FieldEntity data = new FieldEntity();
if (persist == null) return data;
data.setId(persist.getId());
data.setOrdinal(persist.getOrdinal());
data.setSchematics(persist.getSchematics());
//data.setNumbering(persist.get()); //TODO
data.setDefaultValue(persist.getDefaultValue());
data.setValidations(persist.getValidations());
data.setIncludeInExport(persist.getIncludeInExport());
if (persist.getData() != null) data.setData(this.buildFieldDataEntity(persist.getData()));
if (!this.conventionService.isListNullOrEmpty(persist.getVisibilityRules())){
data.setVisibilityRules(new ArrayList<>());
for (RulePersist fieldPersist: persist.getVisibilityRules()) {
data.getVisibilityRules().add(this.buildRuleEntity(fieldPersist));
}
}
return data;
}
private BaseFieldDataEntity<?> buildFieldDataEntity(BaseFieldDataPersist persist){
if (persist == null) return null;
return this.fieldDataHelperServiceProvider.get(persist.getFieldType()).applyPersist(persist);
}
private @NotNull RuleEntity buildRuleEntity(RulePersist persist){
RuleEntity data = new RuleEntity();
if (persist == null) return data;
data.setTarget(persist.getTarget());
data.setValue(persist.getValue());
return data;
}
private @NotNull MultiplicityEntity buildMultiplicityEntity(MultiplicityPersist persist){
MultiplicityEntity data = new MultiplicityEntity();
if (persist == null) return data;
data.setMax(persist.getMax());
data.setMin(persist.getMin());
data.setPlaceholder(persist.getPlaceholder());
data.setTableView(persist.getTableView());
return data;
}
private @NotNull PageEntity buildPageEntity(PagePersist persist){
PageEntity data = new PageEntity();
if (persist == null) return data;
data.setId(persist.getId());
data.setOrdinal(persist.getOrdinal());
data.setTitle(persist.getTitle());
return data;
}
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException { public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
logger.debug("deleting dataset: {}", id); logger.debug("deleting dataset: {}", id);

View File

@ -2,28 +2,36 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.SectionEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.AutoCompleteDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.AutoCompleteDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteData;
import eu.eudat.model.persist.descriptiontemplatedefinition.FieldSetPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.PagePersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.SectionPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.*;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<AutoCompleteData, AutoCompleteDataPersist, AutoCompleteDataEntity> {
private final ConventionService conventionService;
public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<AutoCompleteData, AutoCompleteDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
public AutoCompleteFieldDataHelperService(BuilderFactory builderFactory) { public AutoCompleteFieldDataHelperService(ConventionService conventionService, BuilderFactory builderFactory) {
this.conventionService = conventionService;
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
} }
@ -43,6 +51,11 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
return new AutoCompleteData(); return new AutoCompleteData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new AutoCompleteDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return AutoCompleteDataEntity.class; return AutoCompleteDataEntity.class;
@ -52,8 +65,65 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
return AutoCompleteData.class; return AutoCompleteData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return AutoCompleteDataPersist.class;
}
@Override @Override
public List<AutoCompleteData> buildInternal(FieldSet fieldSet, List<AutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<AutoCompleteData> buildInternal(FieldSet fieldSet, List<AutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(AutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(AutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected AutoCompleteDataEntity applyPersistInternal(AutoCompleteDataPersist persist, AutoCompleteDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
if (!this.conventionService.isListNullOrEmpty(persist.getAutoCompleteSingleDataList())){
data.setAutoCompleteSingleDataList(new ArrayList<>());
for (AutoCompleteSingleDataPersist autoCompleteSingleDataPersist: persist.getAutoCompleteSingleDataList()) {
data.getAutoCompleteSingleDataList().add(this.buildAutoCompleteSingleData(autoCompleteSingleDataPersist));
}
}
return data;
}
private @NotNull AutoCompleteDataEntity.AutoCompleteSingleData buildAutoCompleteSingleData(AutoCompleteSingleDataPersist persist){
AutoCompleteDataEntity.AutoCompleteSingleData data = new AutoCompleteDataEntity.AutoCompleteSingleData();
if (persist == null) return data;
data.setUrl(persist.getUrl());
data.setAutocompleteType(persist.getAutocompleteType());
data.setOptionsRoot(persist.getOptionsRoot());
data.setHasAuth(persist.getHasAuth());
if(persist.getAutoCompleteOptions() != null) data.setAutoCompleteOptions(this.buildOption(persist.getAutoCompleteOptions()));
if(persist.getAuth() != null) data.setAuth(this.buildAuthAutoCompleteData(persist.getAuth()));
data.setMethod(persist.getMethod());
return data;
}
private @NotNull ComboBoxDataEntity.Option buildOption(ComboBoxOptionPersist persist){
ComboBoxDataEntity.Option data = new ComboBoxDataEntity.Option();
if (persist == null) return data;
data.setLabel(persist.getLabel());
data.setValue(persist.getValue());
data.setUri(persist.getUri());
data.setSource(persist.getSource());
return data;
}
private @NotNull AutoCompleteDataEntity.AuthAutoCompleteData buildAuthAutoCompleteData(AuthAutoCompleteDataPersist persist){
AutoCompleteDataEntity.AuthAutoCompleteData data = new AutoCompleteDataEntity.AuthAutoCompleteData();
if (persist == null) return data;
data.setBody(persist.getBody());
data.setUrl(persist.getUrl());
data.setMethod(persist.getMethod());
data.setPath(persist.getPath());
data.setType(persist.getType());
return data;
}
} }

View File

@ -3,32 +3,30 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public abstract class BaseFieldDataHelperService<M extends BaseFieldData, D extends BaseFieldDataEntity<?>> implements FieldDataHelperService { public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM extends BaseFieldDataPersist, D extends BaseFieldDataEntity<?>> implements FieldDataHelperService {
protected String subType; protected String subType;
protected abstract List<M> buildInternal(FieldSet fieldSet, List<D> datas, EnumSet<AuthorizationFlags> authorizationFlags); protected abstract List<M> buildInternal(FieldSet fieldSet, List<D> datas, EnumSet<AuthorizationFlags> authorizationFlags);
protected abstract D applyPersistInternal(PM persist, D data);
@Override
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist){
BaseFieldDataEntity<?> instance = this.newDataInstance();
return this.applyPersist(persist, instance);
}
@Override
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data){
data.setLabel(persist.getLabel());
return this.applyPersistInternal((PM)persist, (D)data);
}
@Override
public boolean requireSubType(){
return false;
}
@Override
public FieldDataHelperService setSubType(String data){
subType = data;
return this;
}
@Override
public String getSubType(){
return subType;
}
@Override @Override
public BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags){ public BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags){
List<BaseFieldData> models = this.build(fieldSet, List.of(data), authorizationFlags); List<BaseFieldData> models = this.build(fieldSet, List.of(data), authorizationFlags);

View File

@ -2,23 +2,28 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.BooleanDecisionDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.BooleanDecisionDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BooleanDecisionData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BooleanDecisionData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.AutoCompleteDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.AutoCompleteSingleDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BooleanDecisionDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class BooleanDecisionFieldDataHelperService extends BaseFieldDataHelperService<BooleanDecisionData, BooleanDecisionDataPersist, BooleanDecisionDataEntity> {
public class BooleanDecisionFieldDataHelperService extends BaseFieldDataHelperService<BooleanDecisionData, BooleanDecisionDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
public BooleanDecisionFieldDataHelperService(BuilderFactory builderFactory) { public BooleanDecisionFieldDataHelperService(BuilderFactory builderFactory) {
@ -40,6 +45,11 @@ public class BooleanDecisionFieldDataHelperService extends BaseFieldDataHelperSe
return new BooleanDecisionData(); return new BooleanDecisionData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new BooleanDecisionDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return BooleanDecisionDataEntity.class; return BooleanDecisionDataEntity.class;
@ -49,8 +59,18 @@ public class BooleanDecisionFieldDataHelperService extends BaseFieldDataHelperSe
return BooleanDecisionData.class; return BooleanDecisionData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return BooleanDecisionDataPersist.class;
}
@Override @Override
public List<BooleanDecisionData> buildInternal(FieldSet fieldSet, List<BooleanDecisionDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<BooleanDecisionData> buildInternal(FieldSet fieldSet, List<BooleanDecisionDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(BooleanDecisionDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(BooleanDecisionDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected BooleanDecisionDataEntity applyPersistInternal(BooleanDecisionDataPersist persist, BooleanDecisionDataEntity data) {
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.CheckBoxDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.CheckBoxDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.CheckBoxDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.CheckBoxDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.CheckBoxData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.CheckBoxData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BooleanDecisionDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.CheckBoxDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class CheckBoxFieldDataHelperService extends BaseFieldDataHelperService<CheckBoxData, CheckBoxDataPersist, CheckBoxDataEntity> {
public class CheckBoxFieldDataHelperService extends BaseFieldDataHelperService<CheckBoxData, CheckBoxDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class CheckBoxFieldDataHelperService extends BaseFieldDataHelperService<C
return new CheckBoxData(); return new CheckBoxData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new CheckBoxDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return CheckBoxDataEntity.class; return CheckBoxDataEntity.class;
@ -52,8 +59,18 @@ public class CheckBoxFieldDataHelperService extends BaseFieldDataHelperService<C
return CheckBoxData.class; return CheckBoxData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return CheckBoxDataPersist.class;
}
@Override @Override
public List<CheckBoxData> buildInternal(FieldSet fieldSet, List<CheckBoxDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<CheckBoxData> buildInternal(FieldSet fieldSet, List<CheckBoxDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(CheckBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(CheckBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected CheckBoxDataEntity applyPersistInternal(CheckBoxDataPersist persist, CheckBoxDataEntity data) {
return data;
}
} }

View File

@ -7,6 +7,8 @@ import eu.eudat.commons.types.descriptiontemplate.fielddata.CurrencyDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.CurrencyDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.CurrencyDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.CurrencyData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.CurrencyData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.CurrencyDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +19,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class CurrencyFieldDataHelperService extends BaseFieldDataHelperService<CurrencyData, CurrencyDataPersist, CurrencyDataEntity> {
public class CurrencyFieldDataHelperService extends BaseFieldDataHelperService<CurrencyData, CurrencyDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +43,11 @@ public class CurrencyFieldDataHelperService extends BaseFieldDataHelperService<C
return new CurrencyData(); return new CurrencyData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new CurrencyDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return CurrencyDataEntity.class; return CurrencyDataEntity.class;
@ -52,8 +57,17 @@ public class CurrencyFieldDataHelperService extends BaseFieldDataHelperService<C
return CurrencyData.class; return CurrencyData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return CurrencyDataPersist.class;
}
@Override @Override
public List<CurrencyData> buildInternal(FieldSet fieldSet, List<CurrencyDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<CurrencyData> buildInternal(FieldSet fieldSet, List<CurrencyDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(CurrencyDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(CurrencyDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected CurrencyDataEntity applyPersistInternal(CurrencyDataPersist persist, CurrencyDataEntity data) {
return data;
}
} }

View File

@ -2,24 +2,28 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DataRepositoryDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DataRepositoryDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.AutoCompleteDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.AutoCompleteSingleDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DataRepositoryFieldDataHelperService extends BaseFieldDataHelperService<DataRepositoryData, DataRepositoryDataPersist, DataRepositoryDataEntity> {
public class DataRepositoryFieldDataHelperService extends BaseFieldDataHelperService<DataRepositoryData, DataRepositoryDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +47,11 @@ public class DataRepositoryFieldDataHelperService extends BaseFieldDataHelperSer
return new DataRepositoryData(); return new DataRepositoryData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new DataRepositoryDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return DataRepositoryDataEntity.class; return DataRepositoryDataEntity.class;
@ -51,9 +60,19 @@ public class DataRepositoryFieldDataHelperService extends BaseFieldDataHelperSer
public Class<?> getModelClass() { public Class<?> getModelClass() {
return DataRepositoryData.class; return DataRepositoryData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return DataRepositoryDataPersist.class;
}
@Override @Override
public List<DataRepositoryData> buildInternal(FieldSet fieldSet, List<DataRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<DataRepositoryData> buildInternal(FieldSet fieldSet, List<DataRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DataRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(DataRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
}
@Override
protected DataRepositoryDataEntity applyPersistInternal(DataRepositoryDataPersist persist, DataRepositoryDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
} }
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DatasetAutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.DatasetAutoCompleteDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DatasetAutoCompleteDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DatasetAutoCompleteDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatasetAutoCompleteData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatasetAutoCompleteData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DatasetAutoCompleteDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DatasetAutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<DatasetAutoCompleteData, DatasetAutoCompleteDataPersist, DatasetAutoCompleteDataEntity> {
public class DatasetAutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<DatasetAutoCompleteData, DatasetAutoCompleteDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class DatasetAutoCompleteFieldDataHelperService extends BaseFieldDataHelp
return new DatasetAutoCompleteData(); return new DatasetAutoCompleteData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new DatasetAutoCompleteDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return DatasetAutoCompleteDataEntity.class; return DatasetAutoCompleteDataEntity.class;
@ -52,8 +59,19 @@ public class DatasetAutoCompleteFieldDataHelperService extends BaseFieldDataHelp
return DatasetAutoCompleteData.class; return DatasetAutoCompleteData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return DatasetAutoCompleteDataPersist.class;
}
@Override @Override
public List<DatasetAutoCompleteData> buildInternal(FieldSet fieldSet, List<DatasetAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<DatasetAutoCompleteData> buildInternal(FieldSet fieldSet, List<DatasetAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatasetAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(DatasetAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected DatasetAutoCompleteDataEntity applyPersistInternal(DatasetAutoCompleteDataPersist persist, DatasetAutoCompleteDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DatasetIdentifierDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.DatasetIdentifierDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DatasetIdentifierDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DatasetIdentifierDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatasetIdentifierData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatasetIdentifierData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BooleanDecisionDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DatasetIdentifierDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DatasetIdentifierFieldDataHelperService extends BaseFieldDataHelperService<DatasetIdentifierData, DatasetIdentifierDataPersist, DatasetIdentifierDataEntity> {
public class DatasetIdentifierFieldDataHelperService extends BaseFieldDataHelperService<DatasetIdentifierData, DatasetIdentifierDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class DatasetIdentifierFieldDataHelperService extends BaseFieldDataHelper
return new DatasetIdentifierData(); return new DatasetIdentifierData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new DatasetIdentifierDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return DatasetIdentifierDataEntity.class; return DatasetIdentifierDataEntity.class;
@ -51,9 +58,18 @@ public class DatasetIdentifierFieldDataHelperService extends BaseFieldDataHelper
public Class<?> getModelClass() { public Class<?> getModelClass() {
return DatasetIdentifierData.class; return DatasetIdentifierData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return DatasetIdentifierDataPersist.class;
}
@Override @Override
public List<DatasetIdentifierData> buildInternal(FieldSet fieldSet, List<DatasetIdentifierDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<DatasetIdentifierData> buildInternal(FieldSet fieldSet, List<DatasetIdentifierDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatasetIdentifierDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(DatasetIdentifierDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected DatasetIdentifierDataEntity applyPersistInternal(DatasetIdentifierDataPersist persist, DatasetIdentifierDataEntity data) {
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DatePickerDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.DatePickerDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DatePickerDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DatePickerDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatePickerData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatePickerData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BooleanDecisionDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DatePickerDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DatePickerFieldDataHelperService extends BaseFieldDataHelperService<DatePickerData, DatePickerDataPersist, DatePickerDataEntity> {
public class DatePickerFieldDataHelperService extends BaseFieldDataHelperService<DatePickerData, DatePickerDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -42,6 +44,10 @@ public class DatePickerFieldDataHelperService extends BaseFieldDataHelperService
public BaseFieldData newModelInstance() { public BaseFieldData newModelInstance() {
return new DatePickerData(); return new DatePickerData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new DatePickerDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
@ -51,9 +57,18 @@ public class DatePickerFieldDataHelperService extends BaseFieldDataHelperService
public Class<?> getModelClass() { public Class<?> getModelClass() {
return DatePickerData.class; return DatePickerData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return DatePickerDataPersist.class;
}
@Override @Override
public List<DatePickerData> buildInternal(FieldSet fieldSet, List<DatePickerDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<DatePickerData> buildInternal(FieldSet fieldSet, List<DatePickerDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatePickerDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(DatePickerDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected DatePickerDataEntity applyPersistInternal(DatePickerDataPersist persist, DatePickerDataEntity data) {
return data;
}
} }

View File

@ -2,11 +2,15 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DmpAutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.DmpAutoCompleteDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DmpAutoCompleteDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.DmpAutoCompleteDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DmpAutoCompleteData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.DmpAutoCompleteData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DmpAutoCompleteDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class DmpAutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<DmpAutoCompleteData, DmpAutoCompleteDataPersist, DmpAutoCompleteDataEntity> {
public class DmpAutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<DmpAutoCompleteData, DmpAutoCompleteDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class DmpAutoCompleteFieldDataHelperService extends BaseFieldDataHelperSe
return new DmpAutoCompleteData(); return new DmpAutoCompleteData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new DmpAutoCompleteDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return DmpAutoCompleteDataEntity.class; return DmpAutoCompleteDataEntity.class;
@ -52,8 +59,19 @@ public class DmpAutoCompleteFieldDataHelperService extends BaseFieldDataHelperSe
return DmpAutoCompleteData.class; return DmpAutoCompleteData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return DmpAutoCompleteDataPersist.class;
}
@Override @Override
public List<DmpAutoCompleteData> buildInternal(FieldSet fieldSet, List<DmpAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<DmpAutoCompleteData> buildInternal(FieldSet fieldSet, List<DmpAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DmpAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(DmpAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected DmpAutoCompleteDataEntity applyPersistInternal(DmpAutoCompleteDataPersist persist, DmpAutoCompleteDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ExternalDatasetDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ExternalDatasetDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.ExternalDatasetDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperService<ExternalDatasetData, ExternalDatasetDataPersist, ExternalDatasetDataEntity> {
public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperService<ExternalDatasetData, ExternalDatasetDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperSe
return new ExternalDatasetData(); return new ExternalDatasetData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new ExternalDatasetDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return ExternalDatasetDataEntity.class; return ExternalDatasetDataEntity.class;
@ -51,9 +58,20 @@ public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperSe
public Class<?> getModelClass() { public Class<?> getModelClass() {
return ExternalDatasetData.class; return ExternalDatasetData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return ExternalDatasetDataPersist.class;
}
@Override @Override
public List<ExternalDatasetData> buildInternal(FieldSet fieldSet, List<ExternalDatasetDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<ExternalDatasetData> buildInternal(FieldSet fieldSet, List<ExternalDatasetDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ExternalDatasetDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(ExternalDatasetDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected ExternalDatasetDataEntity applyPersistInternal(ExternalDatasetDataPersist persist, ExternalDatasetDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
data.setType(persist.getType());
return data;
}
} }

View File

@ -4,6 +4,7 @@ import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import java.util.EnumSet; import java.util.EnumSet;
@ -11,13 +12,14 @@ import java.util.List;
public interface FieldDataHelperService { public interface FieldDataHelperService {
FieldType getFormType(); FieldType getFormType();
String getSubType();
BaseFieldDataEntity<?> newDataInstance(); BaseFieldDataEntity<?> newDataInstance();
BaseFieldData newModelInstance(); BaseFieldData newModelInstance();
BaseFieldDataPersist newPersistModelInstance();
Class<?> getDataClass(); Class<?> getDataClass();
Class<?> getModelClass(); Class<?> getModelClass();
Class<?> getPersistModelClass();
List<BaseFieldData> build(gr.cite.tools.fieldset.FieldSet fieldSet, List<BaseFieldDataEntity<?>> datas, EnumSet<AuthorizationFlags> authorizationFlags); List<BaseFieldData> build(gr.cite.tools.fieldset.FieldSet fieldSet, List<BaseFieldDataEntity<?>> datas, EnumSet<AuthorizationFlags> authorizationFlags);
BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags); BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags);
boolean requireSubType(); BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist);
FieldDataHelperService setSubType(String data); BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data);
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.FreeTextDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.FreeTextDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.FreeTextDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.FreeTextDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.FreeTextData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.FreeTextData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BooleanDecisionDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.FreeTextDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class FreeTextFieldDataHelperService extends BaseFieldDataHelperService<FreeTextData, FreeTextDataPersist, FreeTextDataEntity> {
public class FreeTextFieldDataHelperService extends BaseFieldDataHelperService<FreeTextData, FreeTextDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class FreeTextFieldDataHelperService extends BaseFieldDataHelperService<F
return new FreeTextData(); return new FreeTextData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new FreeTextDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return FreeTextDataEntity.class; return FreeTextDataEntity.class;
@ -52,8 +59,18 @@ public class FreeTextFieldDataHelperService extends BaseFieldDataHelperService<F
return FreeTextData.class; return FreeTextData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return FreeTextDataPersist.class;
}
@Override @Override
public List<FreeTextData> buildInternal(FieldSet fieldSet, List<FreeTextDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<FreeTextData> buildInternal(FieldSet fieldSet, List<FreeTextDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(FreeTextDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(FreeTextDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected FreeTextDataEntity applyPersistInternal(FreeTextDataPersist persist, FreeTextDataEntity data) {
return data;
}
} }

View File

@ -10,6 +10,9 @@ import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.JournalRep
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.JournalRepositoryData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.JournalRepositoryData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.JournalRepositoryDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -20,9 +23,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class JournalRepositoryFieldDataHelperService extends BaseFieldDataHelperService<JournalRepositoryData, JournalRepositoryDataPersist, JournalRepositoryDataEntity> {
public class JournalRepositoryFieldDataHelperService extends BaseFieldDataHelperService<JournalRepositoryData, JournalRepositoryDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -46,6 +47,11 @@ public class JournalRepositoryFieldDataHelperService extends BaseFieldDataHelper
return new JournalRepositoryData(); return new JournalRepositoryData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new JournalRepositoryDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return JournalRepositoryDataEntity.class; return JournalRepositoryDataEntity.class;
@ -54,9 +60,19 @@ public class JournalRepositoryFieldDataHelperService extends BaseFieldDataHelper
public Class<?> getModelClass() { public Class<?> getModelClass() {
return JournalRepositoryData.class; return JournalRepositoryData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return JournalRepositoryDataPersist.class;
}
@Override @Override
public List<JournalRepositoryData> buildInternal(FieldSet fieldSet, List<JournalRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<JournalRepositoryData> buildInternal(FieldSet fieldSet, List<JournalRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(JournalRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(JournalRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected JournalRepositoryDataEntity applyPersistInternal(JournalRepositoryDataPersist persist, JournalRepositoryDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.LicenseDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.LicenseDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.LicenseDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.LicenseDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.LicenseData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.LicenseData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.LicenseDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class LicenseFieldDataHelperService extends BaseFieldDataHelperService<LicenseData, LicenseDataPersist, LicenseDataEntity> {
public class LicenseFieldDataHelperService extends BaseFieldDataHelperService<LicenseData, LicenseDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class LicenseFieldDataHelperService extends BaseFieldDataHelperService<Li
return new LicenseData(); return new LicenseData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new LicenseDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return LicenseDataEntity.class; return LicenseDataEntity.class;
@ -51,9 +58,19 @@ public class LicenseFieldDataHelperService extends BaseFieldDataHelperService<Li
public Class<?> getModelClass() { public Class<?> getModelClass() {
return LicenseData.class; return LicenseData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return LicenseDataPersist.class;
}
@Override @Override
public List<LicenseData> buildInternal(FieldSet fieldSet, List<LicenseDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<LicenseData> buildInternal(FieldSet fieldSet, List<LicenseDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(LicenseDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(LicenseDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected LicenseDataEntity applyPersistInternal(LicenseDataPersist persist, LicenseDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.OrganizationDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.OrganizationDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.OrganizationDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.OrganizationDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.OrganizationData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.OrganizationData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.OrganizationDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class OrganizationFieldDataHelperService extends BaseFieldDataHelperService<OrganizationData, OrganizationDataPersist, OrganizationDataEntity> {
public class OrganizationFieldDataHelperService extends BaseFieldDataHelperService<OrganizationData, OrganizationDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class OrganizationFieldDataHelperService extends BaseFieldDataHelperServi
return new OrganizationData(); return new OrganizationData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new OrganizationDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return OrganizationDataEntity.class; return OrganizationDataEntity.class;
@ -51,9 +58,19 @@ public class OrganizationFieldDataHelperService extends BaseFieldDataHelperServi
public Class<?> getModelClass() { public Class<?> getModelClass() {
return OrganizationData.class; return OrganizationData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return OrganizationDataPersist.class;
}
@Override @Override
public List<OrganizationData> buildInternal(FieldSet fieldSet, List<OrganizationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<OrganizationData> buildInternal(FieldSet fieldSet, List<OrganizationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(OrganizationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(OrganizationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected OrganizationDataEntity applyPersistInternal(OrganizationDataPersist persist, OrganizationDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.PublicationDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.PublicationDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.PublicationDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.PublicationDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.PublicationData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.PublicationData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.PublicationDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class PublicationFieldDataHelperService extends BaseFieldDataHelperService<PublicationData, PublicationDataPersist, PublicationDataEntity> {
public class PublicationFieldDataHelperService extends BaseFieldDataHelperService<PublicationData, PublicationDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class PublicationFieldDataHelperService extends BaseFieldDataHelperServic
return new PublicationData(); return new PublicationData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new PublicationDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return PublicationDataEntity.class; return PublicationDataEntity.class;
@ -51,9 +58,19 @@ public class PublicationFieldDataHelperService extends BaseFieldDataHelperServic
public Class<?> getModelClass() { public Class<?> getModelClass() {
return PublicationData.class; return PublicationData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return PublicationDataPersist.class;
}
@Override @Override
public List<PublicationData> buildInternal(FieldSet fieldSet, List<PublicationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<PublicationData> buildInternal(FieldSet fieldSet, List<PublicationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(PublicationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(PublicationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected PublicationDataEntity applyPersistInternal(PublicationDataPersist persist, PublicationDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -10,6 +10,9 @@ import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.Publicatio
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.PublicationRepositoryData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.PublicationRepositoryData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.PublicationRepositoryDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -20,9 +23,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class PublicationRepositoryFieldDataHelperService extends BaseFieldDataHelperService<PublicationRepositoryData, PublicationRepositoryDataPersist, PublicationRepositoryDataEntity> {
public class PublicationRepositoryFieldDataHelperService extends BaseFieldDataHelperService<PublicationRepositoryData, PublicationRepositoryDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -46,6 +47,11 @@ public class PublicationRepositoryFieldDataHelperService extends BaseFieldDataHe
return new PublicationRepositoryData(); return new PublicationRepositoryData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new PublicationRepositoryDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return PublicationRepositoryDataEntity.class; return PublicationRepositoryDataEntity.class;
@ -54,9 +60,19 @@ public class PublicationRepositoryFieldDataHelperService extends BaseFieldDataHe
public Class<?> getModelClass() { public Class<?> getModelClass() {
return PublicationRepositoryData.class; return PublicationRepositoryData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return PublicationRepositoryDataPersist.class;
}
@Override @Override
public List<PublicationRepositoryData> buildInternal(FieldSet fieldSet, List<PublicationRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<PublicationRepositoryData> buildInternal(FieldSet fieldSet, List<PublicationRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(PublicationRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(PublicationRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected PublicationRepositoryDataEntity applyPersistInternal(PublicationRepositoryDataPersist persist, PublicationRepositoryDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -2,28 +2,36 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.RadioBoxDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.RadioBoxDataEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.RadioBoxDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.RadioBoxDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RadioBoxData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.RadioBoxData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.AutoCompleteSingleDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.RadioBoxDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.RadioBoxOptionPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<RadioBoxData, RadioBoxDataPersist, RadioBoxDataEntity> {
public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<RadioBoxData, RadioBoxDataEntity> { private final ConventionService conventionService;
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
public RadioBoxFieldDataHelperService(BuilderFactory builderFactory) { public RadioBoxFieldDataHelperService(ConventionService conventionService, BuilderFactory builderFactory) {
this.conventionService = conventionService;
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
} }
@ -43,6 +51,11 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
return new RadioBoxData(); return new RadioBoxData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new RadioBoxDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return RadioBoxDataEntity.class; return RadioBoxDataEntity.class;
@ -51,9 +64,34 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
public Class<?> getModelClass() { public Class<?> getModelClass() {
return RadioBoxData.class; return RadioBoxData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return RadioBoxDataPersist.class;
}
@Override @Override
public List<RadioBoxData> buildInternal(FieldSet fieldSet, List<RadioBoxDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<RadioBoxData> buildInternal(FieldSet fieldSet, List<RadioBoxDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RadioBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(RadioBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected RadioBoxDataEntity applyPersistInternal(RadioBoxDataPersist persist, RadioBoxDataEntity data) {
if (!this.conventionService.isListNullOrEmpty(persist.getOptions())){
data.setOptions(new ArrayList<>());
for (RadioBoxOptionPersist radioBoxOptionPersist: persist.getOptions()) {
data.getOptions().add(this.buildOption(radioBoxOptionPersist));
}
}
return data;
}
private @NotNull RadioBoxDataEntity.Option buildOption(RadioBoxOptionPersist persist){
RadioBoxDataEntity.Option data = new RadioBoxDataEntity.Option();
if (persist == null) return data;
data.setLabel(persist.getLabel());
data.setValue(persist.getValue());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.RegistryDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.RegistryDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.RegistryDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.RegistryDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RegistryData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.RegistryData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.RegistryDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class RegistryFieldDataHelperService extends BaseFieldDataHelperService<RegistryData, RegistryDataPersist, RegistryDataEntity> {
public class RegistryFieldDataHelperService extends BaseFieldDataHelperService<RegistryData, RegistryDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class RegistryFieldDataHelperService extends BaseFieldDataHelperService<R
return new RegistryData(); return new RegistryData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new RegistryDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return RegistryDataEntity.class; return RegistryDataEntity.class;
@ -51,9 +58,19 @@ public class RegistryFieldDataHelperService extends BaseFieldDataHelperService<R
public Class<?> getModelClass() { public Class<?> getModelClass() {
return RegistryData.class; return RegistryData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return RegistryDataPersist.class;
}
@Override @Override
public List<RegistryData> buildInternal(FieldSet fieldSet, List<RegistryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<RegistryData> buildInternal(FieldSet fieldSet, List<RegistryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RegistryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(RegistryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected RegistryDataEntity applyPersistInternal(RegistryDataPersist persist, RegistryDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ResearcherAutoCompleteDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ResearcherAutoCompleteDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ResearcherAutoCompleteDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ResearcherAutoCompleteDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ResearcherAutoCompleteData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ResearcherAutoCompleteData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.ResearcherAutoCompleteDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class ResearcherAutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<ResearcherAutoCompleteData, ResearcherAutoCompleteDataPersist, ResearcherAutoCompleteDataEntity> {
public class ResearcherAutoCompleteFieldDataHelperService extends BaseFieldDataHelperService<ResearcherAutoCompleteData, ResearcherAutoCompleteDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class ResearcherAutoCompleteFieldDataHelperService extends BaseFieldDataH
return new ResearcherAutoCompleteData(); return new ResearcherAutoCompleteData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new ResearcherAutoCompleteDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return ResearcherAutoCompleteDataEntity.class; return ResearcherAutoCompleteDataEntity.class;
@ -51,9 +58,19 @@ public class ResearcherAutoCompleteFieldDataHelperService extends BaseFieldDataH
public Class<?> getModelClass() { public Class<?> getModelClass() {
return ResearcherAutoCompleteData.class; return ResearcherAutoCompleteData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return ResearcherAutoCompleteDataPersist.class;
}
@Override @Override
public List<ResearcherAutoCompleteData> buildInternal(FieldSet fieldSet, List<ResearcherAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<ResearcherAutoCompleteData> buildInternal(FieldSet fieldSet, List<ResearcherAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ResearcherAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(ResearcherAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected ResearcherAutoCompleteDataEntity applyPersistInternal(ResearcherAutoCompleteDataPersist persist, ResearcherAutoCompleteDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ResearcherDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ResearcherDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ResearcherDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ResearcherDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ResearcherData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ResearcherData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.ResearcherDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class ResearcherFieldDataHelperService extends BaseFieldDataHelperService<ResearcherData, ResearcherDataPersist, ResearcherDataEntity> {
public class ResearcherFieldDataHelperService extends BaseFieldDataHelperService<ResearcherData, ResearcherDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class ResearcherFieldDataHelperService extends BaseFieldDataHelperService
return new ResearcherData(); return new ResearcherData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new ResearcherDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return ResearcherDataEntity.class; return ResearcherDataEntity.class;
@ -51,9 +58,19 @@ public class ResearcherFieldDataHelperService extends BaseFieldDataHelperService
public Class<?> getModelClass() { public Class<?> getModelClass() {
return ResearcherData.class; return ResearcherData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return ResearcherDataPersist.class;
}
@Override @Override
public List<ResearcherData> buildInternal(FieldSet fieldSet, List<ResearcherDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<ResearcherData> buildInternal(FieldSet fieldSet, List<ResearcherDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ResearcherDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(ResearcherDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected ResearcherDataEntity applyPersistInternal(ResearcherDataPersist persist, ResearcherDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.RichTextAreaDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.RichTextAreaDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.RichTextAreaDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.RichTextAreaDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RichTextAreaData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.RichTextAreaData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BooleanDecisionDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.RichTextAreaDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class RichTextAreaDataFieldDataHelperService extends BaseFieldDataHelperService<RichTextAreaData, RichTextAreaDataPersist, RichTextAreaDataEntity> {
public class RichTextAreaDataFieldDataHelperService extends BaseFieldDataHelperService<RichTextAreaData, RichTextAreaDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class RichTextAreaDataFieldDataHelperService extends BaseFieldDataHelperS
return new RichTextAreaData(); return new RichTextAreaData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new RichTextAreaDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return RichTextAreaDataEntity.class; return RichTextAreaDataEntity.class;
@ -52,8 +59,18 @@ public class RichTextAreaDataFieldDataHelperService extends BaseFieldDataHelperS
return RichTextAreaData.class; return RichTextAreaData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return RichTextAreaDataPersist.class;
}
@Override @Override
public List<RichTextAreaData> buildInternal(FieldSet fieldSet, List<RichTextAreaDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<RichTextAreaData> buildInternal(FieldSet fieldSet, List<RichTextAreaDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RichTextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(RichTextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected RichTextAreaDataEntity applyPersistInternal(RichTextAreaDataPersist persist, RichTextAreaDataEntity data) {
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ServiceDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ServiceDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ServiceDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ServiceDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ServiceData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ServiceData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.ServiceDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class ServiceFieldDataHelperService extends BaseFieldDataHelperService<ServiceData, ServiceDataPersist, ServiceDataEntity> {
public class ServiceFieldDataHelperService extends BaseFieldDataHelperService<ServiceData, ServiceDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class ServiceFieldDataHelperService extends BaseFieldDataHelperService<Se
return new ServiceData(); return new ServiceData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new ServiceDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return ServiceDataEntity.class; return ServiceDataEntity.class;
@ -51,9 +58,19 @@ public class ServiceFieldDataHelperService extends BaseFieldDataHelperService<Se
public Class<?> getModelClass() { public Class<?> getModelClass() {
return ServiceData.class; return ServiceData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return ServiceDataPersist.class;
}
@Override @Override
public List<ServiceData> buildInternal(FieldSet fieldSet, List<ServiceDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<ServiceData> buildInternal(FieldSet fieldSet, List<ServiceDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ServiceDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(ServiceDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected ServiceDataEntity applyPersistInternal(ServiceDataPersist persist, ServiceDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.TagDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.TagDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.TagDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.TagDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.TagData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.TagData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BooleanDecisionDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.TagDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class TagFieldDataHelperService extends BaseFieldDataHelperService<TagData, TagDataPersist, TagDataEntity> {
public class TagFieldDataHelperService extends BaseFieldDataHelperService<TagData, TagDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -38,6 +40,11 @@ public class TagFieldDataHelperService extends BaseFieldDataHelperService<TagDat
return new TagDataEntity(); return new TagDataEntity();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new TagDataPersist();
}
@Override @Override
public BaseFieldData newModelInstance() { public BaseFieldData newModelInstance() {
return new TagData(); return new TagData();
@ -52,8 +59,18 @@ public class TagFieldDataHelperService extends BaseFieldDataHelperService<TagDat
return TagData.class; return TagData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return TagDataPersist.class;
}
@Override @Override
public List<TagData> buildInternal(FieldSet fieldSet, List<TagDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<TagData> buildInternal(FieldSet fieldSet, List<TagDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TagDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(TagDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected TagDataEntity applyPersistInternal(TagDataPersist persist, TagDataEntity data) {
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.TaxonomyDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.TaxonomyDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.TaxonomyDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.TaxonomyDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.TaxonomyData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.TaxonomyData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.TaxonomyDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class TaxonomyFieldDataHelperService extends BaseFieldDataHelperService<TaxonomyData, TaxonomyDataPersist, TaxonomyDataEntity> {
public class TaxonomyFieldDataHelperService extends BaseFieldDataHelperService<TaxonomyData, TaxonomyDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class TaxonomyFieldDataHelperService extends BaseFieldDataHelperService<T
return new TaxonomyData(); return new TaxonomyData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new TaxonomyDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return TaxonomyDataEntity.class; return TaxonomyDataEntity.class;
@ -51,9 +58,19 @@ public class TaxonomyFieldDataHelperService extends BaseFieldDataHelperService<T
public Class<?> getModelClass() { public Class<?> getModelClass() {
return TaxonomyData.class; return TaxonomyData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return TaxonomyDataPersist.class;
}
@Override @Override
public List<TaxonomyData> buildInternal(FieldSet fieldSet, List<TaxonomyDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<TaxonomyData> buildInternal(FieldSet fieldSet, List<TaxonomyDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TaxonomyDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(TaxonomyDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected TaxonomyDataEntity applyPersistInternal(TaxonomyDataPersist persist, TaxonomyDataEntity data) {
data.setMultiAutoComplete(persist.getMultiAutoComplete());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.TextAreaDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.TextAreaDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.TextAreaDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.TextAreaDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.TextAreaData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.TextAreaData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.TextAreaDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class TextAreaFieldDataHelperService extends BaseFieldDataHelperService<TextAreaData, TextAreaDataPersist, TextAreaDataEntity> {
public class TextAreaFieldDataHelperService extends BaseFieldDataHelperService<TextAreaData, TextAreaDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class TextAreaFieldDataHelperService extends BaseFieldDataHelperService<T
return new TextAreaData(); return new TextAreaData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new TextAreaDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return TextAreaDataEntity.class; return TextAreaDataEntity.class;
@ -51,9 +58,18 @@ public class TextAreaFieldDataHelperService extends BaseFieldDataHelperService<T
public Class<?> getModelClass() { public Class<?> getModelClass() {
return TextAreaData.class; return TextAreaData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return TextAreaDataPersist.class;
}
@Override @Override
public List<TextAreaData> buildInternal(FieldSet fieldSet, List<TextAreaDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<TextAreaData> buildInternal(FieldSet fieldSet, List<TextAreaDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(TextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected TextAreaDataEntity applyPersistInternal(TextAreaDataPersist persist, TextAreaDataEntity data) {
return data;
}
} }

View File

@ -3,27 +3,32 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.RadioBoxDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.UploadDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.UploadDataEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.UploadDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.UploadDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.UploadData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.UploadData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.*;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class UploadFieldDataHelperService extends BaseFieldDataHelperService<UploadData, UploadDataPersist, UploadDataEntity> {
public class UploadFieldDataHelperService extends BaseFieldDataHelperService<UploadData, UploadDataEntity> { private final ConventionService conventionService;
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
public UploadFieldDataHelperService(BuilderFactory builderFactory) { public UploadFieldDataHelperService(ConventionService conventionService, BuilderFactory builderFactory) {
this.conventionService = conventionService;
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
} }
@ -43,6 +48,11 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
return new UploadData(); return new UploadData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new UploadDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return UploadDataEntity.class; return UploadDataEntity.class;
@ -51,9 +61,34 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
public Class<?> getModelClass() { public Class<?> getModelClass() {
return UploadData.class; return UploadData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return UploadDataPersist.class;
}
@Override @Override
public List<UploadData> buildInternal(FieldSet fieldSet, List<UploadDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<UploadData> buildInternal(FieldSet fieldSet, List<UploadDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(UploadDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(UploadDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected UploadDataEntity applyPersistInternal(UploadDataPersist persist, UploadDataEntity data) {
if (!this.conventionService.isListNullOrEmpty(persist.getTypes())){
data.setTypes(new ArrayList<>());
for (UploadOptionPersist uploadOptionPersist: persist.getTypes()) {
data.getTypes().add(this.buildOption(uploadOptionPersist));
}
}
return data;
}
private @NotNull UploadDataEntity.Option buildOption(UploadOptionPersist persist){
UploadDataEntity.Option data = new UploadDataEntity.Option();
if (persist == null) return data;
data.setLabel(persist.getLabel());
data.setValue(persist.getValue());
return data;
}
} }

View File

@ -3,10 +3,14 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.ValidationDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.ValidationDataEntity;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ValidationDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.ValidationDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ValidationData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.ValidationData;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.BaseFieldDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.DataRepositoryDataPersist;
import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.ValidationDataPersist;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@ -17,9 +21,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class ValidationFieldDataHelperService extends BaseFieldDataHelperService<ValidationData, ValidationDataPersist, ValidationDataEntity> {
public class ValidationFieldDataHelperService extends BaseFieldDataHelperService<ValidationData, ValidationDataEntity> {
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
@ -43,6 +45,11 @@ public class ValidationFieldDataHelperService extends BaseFieldDataHelperService
return new ValidationData(); return new ValidationData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new ValidationDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return ValidationDataEntity.class; return ValidationDataEntity.class;
@ -51,9 +58,18 @@ public class ValidationFieldDataHelperService extends BaseFieldDataHelperService
public Class<?> getModelClass() { public Class<?> getModelClass() {
return ValidationData.class; return ValidationData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return ValidationDataPersist.class;
}
@Override @Override
public List<ValidationData> buildInternal(FieldSet fieldSet, List<ValidationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<ValidationData> buildInternal(FieldSet fieldSet, List<ValidationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ValidationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(ValidationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
}
@Override
protected ValidationDataEntity applyPersistInternal(ValidationDataPersist persist, ValidationDataEntity data) {
return data;
} }
} }

View File

@ -2,31 +2,32 @@ package eu.eudat.service.fielddatahelper;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.FieldType; import eu.eudat.commons.enums.FieldType;
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.*;
import eu.eudat.commons.types.descriptiontemplate.fielddata.WordListDataEntity; import eu.eudat.commons.types.descriptiontemplate.fielddata.WordListDataEntity;
import eu.eudat.commons.types.descriptiontemplate.fielddata.WordListDataEntity; import eu.eudat.convention.ConventionService;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.WordListDataBuilder;
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.WordListDataBuilder; import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.WordListDataBuilder;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.WordListData; import eu.eudat.model.descriptiontemplatedefinition.fielddata.WordListData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.WordListData; import eu.eudat.model.persist.descriptiontemplatedefinition.fielddata.*;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.fieldset.FieldSet; import gr.cite.tools.fieldset.FieldSet;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@Component @Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class WordListFieldDataHelperService extends BaseFieldDataHelperService<WordListData, WordListDataPersist, WordListDataEntity> {
public class WordListFieldDataHelperService extends BaseFieldDataHelperService<WordListData, WordListDataEntity> { private final ConventionService conventionService;
private final BuilderFactory builderFactory; private final BuilderFactory builderFactory;
public WordListFieldDataHelperService(BuilderFactory builderFactory) { public WordListFieldDataHelperService(ConventionService conventionService, BuilderFactory builderFactory) {
this.conventionService = conventionService;
this.builderFactory = builderFactory; this.builderFactory = builderFactory;
} }
@ -46,6 +47,11 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
return new WordListData(); return new WordListData();
} }
@Override
public BaseFieldDataPersist newPersistModelInstance() {
return new WordListDataPersist();
}
@Override @Override
public Class<?> getDataClass() { public Class<?> getDataClass() {
return WordListDataEntity.class; return WordListDataEntity.class;
@ -54,9 +60,37 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
public Class<?> getModelClass() { public Class<?> getModelClass() {
return WordListData.class; return WordListData.class;
} }
@Override
public Class<?> getPersistModelClass() {
return WordListDataPersist.class;
}
@Override @Override
public List<WordListData> buildInternal(FieldSet fieldSet, List<WordListDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){ public List<WordListData> buildInternal(FieldSet fieldSet, List<WordListDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(WordListDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas); return this.builderFactory.builder(WordListDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
} }
@Override
protected WordListDataEntity applyPersistInternal(WordListDataPersist persist, WordListDataEntity data) {
data.setMultiList(persist.getMultiList());
if (!this.conventionService.isListNullOrEmpty(persist.getOptions())){
data.setOptions(new ArrayList<>());
for (ComboBoxOptionPersist optionPersist: persist.getOptions()) {
data.getOptions().add(this.buildOption(optionPersist));
}
}
return data;
}
private @NotNull ComboBoxDataEntity.Option buildOption(ComboBoxOptionPersist persist){
ComboBoxDataEntity.Option data = new ComboBoxDataEntity.Option();
if (persist == null) return data;
data.setLabel(persist.getLabel());
data.setValue(persist.getValue());
data.setUri(persist.getUri());
data.setSource(persist.getSource());
return data;
}
} }

View File

@ -1,5 +1,6 @@
package eu.eudat.controllers.v2; package eu.eudat.controllers.v2;
import com.fasterxml.jackson.core.JsonProcessingException;
import eu.eudat.audit.AuditableAction; import eu.eudat.audit.AuditableAction;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.data.DescriptionTemplateEntity; import eu.eudat.data.DescriptionTemplateEntity;
@ -22,6 +23,7 @@ import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry; import gr.cite.tools.logging.MapLogEntry;
import gr.cite.tools.validation.MyValidate; import gr.cite.tools.validation.MyValidate;
import jakarta.xml.bind.JAXBException;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
@ -29,6 +31,8 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.management.InvalidApplicationException; import javax.management.InvalidApplicationException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import java.util.*; import java.util.*;
@RestController @RestController
@ -104,7 +108,7 @@ public class DescriptionTemplateController {
@PostMapping("persist") @PostMapping("persist")
@Transactional @Transactional
public DescriptionTemplate Persist(@MyValidate @RequestBody DescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException { public DescriptionTemplate Persist(@MyValidate @RequestBody DescriptionTemplatePersist model, FieldSet fieldSet) throws MyApplicationException, MyForbiddenException, MyNotFoundException, InvalidApplicationException, JAXBException, ParserConfigurationException, JsonProcessingException, TransformerException {
logger.debug(new MapLogEntry("persisting" + DescriptionTemplate.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet)); logger.debug(new MapLogEntry("persisting" + DescriptionTemplate.class.getSimpleName()).And("model", model).And("fieldSet", fieldSet));
DescriptionTemplate persisted = this.descriptionTemplateTypeService.persist(model, fieldSet); DescriptionTemplate persisted = this.descriptionTemplateTypeService.persist(model, fieldSet);