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

This commit is contained in:
Diamantis Tziotzios 2024-01-18 14:23:46 +02:00
commit 5e32f1e74d
53 changed files with 2052 additions and 439 deletions

View File

@ -47,7 +47,7 @@
<dependency>
<groupId>gr.cite.opendmp</groupId>
<artifactId>file-transformer-base</artifactId>
<version>0.0.2</version>
<version>0.0.3</version>
</dependency>
<dependency>
<groupId>gr.cite</groupId>

View File

@ -8,7 +8,8 @@ import java.util.Map;
public enum StorageType implements DatabaseEnum<Short> {
Temp((short) 0),
Main((short) 1);
Main((short) 1),
Transformer((short)2);
private final Short value;

View File

@ -0,0 +1,77 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.convention.ConventionService;
import gr.cite.tools.data.builder.Builder;
import gr.cite.tools.data.query.QueryBase;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
public abstract class BaseFileTransformerBuilder<M, D> implements Builder {
protected final LoggerService logger;
protected final ConventionService conventionService;
public BaseFileTransformerBuilder(
ConventionService conventionService,
LoggerService logger
) {
this.conventionService = conventionService;
this.logger = logger;
}
public M build(D data) throws MyApplicationException {
if (data == null) {
//this.logger.Debug(new MapLogEntry("requested build for null item requesting fields").And("fields", directives));
// return default(M);
M model = null;
return null; //TODO
}
List<FileTransformerBuilderItemResponse<M, D>> models = this.buildInternal(List.of(data));
return models.stream().map(FileTransformerBuilderItemResponse::getModel).findFirst().orElse(null); //TODO
}
public List<M> build(List<D> data) throws MyApplicationException{
List<FileTransformerBuilderItemResponse<M, D>> models = this.buildInternal(data);
return models == null ? null : models.stream().map(FileTransformerBuilderItemResponse::getModel).collect(Collectors.toList());
}
protected abstract List<FileTransformerBuilderItemResponse<M, D>> buildInternal(List<D> data) throws MyApplicationException;
public <K> Map<K, M> asForeignKey(QueryBase<D> query, Function<D, K> keySelector) throws MyApplicationException {
this.logger.trace("Building references from query");
List<D> data = query.collect();
this.logger.debug("collected {} items to build", Optional.ofNullable(data).map(List::size).orElse(0));
return this.asForeignKey(data, keySelector);
}
public <K> Map<K, M> asForeignKey(List<D> data, Function<D, K> keySelector) throws MyApplicationException {
this.logger.trace("building references");
List<FileTransformerBuilderItemResponse<M, D>> models = this.buildInternal(data);
this.logger.debug("mapping {} build items from {} requested", Optional.ofNullable(models).map(List::size).orElse(0), Optional.ofNullable(data).map(List::size).orElse(0));
return models == null ? new HashMap<>() : models.stream().collect(Collectors.toMap(x-> keySelector.apply(x.getData()), FileTransformerBuilderItemResponse::getModel));
}
public <K> Map<K, List<M>> asMasterKey(QueryBase<D> query,Function<D, K> keySelector) throws MyApplicationException {
this.logger.trace("Building details from query");
List<D> data = query.collect();
this.logger.debug("collected {} items to build", Optional.ofNullable(data).map(List::size).orElse(0));
return this.asMasterKey(data, keySelector);
}
public <K> Map<K, List<M>> asMasterKey(List<D> data, Function<D, K> keySelector) throws MyApplicationException {
this.logger.trace("building details");
List<FileTransformerBuilderItemResponse<M, D>> models = this.buildInternal(data);
this.logger.debug("mapping {} build items from {} requested", Optional.ofNullable(models).map(List::size).orElse(0), Optional.ofNullable(data).map(List::size).orElse(0));
Map<K, List<M>> map = new HashMap<>();
if (models == null) return map;
for (FileTransformerBuilderItemResponse<M, D> model : models) {
K key = keySelector.apply(model.getData());
if (!map.containsKey(key)) map.put(key, new ArrayList<M>());
map.get(key).add(model.getModel());
}
return map;
}
}

View File

@ -0,0 +1,268 @@
package eu.eudat.model.builder.filetransformer;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.description.FieldEntity;
import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.depositinterface.enums.FieldType;
import eu.eudat.depositinterface.models.DescriptionFieldDepositModel;
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateFileTransformerModel;
import eu.eudat.file.transformer.models.descriptiontemplate.definition.*;
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DescriptionFieldFileTransformerBuilder extends BaseFileTransformerBuilder<DescriptionTemplateFileTransformerModel, FieldEntity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
private DescriptionTemplateFileTransformerModel definition;
private final FieldDataHelperServiceProvider fieldDataHelperServiceProvider;
@Autowired
public DescriptionFieldFileTransformerBuilder(
ConventionService conventionService, FieldDataHelperServiceProvider fieldDataHelperServiceProvider
) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DescriptionFieldFileTransformerBuilder.class)));
this.fieldDataHelperServiceProvider = fieldDataHelperServiceProvider;
}
public DescriptionFieldFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
public DescriptionFieldFileTransformerBuilder setDefinition(DescriptionTemplateFileTransformerModel definition) {
this.definition = definition;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<DescriptionTemplateFileTransformerModel, FieldEntity>> buildInternal(List<FieldEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
List<FileTransformerBuilderItemResponse<DescriptionFieldDepositModel, FieldEntity>> models = new ArrayList<>();
ObjectMapper objectMapper = new ObjectMapper();
for (FieldEntity d : data) {
// DescriptionFieldDepositModel m = new DescriptionFieldDepositModel();
if (definition != null){
FieldFileTransformerModel fieldEntity = findFieldById(d.getKey());
if (fieldEntity != null){
//m.setSchematics(fieldEntity.getSchematics());
if (fieldEntity.getData() != null) {
/*boolean isMultiValue = fieldDataHelperServiceProvider.get(eu.eudat.commons.enums.FieldType.of(fieldEntity.getData().getFieldType().getValue())).isMultiValue(fieldEntity.getData());
if (!isMultiValue) fieldEntity.getData().setValue(List.of(d.getValue());
else*/ {
fieldEntity.getData().setValue(d.getValue());
}
/*switch (field.getData().getFieldType()) {
case AUTO_COMPLETE -> m.setFieldType(FieldType.AUTO_COMPLETE);
case WORD_LIST -> m.setFieldType(FieldType.WORD_LIST);
case BOOLEAN_DECISION -> m.setFieldType(FieldType.BOOLEAN_DECISION);
case RADIO_BOX -> m.setFieldType(FieldType.RADIO_BOX);
case INTERNAL_DMP_ENTRIES_RESEARCHERS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS);
case INTERNAL_DMP_ENTRIES_DMPS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_DMPS);
case INTERNAL_DMP_ENTRIES_DATASETS -> m.setFieldType(FieldType.INTERNAL_DMP_ENTRIES_DATASETS);
case CHECK_BOX -> m.setFieldType(FieldType.CHECK_BOX);
case FREE_TEXT -> m.setFieldType(FieldType.FREE_TEXT);
case TEXT_AREA -> m.setFieldType(FieldType.TEXT_AREA);
case RICH_TEXT_AREA -> m.setFieldType(FieldType.RICH_TEXT_AREA);
case UPLOAD -> m.setFieldType(FieldType.UPLOAD);
case DATE_PICKER -> m.setFieldType(FieldType.DATE_PICKER);
case EXTERNAL_DATASETS -> m.setFieldType(FieldType.EXTERNAL_DATASETS);
case DATA_REPOSITORIES -> m.setFieldType(FieldType.DATA_REPOSITORIES);
case JOURNAL_REPOSITORIES -> m.setFieldType(FieldType.JOURNAL_REPOSITORIES);
case PUB_REPOSITORIES -> m.setFieldType(FieldType.PUB_REPOSITORIES);
case LICENSES -> m.setFieldType(FieldType.LICENSES);
case PUBLICATIONS -> m.setFieldType(FieldType.PUBLICATIONS);
case REGISTRIES -> m.setFieldType(FieldType.REGISTRIES);
case SERVICES -> m.setFieldType(FieldType.SERVICES);
case TAGS -> m.setFieldType(FieldType.TAGS);
case RESEARCHERS -> m.setFieldType(FieldType.RESEARCHERS);
case ORGANIZATIONS -> m.setFieldType(FieldType.ORGANIZATIONS);
case DATASET_IDENTIFIER -> m.setFieldType(FieldType.DATASET_IDENTIFIER);
case CURRENCY -> m.setFieldType(FieldType.CURRENCY);
case VALIDATION -> m.setFieldType(FieldType.VALIDATION);
case TAXONOMIES -> m.setFieldType(FieldType.TAXONOMIES);
default -> throw new MyApplicationException("unrecognized type " + field.getData().getFieldType());
}*/
}
}
}
//models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
for (PageFileTransformerModel page : definition.getDefinition().getPages()) {
page.setSections(calculateSectionVisibility(page.getSections()));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return List.of(new FileTransformerBuilderItemResponse<>(definition, data.get(0)));
}
private FieldFileTransformerModel findFieldById(String id) {
FieldFileTransformerModel result = null;
List<PageFileTransformerModel> pages = definition.getDefinition().getPages();
for (PageFileTransformerModel page: pages) {
if (page.getSections() != null && !page.getSections().isEmpty()) {
result = findSectionFieldById(id, page.getSections());
if (result != null) {
break;
}
}
}
return result;
}
private FieldFileTransformerModel findSectionFieldById(String id, List<SectionFileTransformerModel> sections) {
FieldFileTransformerModel result = null;
for (SectionFileTransformerModel section: sections) {
if (section.getSections() != null && !section.getSections().isEmpty()) {
result = findSectionFieldById(id, section.getSections());
}
if (result == null) {
List<FieldSetFileTransformerModel> fieldSets = section.getFieldSets();
if (fieldSets != null && !fieldSets.isEmpty()) {
for (FieldSetFileTransformerModel fieldSet : fieldSets) {
List<FieldFileTransformerModel> fields = fieldSet.getFields();
if (fields != null && !fields.isEmpty()) {
for (FieldFileTransformerModel field : fields) {
if (field.getId().equals(id)) {
result = field;
break;
}
}
}
if (result != null) {
break;
}
}
}
}
}
return result;
}
private List<SectionFileTransformerModel> calculateSectionVisibility(List<SectionFileTransformerModel> sections) {
List<SectionFileTransformerModel> result = new ArrayList<>();
for (SectionFileTransformerModel section : sections) {
if (section.getSections() != null && !section.getSections().isEmpty()) {
section.setSections(calculateSectionVisibility(section.getSections()));
}
if (section.getFieldSets() != null && !section.getFieldSets().isEmpty()) {
section.setFieldSets(calculateFieldSetVisibility(section.getFieldSets()));
}
if ((section.getSections() != null && !section.getSections().isEmpty()) || (section.getFieldSets() != null && !section.getFieldSets().isEmpty())) {
result.add(section);
}
}
return result;
}
private List<FieldSetFileTransformerModel> calculateFieldSetVisibility(List<FieldSetFileTransformerModel> fieldSets) {
List<FieldSetFileTransformerModel> result = new ArrayList<>();
for (FieldSetFileTransformerModel fieldSet : fieldSets) {
if (fieldSet.getFields() != null && !fieldSet.getFields().isEmpty()) {
fieldSet.setFields(calculateFieldVisibility(fieldSet.getFields()));
if (fieldSet.getFields() != null && !fieldSet.getFields().isEmpty()) {
result.add(fieldSet);
}
}
}
return result;
}
private List<FieldFileTransformerModel> calculateFieldVisibility(List<FieldFileTransformerModel> fields) {
List<FieldFileTransformerModel> result = new ArrayList<>();
for (FieldFileTransformerModel field : fields) {
if (field.getVisibilityRules() != null && !field.getVisibilityRules().isEmpty()) {
Integer maxChecks = field.getVisibilityRules().size();
Integer successfulChecks = 0;
for (RuleFileTransformerModel rule : field.getVisibilityRules()) {
FieldFileTransformerModel targetField = findFieldByPages(definition.getDefinition().getPages(), rule.getTarget());
if (targetField.getData() != null ) {
successfulChecks = targetField.getData().getValue().equals(rule.getValue()) ? successfulChecks + 1 : successfulChecks;
}
}
if (successfulChecks.equals(maxChecks)) {
result.add(field);
}
} else {
result.add(field);
}
}
return result;
}
private FieldFileTransformerModel findFieldByPages(List<PageFileTransformerModel> pages, String fieldId) {
FieldFileTransformerModel result = null;
for (PageFileTransformerModel page : pages) {
result = findFieldBySections(page.getSections(), fieldId);
if (result != null) {
break;
}
}
return result;
}
private FieldFileTransformerModel findFieldBySections(List<SectionFileTransformerModel> sections, String fieldId) {
FieldFileTransformerModel result = null;
for (SectionFileTransformerModel section : sections) {
if (section.getSections() != null && !section.getSections().isEmpty()) {
result = findFieldBySections(section.getSections(), fieldId);
if (result != null) {
break;
}
}
if (section.getFieldSets() != null && !section.getFieldSets().isEmpty()) {
result = findFieldByFieldSets(section.getFieldSets(), fieldId);
if (result != null) {
break;
}
}
}
return result;
}
private FieldFileTransformerModel findFieldByFieldSets(List<FieldSetFileTransformerModel> fieldSets, String fieldId) {
FieldFileTransformerModel result = null;
for (FieldSetFileTransformerModel fieldSet: fieldSets) {
result = findField(fieldSet.getFields(), fieldId);
if (result != null) {
break;
}
}
return result;
}
private FieldFileTransformerModel findField(List<FieldFileTransformerModel> fields, String fieldId) {
FieldFileTransformerModel result = null;
for (FieldFileTransformerModel field: fields) {
if (field.getId().equals(fieldId)) {
result = field;
break;
}
}
return result;
}
}

View File

@ -0,0 +1,170 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.types.description.PropertyDefinitionEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.*;
import eu.eudat.depositinterface.models.DescriptionDepositModel;
import eu.eudat.file.transformer.enums.DescriptionStatus;
import eu.eudat.file.transformer.models.description.DescriptionFileTransformerModel;
import eu.eudat.file.transformer.models.description.DescriptionReferenceFileTransformerModel;
import eu.eudat.file.transformer.models.description.DescriptionTagFileTransformerModel;
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateFileTransformerModel;
import eu.eudat.file.transformer.models.dmp.DmpFileTransformerModel;
import eu.eudat.file.transformer.models.dmp.DmpReferenceFileTransformerModel;
import eu.eudat.file.transformer.models.reference.ReferenceFileTransformerModel;
import eu.eudat.file.transformer.models.tag.TagFileTransformerModel;
import eu.eudat.file.transformer.models.user.UserFileTransformerModel;
import eu.eudat.model.DescriptionReference;
import eu.eudat.model.DescriptionTemplate;
import eu.eudat.model.DmpReference;
import eu.eudat.model.Tag;
import eu.eudat.model.builder.TagBuilder;
import eu.eudat.query.*;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.fieldset.BaseFieldSet;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DescriptionFileTransformerBuilder extends BaseFileTransformerBuilder<DescriptionFileTransformerModel, DescriptionEntity> {
private final QueryFactory queryFactory;
private final BuilderFactory builderFactory;
private final JsonHandlingService jsonHandlingService;
private final XmlHandlingService xmlHandlingService;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public DescriptionFileTransformerBuilder(
ConventionService conventionService,
QueryFactory queryFactory,
BuilderFactory builderFactory, JsonHandlingService jsonHandlingService, XmlHandlingService xmlHandlingService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DescriptionFileTransformerBuilder.class)));
this.queryFactory = queryFactory;
this.builderFactory = builderFactory;
this.jsonHandlingService = jsonHandlingService;
this.xmlHandlingService = xmlHandlingService;
}
public DescriptionFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<DescriptionFileTransformerModel, DescriptionEntity>> buildInternal(List<DescriptionEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
List<DescriptionTemplateFileTransformerModel> definitionMap = this.collectDescriptionTemplates(data);
Map<UUID, List<DescriptionReferenceFileTransformerModel>> referenceMap = collectReferences(data);
Map<UUID, List<DescriptionTagFileTransformerModel>> tagMap = collectTags(data);
DmpFileTransformerModel dmp = this.getDmp(data.get(0).getDmpId());
List<FileTransformerBuilderItemResponse<DescriptionFileTransformerModel, DescriptionEntity>> models = new ArrayList<>();
for (DescriptionEntity d : data) {
DescriptionFileTransformerModel m = new DescriptionFileTransformerModel();
m.setId(d.getId());
m.setLabel(d.getLabel());
m.setDescription(d.getDescription());
m.setCreatedAt(d.getCreatedAt());
m.setFinalizedAt(d.getFinalizedAt());
m.setUpdatedAt(d.getUpdatedAt());
m.setStatus(DescriptionStatus.of(d.getStatus().getValue()));
if (d.getProperties() != null){
PropertyDefinitionEntity propertyDefinition = this.jsonHandlingService.fromJsonSafe(PropertyDefinitionEntity.class, d.getProperties());
if (definitionMap != null && definitionMap.stream().anyMatch(dt -> dt.getId().equals(d.getDescriptionTemplateId())) && propertyDefinition != null && !this.conventionService.isListNullOrEmpty(propertyDefinition.getFields())) m.setDescriptionTemplate(this.builderFactory.builder(DescriptionFieldFileTransformerBuilder.class).authorize(this.authorize).setDefinition(definitionMap.stream().filter(dm -> dm.getId().equals(d.getDescriptionTemplateId())).findFirst().get()).build(propertyDefinition.getFields()).get(0));
}
if (referenceMap != null && !referenceMap.isEmpty() && referenceMap.containsKey(d.getId())) m.setDescriptionReferenceFileTransformerModels(referenceMap.get(d.getId()));
if (tagMap != null && !tagMap.isEmpty() && tagMap.containsKey(d.getId())) m.setDescriptionTagFileTransformerModels(tagMap.get(d.getId()));
m.setDmp(dmp);
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
private DmpFileTransformerModel getDmp(UUID id) {
DmpQuery query = queryFactory.query(DmpQuery.class).authorize(authorize).isActive(IsActive.Active).ids(id);
return builderFactory.builder(DmpFileTransformerBuilder.class).ignoreDescriptions(true).authorize(authorize).build(query.first());
}
private List<DescriptionTemplateFileTransformerModel> collectDescriptionTemplates(List<DescriptionEntity> data) throws MyApplicationException {
if (data.isEmpty())
return null;
this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName());
List<DescriptionTemplateEntity> descriptionTemplateEntities = this.queryFactory.query(DescriptionTemplateQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().map(DescriptionEntity::getDescriptionTemplateId).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(DescriptionTemplate._id).ensure(DescriptionTemplate._definition));
return this.builderFactory.builder(DescriptionTemplateFileTransformerBuilder.class).authorize(authorize).build(descriptionTemplateEntities);
}
private Map<UUID, List<DescriptionReferenceFileTransformerModel>> collectReferences(List<DescriptionEntity> data) throws MyApplicationException {
if (data.isEmpty()) return null;
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
List<DescriptionReferenceEntity> descriptionReferences = this.queryFactory.query(DescriptionReferenceQuery.class).authorize(this.authorize).descriptionIds(data.stream().map(DescriptionEntity::getId).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(DescriptionReference._description).ensure(DescriptionReference._reference));
Map<UUID, List<DescriptionReferenceFileTransformerModel>> itemMap = new HashMap<>();
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).isActive(IsActive.Active).ids(descriptionReferences.stream().map(DescriptionReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
Map<UUID, ReferenceFileTransformerModel> referenceDepositModelMap = this.builderFactory.builder(ReferenceFileTransformerBuilder.class).authorize(this.authorize).asForeignKey(query, ReferenceEntity::getId);
if (referenceDepositModelMap == null) return null;
for (DescriptionReferenceEntity descriptionReference : descriptionReferences) {
DescriptionReferenceFileTransformerModel descriptionReferenceFileTransformerModel = new DescriptionReferenceFileTransformerModel();
descriptionReferenceFileTransformerModel.setId(descriptionReference.getId());
descriptionReferenceFileTransformerModel.setReference(referenceDepositModelMap.getOrDefault(descriptionReference.getReferenceId(), null));
DescriptionReferenceFileTransformerModel model = descriptionReferenceFileTransformerModel;
if (model == null) continue;
UUID key = descriptionReference.getDescriptionId();
if (!itemMap.containsKey(key)) itemMap.put(key, new ArrayList<>());
itemMap.get(key).add(model);
}
return itemMap;
}
private Map<UUID, List<DescriptionTagFileTransformerModel>> collectTags(List<DescriptionEntity> data) {
if (data.isEmpty()) return null;
List<DescriptionTagEntity> descriptionTags = this.queryFactory.query(DescriptionTagQuery.class).authorize(this.authorize).descriptionIds(data.stream().map(DescriptionEntity::getId).distinct().toList()).collect();
Map<UUID, List<DescriptionTagFileTransformerModel>> itemMap = new HashMap<>();
TagQuery query = this.queryFactory.query(TagQuery.class).authorize(this.authorize).isActive(IsActive.Active).ids(descriptionTags.stream().map(DescriptionTagEntity::getTagId).distinct().toList());
Map<UUID, TagFileTransformerModel> tagMap = this.builderFactory.builder(TagFileTransformerBuilder.class).asForeignKey(query, TagEntity::getId);
for (DescriptionTagEntity descriptionTag : descriptionTags) {
DescriptionTagFileTransformerModel descriptionTagFileTransformerModel = new DescriptionTagFileTransformerModel();
descriptionTagFileTransformerModel.setId(descriptionTag.getId());
descriptionTagFileTransformerModel.setTagFileTransformerModel(tagMap.getOrDefault(descriptionTag.getTagId(), null));
DescriptionTagFileTransformerModel model = descriptionTagFileTransformerModel;
if (model == null) continue;
UUID key = descriptionTag.getDescriptionId();
if (!itemMap.containsKey(key)) itemMap.put(key, new ArrayList<>());
itemMap.get(key).add(model);
}
return itemMap;
}
}

View File

@ -0,0 +1,241 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.types.descriptiontemplate.*;
import eu.eudat.commons.types.descriptiontemplate.fielddata.*;
import eu.eudat.convention.ConventionService;
import eu.eudat.file.transformer.enums.FieldDataExternalDatasetType;
import eu.eudat.file.transformer.enums.FieldType;
import eu.eudat.file.transformer.enums.FieldValidationType;
import eu.eudat.file.transformer.models.descriptiontemplate.definition.*;
import eu.eudat.file.transformer.models.descriptiontemplate.definition.fielddata.*;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.UploadOption;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DescriptionTemplateDefinitionFileTransformerBuilder extends BaseFileTransformerBuilder<DefinitionFileTransformerModel, DefinitionEntity> {
private final QueryFactory queryFactory;
private final BuilderFactory builderFactory;
private final JsonHandlingService jsonHandlingService;
private final XmlHandlingService xmlHandlingService;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public DescriptionTemplateDefinitionFileTransformerBuilder(
ConventionService conventionService,
QueryFactory queryFactory,
BuilderFactory builderFactory, JsonHandlingService jsonHandlingService, XmlHandlingService xmlHandlingService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DescriptionTemplateDefinitionFileTransformerBuilder.class)));
this.queryFactory = queryFactory;
this.builderFactory = builderFactory;
this.jsonHandlingService = jsonHandlingService;
this.xmlHandlingService = xmlHandlingService;
}
public DescriptionTemplateDefinitionFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<DefinitionFileTransformerModel, DefinitionEntity>> buildInternal(List<DefinitionEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
List<FileTransformerBuilderItemResponse<DefinitionFileTransformerModel, DefinitionEntity>> models = new ArrayList<>();
for (DefinitionEntity d : data) {
DefinitionFileTransformerModel m = new DefinitionFileTransformerModel();
m.setPages(collectPages(d.getPages(), d.getSections()));
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
private List<PageFileTransformerModel> collectPages(List<PageEntity> data, List<SectionEntity> sections) {
List<PageFileTransformerModel> result = new ArrayList<>();
for (PageEntity d: data) {
PageFileTransformerModel m = new PageFileTransformerModel();
m.setId(d.getId());
m.setOrdinal(d.getOrdinal());
m.setTitle(d.getTitle());
m.setSections(collectSections(sections.stream().filter(sectionEntity -> sectionEntity.getPage().equals(d.getId())).toList()));
result.add(m);
}
return result;
}
private List<SectionFileTransformerModel> collectSections(List<SectionEntity> data) {
List<SectionFileTransformerModel> result = new ArrayList<>();
for (SectionEntity d : data) {
SectionFileTransformerModel m = new SectionFileTransformerModel();
m.setId(d.getId());
m.setDescription(d.getDescription());
m.setTitle(d.getTitle());
m.setOrdinal(d.getOrdinal());
m.setDefaultVisibility(d.isDefaultVisibility());
m.setExtendedDescription(d.getExtendedDescription());
m.setMultiplicity(d.getMultiplicity());
m.setNumbering(d.getNumbering());
m.setSections(collectSections(d.getSections()));
m.setFieldSets(collectFieldSet(d.getFieldSets()));
result.add(m);
}
return result;
}
private List<FieldSetFileTransformerModel> collectFieldSet(List<FieldSetEntity> data) {
List<FieldSetFileTransformerModel> result = new ArrayList<>();
for (FieldSetEntity d : data) {
FieldSetFileTransformerModel m = new FieldSetFileTransformerModel();
m.setId(d.getId());
m.setDescription(d.getDescription());
m.setExtendedDescription(d.getExtendedDescription());
m.setAdditionalInformation(d.getAdditionalInformation());
m.setHasCommentField(d.getHasCommentField());
m.setNumbering(d.getNumbering());
m.setOrdinal(d.getOrdinal());
m.setTitle(d.getTitle());
//m.setMultiplicity(); //TODO: No multiplicity in this code (yet)
m.setFields(convertFields(d.getFields()));
result.add(m);
}
return result;
}
private List<FieldFileTransformerModel> convertFields(List<FieldEntity> data) {
List<FieldFileTransformerModel> result = new ArrayList<>();
for (FieldEntity d : data) {
FieldFileTransformerModel m = new FieldFileTransformerModel();
m.setId(d.getId());
m.setSchematics(d.getSchematics());
m.setNumbering(d.getNumbering());
m.setOrdinal(d.getOrdinal());
m.setDefaultValue(d.getDefaultValue());
m.setIncludeInExport(d.getIncludeInExport());
m.setValidations(d.getValidations().stream().map(fieldValidationType -> FieldValidationType.of(fieldValidationType.getValue())).toList());
m.setVisibilityRules(convertVisibilityRules(d.getVisibilityRules()));
m.setData(convertData(d.getData()));
result.add(m);
}
return result;
}
public List<RuleFileTransformerModel> convertVisibilityRules(List<RuleEntity> data) {
List<RuleFileTransformerModel> result = new ArrayList<>();
for (RuleEntity d : data) {
RuleFileTransformerModel m = new RuleFileTransformerModel();
m.setTarget(d.getTarget());
m.setValue(d.getValue());
result.add(m);
}
return result;
}
public BaseFieldDataFileTransformerModel convertData (BaseFieldDataEntity data) {
BaseFieldDataFileTransformerModel m;
switch (data) {
case AutoCompleteDataEntity d -> {
m = new AutoCompleteDataFileTransformerModel();
m.setLabel(d.getLabel());
m.setFieldType(FieldType.of(d.getFieldType().getValue()));
((AutoCompleteDataFileTransformerModel)m).setMultiAutoComplete(d.getMultiAutoComplete());
((AutoCompleteDataFileTransformerModel) m).setAutoCompleteSingleDataList(convertAutoCompleteSingleData(d.getAutoCompleteSingleDataList()));
}
case ExternalDatasetDataEntity d -> {
m = new ExternalDatasetDataFileTransformerModel();
m.setLabel(d.getLabel());
m.setFieldType(FieldType.of(d.getFieldType().getValue()));
((ExternalDatasetDataFileTransformerModel)m).setType(FieldDataExternalDatasetType.of(d.getType().getValue()));
}
case RadioBoxDataEntity d -> {
m = new RadioBoxDataFileTransformerModel();
m.setLabel(d.getLabel());
m.setFieldType(FieldType.of(d.getFieldType().getValue()));
((RadioBoxDataFileTransformerModel) m).setOptions(convertRadioBoxOptions(d.getOptions()));
}
case UploadDataEntity d -> {
m = new UploadDataFileTransformerModel();
m.setLabel(d.getLabel());
m.setFieldType(FieldType.of(d.getFieldType().getValue()));
((UploadDataFileTransformerModel) m).setMaxFileSizeInMB(d.getMaxFileSizeInMB());
((UploadDataFileTransformerModel) m).setTypes(convertUploadDataOptions(d.getTypes()));
}
case WordListDataEntity d -> {
m = new WordListDataFileTransformerModel();
m.setLabel(d.getLabel());
m.setFieldType(FieldType.of(d.getFieldType().getValue()));
((WordListDataFileTransformerModel) m).setMultiList(d.getMultiList());
((WordListDataFileTransformerModel) m).setOptions(d.getOptions().stream().map(this::convertComboBoxOption).toList());
}
default -> m = null;
}
return m;
}
private List<RadioBoxOptionFileTransformerModel> convertRadioBoxOptions(List<RadioBoxDataEntity.Option> data) {
List<RadioBoxOptionFileTransformerModel> result = new ArrayList<>();
for (RadioBoxDataEntity.Option d : data) {
RadioBoxOptionFileTransformerModel m = new RadioBoxOptionFileTransformerModel();
m.setLabel(d.getLabel());
m.setValue(d.getValue());
result.add(m);
}
return result;
}
private List<AutoCompleteSingleDataFileTransformerModel> convertAutoCompleteSingleData(List<AutoCompleteDataEntity.AutoCompleteSingleData> data) {
List<AutoCompleteSingleDataFileTransformerModel> result = new ArrayList<>();
for (AutoCompleteDataEntity.AutoCompleteSingleData d : data) {
AutoCompleteSingleDataFileTransformerModel m = new AutoCompleteSingleDataFileTransformerModel();
m.setUrl(d.getUrl());
m.setAutoCompleteOptions(convertComboBoxOption(d.getAutoCompleteOptions()));
result.add(m);
}
return result;
}
private ComboBoxOptionFileTransformerModel convertComboBoxOption(ComboBoxDataEntity.Option data) {
ComboBoxOptionFileTransformerModel m = new ComboBoxOptionFileTransformerModel();
m.setUri(data.getUri());
m.setSource(data.getSource());
m.setLabel(data.getLabel());
m.setValue(data.getValue());
return m;
}
private List<UploadOptionFileTransformerModel> convertUploadDataOptions(List<UploadDataEntity.Option> data) {
List<UploadOptionFileTransformerModel> result = new ArrayList<>();
for (UploadDataEntity.Option d : data) {
UploadOptionFileTransformerModel m = new UploadOptionFileTransformerModel();
m.setLabel(d.getLabel());
m.setValue(d.getValue());
result.add(m);
}
return result;
}
}

View File

@ -0,0 +1,83 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateFileTransformerModel;
import eu.eudat.query.DescriptionTemplateQuery;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DescriptionTemplateFileTransformerBuilder extends BaseFileTransformerBuilder<DescriptionTemplateFileTransformerModel, DescriptionTemplateEntity> {
private final QueryFactory queryFactory;
private final BuilderFactory builderFactory;
private final JsonHandlingService jsonHandlingService;
private final XmlHandlingService xmlHandlingService;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public DescriptionTemplateFileTransformerBuilder(
ConventionService conventionService,
QueryFactory queryFactory,
BuilderFactory builderFactory, JsonHandlingService jsonHandlingService, XmlHandlingService xmlHandlingService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DescriptionTemplateFileTransformerBuilder.class)));
this.queryFactory = queryFactory;
this.builderFactory = builderFactory;
this.jsonHandlingService = jsonHandlingService;
this.xmlHandlingService = xmlHandlingService;
}
public DescriptionTemplateFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<DescriptionTemplateFileTransformerModel, DescriptionTemplateEntity>> buildInternal(List<DescriptionTemplateEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
data = queryFactory.query(DescriptionTemplateQuery.class).ids(data.stream().map(DescriptionTemplateEntity::getId).toList()).collect();
List<FileTransformerBuilderItemResponse<DescriptionTemplateFileTransformerModel, DescriptionTemplateEntity>> models = new ArrayList<>();
for (DescriptionTemplateEntity d : data) {
DescriptionTemplateFileTransformerModel m = new DescriptionTemplateFileTransformerModel();
m.setId(d.getId());
m.setLabel(d.getLabel());
m.setDescription(d.getDescription());
m.setLanguage(d.getLanguage());
m.setVersion(d.getVersion());
m.setDefinition(this.builderFactory.builder(DescriptionTemplateDefinitionFileTransformerBuilder.class).authorize(authorize).build(collectDescriptionTemplates(d)));
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
private eu.eudat.commons.types.descriptiontemplate.DefinitionEntity collectDescriptionTemplates(DescriptionTemplateEntity data) throws MyApplicationException {
return this.xmlHandlingService.fromXmlSafe(eu.eudat.commons.types.descriptiontemplate.DefinitionEntity.class, data.getDefinition());
}
}

View File

@ -0,0 +1,128 @@
package eu.eudat.model.builder.filetransformer;
import com.fasterxml.jackson.core.JsonProcessingException;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.types.dmpblueprint.*;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.data.DmpBlueprintEntity;
import eu.eudat.file.transformer.enums.DmpBlueprintExtraFieldDataType;
import eu.eudat.file.transformer.enums.DmpBlueprintFieldCategory;
import eu.eudat.file.transformer.enums.DmpBlueprintSystemFieldType;
import eu.eudat.file.transformer.models.descriptiontemplate.DescriptionTemplateFileTransformerModel;
import eu.eudat.file.transformer.models.dmpblueprint.DmpBlueprintFileTransformerModel;
import eu.eudat.file.transformer.models.dmpblueprint.definition.*;
import eu.eudat.model.dmpblueprintdefinition.*;
import eu.eudat.query.DescriptionTemplateQuery;
import eu.eudat.query.DmpBlueprintQuery;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DmpBlueprintFileTransformerBuilder extends BaseFileTransformerBuilder<DmpBlueprintFileTransformerModel, DmpBlueprintEntity> {
private final QueryFactory queryFactory;
private final BuilderFactory builderFactory;
private final JsonHandlingService jsonHandlingService;
private final XmlHandlingService xmlHandlingService;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public DmpBlueprintFileTransformerBuilder(
ConventionService conventionService,
QueryFactory queryFactory,
BuilderFactory builderFactory, JsonHandlingService jsonHandlingService, XmlHandlingService xmlHandlingService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpBlueprintFileTransformerBuilder.class)));
this.queryFactory = queryFactory;
this.builderFactory = builderFactory;
this.jsonHandlingService = jsonHandlingService;
this.xmlHandlingService = xmlHandlingService;
}
public DmpBlueprintFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<DmpBlueprintFileTransformerModel, DmpBlueprintEntity>> buildInternal(List<DmpBlueprintEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
data = queryFactory.query(DmpBlueprintQuery.class).ids(data.stream().map(DmpBlueprintEntity::getId).toList()).collect();
List<FileTransformerBuilderItemResponse<DmpBlueprintFileTransformerModel, DmpBlueprintEntity>> models = new ArrayList<>();
for (DmpBlueprintEntity d : data) {
DmpBlueprintFileTransformerModel m = new DmpBlueprintFileTransformerModel();
m.setId(d.getId());
m.setLabel(d.getLabel());
try {
m.setDefinitionFileTransformerModel(getDefinition(d.getDefinition()));
} catch (JsonProcessingException e) {
logger.error(e.getMessage(), e);
}
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
private DefinitionFileTransformerModel getDefinition(String source) throws JsonProcessingException {
DefinitionFileTransformerModel result = new DefinitionFileTransformerModel();
result.setSections(new ArrayList<>());
DefinitionEntity parsedDefinition = xmlHandlingService.fromXmlSafe(DefinitionEntity.class, source);
List<SectionEntity> sections = parsedDefinition.getSections();
sections.forEach(section -> {
SectionFileTransformerModel m = new SectionFileTransformerModel();
m.setId(section.getId());
m.setLabel(section.getLabel());
m.setOrdinal(section.getOrdinal());
m.setDescription(section.getDescription());
m.setFields(mapFields(section.getFields()));
m.setHasTemplates(section.getHasTemplates());
result.getSections().add(m);
});
return result;
}
private List<FieldFileTransformerModel> mapFields(List<FieldEntity> fieldEntities) {
List<FieldFileTransformerModel> result = new ArrayList<>();
fieldEntities.forEach(fieldEntity -> {
FieldFileTransformerModel m = switch (fieldEntity.getCategory()) {
case System -> new SystemFieldFileTransformerModel();
case Extra -> new ExtraFieldFileTransformerModelFileTransformerModel();
};
m.setId(fieldEntity.getId());
m.setLabel(fieldEntity.getLabel());
m.setDescription(fieldEntity.getDescription());
m.setOrdinal(fieldEntity.getOrdinal());
m.setPlaceholder(fieldEntity.getPlaceholder());
m.setRequired(fieldEntity.isRequired());
switch (m) {
case SystemFieldFileTransformerModel sm -> sm.setSystemFieldType(DmpBlueprintSystemFieldType.of(((SystemFieldEntity)fieldEntity).getType().getValue()));
case ExtraFieldFileTransformerModelFileTransformerModel sm -> sm.setDataType(DmpBlueprintExtraFieldDataType.of(((ExtraFieldEntity)fieldEntity).getType().getValue()));
default -> {}
}
result.add(m);
});
return result;
}
}

View File

@ -0,0 +1,200 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.*;
import eu.eudat.file.transformer.enums.DmpAccessType;
import eu.eudat.file.transformer.enums.DmpStatus;
import eu.eudat.file.transformer.enums.DmpVersionStatus;
import eu.eudat.file.transformer.models.description.DescriptionFileTransformerModel;
import eu.eudat.file.transformer.models.dmp.DmpFileTransformerModel;
import eu.eudat.file.transformer.models.dmp.DmpReferenceFileTransformerModel;
import eu.eudat.file.transformer.models.dmp.DmpUserFileTransformerModel;
import eu.eudat.file.transformer.models.dmpblueprint.DmpBlueprintFileTransformerModel;
import eu.eudat.file.transformer.models.dmpblueprint.definition.SectionFileTransformerModel;
import eu.eudat.file.transformer.models.entitydoi.EntityDoiFileTransformerModel;
import eu.eudat.file.transformer.models.reference.ReferenceFileTransformerModel;
import eu.eudat.file.transformer.models.user.UserFileTransformerModel;
import eu.eudat.model.*;
import eu.eudat.model.builder.DmpReferenceBuilder;
import eu.eudat.query.*;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.Ordering;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.fieldset.BaseFieldSet;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DmpFileTransformerBuilder extends BaseFileTransformerBuilder<DmpFileTransformerModel, DmpEntity> {
private final QueryFactory queryFactory;
private final BuilderFactory builderFactory;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
private Boolean ignoreDescriptions = false;
@Autowired
public DmpFileTransformerBuilder(ConventionService conventionService,
QueryFactory queryFactory,
BuilderFactory builderFactory) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpFileTransformerBuilder.class)));
this.queryFactory = queryFactory;
this.builderFactory = builderFactory;
}
public DmpFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
public DmpFileTransformerBuilder ignoreDescriptions(Boolean ignoreDescriptions) {
this.ignoreDescriptions = ignoreDescriptions;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<DmpFileTransformerModel, DmpEntity>> buildInternal(List<DmpEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
List<FileTransformerBuilderItemResponse<DmpFileTransformerModel, DmpEntity>> models = new ArrayList<>();
Map<UUID, List<DmpReferenceFileTransformerModel>> dmpReferencesMap = this.collectReferences(data);
Map<UUID, List<DmpUserFileTransformerModel>> dmpUsersMap = this.collectDmpUsers(data);
Map<UUID, List<DescriptionFileTransformerModel>> descriptionsMap = null;
if (!ignoreDescriptions) {
descriptionsMap = this.collectDmpDescriptions(data);
}
Map<UUID, List<EntityDoiFileTransformerModel>> doiMap = this.collectEntityDois(data);
Map<UUID, UserFileTransformerModel> creatorMap = this.collectCreators(data);
Map<UUID, DmpBlueprintFileTransformerModel> blueprintMap = this.collectBlueprints(data);
for (DmpEntity d : data) {
DmpFileTransformerModel m = new DmpFileTransformerModel();
m.setId(d.getId());
m.setLabel(d.getLabel());
m.setVersion(d.getVersion());
m.setDescription(d.getDescription());
m.setFinalizedAt(d.getFinalizedAt());
m.setCreatedAt(d.getCreatedAt());
if (d.getPublicAfter() != null && d.getPublicAfter().isAfter(Instant.now())) {
m.setPublishedAt(d.getPublicAfter());
}
switch (d.getAccessType()){
case Public -> m.setAccessType(DmpAccessType.Public);
case Restricted -> m.setAccessType(DmpAccessType.Restricted);
case null -> m.setAccessType(null);
default -> throw new MyApplicationException("unrecognized type " + d.getAccessType().getValue());
}
m.setProperties(d.getProperties());
m.setUpdatedAt(d.getUpdatedAt());
m.setLanguage(d.getLanguage());
m.setStatus(DmpStatus.of(d.getStatus().getValue()));
m.setVersionStatus(DmpVersionStatus.of(d.getVersionStatus().getValue()));
if (dmpReferencesMap != null && !dmpReferencesMap.isEmpty() && dmpReferencesMap.containsKey(d.getId())) m.setDmpReferences(dmpReferencesMap.get(d.getId()));
if (dmpUsersMap != null && !dmpUsersMap.isEmpty() && dmpUsersMap.containsKey(d.getId())) m.setDmpUsers(dmpUsersMap.get(d.getId()));
if (descriptionsMap != null && !descriptionsMap.isEmpty() && descriptionsMap.containsKey(d.getId())) m.setDescriptions(descriptionsMap.get(d.getId()));
if (doiMap != null && !doiMap.isEmpty() && doiMap.containsKey(d.getId())) m.setEntityDois(doiMap.get(d.getId()));
if (creatorMap != null && !creatorMap.isEmpty() && creatorMap.containsKey(d.getId())) m.setCreator(creatorMap.get(d.getId()));
if (blueprintMap != null && !blueprintMap.isEmpty() && blueprintMap.containsKey(d.getBlueprintId())) m.setBlueprint(blueprintMap.get(d.getBlueprintId()));
SectionFileTransformerModel templateSection = m.getBlueprint().getDefinitionFileTransformerModel().getSections().stream().filter(SectionFileTransformerModel::getHasTemplates).findFirst().orElse(null);
if (templateSection != null && m.getDescriptions() != null && !m.getDescriptions().isEmpty()) {
m.getDescriptions().forEach(description -> {
description.setSectionId(templateSection.getId());
description.setCreatedBy(m.getCreator());
});
}
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
private Map<UUID, List<DmpReferenceFileTransformerModel>> collectReferences(List<DmpEntity> data) throws MyApplicationException {
if (data.isEmpty()) return null;
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
List<DmpReferenceEntity> dmpReferences = this.queryFactory.query(DmpReferenceQuery.class).isActives(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList())).collectAs(new BaseFieldSet().ensure(DmpReference._dmp).ensure(DmpReference._reference));
Map<UUID, List<DmpReferenceFileTransformerModel>> itemMap = new HashMap<>();
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).isActive(IsActive.Active).ids(dmpReferences.stream().map(DmpReferenceEntity::getReferenceId).distinct().collect(Collectors.toList()));
Map<UUID, ReferenceFileTransformerModel> referenceDepositModelMap = this.builderFactory.builder(ReferenceFileTransformerBuilder.class).authorize(this.authorize).asForeignKey(query, ReferenceEntity::getId);
if (referenceDepositModelMap == null) return null;
for (DmpReferenceEntity dmpReference : dmpReferences) {
DmpReferenceFileTransformerModel dmpReferenceFileTransformerModel = new DmpReferenceFileTransformerModel();
dmpReferenceFileTransformerModel.setId(dmpReference.getId());
dmpReferenceFileTransformerModel.setData(dmpReference.getData());
dmpReferenceFileTransformerModel.setReference(referenceDepositModelMap.getOrDefault(dmpReference.getReferenceId(), null));
DmpReferenceFileTransformerModel model = dmpReferenceFileTransformerModel;
if (model == null) continue;
UUID key = dmpReference.getDmpId();
if (!itemMap.containsKey(key)) itemMap.put(key, new ArrayList<>());
itemMap.get(key).add(model);
}
return itemMap;
}
private Map<UUID, List<DmpUserFileTransformerModel>> collectDmpUsers(List<DmpEntity> data) throws MyApplicationException {
this.logger.debug("checking related - {}", DmpUser.class.getSimpleName());
Map<UUID, List<DmpUserFileTransformerModel>> itemMap;
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).isActives(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DmpUserFileTransformerBuilder.class).authorize(this.authorize).asMasterKey(query, DmpUserEntity::getDmpId);
return itemMap;
}
private Map<UUID, List<DescriptionFileTransformerModel>> collectDmpDescriptions(List<DmpEntity> data) throws MyApplicationException {
if (data.isEmpty()) return null;
this.logger.debug("checking related - {}", Description.class.getSimpleName());
Map<UUID, List<DescriptionFileTransformerModel>> itemMap;
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).isActive(IsActive.Active).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DescriptionFileTransformerBuilder.class).authorize(this.authorize).asMasterKey(query, DescriptionEntity::getDmpId);
return itemMap;
}
private Map<UUID, UserFileTransformerModel> collectCreators(List<DmpEntity> data) {
DmpUserQuery query = this.queryFactory.query(DmpUserQuery.class).isActives(IsActive.Active).authorize(this.authorize).userIds(data.stream().map(DmpEntity::getCreatorId).toList());
return this.builderFactory.builder(DmpUserFileTransformerBuilder.class).authorize(this.authorize).asMasterKey(query, DmpUserEntity::getDmpId)
.entrySet().stream().map(uuidListEntry -> Map.entry(uuidListEntry.getKey(), uuidListEntry.getValue().get(0).getUser()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
private Map<UUID, DmpBlueprintFileTransformerModel> collectBlueprints(List<DmpEntity> data) {
DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().map(DmpEntity::getBlueprintId).toList());
return this.builderFactory.builder(DmpBlueprintFileTransformerBuilder.class).authorize(this.authorize).asMasterKey(query, DmpBlueprintEntity::getId)
.entrySet().stream().map(uuidListEntry -> Map.entry(uuidListEntry.getKey(), uuidListEntry.getValue().get(0)))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
private Map<UUID, List<EntityDoiFileTransformerModel>> collectEntityDois(List<DmpEntity> data) {
if (data.isEmpty()) return null;
Map<UUID, List<EntityDoiFileTransformerModel>> result;
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).isActive(IsActive.Active).authorize(authorize).entityIds(data.stream().map(DmpEntity::getId).distinct().toList());
result = builderFactory.builder(EntityDoiFileTransformerBuilder.class).asMasterKey(query, EntityDoiEntity::getEntityId);
return result;
}
}

View File

@ -0,0 +1,85 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DmpUserEntity;
import eu.eudat.data.UserEntity;
import eu.eudat.file.transformer.enums.DmpUserRole;
import eu.eudat.file.transformer.models.dmp.DmpUserFileTransformerModel;
import eu.eudat.file.transformer.models.user.UserFileTransformerModel;
import eu.eudat.query.UserQuery;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.stream.Collectors;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DmpUserFileTransformerBuilder extends BaseFileTransformerBuilder<DmpUserFileTransformerModel, DmpUserEntity> {
private final BuilderFactory builderFactory;
private final QueryFactory queryFactory;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public DmpUserFileTransformerBuilder(
ConventionService conventionService,
BuilderFactory builderFactory, QueryFactory queryFactory) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpUserFileTransformerBuilder.class)));
this.builderFactory = builderFactory;
this.queryFactory = queryFactory;
}
public DmpUserFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<DmpUserFileTransformerModel, DmpUserEntity>> buildInternal(List<DmpUserEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items ", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null)
return new ArrayList<>();
Map<UUID, UserFileTransformerModel> userItemsMap = this.collectUsers(data);
List<FileTransformerBuilderItemResponse<DmpUserFileTransformerModel, DmpUserEntity>> models = new ArrayList<>();
for (DmpUserEntity d : data) {
DmpUserFileTransformerModel m = new DmpUserFileTransformerModel();
m.setId(d.getId());
switch (d.getRole()){
case User -> m.setRole(DmpUserRole.User);
case Owner -> m.setRole(DmpUserRole.Owner);
default -> throw new MyApplicationException("unrecognized type " + d.getRole().getValue());
}
if (userItemsMap != null && userItemsMap.containsKey(d.getUserId())) m.setUser(userItemsMap.get(d.getUserId()));
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
private Map<UUID, UserFileTransformerModel> collectUsers(List<DmpUserEntity> data) throws MyApplicationException {
if (data.isEmpty())
return null;
this.logger.debug("checking related - {}", UserFileTransformerModel.class.getSimpleName());
Map<UUID, UserFileTransformerModel> itemMap;
UserQuery q = this.queryFactory.query(UserQuery.class).isActive(IsActive.Active).authorize(this.authorize).ids(data.stream().map(DmpUserEntity::getUserId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(UserFileTransformerBuilder.class).authorize(this.authorize).asForeignKey(q, UserEntity::getId);
return itemMap;
}
}

View File

@ -0,0 +1,34 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.EntityDoiEntity;
import eu.eudat.file.transformer.models.entitydoi.EntityDoiFileTransformerModel;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class EntityDoiFileTransformerBuilder extends BaseFileTransformerBuilder<EntityDoiFileTransformerModel, EntityDoiEntity>{
@Autowired
public EntityDoiFileTransformerBuilder(ConventionService conventionService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpFileTransformerBuilder.class)));
}
@Override
protected List<FileTransformerBuilderItemResponse<EntityDoiFileTransformerModel, EntityDoiEntity>> buildInternal(List<EntityDoiEntity> data) throws MyApplicationException {
List<FileTransformerBuilderItemResponse<EntityDoiFileTransformerModel, EntityDoiEntity>> result = new ArrayList<>();
for (EntityDoiEntity d : data) {
EntityDoiFileTransformerModel m = new EntityDoiFileTransformerModel();
m.setId(d.getId());
m.setDoi(d.getDoi());
m.setRepositoryId(d.getRepositoryId());
result.add(new FileTransformerBuilderItemResponse<>(m, d));
}
return result;
}
}

View File

@ -0,0 +1,19 @@
package eu.eudat.model.builder.filetransformer;
public class FileTransformerBuilderItemResponse<M, D>{
private final M model;
private final D data;
public FileTransformerBuilderItemResponse(M model, D data) {
this.model = model;
this.data = data;
}
public D getData() {
return data;
}
public M getModel() {
return model;
}
}

View File

@ -0,0 +1,55 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.reference.DefinitionEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.depositinterface.models.reference.DefinitionDepositModel;
import eu.eudat.file.transformer.models.reference.DefinitionFileTransformerModel;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ReferenceDefinitionFileTransformerBuilder extends BaseFileTransformerBuilder<DefinitionFileTransformerModel, DefinitionEntity> {
private final BuilderFactory builderFactory;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public ReferenceDefinitionFileTransformerBuilder(
ConventionService conventionService, BuilderFactory builderFactory) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(ReferenceDefinitionFileTransformerBuilder.class)));
this.builderFactory = builderFactory;
}
public ReferenceDefinitionFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<DefinitionFileTransformerModel, DefinitionEntity>> buildInternal(List<DefinitionEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
List<FileTransformerBuilderItemResponse<DefinitionFileTransformerModel, DefinitionEntity>> models = new ArrayList<>();
for (DefinitionEntity d : data) {
DefinitionFileTransformerModel m = new DefinitionFileTransformerModel();
if (d.getFields() != null) m.setFields(this.builderFactory.builder(ReferenceFieldFileTransformerBuilder.class).authorize(this.authorize).build(d.getFields()));
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
}

View File

@ -0,0 +1,54 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.types.reference.FieldEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.depositinterface.models.reference.FieldDepositModel;
import eu.eudat.file.transformer.models.reference.FieldFileTransformerModel;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ReferenceFieldFileTransformerBuilder extends BaseFileTransformerBuilder<FieldFileTransformerModel, FieldEntity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public ReferenceFieldFileTransformerBuilder(
ConventionService conventionService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(ReferenceFieldFileTransformerBuilder.class)));
}
public ReferenceFieldFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<FieldFileTransformerModel, FieldEntity>> buildInternal(List<FieldEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
List<FileTransformerBuilderItemResponse<FieldFileTransformerModel, FieldEntity>> models = new ArrayList<>();
for (FieldEntity d : data) {
FieldFileTransformerModel m = new FieldFileTransformerModel();
m.setCode(d.getCode());
m.setValue(d.getValue());
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
}

View File

@ -0,0 +1,94 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.commons.types.reference.DefinitionEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.ReferenceEntity;
import eu.eudat.file.transformer.enums.ReferenceSourceType;
import eu.eudat.file.transformer.enums.ReferenceType;
import eu.eudat.file.transformer.models.description.DescriptionReferenceFileTransformerModel;
import eu.eudat.file.transformer.models.dmp.DmpReferenceFileTransformerModel;
import eu.eudat.file.transformer.models.reference.ReferenceFileTransformerModel;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ReferenceFileTransformerBuilder extends BaseFileTransformerBuilder<ReferenceFileTransformerModel, ReferenceEntity> {
private final BuilderFactory builderFactory;
private final XmlHandlingService xmlHandlingService;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public ReferenceFileTransformerBuilder(
ConventionService conventionService,
BuilderFactory builderFactory, XmlHandlingService xmlHandlingService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(ReferenceFileTransformerBuilder.class)));
this.builderFactory = builderFactory;
this.xmlHandlingService = xmlHandlingService;
}
public ReferenceFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<ReferenceFileTransformerModel, ReferenceEntity>> buildInternal(List<ReferenceEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
List<FileTransformerBuilderItemResponse<ReferenceFileTransformerModel, ReferenceEntity>> models = new ArrayList<>();
for (ReferenceEntity d : data) {
ReferenceFileTransformerModel m = new ReferenceFileTransformerModel();
m.setId(d.getId());
m.setLabel(d.getLabel());
if (d.getDefinition() != null){
DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, d.getDefinition());
m.setDefinition(this.builderFactory.builder(ReferenceDefinitionFileTransformerBuilder.class).authorize(this.authorize).build(definition));
}
m.setReference(d.getReference());
m.setAbbreviation(d.getAbbreviation());
m.setDescription(d.getDescription());
m.setSource(d.getSource());
switch (d.getSourceType()){
case Internal -> m.setSourceType(ReferenceSourceType.Internal);
case External -> m.setSourceType(ReferenceSourceType.External);
default -> throw new MyApplicationException("unrecognized type " + d.getSourceType().getValue());
}
switch (d.getType()){
case Taxonomies -> m.setType(ReferenceType.Taxonomies);
case Licenses -> m.setType(ReferenceType.Licenses);
case Publications -> m.setType(ReferenceType.Publications);
case Journals -> m.setType(ReferenceType.Journals);
case PubRepositories -> m.setType(ReferenceType.PubRepositories);
case DataRepositories -> m.setType(ReferenceType.DataRepositories);
case Registries -> m.setType(ReferenceType.Registries);
case Services -> m.setType(ReferenceType.Services);
case Project -> m.setType(ReferenceType.Project);
case Funder -> m.setType(ReferenceType.Funder);
case Datasets -> m.setType(ReferenceType.Datasets);
case Organizations -> m.setType(ReferenceType.Organizations);
case Grants -> m.setType(ReferenceType.Grants);
case Researcher -> m.setType(ReferenceType.Researcher);
default -> throw new MyApplicationException("unrecognized type " + d.getType().getValue());
}
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
}

View File

@ -0,0 +1,59 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.XmlHandlingService;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.TagEntity;
import eu.eudat.file.transformer.models.tag.TagFileTransformerModel;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class TagFileTransformerBuilder extends BaseFileTransformerBuilder<TagFileTransformerModel, TagEntity> {
private final BuilderFactory builderFactory;
private final XmlHandlingService xmlHandlingService;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public TagFileTransformerBuilder(
ConventionService conventionService,
BuilderFactory builderFactory, XmlHandlingService xmlHandlingService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(TagFileTransformerBuilder.class)));
this.builderFactory = builderFactory;
this.xmlHandlingService = xmlHandlingService;
}
public TagFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<TagFileTransformerModel, TagEntity>> buildInternal(List<TagEntity> data) throws MyApplicationException {
this.logger.debug("building for {}", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty()) return new ArrayList<>();
List<FileTransformerBuilderItemResponse<TagFileTransformerModel, TagEntity>> models = new ArrayList<>();
for (TagEntity d : data) {
TagFileTransformerModel m = new TagFileTransformerModel();
m.setId(d.getId());
m.setLabel(d.getLabel());
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
}

View File

@ -0,0 +1,76 @@
package eu.eudat.model.builder.filetransformer;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.UserContactInfoEntity;
import eu.eudat.data.UserEntity;
import eu.eudat.depositinterface.models.UserDepositModel;
import eu.eudat.file.transformer.enums.ContactInfoType;
import eu.eudat.file.transformer.models.user.UserContactInfoFileTransformerModel;
import eu.eudat.file.transformer.models.user.UserFileTransformerModel;
import eu.eudat.query.UserContactInfoQuery;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class UserFileTransformerBuilder extends BaseFileTransformerBuilder<UserFileTransformerModel, UserEntity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
private final QueryFactory queryFactory;
@Autowired
public UserFileTransformerBuilder(ConventionService conventionService, QueryFactory queryFactory) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(UserFileTransformerBuilder.class)));
this.queryFactory = queryFactory;
}
public UserFileTransformerBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected List<FileTransformerBuilderItemResponse<UserFileTransformerModel, UserEntity>> buildInternal(List<UserEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items ", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null)
return new ArrayList<>();
List<FileTransformerBuilderItemResponse<UserFileTransformerModel, UserEntity>> models = new ArrayList<>();
for (UserEntity d : data) {
UserFileTransformerModel m = new UserFileTransformerModel();
m.setId(d.getId());
m.setName(d.getName());
m.setContacts(mapContactInfo(d.getId()));
models.add(new FileTransformerBuilderItemResponse<>(m, d));
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
private List<UserContactInfoFileTransformerModel> mapContactInfo(UUID userId) {
List<UserContactInfoFileTransformerModel> result = new ArrayList<>();
UserContactInfoQuery query = this.queryFactory.query(UserContactInfoQuery.class).userIds(userId);
List<UserContactInfoEntity> contactInfos = query.collect();
contactInfos.forEach(contactInfo -> {
UserContactInfoFileTransformerModel m = new UserContactInfoFileTransformerModel();
m.setId(contactInfo.getId());
m.setOrdinal(contactInfo.getOrdinal());
m.setType(ContactInfoType.of(contactInfo.getType().getValue()));
m.setValue(contactInfo.getValue());
result.add(m);
});
return result;
}
}

View File

@ -0,0 +1,25 @@
package eu.eudat.model.file;
import java.util.UUID;
public class ExportRequestModel {
private UUID id;
private String format;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
}

View File

@ -1,6 +1,5 @@
package eu.eudat.model.file;
import eu.eudat.file.transformer.model.file.FileFormat;
import eu.eudat.file.transformer.models.misc.FileFormat;
import java.util.List;

View File

@ -1,21 +1,17 @@
package eu.eudat.repository;
import eu.eudat.file.transformer.executor.FileTransformerExecutor;
import eu.eudat.file.transformer.model.DescriptionFileTransformerModel;
import eu.eudat.file.transformer.model.DmpFileTransformerModel;
import eu.eudat.file.transformer.model.ExtraPropertiesModel;
import eu.eudat.file.transformer.model.file.FileEnvelope;
import eu.eudat.file.transformer.model.file.FileFormat;
import eu.eudat.utilities.webclient.WebClientUtils;
import eu.eudat.file.transformer.interfaces.FileTransformerClient;
import eu.eudat.file.transformer.interfaces.FileTransformerConfiguration;
import eu.eudat.file.transformer.models.description.DescriptionFileTransformerModel;
import eu.eudat.file.transformer.models.dmp.DmpFileTransformerModel;
import eu.eudat.file.transformer.models.misc.FileEnvelope;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.web.reactive.function.client.WebClient;
import javax.management.InvalidApplicationException;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public class TransformerRepository implements FileTransformerExecutor {
public class TransformerRepository implements FileTransformerClient {
private final WebClient transformerClient;
@ -24,28 +20,28 @@ public class TransformerRepository implements FileTransformerExecutor {
}
@Override
public FileEnvelope exportDmp(DmpFileTransformerModel dmpFileTransformerModel, ExtraPropertiesModel map) throws InvalidApplicationException, IOException {
return transformerClient.post().uri("/export/dmp", uriBuilder -> WebClientUtils.buildParameters(uriBuilder, map)).bodyValue(dmpFileTransformerModel).exchangeToMono(mono -> mono.bodyToMono(FileEnvelope.class)).block();
public FileEnvelope exportDmp(DmpFileTransformerModel dmpFileTransformerModel) throws InvalidApplicationException, IOException {
return transformerClient.post().uri("/export/dmp").bodyValue(dmpFileTransformerModel).exchangeToMono(mono -> mono.bodyToMono(FileEnvelope.class)).block();
}
@Override
public DmpFileTransformerModel importFileToDmp(FileEnvelope fileEnvelope) {
public DmpFileTransformerModel importDmp(FileEnvelope fileEnvelope) {
return transformerClient.post().uri("/import/dmp").bodyValue(fileEnvelope).exchangeToMono(mono -> mono.bodyToMono(DmpFileTransformerModel.class)).block();
}
@Override
public FileEnvelope exportDescription(DescriptionFileTransformerModel descriptionFileTransformerModel, ExtraPropertiesModel map) throws InvalidApplicationException, IOException {
return transformerClient.post().uri("/export/description", uriBuilder -> WebClientUtils.buildParameters(uriBuilder, map)).bodyValue(descriptionFileTransformerModel).exchangeToMono(mono -> mono.bodyToMono(FileEnvelope.class)).block();
public FileEnvelope exportDescription(DescriptionFileTransformerModel descriptionFileTransformerModel, String format) {
return transformerClient.post().uri("/export/description", uriBuilder -> uriBuilder.queryParam("format", format).build()).bodyValue(descriptionFileTransformerModel).exchangeToMono(mono -> mono.bodyToMono(FileEnvelope.class)).block();
}
@Override
public DescriptionFileTransformerModel importFileToDescription(FileEnvelope fileEnvelope) {
public DescriptionFileTransformerModel importDescription(FileEnvelope fileEnvelope) {
return transformerClient.post().uri("/import/description").bodyValue(fileEnvelope).exchangeToMono(mono -> mono.bodyToMono(DescriptionFileTransformerModel.class)).block();
}
@Override
public List<FileFormat> getSupportedFileFormats() {
return transformerClient.get().uri("/formats").exchangeToMono(mono -> mono.bodyToMono(new ParameterizedTypeReference<List<FileFormat>>() {})).block();
public FileTransformerConfiguration getConfiguration() {
return transformerClient.get().uri("/formats").exchangeToMono(mono -> mono.bodyToMono(new ParameterizedTypeReference<FileTransformerConfiguration>() {})).block();
}

View File

@ -15,7 +15,6 @@ import eu.eudat.commons.types.prefilling.PrefillingEntity;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.data.ReferenceEntity;
import eu.eudat.file.transformer.utils.helpers.StreamDistinctBy;
import eu.eudat.model.*;
import eu.eudat.model.builder.DescriptionTemplateBuilder;
import eu.eudat.model.builder.PrefillingBuilder;
@ -35,6 +34,7 @@ import eu.eudat.service.remotefetcher.config.entities.*;
import eu.eudat.service.remotefetcher.criteria.ExternalReferenceCriteria;
import eu.eudat.service.remotefetcher.criteria.FetchStrategy;
import eu.eudat.service.remotefetcher.models.ExternalAutocompleteFieldResult;
import eu.eudat.utilities.helpers.StreamDistinctBy;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;

View File

@ -4,44 +4,29 @@ import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission;
import eu.eudat.cache.transformer.FileTransformerConfigurationCache;
import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.enums.DmpUserRole;
import eu.eudat.commons.enums.StorageType;
import eu.eudat.configurations.transformer.TransformerProperties;
import eu.eudat.convention.ConventionService;
import eu.eudat.file.transformer.model.DescriptionFileTransformerModel;
import eu.eudat.file.transformer.model.DmpFileTransformerModel;
import eu.eudat.file.transformer.model.ExtraPropertiesModel;
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Field;
import eu.eudat.file.transformer.model.descriptiontemplatedefinition.Rule;
import eu.eudat.file.transformer.model.file.FileFormat;
import eu.eudat.model.*;
import eu.eudat.model.builder.DescriptionBuilder;
import eu.eudat.model.builder.DmpBuilder;
import eu.eudat.model.descriptionproperties.PropertyDefinition;
import eu.eudat.model.descriptiontemplatedefinition.Definition;
import eu.eudat.model.descriptiontemplatedefinition.Multiplicity;
import eu.eudat.model.descriptiontemplatedefinition.Page;
import eu.eudat.model.descriptiontemplatedefinition.Section;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteSingleData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
import eu.eudat.model.dmpblueprintdefinition.ExtraField;
import eu.eudat.model.dmpblueprintdefinition.SystemField;
import eu.eudat.model.file.FileEnvelope;
import eu.eudat.file.transformer.interfaces.FileTransformerConfiguration;
import eu.eudat.file.transformer.models.description.DescriptionFileTransformerModel;
import eu.eudat.file.transformer.models.dmp.DmpFileTransformerModel;
import eu.eudat.file.transformer.models.misc.FileEnvelope;
import eu.eudat.file.transformer.models.misc.FileFormat;
import eu.eudat.model.builder.filetransformer.DescriptionFileTransformerBuilder;
import eu.eudat.model.builder.filetransformer.DmpFileTransformerBuilder;
import eu.eudat.model.file.TransformerCacheModel;
import eu.eudat.query.DescriptionQuery;
import eu.eudat.query.DmpQuery;
import eu.eudat.query.EntityDoiQuery;
import eu.eudat.repository.TransformerRepository;
import eu.eudat.service.entitydoi.EntityDoiService;
import eu.eudat.service.storage.StorageFileService;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeCacheService;
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeFilterFunction;
import gr.cite.commons.web.oidc.filter.webflux.TokenExchangeModel;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.fieldset.BaseFieldSet;
import gr.cite.tools.fieldset.FieldSet;
import jakarta.persistence.EntityManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -58,7 +43,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import java.util.*;
@Service
@ -78,10 +62,11 @@ public class FileTransformerService {
private final JsonHandlingService jsonHandlingService;
private final QueryFactory queryFactory;
private final BuilderFactory builderFactory;
private final StorageFileService storageFileService;
@Autowired
public FileTransformerService(TransformerProperties transformerProperties, TokenExchangeCacheService tokenExchangeCacheService, FileTransformerConfigurationCache fileTransformerConfigurationCache, WebClient.Builder builder, EntityManager entityManager, AuthorizationService authorizationService, ConventionService conventionService, Environment environment, DmpQuery dmpQuery, EntityDoiQuery doiQuery, EntityDoiService doiService, ApplicationContext applicationContext, JsonHandlingService jsonHandlingService, QueryFactory queryFactory, BuilderFactory builderFactory) {
public FileTransformerService(TransformerProperties transformerProperties, TokenExchangeCacheService tokenExchangeCacheService, FileTransformerConfigurationCache fileTransformerConfigurationCache, WebClient.Builder builder, EntityManager entityManager, AuthorizationService authorizationService, ConventionService conventionService, Environment environment, DmpQuery dmpQuery, EntityDoiQuery doiQuery, EntityDoiService doiService, ApplicationContext applicationContext, JsonHandlingService jsonHandlingService, QueryFactory queryFactory, BuilderFactory builderFactory, StorageFileService storageFileService) {
this.transformerProperties = transformerProperties;
this.tokenExchangeCacheService = tokenExchangeCacheService;
this.fileTransformerConfigurationCache = fileTransformerConfigurationCache;
@ -94,6 +79,7 @@ public class FileTransformerService {
this.jsonHandlingService = jsonHandlingService;
this.queryFactory = queryFactory;
this.builderFactory = builderFactory;
this.storageFileService = storageFileService;
this.clients = new HashMap<>();
}
@ -125,9 +111,9 @@ public class FileTransformerService {
List<TransformerRepository> repositories = transformerProperties.getSources().stream().map(depositSource -> getRepository(depositSource.getCodes().get(0))).toList();
repositories.forEach((client) -> {
List<FileFormat> repositoryConfigs = client.getSupportedFileFormats();
if (repositoryConfigs != null && !repositoryConfigs.isEmpty()) {
configurations.addAll(repositoryConfigs);
FileTransformerConfiguration repositoryConfigs = client.getConfiguration();
if (repositoryConfigs != null && !repositoryConfigs.getExportVariants().isEmpty()) {
configurations.addAll(repositoryConfigs.getExportVariants());
}
});
@ -138,318 +124,44 @@ public class FileTransformerService {
return configs.getFormats();
}
public FileEnvelope exportDmp(UUID dmpId, String format) throws InvalidApplicationException, IOException {
public eu.eudat.model.file.FileEnvelope exportDmp(UUID dmpId, String format) throws InvalidApplicationException, IOException {
this.authorizationService.authorize(Permission.EditDmp);
//GK: Why it is in that service, and why it's not static?
this.conventionService.isValidGuid(dmpId);
//GK: First get the right client
TransformerRepository repository = getRepository(format);
//GK: Second get the Target Data Management Plan
FieldSet fieldSet = new BaseFieldSet(Dmp._id,
Dmp._accessType,
Dmp._dmpReferences,
Dmp._blueprint,
Dmp._dmpUsers,
Dmp._createdAt,
Dmp._creator,
Dmp._description,
Dmp._descriptions,
Dmp._entityDois,
Dmp._finalizedAt,
Dmp._groupId,
Dmp._isActive,
Dmp._label,
Dmp._properties,
Dmp._language,
Dmp._publicAfter,
Dmp._status,
Dmp._updatedAt,
Dmp._version,
Dmp._versionStatus,
Dmp._dmpReferences + "." + DmpReference._id,
Dmp._dmpReferences + "." + DmpReference._data,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._id,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._description,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._abbreviation,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._definition,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._label,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._source,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._sourceType,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._type,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._isActive,
Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._reference,
Dmp._creator + "." + User._id,
Dmp._creator + "." + User._additionalInfo + "." + UserAdditionalInfo._avatarUrl,
Dmp._creator + "." + User._additionalInfo + "." + UserAdditionalInfo._culture,
Dmp._creator + "." + User._additionalInfo + "." + UserAdditionalInfo._language,
Dmp._creator + "." + User._additionalInfo + "." + UserAdditionalInfo._timezone,
Dmp._creator + "." + User._additionalInfo + "." + UserAdditionalInfo._roleOrganization,
Dmp._creator + "." + User._additionalInfo + "." + UserAdditionalInfo._organization,
Dmp._creator + "." + User._createdAt,
Dmp._creator + "." + User._isActive,
Dmp._creator + "." + User._name,
Dmp._creator + "." + User._roles + "." + UserRole._id,
Dmp._creator + "." + User._roles + "." + UserRole._role,
Dmp._descriptions + "." + Description._id,
Dmp._descriptions + "." + Description._label,
Dmp._descriptions + "." + Description._properties,
Dmp._descriptions + "." + Description._description,
Dmp._descriptions + "." + Description._status,
Dmp._descriptions + "." + Description._descriptionTags,
Dmp._descriptions + "." + Description._descriptionTemplate,
Dmp._descriptions + "." + Description._descriptionReferences,
Dmp._descriptions + "." + Description._isActive,
Dmp._descriptions + "." + Description._properties + "." + PropertyDefinition._fields + "." + eu.eudat.model.descriptionproperties.Field._key,
Dmp._descriptions + "." + Description._properties + "." + PropertyDefinition._fields + "." + eu.eudat.model.descriptionproperties.Field._value,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._id,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._id,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._description,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._abbreviation,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._definition,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._label,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._source,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._sourceType,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._type,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._isActive,
Dmp._descriptions + "." + Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._reference,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._id,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._description,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._label,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._language,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._status,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._isActive,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._groupId,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._type,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._version,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._id,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._description,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._sections,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._title,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._page,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._ordinal,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._defaultVisibility,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._extendedDescription,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._multiplicity + "." + Multiplicity._max,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._multiplicity + "." + Multiplicity._min,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._multiplicity + "." + Multiplicity._placeholder,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._multiplicity + "." + Multiplicity._tableView,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._numbering,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._id,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._title,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._description,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._ordinal,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._numbering,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._multiplicity + "." + Multiplicity._max,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._multiplicity + "." + Multiplicity._min,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._multiplicity + "." + Multiplicity._tableView,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._multiplicity + "." + Multiplicity._placeholder,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._hasCommentField,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._additionalInformation,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._extendedDescription,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._id,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._ordinal,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._numbering,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + BaseFieldData._label,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + BaseFieldData._fieldType,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._multiAutoComplete,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._autoCompleteSingleDataList + "." + AutoCompleteSingleData._autoCompleteOptions + "." + ComboBoxOption._label,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._autoCompleteSingleDataList + "." + AutoCompleteSingleData._autoCompleteOptions + "." + ComboBoxOption._uri,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._autoCompleteSingleDataList + "." + AutoCompleteSingleData._autoCompleteOptions + "." + ComboBoxOption._source,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._autoCompleteSingleDataList + "." + AutoCompleteSingleData._autoCompleteOptions + "." + ComboBoxOption._value,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._defaultValue,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._includeInExport,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._schematics,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._validations,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._visibilityRules + "." + Rule._target,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._visibilityRules + "." + Rule._value,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._pages + "." + Page._id,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._pages + "." + Page._ordinal,
Dmp._descriptions + "." + Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._pages + "." + Page._title,
Dmp._descriptions + "." + Description._descriptionTags + "." + DescriptionTag._id,
Dmp._descriptions + "." + Description._descriptionTags + "." + DescriptionTag._tag + "." + Tag._id,
Dmp._descriptions + "." + Description._descriptionTags + "." + DescriptionTag._tag + "." + Tag._label,
Dmp._descriptions + "." + Description._dmpDescriptionTemplate + "." + DmpDescriptionTemplate._sectionId,
Dmp._blueprint + "." + DmpBlueprint._id,
Dmp._blueprint + "." + DmpBlueprint._label,
Dmp._blueprint + "." + DmpBlueprint._definition,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._id,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._description,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._label,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._ordinal,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + eu.eudat.model.dmpblueprintdefinition.Field._id,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + eu.eudat.model.dmpblueprintdefinition.Field._description,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + eu.eudat.model.dmpblueprintdefinition.Field._ordinal,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + eu.eudat.model.dmpblueprintdefinition.Field._label,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + eu.eudat.model.dmpblueprintdefinition.Field._placeholder,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + eu.eudat.model.dmpblueprintdefinition.Field._category,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + eu.eudat.model.dmpblueprintdefinition.Field._required,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + SystemField._systemFieldType,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._fields + "." + ExtraField._dataType,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._descriptionTemplates + "." + eu.eudat.model.dmpblueprintdefinition.DescriptionTemplate._id,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._descriptionTemplates + "." + eu.eudat.model.dmpblueprintdefinition.DescriptionTemplate._label,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._descriptionTemplates + "." + eu.eudat.model.dmpblueprintdefinition.DescriptionTemplate._descriptionTemplateId,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._descriptionTemplates + "." + eu.eudat.model.dmpblueprintdefinition.DescriptionTemplate._maxMultiplicity,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._descriptionTemplates + "." + eu.eudat.model.dmpblueprintdefinition.DescriptionTemplate._minMultiplicity,
Dmp._blueprint + "." + DmpBlueprint._definition + "." + eu.eudat.model.dmpblueprintdefinition.Definition._sections + "." + eu.eudat.model.dmpblueprintdefinition.Section._hasTemplates,
Dmp._entityDois + "." + EntityDoi._doi,
Dmp._entityDois + "." + EntityDoi._id,
Dmp._entityDois + "." + EntityDoi._entityType,
Dmp._dmpUsers + "." + DmpUser._id,
Dmp._dmpUsers + "." + DmpUser._user + "." + User._id,
Dmp._dmpUsers + "." + DmpUser._user + "." + User._additionalInfo,
Dmp._dmpUsers + "." + DmpUser._user + "." + User._createdAt,
Dmp._dmpUsers + "." + DmpUser._user + "." + User._isActive,
Dmp._dmpUsers + "." + DmpUser._user + "." + User._name,
Dmp._dmpUsers + "." + DmpUser._user + "." + User._roles + "." + UserRole._id,
Dmp._dmpUsers + "." + DmpUser._user + "." + User._roles + "." + UserRole._role,
Dmp._dmpUsers + "." + DmpUser._role
);
DmpQuery query = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(dmpId);
Dmp model = this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
DmpFileTransformerModel dmpFileTransformerModel = this.jsonHandlingService.fromJsonSafe(DmpFileTransformerModel.class, this.jsonHandlingService.toJsonSafe(model));
ExtraPropertiesModel extraPropertiesModel = new ExtraPropertiesModel();
extraPropertiesModel.setFormat(format);
eu.eudat.file.transformer.model.file.FileEnvelope fileEnvelope = repository.exportDmp(dmpFileTransformerModel, extraPropertiesModel);
FileEnvelope result = new FileEnvelope();
DmpFileTransformerModel dmpFileTransformerModel = this.builderFactory.builder(DmpFileTransformerBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(query.first());
dmpFileTransformerModel.setVariant(format);
FileEnvelope fileEnvelope = repository.exportDmp(dmpFileTransformerModel);
eu.eudat.model.file.FileEnvelope result = new eu.eudat.model.file.FileEnvelope();
byte[] data = storageFileService.readByFileRefAsBytesSafe(fileEnvelope.getFile(), StorageType.Transformer);
File temp = new File(environment.getProperty("path.path") + UUID.randomUUID());
try (FileOutputStream fos = new FileOutputStream(temp)) {
fos.write(fileEnvelope.getFile());
fos.write(data);
}
result.setFile(temp);
result.setFilename(fileEnvelope.getFilename());
return result;
}
public FileEnvelope exportDescription(UUID descriptionId, String format) throws InvalidApplicationException, IOException {
public eu.eudat.model.file.FileEnvelope exportDescription(UUID descriptionId, String format) throws InvalidApplicationException, IOException {
this.authorizationService.authorize(Permission.EditDmp);
//GK: Why it is in that service, and why it's not static?
this.conventionService.isValidGuid(descriptionId);
//GK: First get the right client
TransformerRepository repository = getRepository(format);
//GK: Second get the Target Data Management Plan
FieldSet fieldSet = new BaseFieldSet(
Description._dmp + "." + Dmp._id,
Description._dmp + "." + Dmp._createdAt,
Description._dmp + "." + Dmp._finalizedAt,
Description._dmp + "." + Dmp._groupId,
Description._dmp + "." + Dmp._isActive,
Description._dmp + "." + Dmp._label,
Description._dmp + "." + Dmp._language,
Description._dmp + "." + Dmp._publicAfter,
Description._dmp + "." + Dmp._status,
Description._dmp + "." + Dmp._updatedAt,
Description._dmp + "." + Dmp._version,
Description._dmp + "." + Dmp._properties,
Description._dmp + "." + Dmp._versionStatus,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._id,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._data,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._id,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._description,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._abbreviation,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._definition,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._label,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._source,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._sourceType,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._type,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._isActive,
Description._dmp + "." + Dmp._dmpReferences + "." + DmpReference._reference + "." + Reference._reference,
Description._id,
Description._label,
Description._properties,
Description._description,
Description._status,
Description._descriptionTags,
Description._descriptionTemplate,
Description._descriptionReferences,
Description._isActive,
Description._properties + "." + PropertyDefinition._fields + "." + eu.eudat.model.descriptionproperties.Field._key,
Description._properties + "." + PropertyDefinition._fields + "." + eu.eudat.model.descriptionproperties.Field._value,
Description._descriptionReferences + "." + DescriptionReference._id,
Description._descriptionReferences + "." + DescriptionReference._reference,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._id,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._description,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._abbreviation,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._definition,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._label,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._source,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._sourceType,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._type,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._isActive,
Description._descriptionReferences + "." + DescriptionReference._reference + "." + Reference._reference,
Description._descriptionTemplate + "." + DescriptionTemplate._id,
Description._descriptionTemplate + "." + DescriptionTemplate._description,
Description._descriptionTemplate + "." + DescriptionTemplate._label,
Description._descriptionTemplate + "." + DescriptionTemplate._language,
Description._descriptionTemplate + "." + DescriptionTemplate._status,
Description._descriptionTemplate + "." + DescriptionTemplate._isActive,
Description._descriptionTemplate + "." + DescriptionTemplate._groupId,
Description._descriptionTemplate + "." + DescriptionTemplate._type,
Description._descriptionTemplate + "." + DescriptionTemplate._version,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._pages,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._id,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._description,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._sections,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._title,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._page,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._ordinal,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._defaultVisibility,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._extendedDescription,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._multiplicity + "." + Multiplicity._max,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._multiplicity + "." + Multiplicity._min,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._multiplicity + "." + Multiplicity._placeholder,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._multiplicity + "." + Multiplicity._tableView,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._numbering,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._id,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._title,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._description,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._ordinal,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._numbering,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._multiplicity + "." + Multiplicity._max,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._multiplicity + "." + Multiplicity._min,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._multiplicity + "." + Multiplicity._tableView,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._multiplicity + "." + Multiplicity._placeholder,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._hasCommentField,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._additionalInformation,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._extendedDescription,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._id,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._ordinal,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._numbering,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + BaseFieldData._label,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + BaseFieldData._fieldType,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._multiAutoComplete,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._autoCompleteSingleDataList + "." + AutoCompleteSingleData._autoCompleteOptions + "." + ComboBoxOption._label,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._autoCompleteSingleDataList + "." + AutoCompleteSingleData._autoCompleteOptions + "." + ComboBoxOption._uri,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._autoCompleteSingleDataList + "." + AutoCompleteSingleData._autoCompleteOptions + "." + ComboBoxOption._source,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._data + "." + AutoCompleteData._autoCompleteSingleDataList + "." + AutoCompleteSingleData._autoCompleteOptions + "." + ComboBoxOption._value,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._defaultValue,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._includeInExport,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._schematics,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._validations,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._visibilityRules,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._visibilityRules + "." + Rule._target,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._sections + "." + Section._fieldSets + "." + eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields + "." + Field._visibilityRules + "." + Rule._value,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._pages + "." + Page._id,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._pages + "." + Page._ordinal,
Description._descriptionTemplate + "." + DescriptionTemplate._definition + "." + Definition._pages + "." + Page._title,
Description._descriptionTags + "." + DescriptionTag._id,
Description._descriptionTags + "." + DescriptionTag._tag + "." + Tag._id,
Description._descriptionTags + "." + DescriptionTag._tag + "." + Tag._label,
Description._dmp + "." + Dmp._entityDois + "." + EntityDoi._doi,
Description._dmp + "." + Dmp._entityDois + "." + EntityDoi._id,
Description._dmp + "." + Dmp._entityDois + "." + EntityDoi._entityType
);
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(descriptionId);
Description model = this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
DescriptionFileTransformerModel descriptionFileTransformerModel = this.jsonHandlingService.fromJsonSafe(DescriptionFileTransformerModel.class, this.jsonHandlingService.toJsonSafe(model));
ExtraPropertiesModel extraPropertiesModel = new ExtraPropertiesModel();
extraPropertiesModel.setFormat(format);
eu.eudat.file.transformer.model.file.FileEnvelope fileEnvelope = repository.exportDescription(descriptionFileTransformerModel, extraPropertiesModel);
FileEnvelope result = new FileEnvelope();
DescriptionFileTransformerModel descriptionFileTransformerModel = this.builderFactory.builder(DescriptionFileTransformerBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(query.first());
descriptionFileTransformerModel.setCreatedBy(descriptionFileTransformerModel.getDmp().getCreator());
FileEnvelope fileEnvelope = repository.exportDescription(descriptionFileTransformerModel, format);
eu.eudat.model.file.FileEnvelope result = new eu.eudat.model.file.FileEnvelope();
byte[] data = this.storageFileService.readByFileRefAsBytesSafe(fileEnvelope.getFile(), StorageType.Transformer);
File temp = new File(environment.getProperty("path.path") + UUID.randomUUID());
try (FileOutputStream fos = new FileOutputStream(temp)) {
fos.write(fileEnvelope.getFile());
fos.write(data);
}
result.setFile(temp);
result.setFilename(fileEnvelope.getFilename());

View File

@ -1,4 +1,4 @@
package eu.eudat.logic.utilities.helpers;
package eu.eudat.utilities.helpers;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

View File

@ -2,8 +2,10 @@ package eu.eudat.controllers.v2;
import eu.eudat.audit.AuditableAction;
import eu.eudat.controllers.BaseController;
import eu.eudat.file.transformer.model.file.FileFormat;
import eu.eudat.file.transformer.models.misc.FileFormat;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.model.file.ExportRequestModel;
import eu.eudat.model.file.FileEnvelope;
import eu.eudat.service.transformer.FileTransformerService;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.auditing.AuditService;
@ -12,9 +14,17 @@ import gr.cite.tools.logging.LoggerService;
import gr.cite.tools.logging.MapLogEntry;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.management.InvalidApplicationException;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import java.util.UUID;
@RestController
@CrossOrigin
@ -24,15 +34,15 @@ public class FileTransformerController extends BaseController {
private final AuthorizationService authorizationService;
private final FileTransformerService depositService;
private final FileTransformerService fileTransformerService;
private final CensorFactory censorFactory;
private final AuditService auditService;
@Autowired
public FileTransformerController(ApiContext apiContext, AuthorizationService authorizationService, FileTransformerService depositService, CensorFactory censorFactory, AuditService auditService){
public FileTransformerController(ApiContext apiContext, AuthorizationService authorizationService, FileTransformerService fileTransformerService, CensorFactory censorFactory, AuditService auditService){
super(apiContext);
this.authorizationService = authorizationService;
this.depositService = depositService;
this.fileTransformerService = fileTransformerService;
this.censorFactory = censorFactory;
this.auditService = auditService;
}
@ -41,10 +51,34 @@ public class FileTransformerController extends BaseController {
public List<FileFormat> getAvailableConfigurations() {
logger.debug(new MapLogEntry("getAvailableConfigurations"));
List<FileFormat> model = this.depositService.getAvailableConfigurations();
List<FileFormat> model = this.fileTransformerService.getAvailableConfigurations();
this.auditService.track(AuditableAction.FileTransformer_GetAvailableConfigurations);
//this.auditService.trackIdentity(AuditableAction.IdentityTracking_Action);
return model;
}
@PostMapping("/export-dmp")
public ResponseEntity<byte[]> export(@RequestBody ExportRequestModel requestModel) throws InvalidApplicationException, IOException {
logger.debug(new MapLogEntry("exporting dmp"));
HttpHeaders headers = new HttpHeaders();
FileEnvelope fileEnvelope = this.fileTransformerService.exportDmp(requestModel.getId(), requestModel.getFormat());
headers.add("Content-Disposition", "attachment;filename=" + fileEnvelope.getFilename());
byte[] data = Files.readAllBytes(fileEnvelope.getFile().toPath());
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
return new ResponseEntity<>(data, headers, HttpStatus.OK);
}
@PostMapping("/export-description")
public ResponseEntity<byte[]> exportDescription(@RequestBody ExportRequestModel requestModel) throws InvalidApplicationException, IOException {
logger.debug(new MapLogEntry("exporting dmp"));
HttpHeaders headers = new HttpHeaders();
FileEnvelope fileEnvelope = this.fileTransformerService.exportDescription(requestModel.getId(), requestModel.getFormat());
headers.add("Content-Disposition", "attachment;filename=" + fileEnvelope.getFilename());
byte[] data = Files.readAllBytes(fileEnvelope.getFile().toPath());
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
return new ResponseEntity<>(data, headers, HttpStatus.OK);
}
}

View File

@ -19,7 +19,6 @@ import eu.eudat.data.query.items.table.dataset.DatasetTableRequest;
import eu.eudat.data.query.items.table.datasetprofile.DatasetProfileTableRequestItem;
import eu.eudat.exceptions.security.ForbiddenException;
import eu.eudat.exceptions.security.UnauthorisedException;
import eu.eudat.file.transformer.enums.old.notification.NotificationType;
import eu.eudat.logic.builders.BuilderFactory;
import eu.eudat.logic.builders.entity.UserInfoBuilder;
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
@ -667,9 +666,9 @@ public class DatasetManager {
//updateTags(descriptionEntity1, datasetWizardModel.getTags()); //TODO
if (sendNotification) {
if (descriptionEntity1.getStatus() != DescriptionStatus.Finalized) {
this.sendNotification(descriptionEntity1, dmp1, userInfo, null/*NotificationType.DATASET_MODIFIED*/);
this.sendNotification(descriptionEntity1, dmp1, userInfo/*, NotificationType.DATASET_MODIFIED*/);
} else {
this.sendNotification(descriptionEntity1, dmp1, userInfo, null/*NotificationType.DATASET_MODIFIED_FINALISED*/);
this.sendNotification(descriptionEntity1, dmp1, userInfo/*, NotificationType.DATASET_MODIFIED_FINALISED*/);
}
}
@ -717,7 +716,7 @@ public class DatasetManager {
});
}
private void sendNotification(DescriptionEntity descriptionEntity, DmpEntity dmp, UserEntity user, NotificationType notificationType) throws InvalidApplicationException {
private void sendNotification(DescriptionEntity descriptionEntity, DmpEntity dmp, UserEntity user/*, NotificationType notificationType*/) throws InvalidApplicationException {
List<DmpUserEntity> userDMPS = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmp.getId()).collect();
for (DmpUserEntity userDMP : userDMPS) {
if (!userDMP.getUserId().equals(user.getId())) {

View File

@ -1,7 +1,7 @@
package eu.eudat.logic.managers;
import eu.eudat.logic.proxy.fetching.LocalFetcher;
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
import eu.eudat.utilities.helpers.StreamDistinctBy;
import eu.eudat.models.data.local.LocalFetchModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -13,7 +13,7 @@ import eu.eudat.service.remotefetcher.config.entities.DefaultPrefillingMapping;
import eu.eudat.service.remotefetcher.config.entities.PrefillingFixedMapping;
import eu.eudat.service.remotefetcher.config.entities.PrefillingGet;
import eu.eudat.service.remotefetcher.config.entities.PrefillingMapping;
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
import eu.eudat.utilities.helpers.StreamDistinctBy;
import eu.eudat.logic.utilities.json.JsonSearcher;
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
import eu.eudat.models.data.datasetprofile.DatasetProfileOverviewModel;

View File

@ -3,13 +3,11 @@ package eu.eudat.models.rda.mapper;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.data.DescriptionEntity;
import eu.eudat.data.DescriptionTemplateEntity;
import eu.eudat.data.TagEntity;
import eu.eudat.logic.managers.DatasetManager;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
import eu.eudat.logic.utilities.json.JsonSearcher;
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
import eu.eudat.models.rda.*;

View File

@ -6,8 +6,10 @@ storage:
basePath: ./storage/temp
- type: Main
basePath: ./storage/main
- type: Transformer
basePath: ${TRANSFORMER_BASE_PATH}
static-files:
externalUrls: dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml
externalUrls: externalUrls/ExternalUrls.xml
semantics: Semantics.json
h2020Template: documents/h2020.docx
h2020DescriptionTemplate: documents/h2020_dataset.docx

View File

@ -6,6 +6,18 @@ transformer:
client-id: ${IDP_APIKEY_CLIENT_ID:}
client-secret: ${IDP_APIKEY_CLIENT_SECRET:}
scope: ${IDP_APIKEY_SCOPE:}
- url: http://localhost:8086
codes: [ json ]
issuer-url: ${IDP_ISSUER_URI_TOKEN:}
client-id: ${IDP_APIKEY_CLIENT_ID:}
client-secret: ${IDP_APIKEY_CLIENT_SECRET:}
scope: ${IDP_APIKEY_SCOPE:}
- url: http://localhost:8087
codes: [ xml ]
issuer-url: ${IDP_ISSUER_URI_TOKEN:}
client-id: ${IDP_APIKEY_CLIENT_ID:}
client-secret: ${IDP_APIKEY_CLIENT_SECRET:}
scope: ${IDP_APIKEY_SCOPE:}
temp:
temp: ${TEMP_STORAGE}

View File

@ -1,5 +1,5 @@
export interface FileFormat {
format: string;
formatName: string;
hasLogo: boolean;
icon: string;
}

View File

@ -25,15 +25,15 @@ export class FileTransformerHttpService extends BaseService {
return this.http.get<FileFormat[]>(url).pipe(catchError((error: any) => throwError(error)));
}
exportDmp(dmpId: Guid): Observable<any> {
exportDmp(dmpId: Guid, format: string): Observable<any> {
//TODO: implement
const url = `${this.apiBase}/export-dmp`;
return this.http.post<any>(url, null).pipe(catchError((error: any) => throwError(error)));
return this.http.post<any>(url, {id: dmpId, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error)));
}
exportDescription(item: any): Observable<any> {
exportDescription(id: Guid, format: string): Observable<any> {
//TODO: implement
const url = `${this.apiBase}/export-description`;
return this.http.post<any>(url, item).pipe(catchError((error: any) => throwError(error)));
return this.http.post<any>(url, {id: id, format: format}, {responseType: 'blob', observe: 'response'}).pipe(catchError((error: any) => throwError(error)));
}
}

View File

@ -3,12 +3,18 @@ import { FileFormat } from '@app/core/model/file/file-format.model';
import { BaseService } from '@common/base/base.service';
import { catchError, takeUntil } from 'rxjs/operators';
import { FileTransformerHttpService } from './file-transformer.http.service';
import { Guid } from '@common/types/guid';
import * as FileSaver from 'file-saver';
import { MatomoService } from '../matomo/matomo-service';
import { FileUtils } from '../utilities/file-utils.service';
@Injectable()
export class FileTransformerService extends BaseService {
constructor(
private fileTransformerHttpService: FileTransformerHttpService
private fileTransformerHttpService: FileTransformerHttpService,
private matomoService: MatomoService,
private fileUtils: FileUtils
) { super(); }
private _initialized: boolean = false;
@ -34,4 +40,36 @@ export class FileTransformerService extends BaseService {
this._initialized = true;
});
}
exportDmp(id: Guid, format: string) {
this._loading = true;
this.fileTransformerHttpService.exportDmp(id, format).pipe(takeUntil(this._destroyed), catchError((error) => {
this._loading = false;
return null;
})).subscribe(result => {
if (result !== null) {
const blob = new Blob([result.body], { type: 'application/octet-stream' });
const filename = this.fileUtils.getFilenameFromContentDispositionHeader(result.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename);
this.matomoService.trackDownload('dmps', format, id.toString());
}
});
}
exportDescription(id: Guid, format: string) {
this._loading = true;
this.fileTransformerHttpService.exportDescription(id, format).pipe(takeUntil(this._destroyed), catchError((error) => {
this._loading = false;
return null;
})).subscribe(result => {
if (result !== null) {
const blob = new Blob([result.body], { type: 'application/octet-stream' });
const filename = this.fileUtils.getFilenameFromContentDispositionHeader(result.headers.get('Content-Disposition'));
FileSaver.saveAs(blob, filename);
this.matomoService.trackDownload('descriptions', format, id.toString());
}
});
}
}

View File

@ -39,8 +39,8 @@
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.NAME' | translate}}</mat-label>
<input matInput type="text" name="label" [formControl]="formGroup.get('label')" required>
<mat-error *ngIf="formGroup.get('label').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="formGroup.get('label').hasError('backendError')">{{formGroup.get('label').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<h4 class="col-12">{{'DMP-BLUEPRINT-EDITOR.FIELDS.SECTIONS' | translate}}</h4>
@ -69,16 +69,16 @@
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.SECTION-NAME' | translate}}</mat-label>
<input matInput type="text" name="label" [formControl]="section.get('label')" required>
<mat-error *ngIf="section.get('label').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="section.get('label').hasError('backendError')">{{section.get('label').getError('backendError').message}}</mat-error>
<mat-error *ngIf="section.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-6">
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.SECTION-DESCRIPTION' | translate}}</mat-label>
<input matInput type="text" name="description" [formControl]="section.get('description')">
<mat-error *ngIf="section.get('description').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="section.get('description').hasError('backendError')">{{section.get('description').getError('backendError').message}}</mat-error>
<mat-error *ngIf="section.get('description').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-6">
@ -119,32 +119,35 @@
{{enumUtils.toDmpBlueprintExtraFieldDataTypeString(extraFieldDataType)}}
</mat-option>
</mat-select>
<mat-error *ngIf="field.get('dataType').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="field.get('dataType').hasError('backendError')">{{field.get('dataType').getError('backendError').message}}</mat-error>
<mat-error *ngIf="field.get('dataType').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col">
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-LABEL' | translate}}</mat-label>
<input matInput type="text" name="label" [formControl]="field.get('label')" required>
<mat-error *ngIf="field.get('label').hasError('required')">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="field.get('label').hasError('backendError')">{{field.get('label').getError('backendError').message}}</mat-error>
<mat-error *ngIf="field.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col">
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="text" name="placeholder" [formControl]="field.get('placeholder')">
<mat-error *ngIf="field.get('placeholder').hasError('backendError')">{{field.get('placeholder').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>
<div class="col">
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-DESCRIPTION' | translate}}</mat-label>
<input matInput type="text" name="description" [formControl]="field.get('description')">
<mat-error *ngIf="field.get('description').hasError('backendError')">{{field.get('description').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>
<div class="col-auto">
<mat-checkbox [disabled]="field.get('systemFieldType')?.value === dmpBlueprintSystemFieldType.TEXT || field.get('systemFieldType')?.value === dmpBlueprintSystemFieldType.HTML_TEXT" [formControl]="field.get('required')"><span>{{'DMP-BLUEPRINT-EDITOR.FIELDS.FIELD-REQUIRED' | translate}}</span></mat-checkbox>
<mat-error *ngIf="field.get('systemFieldType').hasError('backendError')">{{field.get('systemFieldType').getError('backendError').message}}</mat-error>
</div>
<div *ngIf="field.get('category').value === dmpBlueprintSectionFieldCategory.SYSTEM" [hidden]="viewOnly" class="col-auto">
<button mat-icon-button matTooltip="{{'DMP-BLUEPRINT-EDITOR.ACTIONS.REMOVE-SYSTEM-FIELD' | translate}}" (click)="removeSystemField(sectionIndex, fieldIndex)" [disabled]="formGroup.disabled">
@ -164,7 +167,8 @@
<div class="col-12">
<div class="row">
<div class="col-auto">
<mat-checkbox [formControl]="section.get('hasTemplates')" (change)="checkForBlueprints($event, sectionIndex)">
<!-- <mat-checkbox [formControl]="section.get('hasTemplates')" (change)="checkForBlueprints($event, sectionIndex)"> -->
<mat-checkbox [formControl]="section.get('hasTemplates')">
{{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
</mat-checkbox>
</div>
@ -189,18 +193,21 @@
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE-LABEL' | translate}}</mat-label>
<input matInput type="text" value="descriptionTemplate.get('label')" name="label" [formControl]="descriptionTemplate.get('label')">
<mat-error *ngIf="descriptionTemplate.get('label').hasError('backendError')">{{descriptionTemplate.get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>
<div class="col-4">
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE-MIN-MULTIPLICITY' | translate}}</mat-label>
<input matInput type="number" min="0" name="minMultiplicity" [formControl]="descriptionTemplate.get('minMultiplicity')">
<mat-error *ngIf="descriptionTemplate.get('minMultiplicity').hasError('backendError')">{{descriptionTemplate.get('minMultiplicity').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>
<div class="col-4">
<mat-form-field class="w-100">
<mat-label>{{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATE-MAX-MULTIPLICITY' | translate}}</mat-label>
<input matInput type="number" min="1" name="maxMultiplicity" [formControl]="descriptionTemplate.get('maxMultiplicity')">
<mat-error *ngIf="descriptionTemplate.get('maxMultiplicity').hasError('backendError')">{{descriptionTemplate.get('maxMultiplicity').getError('backendError').message}}</mat-error>
</mat-form-field>
</div>
</div>

View File

@ -214,11 +214,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
//
//
addSection(): void {
const section: DmpBlueprintDefinitionSectionEditorModel = new DmpBlueprintDefinitionSectionEditorModel();
section.id = Guid.create();
section.ordinal = (this.formGroup.get('definition').get('sections') as FormArray).controls.length + 1;
section.hasTemplates = false;
(this.formGroup.get('definition').get('sections') as FormArray).push(section.buildForm()); //TODO: dtziotzios validation path
(this.formGroup.get('definition').get('sections') as FormArray).push(this.editorModel.createChildSection( (this.formGroup.get('definition').get('sections') as FormArray).controls.length));
}
removeSection(sectionIndex: number): void {
@ -226,6 +222,16 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
(this.formGroup.get('definition').get('sections') as FormArray).controls.forEach((section, index) => {
section.get('ordinal').setValue(index + 1);
});
//Reapply validators
DmpBlueprintEditorModel.reApplySectionValidators(
{
formGroup: this.formGroup,
validationErrorModel: this.editorModel.validationErrorModel
}
);
this.formGroup.get('definition').get('sections').markAsDirty();
}
dropSections(event: CdkDragDrop<string[]>) {
@ -282,11 +288,9 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
}
addExtraField(sectionIndex: number): void {
const field: FieldInSectionEditorModel = new FieldInSectionEditorModel();
field.id = Guid.create();
field.ordinal = ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).length + 1;
field.category = DmpBlueprintSectionFieldCategory.EXTRA;
((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).push(field.buildForm()); //TODO: dtziotzios validation path
((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray)
.push(this.editorModel.createChildExtraField(sectionIndex, ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).length));
}
removeExtraField(sectionIndex: number, fieldIndex: number): void {
@ -295,6 +299,16 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
formArray.controls.forEach((section, index) => {
section.get('ordinal').setValue(index + 1);
});
//Reapply validators
DmpBlueprintEditorModel.reApplySectionValidators(
{
formGroup: this.formGroup,
validationErrorModel: this.editorModel.validationErrorModel
}
);
(this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields').markAsDirty();
// ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('fields') as FormArray).at(fieldIndex).markAsDirty();
}
@ -328,15 +342,20 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
const foundIndex = descriptionTemplateFormArray.controls.findIndex(blueprint => blueprint.get('descriptionTemplateId').value === event.id);
if (foundIndex !== -1) {
descriptionTemplateFormArray.removeAt(foundIndex);
DmpBlueprintEditorModel.reApplySectionValidators(
{
formGroup: this.formGroup,
validationErrorModel: this.editorModel.validationErrorModel
}
)
this.formGroup.get('definition').get('sections').markAsDirty();
}
}
onSelectDescritionTemplate(item, sectionIndex) {
const descriptionTemplate: DescriptionTemplatesInSectionEditorModel = new DescriptionTemplatesInSectionEditorModel();
descriptionTemplate.id = Guid.create();
descriptionTemplate.descriptionTemplateId = item.id;
descriptionTemplate.label = item.label;
((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray).push(descriptionTemplate.buildForm()); //TODO: dtziotzios validation path
((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray)
.push(this.editorModel.createChildDescriptionTemplate(item, sectionIndex, ((this.formGroup.get('definition').get('sections') as FormArray).at(sectionIndex).get('descriptionTemplates') as FormArray).length));
}
// ngAfterViewInit() {

View File

@ -1,4 +1,4 @@
import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
import { FormArray, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
import { DmpBlueprintExtraFieldDataType } from "@app/core/common/enum/dmp-blueprint-field-type";
import { DmpBlueprintSectionFieldCategory } from "@app/core/common/enum/dmp-blueprint-section-field-category";
import { DmpBlueprintStatus } from "@app/core/common/enum/dmp-blueprint-status";
@ -58,6 +58,44 @@ export class DmpBlueprintEditorModel extends BaseEditorModel implements DmpBluep
baseContext.validation = baseValidationArray;
return baseContext;
}
createChildSection(index: number): UntypedFormGroup {
const section: DmpBlueprintDefinitionSectionEditorModel = new DmpBlueprintDefinitionSectionEditorModel(this.validationErrorModel);
section.id = Guid.create();
section.ordinal = index + 1;
section.hasTemplates = false;
return section.buildForm({ rootPath: 'definition.sections[' + index + '].' });
}
createChildExtraField(sectionIndex: number, index: number): UntypedFormGroup {
const field: FieldInSectionEditorModel = new FieldInSectionEditorModel(this.validationErrorModel);
field.id = Guid.create();
field.ordinal = index + 1;
field.category = DmpBlueprintSectionFieldCategory.EXTRA;
return field.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fields[' + index + '].'});
}
createChildDescriptionTemplate(item: any, sectionIndex: number, index: number): UntypedFormGroup {
const descriptionTemplate: DescriptionTemplatesInSectionEditorModel = new DescriptionTemplatesInSectionEditorModel(this.validationErrorModel);
descriptionTemplate.id = Guid.create();
descriptionTemplate.descriptionTemplateId = item.id;
descriptionTemplate.label = item.label;
return descriptionTemplate.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].descriptionTemplates[' + index + '].'});
}
static reApplySectionValidators(params: {
formGroup: UntypedFormGroup,
validationErrorModel: ValidationErrorModel,
}): void {
const { formGroup, validationErrorModel } = params;
const control = formGroup?.get('definition');
DmpBlueprintDefinitionEditorModel.reapplySectionsValidators({
formArray: control.get('sections') as UntypedFormArray,
rootPath: `definition.`,
validationErrorModel: validationErrorModel
});
}
}
export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinitionPersist {
@ -115,6 +153,21 @@ export class DmpBlueprintDefinitionEditorModel implements DmpBlueprintDefinition
return baseContext;
}
static reapplySectionsValidators(params: {
formArray: UntypedFormArray,
validationErrorModel: ValidationErrorModel,
rootPath: string
}): void {
const { validationErrorModel, rootPath, formArray } = params;
formArray?.controls?.forEach(
(control, index) => DmpBlueprintDefinitionSectionEditorModel.reapplySectionValidators({
formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}sections[${index}].`,
validationErrorModel: validationErrorModel
})
);
}
}
export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDefinitionSectionPersist {
@ -206,6 +259,43 @@ export class DmpBlueprintDefinitionSectionEditorModel implements DmpBlueprintDef
return baseContext;
}
static reapplySectionValidators(params: {
formGroup: UntypedFormGroup,
validationErrorModel: ValidationErrorModel,
rootPath: string
}): void {
const { formGroup, rootPath, validationErrorModel } = params;
const context = DmpBlueprintDefinitionSectionEditorModel.createValidationContext({
rootPath,
validationErrorModel
});
['id','label', 'ordinal', 'description', 'hasTemplates', 'hash'].forEach(keyField => {
const control = formGroup?.get(keyField);
control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators);
});
(formGroup.get('fields') as FormArray).controls?.forEach(
(control, index) => FieldInSectionEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}fields[${index}].`,
validationErrorModel: validationErrorModel
}
)
);
(formGroup.get('fields') as FormArray).controls?.forEach(
(control, index) => DescriptionTemplatesInSectionEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}descriptionTemplates[${index}].`,
validationErrorModel: validationErrorModel
}
)
);
}
}
export class FieldInSectionEditorModel implements FieldInSectionPersist {
@ -288,6 +378,25 @@ export class FieldInSectionEditorModel implements FieldInSectionPersist {
baseContext.validation = baseValidationArray;
return baseContext;
}
static reapplyValidators(params: {
formGroup: UntypedFormGroup,
validationErrorModel: ValidationErrorModel,
rootPath: string
}): void {
const { formGroup, rootPath, validationErrorModel } = params;
const context = FieldInSectionEditorModel.createValidationContext({
rootPath,
validationErrorModel
});
['id', 'category', 'dataType', 'systemFieldType', 'label', 'placeholder', 'description', 'required', 'ordinal'].forEach(keyField => {
const control = formGroup?.get(keyField);
control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators);
})
}
}
export class DescriptionTemplatesInSectionEditorModel implements DescriptionTemplatesInSectionPersist {
@ -352,4 +461,23 @@ export class DescriptionTemplatesInSectionEditorModel implements DescriptionTemp
baseContext.validation = baseValidationArray;
return baseContext;
}
static reapplyValidators(params: {
formGroup: UntypedFormGroup,
validationErrorModel: ValidationErrorModel,
rootPath: string
}): void {
const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplatesInSectionEditorModel.createValidationContext({
rootPath,
validationErrorModel
});
['id', 'descriptionTemplateId', 'label', 'minMultiplicity', 'maxMultiplicity'].forEach(keyField => {
const control = formGroup?.get(keyField);
control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators);
})
}
}

View File

@ -70,19 +70,19 @@
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(activity.id)">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
<span>{{'GENERAL.FILE-TRANSFOMER.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDocx(activity.id)">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
<span>{{'GENERAL.FILE-TRANSFOMER.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXml(activity.id)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
<span>{{'GENERAL.FILE-TRANSFOMER.XML' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadJson(activity.id)">
<i class="fa fa-file-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.JSON' | translate}}</span>
<span>{{'GENERAL.FILE-TRANSFOMER.JSON' | translate}}</span>
</button>
</mat-menu>
<mat-menu #actionsMenu="matMenu" xPosition="before">

View File

@ -34,15 +34,15 @@
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item (click)="downloadPDF(formGroup.get('id').value)">
<i class="fa fa-file-pdf-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.PDF' | translate}}</span>
<span>{{'GENERAL.FILE-TRANSFOMER.PDF' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadDOCX(formGroup.get('id').value)">
<i class="fa fa-file-word-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.DOC' | translate}}</span>
<span>{{'GENERAL.FILE-TRANSFOMER.DOC' | translate}}</span>
</button>
<button mat-menu-item (click)="downloadXML(formGroup.get('id').value)">
<i class="fa fa-file-code-o pr-2"></i>
<span>{{'GENERAL.FILE-TYPES.XML' | translate}}</span>
<span>{{'GENERAL.FILE-TRANSFOMER.XML' | translate}}</span>
</button>
</mat-menu>
</div>

View File

@ -716,7 +716,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
// this.filesToUpload = null;
// messages.push(this.language.instant('DATASET-WIZARD.MESSAGES.LARGE-FILE-OR-UNACCEPTED-TYPE'));
// messages.push(this.language.instant('DATASET-WIZARD.MESSAGES.MAX-FILE-SIZE', { 'maxfilesize': this.form.get("data").value.maxFileSizeInMB }));
// messages.push(this.language.instant('DATASET-WIZARD.MESSAGES.ACCEPTED-FILE-TYPES') + this.form.get("data").value.types.map(type => type.value).join(", "));
// messages.push(this.language.instant('DATASET-WIZARD.MESSAGES.ACCEPTED-FILE-TRANSFOMER') + this.form.get("data").value.types.map(type => type.value).join(", "));
// }
// if (messages && messages.length > 0) {

View File

@ -38,9 +38,9 @@
</button>
</mat-menu>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item *ngFor='let fileTransformer of fileTransformerService.availableFormats' (click)="fileTransformerService.exportDescription(description.id)">
<i class="fa pr-2" [ngClass]="fileTransformer.icon"></i>
<span>{{'GENERAL.FILE-TRANSFORMER.' + fileTransformer.format | translate}}</span>
<button mat-menu-item *ngFor='let fileTransformer of fileTransformerService.availableFormats' (click)="fileTransformerService.exportDescription(description.id, fileTransformer.format)">
<i class="fa pr-2" [ngClass]="fileTransformer.icon ? fileTransformer.icon : 'fa-file-o'"></i>
<span>{{'GENERAL.FILE-TRANSFORMER.' + fileTransformer.format.toUpperCase() | translate}}</span>
</button>
</mat-menu>
</div>

View File

@ -117,9 +117,9 @@
{{ 'DESCRIPTION-OVERVIEW.ACTIONS.EXPORT' | translate }}</p>
</div>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item *ngFor='let fileTransformer of fileTransformerService.availableFormats' (click)="fileTransformerService.exportDescription(description.id)">
<i class="fa pr-2" [ngClass]="fileTransformer.icon"></i>
<span>{{'GENERAL.FILE-TRANSFORMER.' + fileTransformer.format | translate}}</span>
<button mat-menu-item *ngFor='let fileTransformer of fileTransformerService.availableFormats' (click)="fileTransformerService.exportDescription(description.id, fileTransformer.format)">
<i class="fa pr-2" [ngClass]="fileTransformer.icon ? fileTransformer.icon : 'fa-file-o'"></i>
<span>{{'GENERAL.FILE-TRANSFORMER.' + fileTransformer.format.toUpperCase() | translate}}</span>
</button>
</mat-menu>
</div>

View File

@ -38,9 +38,9 @@
<a class="col-auto pointer" *ngIf="isAuthenticated()" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item *ngFor='let fileTransformer of fileTransformerService.availableFormats' (click)="fileTransformerService.exportDmp(dmp.id)">
<i class="fa pr-2" [ngClass]="fileTransformer.icon"></i>
<span>{{'GENERAL.FILE-TRANSFORMER.' + fileTransformer.format | translate}}</span>
<button mat-menu-item *ngFor='let fileTransformer of fileTransformerService.availableFormats' (click)="fileTransformerService.exportDmp(dmp.id, fileTransformer.format)">
<i class="fa pr-2" [ngClass]="fileTransformer.hasLogo ? fileTransformer.icon : 'fa-file-o'"></i>
<span>{{'GENERAL.FILE-TRANSFORMER.' + fileTransformer.format.toUpperCase() | translate}}</span>
</button>
</mat-menu>
<mat-menu #actionsMenu="matMenu" xPosition="before">

View File

@ -166,9 +166,9 @@
</p>
</div>
<mat-menu #exportMenu="matMenu" xPosition="before">
<button mat-menu-item *ngFor='let fileTransformer of fileTransformerService.availableFormats' (click)="fileTransformerService.exportDmp(dmp.id)">
<i class="fa pr-2" [ngClass]="fileTransformer.icon"></i>
<span>{{'GENERAL.FILE-TRANSFORMER.' + fileTransformer.format | translate}}</span>
<button mat-menu-item *ngFor='let fileTransformer of fileTransformerService.availableFormats' (click)="fileTransformerService.exportDmp(dmp.id, fileTransformer.format)">
<i class="fa pr-2" [ngClass]="fileTransformer.icon ? fileTransformer.icon : 'fa-file-o'"></i>
<span>{{'GENERAL.FILE-TRANSFORMER.' + fileTransformer.formatName.toUpperCase() | translate}}</span>
</button>
</mat-menu>
</div>

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Sprache",
"SIGN-IN": "Sign in to account"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "There is no selected file to upload",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.",
"MAX-FILE-SIZE": "Uploaded files should be up to {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Supported media types are: "
"ACCEPTED-FILE-TRANSFOMER": "Supported media types are: "
},
"UPLOAD": {
"UPLOAD-XML": "Importieren",

View File

@ -176,7 +176,7 @@
"TENANTS": "Tenants",
"REFERENCES": "References"
},
"FILE-TYPES": {
"FILE-TRANSFORMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "RDA JSON",
@ -849,7 +849,7 @@
"NO-FILES-SELECTED": "There is no selected file to upload",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.",
"MAX-FILE-SIZE": "Uploaded files should be up to {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Supported media types are: "
"ACCEPTED-FILE-TRANSFOMER": "Supported media types are: "
},
"UPLOAD": {
"UPLOAD-XML": "Import",

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Idioma",
"SIGN-IN": "Identificarse con su cuenta"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "RDA JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "There is no selected file to upload",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.",
"MAX-FILE-SIZE": "Uploaded files should be up to {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Supported media types are: "
"ACCEPTED-FILE-TRANSFOMER": "Supported media types are: "
},
"UPLOAD": {
"UPLOAD-XML": "Importar",

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Γλώσσα",
"SIGN-IN": "Σύνδεση στο λογαριασμό"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "Δεν υπάρχουν επιλεγμένα αρχεία για μεταφόρτωση",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "Το αρχείο είναι πολύ μεγάλο ή ο τύπος του δεν υποστηρίζεται.",
"MAX-FILE-SIZE": "Τα αρχεία πρέπει να είναι έως {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Οι υποστηριζόμενοι τύποι πολυμέσων είναι: "
"ACCEPTED-FILE-TRANSFOMER": "Οι υποστηριζόμενοι τύποι πολυμέσων είναι: "
},
"UPLOAD": {
"UPLOAD-XML": "Εισαγωγή",

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Jezik",
"SIGN-IN": "Prijava"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "RDA JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "Nije izabrana niti jedna datoteka",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "Datoteka je prevelika ili format nije podržan.",
"MAX-FILE-SIZE": "Veličina odabranih datoteka ne smije biti veća od {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Podržani formati datoteka su: "
"ACCEPTED-FILE-TRANSFOMER": "Podržani formati datoteka su: "
},
"UPLOAD": {
"UPLOAD-XML": "Uvezi",

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Język",
"SIGN-IN": "Zaloguj się na konto"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "RDA JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "Nie zaznaczono pliku do przesłania",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "Plik jest za duży lub jego typ nie jest obsługiwany.",
"MAX-FILE-SIZE": "Przesyłane pliki powinny mieć do {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Obsługiwane typy nośników to: "
"ACCEPTED-FILE-TRANSFOMER": "Obsługiwane typy nośników to: "
},
"UPLOAD": {
"UPLOAD-XML": "Importuj",

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Idioma",
"SIGN-IN": "Entrar na conta"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "RDA JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "There is no selected file to upload",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.",
"MAX-FILE-SIZE": "Uploaded files should be up to {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Supported media types are: "
"ACCEPTED-FILE-TRANSFOMER": "Supported media types are: "
},
"UPLOAD": {
"UPLOAD-XML": "Importar",

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Jazyk",
"SIGN-IN": "Prihlásiť sa do účtu"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "There is no selected file to upload",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.",
"MAX-FILE-SIZE": "Uploaded files should be up to {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Supported media types are: "
"ACCEPTED-FILE-TRANSFOMER": "Supported media types are: "
},
"UPLOAD": {
"UPLOAD-XML": "Importovať",

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Jezik",
"SIGN-IN": "Prijavljivanje korisnika"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "RDA JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "There is no selected file to upload",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.",
"MAX-FILE-SIZE": "Uploaded files should be up to {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Supported media types are: "
"ACCEPTED-FILE-TRANSFOMER": "Supported media types are: "
},
"UPLOAD": {
"UPLOAD-XML": "Uvezite",

View File

@ -175,7 +175,7 @@
"LANGUAGE": "Dil",
"SIGN-IN": "Oturum aç"
},
"FILE-TYPES": {
"FILE-TRANSFOMER": {
"PDF": "PDF",
"XML": "XML",
"JSON": "RDA JSON",
@ -776,7 +776,7 @@
"NO-FILES-SELECTED": "There is no selected file to upload",
"LARGE-FILE-OR-UNACCEPTED-TYPE": "The file is too large or its type is not supported.",
"MAX-FILE-SIZE": "Uploaded files should be up to {{maxfilesize}} MB.",
"ACCEPTED-FILE-TYPES": "Supported media types are: "
"ACCEPTED-FILE-TRANSFOMER": "Supported media types are: "
},
"UPLOAD": {
"UPLOAD-XML": "İçeri Aktar",