Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
# Conflicts: # dmp-frontend/src/app/core/model/reference/reference.ts
This commit is contained in:
commit
9201f265d2
|
@ -40,5 +40,10 @@ public class AuditableAction {
|
||||||
public static final EventId Reference_Lookup = new EventId(7001, "Reference_Lookup");
|
public static final EventId Reference_Lookup = new EventId(7001, "Reference_Lookup");
|
||||||
public static final EventId Reference_Persist = new EventId(7002, "Reference_Persist");
|
public static final EventId Reference_Persist = new EventId(7002, "Reference_Persist");
|
||||||
public static final EventId Reference_Delete = new EventId(7003, "Reference_Delete");
|
public static final EventId Reference_Delete = new EventId(7003, "Reference_Delete");
|
||||||
|
|
||||||
|
public static final EventId DescriptionTemplate_Query = new EventId(8000, "DescriptionTemplate_Query");
|
||||||
|
public static final EventId DescriptionTemplate_Lookup = new EventId(8001, "DescriptionTemplate_Lookup");
|
||||||
|
public static final EventId DescriptionTemplate_Persist = new EventId(8002, "DescriptionTemplate_Persist");
|
||||||
|
public static final EventId DescriptionTemplate_Delete = new EventId(8003, "DescriptionTemplate_Delete");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,11 @@ public final class Permission {
|
||||||
//Language
|
//Language
|
||||||
public static String BrowseStatistics = "BrowseStatistics";
|
public static String BrowseStatistics = "BrowseStatistics";
|
||||||
public static String BrowsePublicStatistics = "BrowsePublicStatistics";
|
public static String BrowsePublicStatistics = "BrowsePublicStatistics";
|
||||||
|
|
||||||
|
//DescriptionTemplate
|
||||||
|
public static String BrowseDescriptionTemplate = "BrowseDescriptionTemplate";
|
||||||
|
public static String EditDescriptionTemplate = "EditDescriptionTemplate";
|
||||||
|
public static String DeleteDescriptionTemplate = "DeleteDescriptionTemplate";
|
||||||
|
|
||||||
//DescriptionTemplateType
|
//DescriptionTemplateType
|
||||||
public static String BrowseDescriptionTemplateType = "BrowseDescriptionTemplateType";
|
public static String BrowseDescriptionTemplateType = "BrowseDescriptionTemplateType";
|
||||||
|
|
|
@ -32,22 +32,6 @@ import java.io.StringWriter;
|
||||||
@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
|
@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
|
||||||
public class XmlHandlingService {
|
public class XmlHandlingService {
|
||||||
|
|
||||||
public String xmlSerializableToXml(XmlSerializable<?> item) throws InvalidApplicationException, TransformerException, ParserConfigurationException {
|
|
||||||
Document document = this.getDocument();
|
|
||||||
if (document == null) throw new InvalidApplicationException("Can not create document");
|
|
||||||
document.appendChild(item.toXml(document));
|
|
||||||
return this.generateXml(document);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String xmlSerializableToXmlSafe(XmlSerializable<?> item) {
|
|
||||||
if (item == null) return null;
|
|
||||||
try {
|
|
||||||
return this.xmlSerializableToXml(item);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String generateXml(Document doc) throws TransformerException {
|
public String generateXml(Document doc) throws TransformerException {
|
||||||
TransformerFactory tFact = TransformerFactory.newInstance();
|
TransformerFactory tFact = TransformerFactory.newInstance();
|
||||||
Transformer trans = tFact.newTransformer();
|
Transformer trans = tFact.newTransformer();
|
||||||
|
@ -60,7 +44,14 @@ public class XmlHandlingService {
|
||||||
return writer.toString();
|
return writer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toXml(Object item) throws JsonProcessingException, JAXBException {
|
public String toXml(Object item) throws JsonProcessingException, JAXBException, ParserConfigurationException, InvalidApplicationException, TransformerException {
|
||||||
|
if (XmlSerializable.class.isAssignableFrom(item.getClass())){
|
||||||
|
Document document = this.getDocument();
|
||||||
|
if (document == null) throw new InvalidApplicationException("Can not create document");
|
||||||
|
document.appendChild(((XmlSerializable)item).toXml(document));
|
||||||
|
return this.generateXml(document);
|
||||||
|
}
|
||||||
|
|
||||||
JAXBContext context = JAXBContext.newInstance(item.getClass());
|
JAXBContext context = JAXBContext.newInstance(item.getClass());
|
||||||
Marshaller marshaller = context.createMarshaller();
|
Marshaller marshaller = context.createMarshaller();
|
||||||
StringWriter out = new StringWriter();
|
StringWriter out = new StringWriter();
|
||||||
|
@ -77,11 +68,16 @@ public class XmlHandlingService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T fromXml(Class<T> type, String xmlString) throws JAXBException {
|
public <T> T fromXml(Class<T> type, String xmlString) throws JAXBException, InstantiationException, IllegalAccessException, ParserConfigurationException, IOException, SAXException {
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(type);
|
if (XmlSerializable.class.isAssignableFrom(type)){
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
XmlSerializable<T> object = (XmlSerializable<T>)type.newInstance();
|
||||||
|
return (T) object.fromXml(this.getDocument(xmlString).getDocumentElement());
|
||||||
|
} else {
|
||||||
|
JAXBContext jaxbContext = JAXBContext.newInstance(type);
|
||||||
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
|
|
||||||
return (T) jaxbUnmarshaller.unmarshal(new StringReader(xmlString));
|
return (T) jaxbUnmarshaller.unmarshal(new StringReader(xmlString));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T fromXmlSafe(Class<T> type, String xmlString) {
|
public <T> T fromXmlSafe(Class<T> type, String xmlString) {
|
||||||
|
@ -93,19 +89,19 @@ public class XmlHandlingService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends XmlSerializable<T>> T xmlSerializableFromXml(Class<T> type, String xmlString) throws JAXBException, InstantiationException, IllegalAccessException, ParserConfigurationException, IOException, SAXException {
|
// public <T extends XmlSerializable<T>> T xmlSerializableFromXml(Class<T> type, String xmlString) throws JAXBException, InstantiationException, IllegalAccessException, ParserConfigurationException, IOException, SAXException {
|
||||||
T object = type.newInstance();
|
// T object = type.newInstance();
|
||||||
return (T) object.fromXml(this.getDocument(xmlString).getDocumentElement());
|
// return (T) object.fromXml(this.getDocument(xmlString).getDocumentElement());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public <T extends XmlSerializable<T>> T xmlSerializableFromXmlSafe(Class<T> type, String xmlString) {
|
// public <T extends XmlSerializable<T>> T xmlSerializableFromXmlSafe(Class<T> type, String xmlString) {
|
||||||
if (xmlString == null) return null;
|
// if (xmlString == null) return null;
|
||||||
try {
|
// try {
|
||||||
return this.xmlSerializableFromXml(type, xmlString);
|
// return this.xmlSerializableFromXml(type, xmlString);
|
||||||
} catch (Exception ex) {
|
// } catch (Exception ex) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public Document getDocument(String xml) throws ParserConfigurationException, IOException, SAXException {
|
public Document getDocument(String xml) throws ParserConfigurationException, IOException, SAXException {
|
||||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum DescriptionTemplateStatus implements DatabaseEnum<Short> {
|
||||||
|
|
||||||
|
Draft((short) 0),
|
||||||
|
Finalized((short) 1);
|
||||||
|
|
||||||
|
private final Short value;
|
||||||
|
|
||||||
|
DescriptionTemplateStatus(Short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public Short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, DescriptionTemplateStatus> map = EnumUtils.getEnumValueMap(DescriptionTemplateStatus.class);
|
||||||
|
|
||||||
|
public static DescriptionTemplateStatus of(Short i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum FieldDataComboBoxType implements DatabaseEnum<String> {
|
||||||
|
Autocomplete("autocomplete"),
|
||||||
|
Wordlist("wordlist");
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
FieldDataComboBoxType(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<String, FieldDataComboBoxType> map = EnumUtils.getEnumValueMap(FieldDataComboBoxType.class);
|
||||||
|
|
||||||
|
public static FieldDataComboBoxType of(String i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum FieldDataExternalDatasetType implements DatabaseEnum<String> {
|
||||||
|
ReusedDataset("reused_dataset"),
|
||||||
|
ProducedDataset("produced_dataset"),
|
||||||
|
Other("other");
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
FieldDataExternalDatasetType(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<String, FieldDataExternalDatasetType> map = EnumUtils.getEnumValueMap(FieldDataExternalDatasetType.class);
|
||||||
|
|
||||||
|
public static FieldDataExternalDatasetType of(String i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum FieldDataInternalDmpEntryType implements DatabaseEnum<String> {
|
||||||
|
Researchers("researchers"),
|
||||||
|
Dmps("dmps"),
|
||||||
|
Datasets("datasets");
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
FieldDataInternalDmpEntryType(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<String, FieldDataInternalDmpEntryType> map = EnumUtils.getEnumValueMap(FieldDataInternalDmpEntryType.class);
|
||||||
|
|
||||||
|
public static FieldDataInternalDmpEntryType of(String i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum FieldType implements DatabaseEnum<String> {
|
||||||
|
COMBO_BOX("combobox"),
|
||||||
|
BOOLEAN_DECISION("booleanDecision"),
|
||||||
|
RADIO_BOX("radiobox"),
|
||||||
|
INTERNAL_DMP_ENTRIES("internalDmpEntities"),
|
||||||
|
CHECK_BOX("checkBox"),
|
||||||
|
FREE_TEXT("freetext"),
|
||||||
|
TEXT_AREA("textarea"),
|
||||||
|
RICH_TEXT_AREA("richTextarea"),
|
||||||
|
UPLOAD("upload"),
|
||||||
|
DATE_PICKER("datePicker"),
|
||||||
|
EXTERNAL_DATASETS("externalDatasets"),
|
||||||
|
DATA_REPOSITORIES("dataRepositories"),
|
||||||
|
JOURNAL_REPOSITORIES("journalRepositories"),
|
||||||
|
PUB_REPOSITORIES("pubRepositories"),
|
||||||
|
LICENSES("licenses"),
|
||||||
|
TAXONOMIES("taxonomies"),
|
||||||
|
PUBLICATIONS("publications"),
|
||||||
|
REGISTRIES("registries"),
|
||||||
|
SERVICES("services"),
|
||||||
|
TAGS("tags"),
|
||||||
|
RESEARCHERS("researchers"),
|
||||||
|
ORGANIZATIONS("organizations"),
|
||||||
|
DATASET_IDENTIFIER("datasetIdentifier"),
|
||||||
|
CURRENCY("currency"),
|
||||||
|
VALIDATION("validation");;
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
FieldType(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<String, FieldType> map = EnumUtils.getEnumValueMap(FieldType.class);
|
||||||
|
|
||||||
|
public static FieldType of(String i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public enum FieldValidationType implements DatabaseEnum<Short> {
|
||||||
|
|
||||||
|
None((short) 0),
|
||||||
|
Required((short) 1),
|
||||||
|
Url((short) 2);
|
||||||
|
|
||||||
|
private final Short value;
|
||||||
|
|
||||||
|
FieldValidationType(Short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public Short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Map<Short, FieldValidationType> map = EnumUtils.getEnumValueMap(FieldValidationType.class);
|
||||||
|
|
||||||
|
public static FieldValidationType of(Short i) {
|
||||||
|
return map.get(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,14 +4,14 @@ import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum SourceType implements DatabaseEnum<Short> {
|
public enum ReferenceSourceType implements DatabaseEnum<Short> {
|
||||||
|
|
||||||
Internal((short) 0),
|
Internal((short) 0),
|
||||||
External((short) 1);
|
External((short) 1);
|
||||||
|
|
||||||
private final Short value;
|
private final Short value;
|
||||||
|
|
||||||
SourceType(Short value) {
|
ReferenceSourceType(Short value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ public enum SourceType implements DatabaseEnum<Short> {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<Short, SourceType> map = EnumUtils.getEnumValueMap(SourceType.class);
|
private static final Map<Short, ReferenceSourceType> map = EnumUtils.getEnumValueMap(ReferenceSourceType.class);
|
||||||
|
|
||||||
public static SourceType of(Short i) {
|
public static ReferenceSourceType of(Short i) {
|
||||||
return map.get(i);
|
return map.get(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package eu.eudat.commons.types.common;
|
||||||
|
|
||||||
|
|
||||||
|
public interface DatabaseDefinition {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package eu.eudat.commons.types.common;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.common.DatabaseDefinition;
|
||||||
|
|
||||||
|
public interface DatabaseModelDefinition extends DatabaseDefinition {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package eu.eudat.commons.types.common;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.common.DatabaseDefinition;
|
||||||
|
|
||||||
|
public interface DatabaseViewStyleDefinition extends DatabaseDefinition {
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.commons.types.descriptiontemplate;
|
||||||
|
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
@ -10,24 +10,24 @@ import org.w3c.dom.NodeList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
public class DefinitionEntity implements XmlSerializable<DefinitionEntity> {
|
||||||
private List<Section> sections;
|
private List<SectionEntity> sections;
|
||||||
private List<Page> pages;
|
private List<PageEntity> pages;
|
||||||
|
|
||||||
public List<Section> getSections() {
|
public List<SectionEntity> getSections() {
|
||||||
return sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSections(List<Section> sections) {
|
public void setSections(List<SectionEntity> sections) {
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Page> getPages() {
|
public List<PageEntity> getPages() {
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPages(List<Page> pages) {
|
public void setPages(List<PageEntity> pageEntities) {
|
||||||
this.pages = pages;
|
this.pages = pageEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,13 +35,13 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
||||||
Element root = doc.createElement("root");
|
Element root = doc.createElement("root");
|
||||||
Element sections = doc.createElement("sections");
|
Element sections = doc.createElement("sections");
|
||||||
Element pages = doc.createElement("pages");
|
Element pages = doc.createElement("pages");
|
||||||
for (Section section : this.sections) {
|
for (SectionEntity sectionEntity : this.sections) {
|
||||||
section.setNumbering("" + (this.sections.indexOf(section) + 1));
|
sectionEntity.setNumbering("" + (this.sections.indexOf(sectionEntity) + 1));
|
||||||
sections.appendChild(section.toXml(doc));
|
sections.appendChild(sectionEntity.toXml(doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Page page : this.pages) {
|
for (PageEntity pageEntity : this.pages) {
|
||||||
pages.appendChild(page.toXml(doc));
|
pages.appendChild(pageEntity.toXml(doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
root.appendChild(pages);
|
root.appendChild(pages);
|
||||||
|
@ -50,7 +50,7 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ViewStyleModel fromXml(Element element) {
|
public DefinitionEntity fromXml(Element element) {
|
||||||
|
|
||||||
this.sections = new LinkedList();
|
this.sections = new LinkedList();
|
||||||
Element sections = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections");
|
Element sections = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections");
|
||||||
|
@ -59,7 +59,7 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
||||||
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
|
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
|
||||||
Node sectionElement = sectionElements.item(temp);
|
Node sectionElement = sectionElements.item(temp);
|
||||||
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.sections.add(new Section().fromXml((Element) sectionElement));
|
this.sections.add(new SectionEntity().fromXml((Element) sectionElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
||||||
for (int temp = 0; temp < pagesElements.getLength(); temp++) {
|
for (int temp = 0; temp < pagesElements.getLength(); temp++) {
|
||||||
Node pageElement = pagesElements.item(temp);
|
Node pageElement = pagesElements.item(temp);
|
||||||
if (pageElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (pageElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.pages.add(new Page().fromXml((Element) pageElement));
|
this.pages.add(new PageEntity().fromXml((Element) pageElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.commons.types.descriptiontemplate;
|
||||||
|
|
||||||
import eu.eudat.models.data.components.commons.DefaultValue;
|
import eu.eudat.commons.enums.FieldValidationType;
|
||||||
import eu.eudat.models.data.components.commons.ViewStyle;
|
import eu.eudat.commons.enums.FieldType;
|
||||||
import eu.eudat.models.data.components.commons.Visibility;
|
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
|
||||||
import eu.eudat.models.data.components.commons.datafield.FieldData;
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.FieldDataHelper;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -15,18 +15,17 @@ import org.w3c.dom.NodeList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field> {
|
public class FieldEntity implements DatabaseViewStyleDefinition, XmlSerializable<FieldEntity> {
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private List<String> schematics;
|
private List<String> schematics;
|
||||||
private String numbering;
|
private String numbering;
|
||||||
private ViewStyle viewStyle;
|
private String defaultValue;
|
||||||
private DefaultValue defaultValue;
|
private List<RuleEntity> visibilityRules;
|
||||||
private Visibility visible;
|
private BaseFieldDataEntity<?> data;
|
||||||
private FieldData data;
|
private List<FieldValidationType> validations;
|
||||||
private List<eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType> validations;
|
private FieldType fieldType;
|
||||||
|
private Boolean includeInExport;
|
||||||
private Boolean export;
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -49,38 +48,33 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
||||||
this.schematics = schematics;
|
this.schematics = schematics;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewStyle getViewStyle() {
|
public BaseFieldDataEntity<?> getData() {
|
||||||
return viewStyle;
|
|
||||||
}
|
|
||||||
public void setViewStyle(ViewStyle viewStyle) {
|
|
||||||
this.viewStyle = viewStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FieldData getData() {
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
public void setData(FieldData data) {
|
public void setData(BaseFieldDataEntity<?> data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DefaultValue getDefaultValue() {
|
public FieldType getFieldType() {
|
||||||
|
return fieldType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFieldType(FieldType fieldType) {
|
||||||
|
this.fieldType = fieldType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultValue() {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
public void setDefaultValue(DefaultValue defaultValue) {
|
public void setDefaultValue(String defaultValue) {
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Visibility getVisible() {
|
|
||||||
return visible;
|
|
||||||
}
|
|
||||||
public void setVisible(Visibility visible) {
|
|
||||||
this.visible = visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType> getValidations() {
|
public List<FieldValidationType> getValidations() {
|
||||||
return validations;
|
return validations;
|
||||||
}
|
}
|
||||||
public void setValidations(List<eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType> validations) {
|
public void setValidations(List<FieldValidationType> validations) {
|
||||||
this.validations = validations;
|
this.validations = validations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,12 +85,20 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
||||||
this.numbering = numbering;
|
this.numbering = numbering;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getExport() {
|
public Boolean getIncludeInExport() {
|
||||||
return export;
|
return includeInExport;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExport(Boolean export) {
|
public void setIncludeInExport(Boolean includeInExport) {
|
||||||
this.export = export;
|
this.includeInExport = includeInExport;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RuleEntity> getVisibilityRules() {
|
||||||
|
return visibilityRules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisibilityRules(List<RuleEntity> visibilityRules) {
|
||||||
|
this.visibilityRules = visibilityRules;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,17 +117,19 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
||||||
}
|
}
|
||||||
|
|
||||||
Element viewStyle = doc.createElement("viewStyle");
|
Element viewStyle = doc.createElement("viewStyle");
|
||||||
viewStyle.setAttribute("renderstyle", this.viewStyle.getRenderStyle());
|
viewStyle.setAttribute("renderstyle", this.getFieldType().getValue());
|
||||||
viewStyle.setAttribute("cssClass", this.viewStyle.getCssClass());
|
|
||||||
|
|
||||||
Element visibility = this.visible.toXml(doc);
|
|
||||||
|
|
||||||
|
Element visibilityRulesElement = doc.createElement("visible");
|
||||||
|
if (this.visibilityRules != null && !this.visibilityRules.isEmpty()) {
|
||||||
|
for (RuleEntity rule : this.visibilityRules) {
|
||||||
|
visibilityRulesElement.appendChild(rule.toXml(doc));
|
||||||
|
}
|
||||||
|
}
|
||||||
Element defaultValue = doc.createElement("defaultValue");
|
Element defaultValue = doc.createElement("defaultValue");
|
||||||
defaultValue.setAttribute("type", this.defaultValue.getType());
|
defaultValue.setAttribute("value", this.getDefaultValue());
|
||||||
defaultValue.setAttribute("value", this.defaultValue.getValue());
|
|
||||||
|
|
||||||
Element validations = doc.createElement("validations");
|
Element validations = doc.createElement("validations");
|
||||||
for (eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType validationType : this.validations) {
|
for (FieldValidationType validationType : this.validations) {
|
||||||
Element validation = doc.createElement("validation");
|
Element validation = doc.createElement("validation");
|
||||||
validation.setAttribute("type", "" + validationType.getValue());
|
validation.setAttribute("type", "" + validationType.getValue());
|
||||||
validations.appendChild(validation);
|
validations.appendChild(validation);
|
||||||
|
@ -138,28 +142,32 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
||||||
rootElement.appendChild(numbering);
|
rootElement.appendChild(numbering);
|
||||||
rootElement.appendChild(validations);
|
rootElement.appendChild(validations);
|
||||||
rootElement.appendChild(defaultValue);
|
rootElement.appendChild(defaultValue);
|
||||||
rootElement.appendChild(visibility);
|
rootElement.appendChild(visibilityRulesElement);
|
||||||
rootElement.appendChild(viewStyle);
|
rootElement.appendChild(viewStyle);
|
||||||
if (this.data != null) rootElement.appendChild(this.data.toXml(doc));
|
if (this.data != null) rootElement.appendChild(this.data.toXml(doc));
|
||||||
rootElement.setAttribute("export", this.export == null || this.export ? "true" : "false");
|
rootElement.setAttribute("export", this.includeInExport == null || this.includeInExport ? "true" : "false");
|
||||||
return rootElement;
|
return rootElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Field fromXml(Element element) {
|
public FieldEntity fromXml(Element element) {
|
||||||
this.id = element.getAttribute("id");
|
this.id = element.getAttribute("id");
|
||||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||||
|
|
||||||
|
|
||||||
this.viewStyle = new ViewStyle();
|
|
||||||
Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
|
Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
|
||||||
|
|
||||||
this.viewStyle.setRenderStyle(viewStyle.getAttribute("renderstyle"));
|
this.fieldType = FieldType.of(viewStyle.getAttribute("renderstyle"));
|
||||||
this.viewStyle.setCssClass(viewStyle.getAttribute("cssClass"));
|
|
||||||
|
|
||||||
Element visibility = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "visible");
|
Element visibility = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "visible");
|
||||||
|
NodeList rulesElements = visibility.getChildNodes();
|
||||||
this.visible = new Visibility().fromXml(visibility);
|
this.visibilityRules = new LinkedList();
|
||||||
|
for (int temp = 0; temp < rulesElements.getLength(); temp++) {
|
||||||
|
Node ruleElement = rulesElements.item(temp);
|
||||||
|
if (ruleElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
this.visibilityRules.add(new RuleEntity().fromXml((Element) ruleElement));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
||||||
if (numbering != null) this.numbering = numbering.getTextContent();
|
if (numbering != null) this.numbering = numbering.getTextContent();
|
||||||
|
@ -180,10 +188,8 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
||||||
|
|
||||||
Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue");
|
Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue");
|
||||||
|
|
||||||
this.defaultValue = new DefaultValue();
|
this.defaultValue = defaultValue.getAttribute("value");
|
||||||
this.defaultValue.setType(defaultValue.getAttribute("type"));
|
this.data = new FieldDataHelper().toFieldData(null, this.getFieldType(), dataElement);
|
||||||
this.defaultValue.setValue(defaultValue.getAttribute("value"));
|
|
||||||
this.data = new ModelBuilder().toFieldData(null, this.viewStyle.getRenderStyle(), dataElement);
|
|
||||||
if (this.data != null) this.data.fromXml(dataElement);
|
if (this.data != null) this.data.fromXml(dataElement);
|
||||||
|
|
||||||
this.validations = new LinkedList<>();
|
this.validations = new LinkedList<>();
|
||||||
|
@ -193,16 +199,16 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
||||||
for (int temp = 0; temp < validationElements.getLength(); temp++) {
|
for (int temp = 0; temp < validationElements.getLength(); temp++) {
|
||||||
Node validationElement = validationElements.item(temp);
|
Node validationElement = validationElements.item(temp);
|
||||||
if (validationElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (validationElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
int enumValue = Integer.parseInt(((Element) validationElement).getAttribute("type"));
|
Short enumValue = Short.parseShort(((Element) validationElement).getAttribute("type"));
|
||||||
eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType validationType = eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType.fromInteger(enumValue);
|
FieldValidationType validationType = FieldValidationType.of(enumValue);
|
||||||
this.validations.add(validationType);
|
this.validations.add(validationType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (element.hasAttribute("export")) {
|
if (element.hasAttribute("export")) {
|
||||||
this.export = Boolean.parseBoolean(element.getAttribute("export"));
|
this.includeInExport = Boolean.parseBoolean(element.getAttribute("export"));
|
||||||
} else {
|
} else {
|
||||||
this.export = true;
|
this.includeInExport = true;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.commons.types.descriptiontemplate;
|
||||||
|
|
||||||
import eu.eudat.models.data.components.commons.Multiplicity;
|
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -11,24 +11,24 @@ import org.w3c.dom.NodeList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<FieldSet> {
|
public class FieldSetEntity implements DatabaseViewStyleDefinition, XmlSerializable<FieldSetEntity> {
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private List<Field> fields;
|
private List<FieldEntity> fields;
|
||||||
private String numbering;
|
private String numbering;
|
||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
private String additionalInformation;
|
private String additionalInformation;
|
||||||
private Multiplicity multiplicity;
|
private MultiplicityEntity multiplicity;
|
||||||
private boolean hasCommentField;
|
private boolean hasCommentField;
|
||||||
private String commentFieldValue;
|
private String commentFieldValue; //TODO: DescriptionTemplate
|
||||||
|
|
||||||
public List<Field> getFields() {
|
public List<FieldEntity> getFields() {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
public void setFields(List<Field> fields) {
|
public void setFields(List<FieldEntity> fieldEntities) {
|
||||||
this.fields = fields;
|
this.fields = fieldEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -66,10 +66,10 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
||||||
this.extendedDescription = extendedDescription;
|
this.extendedDescription = extendedDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Multiplicity getMultiplicity() {
|
public MultiplicityEntity getMultiplicity() {
|
||||||
return multiplicity;
|
return multiplicity;
|
||||||
}
|
}
|
||||||
public void setMultiplicity(Multiplicity multiplicity) {
|
public void setMultiplicity(MultiplicityEntity multiplicity) {
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,12 +80,12 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
||||||
this.hasCommentField = hasCommentField;
|
this.hasCommentField = hasCommentField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCommentFieldValue() {
|
// public String getCommentFieldValue() {
|
||||||
return commentFieldValue;
|
// return commentFieldValue;
|
||||||
}
|
// }
|
||||||
public void setCommentFieldValue(String commentFieldValue) {
|
// public void setCommentFieldValue(String commentFieldValue) {
|
||||||
this.commentFieldValue = commentFieldValue;
|
// this.commentFieldValue = commentFieldValue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public String getNumbering() {
|
public String getNumbering() {
|
||||||
return numbering;
|
return numbering;
|
||||||
|
@ -126,15 +126,15 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
||||||
|
|
||||||
Element commentField = doc.createElement("commentField");
|
Element commentField = doc.createElement("commentField");
|
||||||
commentField.setAttribute("hasCommentField", "" + this.hasCommentField);
|
commentField.setAttribute("hasCommentField", "" + this.hasCommentField);
|
||||||
commentField.setAttribute("commentFieldValue", this.commentFieldValue);
|
// commentField.setAttribute("commentFieldValue", this.commentFieldValue);
|
||||||
|
|
||||||
Element numbering = doc.createElement("numbering");
|
Element numbering = doc.createElement("numbering");
|
||||||
numbering.setTextContent(this.numbering);
|
numbering.setTextContent(this.numbering);
|
||||||
|
|
||||||
Element fieldsElement = doc.createElement("fields");
|
Element fieldsElement = doc.createElement("fields");
|
||||||
for (Field field : fields) {
|
for (FieldEntity fieldEntity : fields) {
|
||||||
field.setNumbering(this.numbering + "." + (this.fields.indexOf(field) + 1));
|
fieldEntity.setNumbering(this.numbering + "." + (this.fields.indexOf(fieldEntity) + 1));
|
||||||
fieldsElement.appendChild(field.toXml(doc));
|
fieldsElement.appendChild(fieldEntity.toXml(doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldSet.appendChild(numbering);
|
fieldSet.appendChild(numbering);
|
||||||
|
@ -149,7 +149,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldSet fromXml(Element element) {
|
public FieldSetEntity fromXml(Element element) {
|
||||||
this.id = element.getAttribute("id");
|
this.id = element.getAttribute("id");
|
||||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||||
this.fields = new LinkedList();
|
this.fields = new LinkedList();
|
||||||
|
@ -164,7 +164,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
||||||
this.additionalInformation = additionalInformation.getTextContent();
|
this.additionalInformation = additionalInformation.getTextContent();
|
||||||
Element commentField = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "commentField");
|
Element commentField = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "commentField");
|
||||||
this.hasCommentField = Boolean.parseBoolean(commentField.getAttribute("hasCommentField"));
|
this.hasCommentField = Boolean.parseBoolean(commentField.getAttribute("hasCommentField"));
|
||||||
this.commentFieldValue = commentField.getAttribute("commentFieldValue");
|
// this.commentFieldValue = commentField.getAttribute("commentFieldValue");
|
||||||
Element fields = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
|
Element fields = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
|
||||||
|
|
||||||
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
||||||
|
@ -175,12 +175,12 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
||||||
for (int temp = 0; temp < fieldElements.getLength(); temp++) {
|
for (int temp = 0; temp < fieldElements.getLength(); temp++) {
|
||||||
Node fieldElement = fieldElements.item(temp);
|
Node fieldElement = fieldElements.item(temp);
|
||||||
if (fieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (fieldElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.fields.add(new Field().fromXml((Element) fieldElement));
|
this.fields.add(new FieldEntity().fromXml((Element) fieldElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.multiplicity = new Multiplicity();
|
this.multiplicity = new MultiplicityEntity();
|
||||||
Element multiplicity = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "multiplicity");
|
Element multiplicity = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "multiplicity");
|
||||||
|
|
||||||
this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min")));
|
this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min")));
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons;
|
package eu.eudat.commons.types.descriptiontemplate;
|
||||||
|
|
||||||
public class Multiplicity {
|
public class MultiplicityEntity {
|
||||||
|
|
||||||
private int min;
|
private int min;
|
||||||
private int max;
|
private int max;
|
|
@ -1,11 +1,12 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.commons.types.descriptiontemplate;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
||||||
public class Page implements DatabaseViewStyleDefinition, XmlSerializable<Page> {
|
public class PageEntity implements DatabaseViewStyleDefinition, XmlSerializable<PageEntity> {
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private String title;
|
private String title;
|
||||||
|
@ -44,7 +45,7 @@ public class Page implements DatabaseViewStyleDefinition, XmlSerializable<Page>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page fromXml(Element item) {
|
public PageEntity fromXml(Element item) {
|
||||||
this.ordinal = Integer.parseInt(item.getAttribute("ordinal"));
|
this.ordinal = Integer.parseInt(item.getAttribute("ordinal"));
|
||||||
this.id = item.getAttribute("id");
|
this.id = item.getAttribute("id");
|
||||||
this.title = item.getAttribute("title");
|
this.title = item.getAttribute("title");
|
|
@ -0,0 +1,52 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
public class RuleEntity implements XmlSerializable<RuleEntity> {
|
||||||
|
private String target;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public String getTarget() {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarget(String target) {
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toXml(Document doc) {
|
||||||
|
Element rule = doc.createElement("rule");
|
||||||
|
rule.setAttribute("target", this.target);
|
||||||
|
|
||||||
|
Element value = doc.createElement("value");
|
||||||
|
value.setTextContent(this.value);
|
||||||
|
|
||||||
|
rule.appendChild(value);
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RuleEntity fromXml(Element item) {
|
||||||
|
this.target = item.getAttribute("target");
|
||||||
|
|
||||||
|
Element value = (Element) item.getElementsByTagName("value").item(0);
|
||||||
|
if (value != null) {
|
||||||
|
this.value = value.getTextContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
package eu.eudat.commons.types.descriptiontemplate;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.common.DatabaseViewStyleDefinition;
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -10,7 +11,7 @@ import org.w3c.dom.NodeList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Section> {
|
public class SectionEntity implements DatabaseViewStyleDefinition, XmlSerializable<SectionEntity> {
|
||||||
private String id;
|
private String id;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
private boolean defaultVisibility;
|
private boolean defaultVisibility;
|
||||||
|
@ -19,8 +20,8 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
private List<Section> sections;
|
private List<SectionEntity> sections;
|
||||||
private List<FieldSet> fieldSets;
|
private List<FieldSetEntity> fieldSets;
|
||||||
private Boolean multiplicity;
|
private Boolean multiplicity;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -71,20 +72,20 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Section> getSections() {
|
public List<SectionEntity> getSections() {
|
||||||
return sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSections(List<Section> sections) {
|
public void setSections(List<SectionEntity> sections) {
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FieldSet> getFieldSets() {
|
public List<FieldSetEntity> getFieldSets() {
|
||||||
return fieldSets;
|
return fieldSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFieldSets(List<FieldSet> fieldSets) {
|
public void setFieldSets(List<FieldSetEntity> fieldSetEntities) {
|
||||||
this.fieldSets = fieldSets;
|
this.fieldSets = fieldSetEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExtendedDescription() {
|
public String getExtendedDescription() {
|
||||||
|
@ -134,18 +135,18 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
|
|
||||||
if (sections != null) {
|
if (sections != null) {
|
||||||
Element sections = doc.createElement("sections");
|
Element sections = doc.createElement("sections");
|
||||||
for (Section section : this.sections) {
|
for (SectionEntity sectionEntity : this.sections) {
|
||||||
section.setNumbering(this.numbering + "." + (this.sections.indexOf(section) + 1));
|
sectionEntity.setNumbering(this.numbering + "." + (this.sections.indexOf(sectionEntity) + 1));
|
||||||
sections.appendChild(section.toXml(doc));
|
sections.appendChild(sectionEntity.toXml(doc));
|
||||||
}
|
}
|
||||||
rootElement.appendChild(sections);
|
rootElement.appendChild(sections);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fieldSets != null) {
|
if (this.fieldSets != null) {
|
||||||
Element formGroups = doc.createElement("fieldSets");
|
Element formGroups = doc.createElement("fieldSets");
|
||||||
for (FieldSet fieldSet : this.fieldSets) {
|
for (FieldSetEntity fieldSetEntity : this.fieldSets) {
|
||||||
fieldSet.setNumbering(this.numbering + "." + (this.fieldSets.indexOf(fieldSet) + 1));
|
fieldSetEntity.setNumbering(this.numbering + "." + (this.fieldSets.indexOf(fieldSetEntity) + 1));
|
||||||
formGroups.appendChild(fieldSet.toXml(doc));
|
formGroups.appendChild(fieldSetEntity.toXml(doc));
|
||||||
}
|
}
|
||||||
rootElement.appendChild(formGroups);
|
rootElement.appendChild(formGroups);
|
||||||
}
|
}
|
||||||
|
@ -159,7 +160,7 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Section fromXml(Element element) {
|
public SectionEntity fromXml(Element element) {
|
||||||
|
|
||||||
this.id = element.getAttribute("id");
|
this.id = element.getAttribute("id");
|
||||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||||
|
@ -179,19 +180,19 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
|
Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
|
||||||
if (title != null) this.title = title.getTextContent();
|
if (title != null) this.title = title.getTextContent();
|
||||||
|
|
||||||
this.sections = new LinkedList<Section>();
|
this.sections = new LinkedList<SectionEntity>();
|
||||||
Element sections = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections");
|
Element sections = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "sections");
|
||||||
if (sections != null) {
|
if (sections != null) {
|
||||||
NodeList sectionElements = sections.getChildNodes();
|
NodeList sectionElements = sections.getChildNodes();
|
||||||
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
|
for (int temp = 0; temp < sectionElements.getLength(); temp++) {
|
||||||
Node sectionElement = sectionElements.item(temp);
|
Node sectionElement = sectionElements.item(temp);
|
||||||
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (sectionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.sections.add(new Section().fromXml((Element) sectionElement));
|
this.sections.add(new SectionEntity().fromXml((Element) sectionElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fieldSets = new LinkedList<FieldSet>();
|
this.fieldSets = new LinkedList<FieldSetEntity>();
|
||||||
Element fieldGroups = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldSets");
|
Element fieldGroups = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fieldSets");
|
||||||
|
|
||||||
if (fieldGroups != null) {
|
if (fieldGroups != null) {
|
||||||
|
@ -199,7 +200,7 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
||||||
for (int temp = 0; temp < fieldGroupElements.getLength(); temp++) {
|
for (int temp = 0; temp < fieldGroupElements.getLength(); temp++) {
|
||||||
Node fieldGroupElement = fieldGroupElements.item(temp);
|
Node fieldGroupElement = fieldGroupElements.item(temp);
|
||||||
if (fieldGroupElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (fieldGroupElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.fieldSets.add(new FieldSet().fromXml((Element) fieldGroupElement));
|
this.fieldSets.add(new FieldSetEntity().fromXml((Element) fieldGroupElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import eu.eudat.commons.enums.EnumUtils;
|
||||||
|
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
@ -9,7 +12,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
public class AutoCompleteDataEntity extends ComboBoxDataEntity<AutoCompleteDataEntity> {
|
||||||
|
|
||||||
public static class AuthAutoCompleteData {
|
public static class AuthAutoCompleteData {
|
||||||
private String url;
|
private String url;
|
||||||
|
@ -59,19 +62,19 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static class AutoCompleteSingleData {
|
public static class AutoCompleteSingleData {
|
||||||
private int autocompleteType;
|
private AutocompleteType autocompleteType;
|
||||||
private String url;
|
private String url;
|
||||||
private ComboBoxData.Option autoCompleteOptions;
|
private ComboBoxDataEntity.Option autoCompleteOptions;
|
||||||
private String optionsRoot;
|
private String optionsRoot;
|
||||||
private Boolean hasAuth;
|
private Boolean hasAuth;
|
||||||
private AuthAutoCompleteData auth;
|
private AuthAutoCompleteData auth;
|
||||||
private String method;
|
private String method;
|
||||||
|
|
||||||
public int getAutocompleteType() {
|
public AutocompleteType getAutocompleteType() {
|
||||||
return autocompleteType;
|
return autocompleteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutocompleteType(int autocompleteType) {
|
public void setAutocompleteType(AutocompleteType autocompleteType) {
|
||||||
this.autocompleteType = autocompleteType;
|
this.autocompleteType = autocompleteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,10 +108,10 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
this.auth = auth;
|
this.auth = auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComboBoxData.Option getAutoCompleteOptions() {
|
public ComboBoxDataEntity.Option getAutoCompleteOptions() {
|
||||||
return autoCompleteOptions;
|
return autoCompleteOptions;
|
||||||
}
|
}
|
||||||
public void setAutoCompleteOptions(ComboBoxData.Option autoCompleteOptions) {
|
public void setAutoCompleteOptions(ComboBoxDataEntity.Option autoCompleteOptions) {
|
||||||
this.autoCompleteOptions = autoCompleteOptions;
|
this.autoCompleteOptions = autoCompleteOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +147,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
Element parent = doc.createElement("autocompleteSingle");
|
Element parent = doc.createElement("autocompleteSingle");
|
||||||
parent.setAttribute("url", singleData.url);
|
parent.setAttribute("url", singleData.url);
|
||||||
parent.setAttribute("optionsRoot", singleData.optionsRoot);
|
parent.setAttribute("optionsRoot", singleData.optionsRoot);
|
||||||
parent.setAttribute("autoCompleteType", Integer.toString(singleData.autocompleteType));
|
parent.setAttribute("autoCompleteType", Integer.toString(singleData.autocompleteType.getValue()));
|
||||||
parent.setAttribute("hasAuth", Boolean.toString(singleData.hasAuth));
|
parent.setAttribute("hasAuth", Boolean.toString(singleData.hasAuth));
|
||||||
parent.setAttribute("method", singleData.method);
|
parent.setAttribute("method", singleData.method);
|
||||||
Element element = doc.createElement("option");
|
Element element = doc.createElement("option");
|
||||||
|
@ -167,7 +170,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AutoCompleteData fromXml(Element item) {
|
public AutoCompleteDataEntity fromXml(Element item) {
|
||||||
super.fromXml(item);
|
super.fromXml(item);
|
||||||
this.autoCompleteSingleDataList = new ArrayList<>();
|
this.autoCompleteSingleDataList = new ArrayList<>();
|
||||||
NodeList items = item.getElementsByTagName("autocompleteSingle");
|
NodeList items = item.getElementsByTagName("autocompleteSingle");
|
||||||
|
@ -190,9 +193,9 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
singleData.optionsRoot = item.getAttribute("optionsRoot");
|
singleData.optionsRoot = item.getAttribute("optionsRoot");
|
||||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||||
if (item.getAttribute("autoCompleteType") == null || item.getAttribute("autoCompleteType").equals("") ) {
|
if (item.getAttribute("autoCompleteType") == null || item.getAttribute("autoCompleteType").equals("") ) {
|
||||||
singleData.autocompleteType = AutocompleteType.UNCACHED.getValue();
|
singleData.autocompleteType = AutocompleteType.UNCACHED;
|
||||||
} else {
|
} else {
|
||||||
singleData.autocompleteType = AutocompleteType.fromValue(Integer.parseInt(item.getAttribute("autoCompleteType"))).getValue();
|
singleData.autocompleteType = AutocompleteType.of(Integer.parseInt(item.getAttribute("autoCompleteType")));
|
||||||
}
|
}
|
||||||
singleData.hasAuth = Boolean.parseBoolean(item.getAttribute("hasAuth"));
|
singleData.hasAuth = Boolean.parseBoolean(item.getAttribute("hasAuth"));
|
||||||
singleData.method = item.hasAttribute("method") ? item.getAttribute("method") : "GET";
|
singleData.method = item.hasAttribute("method") ? item.getAttribute("method") : "GET";
|
||||||
|
@ -218,7 +221,7 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AutoCompleteData fromData(Object data) {
|
public AutoCompleteDataEntity fromData(Object data) {
|
||||||
super.fromData(data);
|
super.fromData(data);
|
||||||
this.autoCompleteSingleDataList = new ArrayList<>();
|
this.autoCompleteSingleDataList = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -244,9 +247,9 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
this.autoCompleteSingleDataList.get(i).method = singleData.containsKey("method") ? (String) singleData.get("method") : "GET";
|
this.autoCompleteSingleDataList.get(i).method = singleData.containsKey("method") ? (String) singleData.get("method") : "GET";
|
||||||
|
|
||||||
if (singleData.get("autoCompleteType") == null) {
|
if (singleData.get("autoCompleteType") == null) {
|
||||||
this.autoCompleteSingleDataList.get(i).autocompleteType = AutocompleteType.UNCACHED.getValue();
|
this.autoCompleteSingleDataList.get(i).autocompleteType = AutocompleteType.UNCACHED;
|
||||||
} else {
|
} else {
|
||||||
this.autoCompleteSingleDataList.get(i).autocompleteType = AutocompleteType.fromValue((Integer) singleData.get("autoCompleteType")).getValue();
|
this.autoCompleteSingleDataList.get(i).autocompleteType = AutocompleteType.of((Integer) singleData.get("autoCompleteType"));
|
||||||
}
|
}
|
||||||
Map<String, String> options = (Map<String, String>) singleData.get("autoCompleteOptions");
|
Map<String, String> options = (Map<String, String>) singleData.get("autoCompleteOptions");
|
||||||
if (options != null) {
|
if (options != null) {
|
||||||
|
@ -354,26 +357,25 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
|
||||||
return dataMap;
|
return dataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AutocompleteType {
|
public enum AutocompleteType implements DatabaseEnum<Integer> {
|
||||||
UNCACHED(0), CACHED(1);
|
UNCACHED(0),
|
||||||
|
CACHED(1);
|
||||||
|
|
||||||
int value;
|
private final int value;
|
||||||
|
|
||||||
AutocompleteType(int value) {
|
AutocompleteType(int value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
@JsonValue
|
||||||
return this.value;
|
public Integer getValue() {
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AutocompleteType fromValue(int value) {
|
private static final Map<Integer, AutocompleteType> map = EnumUtils.getEnumValueMap(AutocompleteType.class);
|
||||||
for (AutocompleteType type: AutocompleteType.values()) {
|
|
||||||
if (type.getValue() == value) {
|
public static AutocompleteType of(int i) {
|
||||||
return type;
|
return map.get(i);
|
||||||
}
|
|
||||||
}
|
|
||||||
return UNCACHED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -6,8 +6,9 @@ import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class FieldData<T> implements XmlSerializable<T> {
|
public abstract class BaseFieldDataEntity<T> implements XmlSerializable<T> {
|
||||||
private String label;
|
private String label;
|
||||||
|
private String subType;
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
|
@ -17,6 +18,14 @@ public abstract class FieldData<T> implements XmlSerializable<T> {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSubType() {
|
||||||
|
return subType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubType(String subType) {
|
||||||
|
this.subType = subType;
|
||||||
|
}
|
||||||
|
|
||||||
public T fromData(Object data) {
|
public T fromData(Object data) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -29,9 +38,5 @@ public abstract class FieldData<T> implements XmlSerializable<T> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T fromXml(Element item) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract Map<String, Object> toMap(Element item);
|
public abstract Map<String, Object> toMap(Element item);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,10 +6,10 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class BooleanDecisionData extends FieldData<BooleanDecisionData> {
|
public class BooleanDecisionDataEntity extends BaseFieldDataEntity<BooleanDecisionDataEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BooleanDecisionData fromData(Object data) {
|
public BooleanDecisionDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class BooleanDecisionData extends FieldData<BooleanDecisionData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BooleanDecisionData fromXml(Element item) {
|
public BooleanDecisionDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item.getAttribute("label"));
|
this.setLabel(item.getAttribute("label"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class CheckBoxData extends FieldData<CheckBoxData> {
|
public class CheckBoxDataEntity extends BaseFieldDataEntity<CheckBoxDataEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
|
@ -16,13 +16,13 @@ public class CheckBoxData extends FieldData<CheckBoxData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CheckBoxData fromXml(Element item) {
|
public CheckBoxDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CheckBoxData fromData(Object data) {
|
public CheckBoxDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.FieldDataComboBoxType;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -7,7 +8,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class ComboBoxData<T> extends FieldData<T> {
|
public abstract class ComboBoxDataEntity<T> extends BaseFieldDataEntity<T> {
|
||||||
public static class Option implements XmlSerializable<Option> {
|
public static class Option implements XmlSerializable<Option> {
|
||||||
private String label;
|
private String label;
|
||||||
private String value;
|
private String value;
|
||||||
|
@ -54,7 +55,7 @@ public abstract class ComboBoxData<T> extends FieldData<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ComboBoxData.Option fromXml(Element item) {
|
public ComboBoxDataEntity.Option fromXml(Element item) {
|
||||||
this.label = item.getAttribute("label");
|
this.label = item.getAttribute("label");
|
||||||
this.value = item.getAttribute("value");
|
this.value = item.getAttribute("value");
|
||||||
this.source = item.getAttribute("source");
|
this.source = item.getAttribute("source");
|
||||||
|
@ -64,20 +65,18 @@ public abstract class ComboBoxData<T> extends FieldData<T> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String type;
|
public FieldDataComboBoxType getType() {
|
||||||
|
return FieldDataComboBoxType.of(this.getSubType());
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(String type) {
|
public void setType(FieldDataComboBoxType type) {
|
||||||
this.type = type;
|
this.setSubType(type.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
Element root = doc.createElement("data");
|
Element root = doc.createElement("data");
|
||||||
root.setAttribute("type", this.type);
|
root.setAttribute("type", this.getSubType());
|
||||||
root.setAttribute("label", this.getLabel());
|
root.setAttribute("label", this.getLabel());
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +84,7 @@ public abstract class ComboBoxData<T> extends FieldData<T> {
|
||||||
@Override
|
@Override
|
||||||
public T fromXml(Element item) {
|
public T fromXml(Element item) {
|
||||||
this.setLabel(item.getAttribute("label"));
|
this.setLabel(item.getAttribute("label"));
|
||||||
this.type = item.getAttribute("type");
|
this.setSubType(item.getAttribute("type"));
|
||||||
return (T) this;
|
return (T) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ public abstract class ComboBoxData<T> extends FieldData<T> {
|
||||||
public T fromData(Object data) {
|
public T fromData(Object data) {
|
||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.type = (String) ((Map<String, Object>) data).get("type");
|
this.setSubType((String) ((Map<String, Object>) data).get("type"));
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,9 +6,9 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class DatePickerData extends FieldData<DatePickerData> {
|
public class CurrencyDataEntity extends BaseFieldDataEntity<CurrencyDataEntity> {
|
||||||
@Override
|
@Override
|
||||||
public DatePickerData fromData(Object data) {
|
public CurrencyDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class DatePickerData extends FieldData<DatePickerData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatePickerData fromXml(Element item) {
|
public CurrencyDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class LicensesData extends FieldData<LicensesData> {
|
public class DataRepositoryDataEntity extends BaseFieldDataEntity<DataRepositoryDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -18,7 +18,7 @@ public class LicensesData extends FieldData<LicensesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LicensesData fromData(Object data) {
|
public DataRepositoryDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
||||||
|
@ -42,7 +42,7 @@ public class LicensesData extends FieldData<LicensesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LicensesData fromXml(Element item) {
|
public DataRepositoryDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
return this;
|
return this;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class DatasetsAutoCompleteData extends InternalDmpEntitiesData<DatasetsAutoCompleteData> {
|
public class DatasetAutoCompleteDataEntity extends InternalDmpBaseDataEntity<DatasetAutoCompleteDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -25,7 +25,7 @@ public class DatasetsAutoCompleteData extends InternalDmpEntitiesData<DatasetsAu
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetsAutoCompleteData fromXml(Element item) {
|
public DatasetAutoCompleteDataEntity fromXml(Element item) {
|
||||||
super.fromXml(item);
|
super.fromXml(item);
|
||||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class DatasetsAutoCompleteData extends InternalDmpEntitiesData<DatasetsAu
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetsAutoCompleteData fromData(Object data) {
|
public DatasetAutoCompleteDataEntity fromData(Object data) {
|
||||||
super.fromData(data);
|
super.fromData(data);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.multiAutoComplete = (Boolean) ((Map<Boolean, Object>) data).get("multiAutoComplete");
|
this.multiAutoComplete = (Boolean) ((Map<Boolean, Object>) data).get("multiAutoComplete");
|
|
@ -0,0 +1,42 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DatasetIdentifierDataEntity extends BaseFieldDataEntity<DatasetIdentifierDataEntity> {
|
||||||
|
@Override
|
||||||
|
public DatasetIdentifierDataEntity fromData(Object data) {
|
||||||
|
if (data != null) {
|
||||||
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object toData() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toXml(Document doc) {
|
||||||
|
Element root = doc.createElement("data");
|
||||||
|
root.setAttribute("label", this.getLabel());
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatasetIdentifierDataEntity fromXml(Element item) {
|
||||||
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> toMap(Element item) {
|
||||||
|
HashMap dataMap = new HashMap();
|
||||||
|
dataMap.put("label", item != null ? item.getAttribute("label") : "");
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,9 +6,9 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class DatasetIdentifierData extends FieldData<DatasetIdentifierData> {
|
public class DatePickerDataEntity extends BaseFieldDataEntity<DatePickerDataEntity> {
|
||||||
@Override
|
@Override
|
||||||
public DatasetIdentifierData fromData(Object data) {
|
public DatePickerDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class DatasetIdentifierData extends FieldData<DatasetIdentifierData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetIdentifierData fromXml(Element item) {
|
public DatePickerDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class DMPsAutoCompleteData extends InternalDmpEntitiesData<DMPsAutoCompleteData>{
|
public class DmpAutoCompleteDataEntity extends InternalDmpBaseDataEntity<DmpAutoCompleteDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -25,7 +25,7 @@ public class DMPsAutoCompleteData extends InternalDmpEntitiesData<DMPsAutoComple
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DMPsAutoCompleteData fromXml(Element item) {
|
public DmpAutoCompleteDataEntity fromXml(Element item) {
|
||||||
super.fromXml(item);
|
super.fromXml(item);
|
||||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class DMPsAutoCompleteData extends InternalDmpEntitiesData<DMPsAutoComple
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DMPsAutoCompleteData fromData(Object data) {
|
public DmpAutoCompleteDataEntity fromData(Object data) {
|
||||||
super.fromData(data);
|
super.fromData(data);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.multiAutoComplete = (Boolean) ((Map<Boolean, Object>) data).get("multiAutoComplete");
|
this.multiAutoComplete = (Boolean) ((Map<Boolean, Object>) data).get("multiAutoComplete");
|
|
@ -1,14 +1,15 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.FieldDataExternalDatasetType;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
|
public class ExternalDatasetDataEntity extends BaseFieldDataEntity<ExternalDatasetDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
private String type;
|
private FieldDataExternalDatasetType type;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
return multiAutoComplete;
|
return multiAutoComplete;
|
||||||
|
@ -18,20 +19,20 @@ public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
|
||||||
this.multiAutoComplete = multiAutoComplete;
|
this.multiAutoComplete = multiAutoComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
public FieldDataExternalDatasetType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(String type) {
|
public void setType(FieldDataExternalDatasetType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExternalDatasetsData fromData(Object data) {
|
public ExternalDatasetDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
||||||
this.setType(((Map<String, Object>) data).get("type") != null && !((Map<String, Object>) data).get("type").toString().isEmpty()? ((Map<String, Object>) data).get("type").toString() : "other");
|
this.setType(((Map<String, Object>) data).get("type") != null && !((Map<String, Object>) data).get("type").toString().isEmpty()? FieldDataExternalDatasetType.of(((Map<String, Object>) data).get("type").toString()) : FieldDataExternalDatasetType.Other);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -49,16 +50,16 @@ public class ExternalDatasetsData extends FieldData<ExternalDatasetsData> {
|
||||||
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
|
root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString());
|
||||||
}
|
}
|
||||||
if (this.getType() != null) {
|
if (this.getType() != null) {
|
||||||
root.setAttribute("type", this.getType());
|
root.setAttribute("type", this.getType().getValue());
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExternalDatasetsData fromXml(Element item) {
|
public ExternalDatasetDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
this.setType(item.getAttribute("type") != null ? item.getAttribute("type"): "other");
|
this.setType(item.getAttribute("type") != null ? FieldDataExternalDatasetType.of(item.getAttribute("type")): FieldDataExternalDatasetType.Other);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.FieldDataComboBoxType;
|
||||||
|
import eu.eudat.commons.enums.FieldDataInternalDmpEntryType;
|
||||||
|
import eu.eudat.commons.enums.FieldType;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class FieldDataHelper {
|
||||||
|
public BaseFieldDataEntity<?> create(FieldType type, String subType) {
|
||||||
|
switch (type) {
|
||||||
|
case COMBO_BOX: {
|
||||||
|
if (subType != null && !subType.isBlank()) {
|
||||||
|
switch (FieldDataComboBoxType.of(subType)) {
|
||||||
|
case Wordlist: {
|
||||||
|
return new WordListDataEntity();
|
||||||
|
}
|
||||||
|
case Autocomplete: {
|
||||||
|
return new AutoCompleteDataEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case INTERNAL_DMP_ENTRIES: {
|
||||||
|
if (subType != null && !subType.isBlank()) {
|
||||||
|
switch (FieldDataInternalDmpEntryType.of(subType)){
|
||||||
|
case Dmps: {
|
||||||
|
return new DmpAutoCompleteDataEntity();
|
||||||
|
}
|
||||||
|
case Datasets: {
|
||||||
|
return new DatasetAutoCompleteDataEntity();
|
||||||
|
}
|
||||||
|
case Researchers : {
|
||||||
|
return new ResearcherAutoCompleteDataEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOOLEAN_DECISION: return new BooleanDecisionDataEntity();
|
||||||
|
case RADIO_BOX: return new RadioBoxDataEntity();
|
||||||
|
case CHECK_BOX: return new CheckBoxDataEntity();
|
||||||
|
case FREE_TEXT: return new FreeTextDataEntity();
|
||||||
|
case TEXT_AREA: return new TextAreaDataEntity();
|
||||||
|
case RICH_TEXT_AREA: return new RichTextAreaDataEntity();
|
||||||
|
case UPLOAD: return new UploadDataEntity();
|
||||||
|
case DATE_PICKER: return new DatePickerDataEntity();
|
||||||
|
case EXTERNAL_DATASETS: return new ExternalDatasetDataEntity();
|
||||||
|
case DATA_REPOSITORIES:
|
||||||
|
case PUB_REPOSITORIES:
|
||||||
|
case JOURNAL_REPOSITORIES: return new DataRepositoryDataEntity();
|
||||||
|
case TAXONOMIES: return new TaxonomyDataEntity();
|
||||||
|
case LICENSES: return new LicenseDataEntity();
|
||||||
|
case PUBLICATIONS: return new PublicationDataEntity();
|
||||||
|
case REGISTRIES: return new RegistryDataEntity();
|
||||||
|
case SERVICES: return new ServiceDataEntity();
|
||||||
|
case TAGS: return new TagDataEntity();
|
||||||
|
case RESEARCHERS: return new ResearcherDataEntity();
|
||||||
|
case ORGANIZATIONS: return new OrganizationDataEntity();
|
||||||
|
case DATASET_IDENTIFIER: return new DatasetIdentifierDataEntity();
|
||||||
|
case CURRENCY: return new CurrencyDataEntity();
|
||||||
|
case VALIDATION: return new ValidationDataEntity();
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseFieldDataEntity<?> toFieldData(Object data, FieldType type, Element dataElement) {
|
||||||
|
String subType = dataElement != null ? dataElement.getAttribute("type") : null;
|
||||||
|
BaseFieldDataEntity<?> baseFieldData = this.create(type, subType);
|
||||||
|
if (baseFieldData == null) return baseFieldData;
|
||||||
|
return (BaseFieldDataEntity<?>) baseFieldData.fromData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseFieldDataEntity<?> toFieldData(Object data, FieldType type) {
|
||||||
|
Map<String, Object> dataAsMap = (Map<String, Object>) data;
|
||||||
|
String subType = dataAsMap != null ? (String) dataAsMap.getOrDefault("type", null) : null;
|
||||||
|
BaseFieldDataEntity<?> baseFieldData = this.create(type, subType);
|
||||||
|
if (baseFieldData == null) return baseFieldData;
|
||||||
|
return (BaseFieldDataEntity<?>) baseFieldData.fromData(data);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -7,10 +7,10 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class FreeTextData extends FieldData<FreeTextData> {
|
public class FreeTextDataEntity extends BaseFieldDataEntity<FreeTextDataEntity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FreeTextData fromData(Object data) {
|
public FreeTextDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel(((Map<String, String>) data).get("label"));
|
this.setLabel(((Map<String, String>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class FreeTextData extends FieldData<FreeTextData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FreeTextData fromXml(Element item) {
|
public FreeTextDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item.getAttribute("label"));
|
this.setLabel(item.getAttribute("label"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,25 +1,24 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.FieldDataInternalDmpEntryType;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class InternalDmpEntitiesData<T> extends FieldData<T> {
|
public abstract class InternalDmpBaseDataEntity<T> extends BaseFieldDataEntity<T> {
|
||||||
private String type;
|
public FieldDataInternalDmpEntryType getType() {
|
||||||
|
return FieldDataInternalDmpEntryType.of(this.getSubType());
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
public void setType(String type) {
|
public void setType(FieldDataInternalDmpEntryType type) {
|
||||||
this.type = type;
|
this.setSubType(type.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
Element root = doc.createElement("data");
|
Element root = doc.createElement("data");
|
||||||
root.setAttribute("type", this.type);
|
root.setAttribute("type", this.getType().getValue());
|
||||||
root.setAttribute("label", this.getLabel());
|
root.setAttribute("label", this.getLabel());
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +26,7 @@ public abstract class InternalDmpEntitiesData<T> extends FieldData<T> {
|
||||||
@Override
|
@Override
|
||||||
public T fromXml(Element item) {
|
public T fromXml(Element item) {
|
||||||
this.setLabel(item.getAttribute("label"));
|
this.setLabel(item.getAttribute("label"));
|
||||||
this.type = item.getAttribute("type");
|
this.setType(FieldDataInternalDmpEntryType.of(item.getAttribute("type")));
|
||||||
return (T) this;
|
return (T) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ public abstract class InternalDmpEntitiesData<T> extends FieldData<T> {
|
||||||
public T fromData(Object data) {
|
public T fromData(Object data) {
|
||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.type = (String) ((Map<String, Object>) data).get("type");
|
this.setType(FieldDataInternalDmpEntryType.of ((String) ((Map<String, Object>) data).get("type")));
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class TaxonomiesData extends FieldData<TaxonomiesData> {
|
public class LicenseDataEntity extends BaseFieldDataEntity<LicenseDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -18,7 +18,7 @@ public class TaxonomiesData extends FieldData<TaxonomiesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaxonomiesData fromData(Object data) {
|
public LicenseDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
||||||
|
@ -42,7 +42,7 @@ public class TaxonomiesData extends FieldData<TaxonomiesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TaxonomiesData fromXml(Element item) {
|
public LicenseDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
return this;
|
return this;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ServicesData extends FieldData<ServicesData> {
|
public class OrganizationDataEntity extends BaseFieldDataEntity<OrganizationDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -18,7 +18,7 @@ public class ServicesData extends FieldData<ServicesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServicesData fromData(Object data) {
|
public OrganizationDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
||||||
|
@ -42,7 +42,7 @@ public class ServicesData extends FieldData<ServicesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServicesData fromXml(Element item) {
|
public OrganizationDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
return this;
|
return this;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class DataRepositoriesData extends FieldData<DataRepositoriesData> {
|
public class PublicationDataEntity extends BaseFieldDataEntity<PublicationDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -18,7 +18,7 @@ public class DataRepositoriesData extends FieldData<DataRepositoriesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataRepositoriesData fromData(Object data) {
|
public PublicationDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
||||||
|
@ -42,7 +42,7 @@ public class DataRepositoriesData extends FieldData<DataRepositoriesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataRepositoriesData fromXml(Element item) {
|
public PublicationDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
return this;
|
return this;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -11,7 +11,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class RadioBoxData extends FieldData<RadioBoxData> {
|
public class RadioBoxDataEntity extends BaseFieldDataEntity<RadioBoxDataEntity> {
|
||||||
|
|
||||||
public class Option implements XmlSerializable<Option> {
|
public class Option implements XmlSerializable<Option> {
|
||||||
private String label;
|
private String label;
|
||||||
|
@ -62,7 +62,7 @@ public class RadioBoxData extends FieldData<RadioBoxData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RadioBoxData fromData(Object data) {
|
public RadioBoxDataEntity fromData(Object data) {
|
||||||
this.options = new LinkedList();
|
this.options = new LinkedList();
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
List<Map<String, String>> options = ((Map<String, List<Map<String, String>>>) data).get("options");
|
List<Map<String, String>> options = ((Map<String, List<Map<String, String>>>) data).get("options");
|
||||||
|
@ -96,7 +96,7 @@ public class RadioBoxData extends FieldData<RadioBoxData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RadioBoxData fromXml(Element item) {
|
public RadioBoxDataEntity fromXml(Element item) {
|
||||||
|
|
||||||
this.options = new LinkedList<>();
|
this.options = new LinkedList<>();
|
||||||
Element optionsElement = (Element) item.getElementsByTagName("options").item(0);
|
Element optionsElement = (Element) item.getElementsByTagName("options").item(0);
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class RegistriesData extends FieldData<RegistriesData> {
|
public class RegistryDataEntity extends BaseFieldDataEntity<RegistryDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -18,7 +18,7 @@ public class RegistriesData extends FieldData<RegistriesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RegistriesData fromData(Object data) {
|
public RegistryDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()?Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()): false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()?Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()): false);
|
||||||
|
@ -42,7 +42,7 @@ public class RegistriesData extends FieldData<RegistriesData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RegistriesData fromXml(Element item) {
|
public RegistryDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
return this;
|
return this;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ResearchersAutoCompleteData extends InternalDmpEntitiesData<ResearchersAutoCompleteData> {
|
public class ResearcherAutoCompleteDataEntity extends InternalDmpBaseDataEntity<ResearcherAutoCompleteDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -25,7 +25,7 @@ public class ResearchersAutoCompleteData extends InternalDmpEntitiesData<Researc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResearchersAutoCompleteData fromXml(Element item) {
|
public ResearcherAutoCompleteDataEntity fromXml(Element item) {
|
||||||
super.fromXml(item);
|
super.fromXml(item);
|
||||||
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
this.multiAutoComplete = Boolean.parseBoolean(item.getAttribute("multiAutoComplete"));
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class ResearchersAutoCompleteData extends InternalDmpEntitiesData<Researc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResearchersAutoCompleteData fromData(Object data) {
|
public ResearcherAutoCompleteDataEntity fromData(Object data) {
|
||||||
super.fromData(data);
|
super.fromData(data);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.multiAutoComplete = Boolean.parseBoolean(((Map<Boolean, Object>) data).get("multiAutoComplete").toString());
|
this.multiAutoComplete = Boolean.parseBoolean(((Map<Boolean, Object>) data).get("multiAutoComplete").toString());
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ResearcherData extends FieldData<ResearcherData> {
|
public class ResearcherDataEntity extends BaseFieldDataEntity<ResearcherDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -18,7 +18,7 @@ public class ResearcherData extends FieldData<ResearcherData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResearcherData fromData(Object data) {
|
public ResearcherDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
||||||
|
@ -42,7 +42,7 @@ public class ResearcherData extends FieldData<ResearcherData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResearcherData fromXml(Element item) {
|
public ResearcherDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
return this;
|
return this;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -7,9 +7,9 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class RichTextAreaData extends FieldData<RichTextAreaData> {
|
public class RichTextAreaDataEntity extends BaseFieldDataEntity<RichTextAreaDataEntity> {
|
||||||
@Override
|
@Override
|
||||||
public RichTextAreaData fromData(Object data) {
|
public RichTextAreaDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel(((Map<String, String>) data).get("label"));
|
this.setLabel(((Map<String, String>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class RichTextAreaData extends FieldData<RichTextAreaData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RichTextAreaData fromXml(Element item) {
|
public RichTextAreaDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item.getAttribute("label"));
|
this.setLabel(item.getAttribute("label"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class OrganizationsData extends FieldData<OrganizationsData> {
|
public class ServiceDataEntity extends BaseFieldDataEntity<ServiceDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -18,7 +18,7 @@ public class OrganizationsData extends FieldData<OrganizationsData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrganizationsData fromData(Object data) {
|
public ServiceDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean( ((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
||||||
|
@ -42,7 +42,7 @@ public class OrganizationsData extends FieldData<OrganizationsData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrganizationsData fromXml(Element item) {
|
public ServiceDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
return this;
|
return this;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,9 +6,9 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class TagsData extends FieldData<TagsData> {
|
public class TagDataEntity extends BaseFieldDataEntity<TagDataEntity> {
|
||||||
@Override
|
@Override
|
||||||
public TagsData fromData(Object data) {
|
public TagDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class TagsData extends FieldData<TagsData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TagsData fromXml(Element item) {
|
public TagDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,7 +6,7 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PublicationsData extends FieldData<PublicationsData> {
|
public class TaxonomyDataEntity extends BaseFieldDataEntity<TaxonomyDataEntity> {
|
||||||
private Boolean multiAutoComplete;
|
private Boolean multiAutoComplete;
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() {
|
public Boolean getMultiAutoComplete() {
|
||||||
|
@ -18,7 +18,7 @@ public class PublicationsData extends FieldData<PublicationsData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PublicationsData fromData(Object data) {
|
public TaxonomyDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
this.setMultiAutoComplete(((Map<String, Object>) data).get("multiAutoComplete") != null && !((Map<String, Object>) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map<String, Object>) data).get("multiAutoComplete").toString()) : false);
|
||||||
|
@ -42,7 +42,7 @@ public class PublicationsData extends FieldData<PublicationsData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PublicationsData fromXml(Element item) {
|
public TaxonomyDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete")));
|
||||||
return this;
|
return this;
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -7,9 +7,9 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class TextAreaData extends FieldData<TextAreaData> {
|
public class TextAreaDataEntity extends BaseFieldDataEntity<TextAreaDataEntity> {
|
||||||
@Override
|
@Override
|
||||||
public TextAreaData fromData(Object data) {
|
public TextAreaDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel(((Map<String, String>) data).get("label"));
|
this.setLabel(((Map<String, String>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class TextAreaData extends FieldData<TextAreaData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextAreaData fromXml(Element item) {
|
public TextAreaDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item.getAttribute("label"));
|
this.setLabel(item.getAttribute("label"));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
@ -12,8 +12,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class UploadData extends FieldData<UploadData> {
|
public class UploadDataEntity extends BaseFieldDataEntity<UploadDataEntity> {
|
||||||
public class Option implements XmlSerializable<UploadData.Option> {
|
public class Option implements XmlSerializable<UploadDataEntity.Option> {
|
||||||
private String label;
|
private String label;
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class UploadData extends FieldData<UploadData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadData.Option fromXml(Element item) {
|
public UploadDataEntity.Option fromXml(Element item) {
|
||||||
this.label = item.getAttribute("label");
|
this.label = item.getAttribute("label");
|
||||||
this.value = item.getAttribute("value");
|
this.value = item.getAttribute("value");
|
||||||
return this;
|
return this;
|
||||||
|
@ -51,13 +51,13 @@ public class UploadData extends FieldData<UploadData> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<UploadData.Option> types;
|
private List<UploadDataEntity.Option> types;
|
||||||
|
|
||||||
public List<UploadData.Option> getTypes() {
|
public List<UploadDataEntity.Option> getTypes() {
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypes(List<UploadData.Option> types) {
|
public void setTypes(List<UploadDataEntity.Option> types) {
|
||||||
this.types = types;
|
this.types = types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@ public class UploadData extends FieldData<UploadData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadData fromData(Object data) {
|
public UploadDataEntity fromData(Object data) {
|
||||||
this.types = new LinkedList();
|
this.types = new LinkedList();
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
List<Map<String, String>> types = ((Map<String, List<Map<String, String>>>) data).get("types");
|
List<Map<String, String>> types = ((Map<String, List<Map<String, String>>>) data).get("types");
|
||||||
for (Map<String, String> map : types) {
|
for (Map<String, String> map : types) {
|
||||||
UploadData.Option newOption = new UploadData.Option();
|
UploadDataEntity.Option newOption = new UploadDataEntity.Option();
|
||||||
newOption.setLabel(map.get("label"));
|
newOption.setLabel(map.get("label"));
|
||||||
newOption.setValue(map.get("value"));
|
newOption.setValue(map.get("value"));
|
||||||
this.types.add(newOption);
|
this.types.add(newOption);
|
||||||
|
@ -104,7 +104,7 @@ public class UploadData extends FieldData<UploadData> {
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
Element root = doc.createElement("data");
|
Element root = doc.createElement("data");
|
||||||
Element element = doc.createElement("types");
|
Element element = doc.createElement("types");
|
||||||
for (UploadData.Option type : this.types) {
|
for (UploadDataEntity.Option type : this.types) {
|
||||||
element.appendChild(type.toXml(doc));
|
element.appendChild(type.toXml(doc));
|
||||||
}
|
}
|
||||||
root.setAttribute("label", this.getLabel());
|
root.setAttribute("label", this.getLabel());
|
||||||
|
@ -114,7 +114,7 @@ public class UploadData extends FieldData<UploadData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UploadData fromXml(Element item) {
|
public UploadDataEntity fromXml(Element item) {
|
||||||
this.types = new LinkedList<>();
|
this.types = new LinkedList<>();
|
||||||
Element optionsElement = (Element) item.getElementsByTagName("types").item(0);
|
Element optionsElement = (Element) item.getElementsByTagName("types").item(0);
|
||||||
this.setLabel(item.getAttribute("label"));
|
this.setLabel(item.getAttribute("label"));
|
||||||
|
@ -126,7 +126,7 @@ public class UploadData extends FieldData<UploadData> {
|
||||||
for (int temp = 0; temp < optionElements.getLength(); temp++) {
|
for (int temp = 0; temp < optionElements.getLength(); temp++) {
|
||||||
Node optionElement = optionElements.item(temp);
|
Node optionElement = optionElements.item(temp);
|
||||||
if (optionElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (optionElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.types.add(new UploadData.Option().fromXml((Element) optionElement));
|
this.types.add(new UploadDataEntity.Option().fromXml((Element) optionElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -6,9 +6,9 @@ import org.w3c.dom.Element;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class CurrencyData extends FieldData<CurrencyData> {
|
public class ValidationDataEntity extends BaseFieldDataEntity<ValidationDataEntity> {
|
||||||
@Override
|
@Override
|
||||||
public CurrencyData fromData(Object data) {
|
public ValidationDataEntity fromData(Object data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
this.setLabel((String) ((Map<String, Object>) data).get("label"));
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class CurrencyData extends FieldData<CurrencyData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CurrencyData fromXml(Element item) {
|
public ValidationDataEntity fromXml(Element item) {
|
||||||
this.setLabel(item != null ? item.getAttribute("label") : "");
|
this.setLabel(item != null ? item.getAttribute("label") : "");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package eu.eudat.models.data.components.commons.datafield;
|
package eu.eudat.commons.types.descriptiontemplate.fielddata;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -10,8 +10,9 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class WordListData extends ComboBoxData<WordListData> {
|
public class WordListDataEntity extends ComboBoxDataEntity<WordListDataEntity> {
|
||||||
private List<Option> options;
|
private List<Option> options;
|
||||||
|
|
||||||
private Boolean multiList;
|
private Boolean multiList;
|
||||||
|
|
||||||
public List<Option> getOptions() {
|
public List<Option> getOptions() {
|
||||||
|
@ -45,7 +46,7 @@ public class WordListData extends ComboBoxData<WordListData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WordListData fromXml(Element item) {
|
public WordListDataEntity fromXml(Element item) {
|
||||||
super.fromXml(item);
|
super.fromXml(item);
|
||||||
this.options = new LinkedList<>();
|
this.options = new LinkedList<>();
|
||||||
Element optionsElement = (Element) item.getElementsByTagName("options").item(0);
|
Element optionsElement = (Element) item.getElementsByTagName("options").item(0);
|
||||||
|
@ -65,7 +66,7 @@ public class WordListData extends ComboBoxData<WordListData> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WordListData fromData(Object data) {
|
public WordListDataEntity fromData(Object data) {
|
||||||
super.fromData(data);
|
super.fromData(data);
|
||||||
this.options = new LinkedList();
|
this.options = new LinkedList();
|
||||||
if (data != null) {
|
if (data != null) {
|
|
@ -1,6 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons;
|
package eu.eudat.commons.types.descriptiontemplate.todelete;
|
||||||
|
|
||||||
public class DefaultValue {
|
public class DefaultValueEntity {
|
||||||
private String type;
|
private String type;
|
||||||
private String value;
|
private String value;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package eu.eudat.commons.types.descriptiontemplate.todelete;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.FieldType;
|
||||||
|
|
||||||
|
public class FieldDescriptionEntity {
|
||||||
|
private FieldType fieldType;
|
||||||
|
private String cssClass;
|
||||||
|
|
||||||
|
public FieldType getFieldType() {
|
||||||
|
return fieldType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFieldType(FieldType fieldType) {
|
||||||
|
this.fieldType = fieldType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCssClass() {
|
||||||
|
return cssClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCssClass(String cssClass) {
|
||||||
|
this.cssClass = cssClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.models.data.components.commons;
|
package eu.eudat.commons.types.descriptiontemplate.todelete;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.RuleEntity;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
@ -9,15 +10,15 @@ import org.w3c.dom.NodeList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Visibility implements XmlSerializable<Visibility> {
|
public class VisibilityEntity implements XmlSerializable<VisibilityEntity> {
|
||||||
private List<Rule> rules;
|
private List<RuleEntity> rules;
|
||||||
private String style;
|
private String style;
|
||||||
|
|
||||||
public List<Rule> getRules() {
|
public List<RuleEntity> getRules() {
|
||||||
return rules;
|
return rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRules(List<Rule> rules) {
|
public void setRules(List<RuleEntity> rules) {
|
||||||
this.rules = rules;
|
this.rules = rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ public class Visibility implements XmlSerializable<Visibility> {
|
||||||
Element root = doc.createElement("visible");
|
Element root = doc.createElement("visible");
|
||||||
root.setAttribute("style", this.style);
|
root.setAttribute("style", this.style);
|
||||||
if (rules != null && !rules.isEmpty()) {
|
if (rules != null && !rules.isEmpty()) {
|
||||||
for (Rule rule : rules) {
|
for (RuleEntity rule : rules) {
|
||||||
root.appendChild(rule.toXml(doc));
|
root.appendChild(rule.toXml(doc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,14 +43,14 @@ public class Visibility implements XmlSerializable<Visibility> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Visibility fromXml(Element item) {
|
public VisibilityEntity fromXml(Element item) {
|
||||||
this.style = item.getAttribute("style");
|
this.style = item.getAttribute("style");
|
||||||
this.rules = new LinkedList();
|
this.rules = new LinkedList();
|
||||||
NodeList rulesElements = item.getChildNodes();
|
NodeList rulesElements = item.getChildNodes();
|
||||||
for (int temp = 0; temp < rulesElements.getLength(); temp++) {
|
for (int temp = 0; temp < rulesElements.getLength(); temp++) {
|
||||||
Node ruleElement = rulesElements.item(temp);
|
Node ruleElement = rulesElements.item(temp);
|
||||||
if (ruleElement.getNodeType() == Node.ELEMENT_NODE) {
|
if (ruleElement.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
this.rules.add(new Rule().fromXml((Element) ruleElement));
|
this.rules.add(new RuleEntity().fromXml((Element) ruleElement));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
|
@ -2,6 +2,7 @@ package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import jakarta.xml.bind.annotation.*;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -10,7 +11,11 @@ import org.w3c.dom.NodeList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "root")
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class DefinitionEntity implements XmlSerializable<DefinitionEntity> {
|
public class DefinitionEntity implements XmlSerializable<DefinitionEntity> {
|
||||||
|
@XmlElementWrapper(name = "sections")
|
||||||
|
@XmlElement(name = "section")
|
||||||
private List<SectionEntity> sections;
|
private List<SectionEntity> sections;
|
||||||
|
|
||||||
public List<SectionEntity> getSections() {
|
public List<SectionEntity> getSections() {
|
||||||
|
|
|
@ -1,17 +1,26 @@
|
||||||
package eu.eudat.commons.types.dmpblueprint;
|
package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class DescriptionTemplateEntity implements XmlSerializable<DescriptionTemplateEntity> {
|
public class DescriptionTemplateEntity implements XmlSerializable<DescriptionTemplateEntity> {
|
||||||
|
|
||||||
|
@XmlAttribute(name="id")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
@XmlAttribute(name="descriptionTemplateId")
|
||||||
private UUID descriptionTemplateId;
|
private UUID descriptionTemplateId;
|
||||||
|
@XmlAttribute(name="label")
|
||||||
private String label;
|
private String label;
|
||||||
|
@XmlAttribute(name="minMultiplicity")
|
||||||
private Integer minMultiplicity;
|
private Integer minMultiplicity;
|
||||||
|
@XmlAttribute(name="maxMultiplicity")
|
||||||
private Integer maxMultiplicity;
|
private Integer maxMultiplicity;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
package eu.eudat.commons.types.dmpblueprint;
|
|
||||||
|
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
|
|
||||||
public class ExternalAutoCompleteEntity implements XmlSerializable<ExternalAutoCompleteEntity> {
|
|
||||||
private String url;
|
|
||||||
private String optionsRoot;
|
|
||||||
private Boolean multiAutoComplete;
|
|
||||||
private String label;
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOptionsRoot() {
|
|
||||||
return optionsRoot;
|
|
||||||
}
|
|
||||||
public void setOptionsRoot(String optionsRoot) {
|
|
||||||
this.optionsRoot = optionsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getMultiAutoComplete() { return multiAutoComplete; }
|
|
||||||
public void setMultiAutoComplete(Boolean multiAutoComplete) { this.multiAutoComplete = multiAutoComplete; }
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Element toXml(Document doc) {
|
|
||||||
Element root = doc.createElement("externalAutocomplete");
|
|
||||||
root.setAttribute("url", this.url);
|
|
||||||
root.setAttribute("optionsRoot", this.optionsRoot);
|
|
||||||
if (this.multiAutoComplete == null) this.multiAutoComplete = false;
|
|
||||||
root.setAttribute("multiAutoComplete", this.multiAutoComplete.toString());
|
|
||||||
root.setAttribute("label", this.label);
|
|
||||||
root.setAttribute("value", this.value);
|
|
||||||
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ExternalAutoCompleteEntity fromXml(Element item) {
|
|
||||||
this.url = item.getAttribute("url");
|
|
||||||
this.optionsRoot = item.getAttribute("optionsRoot");
|
|
||||||
this.multiAutoComplete = Boolean.valueOf(item.getAttribute("multiAutoComplete"));
|
|
||||||
this.label = item.getAttribute("label");
|
|
||||||
this.value = item.getAttribute("value");
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,10 +2,15 @@ package eu.eudat.commons.types.dmpblueprint;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class ExtraFieldEntity extends FieldEntity {
|
public class ExtraFieldEntity extends FieldEntity {
|
||||||
|
|
||||||
|
@XmlAttribute(name="type")
|
||||||
private DmpBlueprintExtraFieldDataType type;
|
private DmpBlueprintExtraFieldDataType type;
|
||||||
|
|
||||||
public DmpBlueprintExtraFieldDataType getType() {
|
public DmpBlueprintExtraFieldDataType getType() {
|
||||||
|
|
|
@ -3,18 +3,36 @@ package eu.eudat.commons.types.dmpblueprint;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
|
import eu.eudat.commons.enums.DmpBlueprintExtraFieldDataType;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
|
import jakarta.xml.bind.annotation.XmlTransient;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public abstract class FieldEntity implements XmlSerializable<FieldEntity> {
|
public abstract class FieldEntity implements XmlSerializable<FieldEntity> {
|
||||||
|
@XmlAttribute(name="id")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
@XmlTransient
|
||||||
private DmpBlueprintFieldCategory category;
|
private DmpBlueprintFieldCategory category;
|
||||||
|
|
||||||
|
@XmlAttribute(name="label")
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
@XmlAttribute(name="placeholder")
|
||||||
private String placeholder;
|
private String placeholder;
|
||||||
|
|
||||||
|
@XmlAttribute(name="description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@XmlAttribute(name="ordinal")
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
|
||||||
|
@XmlAttribute(name="required")
|
||||||
private boolean required;
|
private boolean required;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.commons.types.dmpblueprint;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.commons.types.xml.XmlBuilder;
|
import eu.eudat.commons.types.xml.XmlBuilder;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import jakarta.xml.bind.annotation.*;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
@ -13,14 +14,29 @@ import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class SectionEntity implements XmlSerializable<SectionEntity> {
|
public class SectionEntity implements XmlSerializable<SectionEntity> {
|
||||||
|
|
||||||
|
@XmlAttribute(name="id")
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
@XmlAttribute(name="label")
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
@XmlAttribute(name="description")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@XmlAttribute(name="ordinal")
|
||||||
private Integer ordinal;
|
private Integer ordinal;
|
||||||
|
|
||||||
|
@XmlTransient
|
||||||
private List<FieldEntity> fields;
|
private List<FieldEntity> fields;
|
||||||
|
|
||||||
|
@XmlAttribute(name="hasTemplates")
|
||||||
private Boolean hasTemplates;
|
private Boolean hasTemplates;
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "descriptionTemplates")
|
||||||
|
@XmlElement(name = "descriptionTemplate")
|
||||||
private List<DescriptionTemplateEntity> descriptionTemplates;
|
private List<DescriptionTemplateEntity> descriptionTemplates;
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
|
|
|
@ -3,13 +3,18 @@ package eu.eudat.commons.types.dmpblueprint;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
import eu.eudat.commons.enums.DmpBlueprintFieldCategory;
|
||||||
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
import eu.eudat.commons.enums.DmpBlueprintSystemFieldType;
|
||||||
import eu.eudat.commons.types.xml.XmlSerializable;
|
import eu.eudat.commons.types.xml.XmlSerializable;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import jakarta.xml.bind.annotation.XmlAttribute;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class SystemFieldEntity extends FieldEntity {
|
public class SystemFieldEntity extends FieldEntity {
|
||||||
|
|
||||||
|
@XmlAttribute(name="type")
|
||||||
private DmpBlueprintSystemFieldType type;
|
private DmpBlueprintSystemFieldType type;
|
||||||
|
|
||||||
public DmpBlueprintSystemFieldType getType() {
|
public DmpBlueprintSystemFieldType getType() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.eudat.configurations.referencetype;
|
package eu.eudat.configurations.referencetype;
|
||||||
|
|
||||||
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
|
import eu.eudat.model.persist.referencedefinition.DefinitionPersist;
|
||||||
|
import eu.eudat.model.referencedefinition.Field;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
import org.springframework.boot.context.properties.bind.ConstructorBinding;
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ public class ReferenceTypeProperties {
|
||||||
private Map<String, List<ReferenceTypeField>> project;
|
private Map<String, List<ReferenceTypeField>> project;
|
||||||
private Map<String, List<ReferenceTypeField>> organisation;
|
private Map<String, List<ReferenceTypeField>> organisation;
|
||||||
private Map<String, List<ReferenceTypeField>> dataset;
|
private Map<String, List<ReferenceTypeField>> dataset;
|
||||||
private Map<String, List<ReferenceTypeField>> dataRepository;
|
private Map<String, List<Field>> dataRepository;
|
||||||
private Map<String, List<ReferenceTypeField>> pubRepository;
|
private Map<String, List<ReferenceTypeField>> pubRepository;
|
||||||
private Map<String, List<ReferenceTypeField>> journal;
|
private Map<String, List<ReferenceTypeField>> journal;
|
||||||
private Map<String, List<ReferenceTypeField>> publication;
|
private Map<String, List<ReferenceTypeField>> publication;
|
||||||
|
@ -30,7 +31,7 @@ public class ReferenceTypeProperties {
|
||||||
Map<String, List<ReferenceTypeField>> researcher, Map<String, List<ReferenceTypeField>> service,
|
Map<String, List<ReferenceTypeField>> researcher, Map<String, List<ReferenceTypeField>> service,
|
||||||
Map<String, List<ReferenceTypeField>> registry, Map<String, List<ReferenceTypeField>> project,
|
Map<String, List<ReferenceTypeField>> registry, Map<String, List<ReferenceTypeField>> project,
|
||||||
Map<String, List<ReferenceTypeField>> organisation, Map<String, List<ReferenceTypeField>> dataset,
|
Map<String, List<ReferenceTypeField>> organisation, Map<String, List<ReferenceTypeField>> dataset,
|
||||||
Map<String, List<ReferenceTypeField>> dataRepository, Map<String, List<ReferenceTypeField>> pubRepository,
|
Map<String, List<Field>> dataRepository, Map<String, List<ReferenceTypeField>> pubRepository,
|
||||||
Map<String, List<ReferenceTypeField>> journal, Map<String, List<ReferenceTypeField>> publication,
|
Map<String, List<ReferenceTypeField>> journal, Map<String, List<ReferenceTypeField>> publication,
|
||||||
Map<String, List<ReferenceTypeField>> licence, Map<String, List<ReferenceTypeField>> taxonomy) {
|
Map<String, List<ReferenceTypeField>> licence, Map<String, List<ReferenceTypeField>> taxonomy) {
|
||||||
this.grant = grant;
|
this.grant = grant;
|
||||||
|
@ -113,11 +114,11 @@ public class ReferenceTypeProperties {
|
||||||
this.dataset = dataset;
|
this.dataset = dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, List<ReferenceTypeField>> getDataRepository() {
|
public Map<String, List<Field>> getDataRepository() {
|
||||||
return dataRepository;
|
return dataRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataRepository(Map<String, List<ReferenceTypeField>> dataRepository) {
|
public void setDataRepository(Map<String, List<Field>> dataRepository) {
|
||||||
this.dataRepository = dataRepository;
|
this.dataRepository = dataRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,174 @@
|
||||||
|
package eu.eudat.data;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DescriptionTemplateStatus;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.data.converters.enums.DescriptionTemplateStatusConverter;
|
||||||
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
|
import eu.eudat.data.old.UserDatasetProfile;
|
||||||
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "\"DescriptionTemplate\"")
|
||||||
|
public class DescriptionTemplateEntity implements DataEntity<DescriptionTemplateEntity,UUID>{
|
||||||
|
@Id
|
||||||
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
|
private UUID id;
|
||||||
|
public static final String _id = "id";
|
||||||
|
|
||||||
|
@Column(name = "\"label\"", length = DescriptionTemplateEntity._labelLength, nullable = false)
|
||||||
|
private String label;
|
||||||
|
public static final String _label = "label";
|
||||||
|
public static final int _labelLength = 250;
|
||||||
|
|
||||||
|
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
||||||
|
@Column(name = "\"definition\"", columnDefinition = "xml", nullable = false)
|
||||||
|
private String definition;
|
||||||
|
public static final String _definition = "definition";
|
||||||
|
|
||||||
|
@Column(name = "\"status\"", nullable = false)
|
||||||
|
@Convert(converter = DescriptionTemplateStatusConverter.class)
|
||||||
|
private DescriptionTemplateStatus status;
|
||||||
|
public static final String _status = "status";
|
||||||
|
|
||||||
|
@Column(name = "is_active", nullable = false)
|
||||||
|
@Convert(converter = IsActiveConverter.class)
|
||||||
|
private IsActive isActive;
|
||||||
|
public static final String _isActive = "isActive";
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "\"created_at\"", nullable = false)
|
||||||
|
private Instant createdAt = null;
|
||||||
|
public static final String _createdAt = "createdAt";
|
||||||
|
|
||||||
|
@Column(name = "\"updated_at\"", nullable = false)
|
||||||
|
private Instant updatedAt;
|
||||||
|
public static final String _updatedAt = "updatedAt";
|
||||||
|
|
||||||
|
@Column(name = "\"description\"", nullable = false)
|
||||||
|
private String description;
|
||||||
|
public static final String _description = "description";
|
||||||
|
|
||||||
|
@Column(name = "\"group_id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
|
private UUID groupId;
|
||||||
|
public static final String _groupId = "groupId";
|
||||||
|
|
||||||
|
@Column(name = "\"version\"", nullable = false)
|
||||||
|
private Short version;
|
||||||
|
public static final String _version = "version";
|
||||||
|
|
||||||
|
@Column(name = "\"language\"", nullable = false)
|
||||||
|
private String language;
|
||||||
|
public static final String _language = "language";
|
||||||
|
|
||||||
|
@Column(name = "\"type\"", nullable = false)
|
||||||
|
private UUID type;
|
||||||
|
public static final String _type = "type";
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(UUID id) { this.id = id;}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefinition() {
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
public void setDefinition(String definition) {
|
||||||
|
this.definition = definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getGroupId() { return groupId; }
|
||||||
|
public void setGroupId(UUID groupId) { this.groupId = groupId;}
|
||||||
|
|
||||||
|
public Short getVersion() { return version; }
|
||||||
|
public void setVersion(Short version) { this.version = version; }
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(DescriptionTemplateStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(UUID type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<UserDatasetProfile> getUsers() {
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
|
public void setUsers(Set<UserDatasetProfile> users) {
|
||||||
|
//this.users = users;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(DescriptionTemplateEntity entity) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UUID getKeys() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DescriptionTemplateEntity buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
||||||
|
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,8 +19,9 @@ public class DescriptionTemplateTypeEntity {
|
||||||
|
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
@Column(name = "name", length = 500, nullable = false)
|
@Column(name = "name", length = DescriptionTemplateTypeEntity._nameLength, nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
|
public static final int _nameLength = 500;
|
||||||
|
|
||||||
public static final String _name = "name";
|
public static final String _name = "name";
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "\"DmpBlueprint\"")
|
@Table(name = "\"DmpBlueprint\"")
|
||||||
public class DmpBlueprintEntity implements DataEntity<DmpBlueprintEntity, UUID> {
|
public class DmpBlueprintEntity {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
@ -115,24 +115,4 @@ public class DmpBlueprintEntity implements DataEntity<DmpBlueprintEntity, UUID>
|
||||||
public void setUpdatedAt(Instant updatedAt) {
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
this.updatedAt = updatedAt;
|
this.updatedAt = updatedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(DmpBlueprintEntity entity) {
|
|
||||||
this.updatedAt = Instant.now();
|
|
||||||
this.definition = entity.getDefinition();
|
|
||||||
this.label = entity.getLabel();
|
|
||||||
this.status= entity.getStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getKeys() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DmpBlueprintEntity buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
|
||||||
String currentBase = base.isEmpty() ? "" : base + ".";
|
|
||||||
if (fields.contains(currentBase + "id")) this.id = EntityBinder.fromTuple(tuple, currentBase + "id");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ package eu.eudat.data;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceType;
|
import eu.eudat.commons.enums.ReferenceType;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.commons.enums.SourceType;
|
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||||
|
import eu.eudat.data.converters.enums.ReferenceSourceTypeConverter;
|
||||||
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
|
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
|
||||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
@ -51,7 +52,8 @@ public class ReferenceEntity {
|
||||||
public static final String _source = "source";
|
public static final String _source = "source";
|
||||||
|
|
||||||
@Column(name = "source_type", nullable = false)
|
@Column(name = "source_type", nullable = false)
|
||||||
private SourceType sourceType;
|
@Convert(converter = ReferenceSourceTypeConverter.class)
|
||||||
|
private ReferenceSourceType referenceSourceType;
|
||||||
public static final String _sourceType = "sourceType";
|
public static final String _sourceType = "sourceType";
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
|
@ -135,12 +137,12 @@ public class ReferenceEntity {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SourceType getSourceType() {
|
public ReferenceSourceType getReferenceSourceType() {
|
||||||
return sourceType;
|
return referenceSourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSourceType(SourceType sourceType) {
|
public void setReferenceSourceType(ReferenceSourceType referenceSourceType) {
|
||||||
this.sourceType = sourceType;
|
this.referenceSourceType = referenceSourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
public IsActive getIsActive() {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package eu.eudat.data.converters.enums;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DescriptionTemplateTypeStatus;
|
||||||
|
import jakarta.persistence.Converter;
|
||||||
|
|
||||||
|
@Converter
|
||||||
|
public class DescriptionTemplateStatusConverter extends DatabaseEnumConverter<DescriptionTemplateTypeStatus, Short> {
|
||||||
|
public DescriptionTemplateTypeStatus of(Short i) {
|
||||||
|
return DescriptionTemplateTypeStatus.of(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package eu.eudat.data.converters.enums;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||||
|
import jakarta.persistence.Converter;
|
||||||
|
|
||||||
|
@Converter
|
||||||
|
public class ReferenceSourceTypeConverter extends DatabaseEnumConverter<ReferenceSourceType, Short>{
|
||||||
|
public ReferenceSourceType of(Short i) {
|
||||||
|
return ReferenceSourceType.of(i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
package eu.eudat.data.converters.enums;
|
|
||||||
|
|
||||||
import eu.eudat.commons.enums.SourceType;
|
|
||||||
import jakarta.persistence.Converter;
|
|
||||||
|
|
||||||
@Converter
|
|
||||||
public class SourceTypeConverter extends DatabaseEnumConverter<SourceType, Short>{
|
|
||||||
public SourceType of(Short i) {
|
|
||||||
return SourceType.of(i);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.data.old;
|
package eu.eudat.data.old;
|
||||||
|
|
||||||
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ public class DMPDatasetProfile implements DataEntity<DMPDatasetProfile, UUID> {
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "\"datasetprofile\"")
|
@JoinColumn(name = "\"datasetprofile\"")
|
||||||
private DescriptionTemplate datasetprofile;
|
private DescriptionTemplateEntity datasetprofile;
|
||||||
|
|
||||||
@Column(name = "\"data\"")
|
@Column(name = "\"data\"")
|
||||||
private String data;
|
private String data;
|
||||||
|
@ -42,10 +43,10 @@ public class DMPDatasetProfile implements DataEntity<DMPDatasetProfile, UUID> {
|
||||||
this.dmp = dmp;
|
this.dmp = dmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DescriptionTemplate getDatasetprofile() {
|
public DescriptionTemplateEntity getDatasetprofile() {
|
||||||
return datasetprofile;
|
return datasetprofile;
|
||||||
}
|
}
|
||||||
public void setDatasetprofile(DescriptionTemplate datasetprofile) {
|
public void setDatasetprofile(DescriptionTemplateEntity datasetprofile) {
|
||||||
this.datasetprofile = datasetprofile;
|
this.datasetprofile = datasetprofile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.eudat.data.old;
|
package eu.eudat.data.old;
|
||||||
|
|
||||||
|
|
||||||
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
import eu.eudat.data.converters.DateToUTCConverter;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
|
@ -113,7 +114,7 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
//@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
//@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||||
@JoinColumn(name = "\"Profile\"")
|
@JoinColumn(name = "\"Profile\"")
|
||||||
private DescriptionTemplate profile;
|
private DescriptionTemplateEntity profile;
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
||||||
@Column(name = "\"Reference\"", columnDefinition = "xml")
|
@Column(name = "\"Reference\"", columnDefinition = "xml")
|
||||||
|
@ -258,10 +259,10 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DescriptionTemplate getProfile() {
|
public DescriptionTemplateEntity getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
public void setProfile(DescriptionTemplate profile) {
|
public void setProfile(DescriptionTemplateEntity profile) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,199 +0,0 @@
|
||||||
package eu.eudat.data.old;
|
|
||||||
|
|
||||||
|
|
||||||
import eu.eudat.data.DescriptionTemplateTypeEntity;
|
|
||||||
import eu.eudat.data.converters.DateToUTCConverter;
|
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.hibernate.annotations.Type;
|
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "\"DescriptionTemplate\"")
|
|
||||||
public class DescriptionTemplate implements DataEntity<DescriptionTemplate,UUID>{
|
|
||||||
|
|
||||||
public enum Status {
|
|
||||||
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
|
|
||||||
|
|
||||||
private short value;
|
|
||||||
|
|
||||||
private Status(short value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
public short getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Status fromInteger(int value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0:
|
|
||||||
return SAVED;
|
|
||||||
case 1:
|
|
||||||
return FINALIZED;
|
|
||||||
case 99:
|
|
||||||
return DELETED;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unsupported Dataset Profile Status");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue
|
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
|
||||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
|
||||||
private UUID id;
|
|
||||||
|
|
||||||
@Column(name = "\"Label\"", nullable = false)
|
|
||||||
private String label;
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
|
|
||||||
private Set<Dataset> dataset;
|
|
||||||
|
|
||||||
@Type(eu.eudat.configurations.typedefinition.XMLType.class)
|
|
||||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
|
||||||
private String definition;
|
|
||||||
|
|
||||||
@Column(name = "\"Status\"", nullable = false)
|
|
||||||
private Short status;
|
|
||||||
|
|
||||||
@Column(name = "\"Created\"")
|
|
||||||
@Convert(converter = DateToUTCConverter.class)
|
|
||||||
private Date created;
|
|
||||||
|
|
||||||
@Column(name = "\"Modified\"")
|
|
||||||
@Convert(converter = DateToUTCConverter.class)
|
|
||||||
private Date modified = new Date();
|
|
||||||
|
|
||||||
@Column(name = "\"Description\"")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
@Column(name = "\"GroupId\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
|
||||||
private UUID groupId;
|
|
||||||
|
|
||||||
@Column(name = "\"Version\"", nullable = false)
|
|
||||||
private Short version;
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY)
|
|
||||||
private Set<DMP> dmps;
|
|
||||||
|
|
||||||
@Column(name = "\"Language\"", nullable = false)
|
|
||||||
private String language;
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER)
|
|
||||||
@JoinColumn(name = "\"Type\"", nullable = false)
|
|
||||||
private DescriptionTemplateTypeEntity type;
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "descriptionTemplate", fetch = FetchType.LAZY)
|
|
||||||
private Set<UserDatasetProfile> users;
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "datasetprofile")
|
|
||||||
private Set<DMPDatasetProfile> associatedDmps;
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Short getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
public void setStatus(Short status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreated() {
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
public void setCreated(Date created) {
|
|
||||||
this.created = created;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getModified() {
|
|
||||||
return modified;
|
|
||||||
}
|
|
||||||
public void setModified(Date modified) {
|
|
||||||
this.modified = modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(UUID id) { this.id = id;}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefinition() {
|
|
||||||
return definition;
|
|
||||||
}
|
|
||||||
public void setDefinition(String definition) {
|
|
||||||
this.definition = definition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Dataset> getDataset() {
|
|
||||||
return dataset;
|
|
||||||
}
|
|
||||||
public void setDataset(Set<Dataset> dataset) {
|
|
||||||
this.dataset = dataset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getGroupId() { return groupId; }
|
|
||||||
public void setGroupId(UUID groupId) { this.groupId = groupId;}
|
|
||||||
|
|
||||||
public Short getVersion() { return version; }
|
|
||||||
public void setVersion(Short version) { this.version = version; }
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DescriptionTemplateTypeEntity getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
public void setType(DescriptionTemplateTypeEntity type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<UserDatasetProfile> getUsers() {
|
|
||||||
return users;
|
|
||||||
}
|
|
||||||
public void setUsers(Set<UserDatasetProfile> users) {
|
|
||||||
this.users = users;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "DatasetProfileListingModel [id=" + id + ", label=" + label + ", dataset=" + dataset + ", definition=" + definition + ", version=" + version + ", language=" + language + ", type=" + type +"]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(DescriptionTemplate entity) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getKeys() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DescriptionTemplate buildFromTuple(List<Tuple> tuple, List<String> fields, String base) {
|
|
||||||
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.data.old;
|
package eu.eudat.data.old;
|
||||||
|
|
||||||
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
import eu.eudat.data.old.helpers.EntityBinder;
|
import eu.eudat.data.old.helpers.EntityBinder;
|
||||||
import eu.eudat.queryable.queryableentity.DataEntity;
|
import eu.eudat.queryable.queryableentity.DataEntity;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
@ -23,7 +24,7 @@ public class UserDatasetProfile implements DataEntity<UserDatasetProfile, UUID>
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.LAZY)
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "\"descriptionTemplate\"")
|
@JoinColumn(name = "\"descriptionTemplate\"")
|
||||||
private DescriptionTemplate descriptionTemplate;
|
private DescriptionTemplateEntity descriptionTemplate;
|
||||||
|
|
||||||
@Column(name = "role")
|
@Column(name = "role")
|
||||||
private Integer role;
|
private Integer role;
|
||||||
|
@ -44,12 +45,12 @@ public class UserDatasetProfile implements DataEntity<UserDatasetProfile, UUID>
|
||||||
this.user = user;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DescriptionTemplate getDatasetProfile() {
|
public DescriptionTemplateEntity getDatasetProfile() {
|
||||||
return descriptionTemplate;
|
return descriptionTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDatasetProfile(DescriptionTemplate descriptionTemplate) {
|
public void setDatasetProfile(DescriptionTemplateEntity descriptionTemplateEntity) {
|
||||||
this.descriptionTemplate = descriptionTemplate;
|
this.descriptionTemplate = descriptionTemplateEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getRole() {
|
public Integer getRole() {
|
||||||
|
|
|
@ -0,0 +1,155 @@
|
||||||
|
package eu.eudat.model;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.DescriptionTemplateStatus;
|
||||||
|
import eu.eudat.commons.enums.DescriptionTemplateTypeStatus;
|
||||||
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Definition;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DescriptionTemplate {
|
||||||
|
|
||||||
|
public final static String _id = "id";
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
|
public final static String _label = "label";
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
public final static String _description = "description";
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public final static String _groupId = "groupId";
|
||||||
|
private UUID groupId;
|
||||||
|
|
||||||
|
public final static String _version = "version";
|
||||||
|
private Short version;
|
||||||
|
|
||||||
|
public final static String _language = "language";
|
||||||
|
private String language;
|
||||||
|
|
||||||
|
public final static String _type = "type";
|
||||||
|
private DescriptionTemplateType type;
|
||||||
|
|
||||||
|
public final static String _definition = "definition";
|
||||||
|
private Definition definition;
|
||||||
|
|
||||||
|
public final static String _createdAt = "createdAt";
|
||||||
|
private Instant createdAt;
|
||||||
|
|
||||||
|
public final static String _updatedAt = "updatedAt";
|
||||||
|
private Instant updatedAt;
|
||||||
|
|
||||||
|
public final static String _isActive = "isActive";
|
||||||
|
private IsActive isActive;
|
||||||
|
|
||||||
|
public final static String _status = "status";
|
||||||
|
private DescriptionTemplateStatus status;
|
||||||
|
|
||||||
|
public final static String _hash = "hash";
|
||||||
|
private String hash;
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getGroupId() {
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupId(UUID groupId) {
|
||||||
|
this.groupId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(Short version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(DescriptionTemplateType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Definition getDefinition() {
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefinition(Definition definition) {
|
||||||
|
this.definition = definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Instant createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Instant getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Instant updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IsActive getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(IsActive isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(DescriptionTemplateStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHash() {
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHash(String hash) {
|
||||||
|
this.hash = hash;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package eu.eudat.model;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.DescriptionTemplateTypeStatus;
|
import eu.eudat.commons.enums.DescriptionTemplateTypeStatus;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Definition;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -26,6 +27,9 @@ public class DescriptionTemplateType {
|
||||||
public final static String _status = "status";
|
public final static String _status = "status";
|
||||||
private DescriptionTemplateTypeStatus status;
|
private DescriptionTemplateTypeStatus status;
|
||||||
|
|
||||||
|
public final static String _definition = "definition";
|
||||||
|
private Definition definition;
|
||||||
|
|
||||||
public final static String _hash = "hash";
|
public final static String _hash = "hash";
|
||||||
private String hash;
|
private String hash;
|
||||||
|
|
||||||
|
@ -84,4 +88,12 @@ public class DescriptionTemplateType {
|
||||||
public void setHash(String hash) {
|
public void setHash(String hash) {
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Definition getDefinition() {
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefinition(Definition definition) {
|
||||||
|
this.definition = definition;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package eu.eudat.model;
|
||||||
|
|
||||||
import eu.eudat.commons.enums.ReferenceType;
|
import eu.eudat.commons.enums.ReferenceType;
|
||||||
import eu.eudat.commons.enums.IsActive;
|
import eu.eudat.commons.enums.IsActive;
|
||||||
import eu.eudat.commons.enums.SourceType;
|
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||||
import eu.eudat.model.referencedefinition.Definition;
|
import eu.eudat.model.referencedefinition.Definition;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
@ -35,7 +35,7 @@ public class Reference {
|
||||||
private String source;
|
private String source;
|
||||||
public static final String _source = "source";
|
public static final String _source = "source";
|
||||||
|
|
||||||
private SourceType sourceType;
|
private ReferenceSourceType referenceSourceType;
|
||||||
public static final String _sourceType = "sourceType";
|
public static final String _sourceType = "sourceType";
|
||||||
|
|
||||||
private IsActive isActive;
|
private IsActive isActive;
|
||||||
|
@ -117,12 +117,12 @@ public class Reference {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SourceType getSourceType() {
|
public ReferenceSourceType getReferenceSourceType() {
|
||||||
return sourceType;
|
return referenceSourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSourceType(SourceType sourceType) {
|
public void setReferenceSourceType(ReferenceSourceType referenceSourceType) {
|
||||||
this.sourceType = sourceType;
|
this.referenceSourceType = referenceSourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsActive getIsActive() {
|
public IsActive getIsActive() {
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
package eu.eudat.model.builder;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.XmlHandlingService;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.data.DescriptionTemplateEntity;
|
||||||
|
import eu.eudat.model.DescriptionTemplate;
|
||||||
|
import eu.eudat.model.DescriptionTemplateType;
|
||||||
|
import eu.eudat.model.builder.descriptiontemplatedefinition.DefinitionBuilder;
|
||||||
|
import eu.eudat.query.DescriptionTemplateTypeQuery;
|
||||||
|
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.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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 DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate, DescriptionTemplateEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
private final QueryFactory queryFactory;
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private final XmlHandlingService xmlHandlingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DescriptionTemplateBuilder(
|
||||||
|
ConventionService conventionService, QueryFactory queryFactory, BuilderFactory builderFactory, XmlHandlingService xmlHandlingService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DescriptionTemplateBuilder.class)));
|
||||||
|
this.queryFactory = queryFactory;
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
this.xmlHandlingService = xmlHandlingService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DescriptionTemplateBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DescriptionTemplate> build(FieldSet fields, List<DescriptionTemplateEntity> datas) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(datas).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || datas == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
FieldSet descriptionTemplateTypeFields = fields.extractPrefixed(this.asPrefix(DescriptionTemplate._type));
|
||||||
|
Map<UUID, DescriptionTemplateType> descriptionTemplateTypeMap = this.collectDescriptionTemplateTypes(descriptionTemplateTypeFields, datas);
|
||||||
|
|
||||||
|
|
||||||
|
FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(DescriptionTemplate._definition));
|
||||||
|
List<DescriptionTemplate> models = new ArrayList<>();
|
||||||
|
for (DescriptionTemplateEntity d : datas) {
|
||||||
|
DescriptionTemplate m = new DescriptionTemplate();
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._id))) m.setId(d.getId());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._description))) m.setDescription(d.getDescription());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._groupId))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._version))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._language))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._type))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._definition))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._isActive))) m.setIsActive(d.getIsActive());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._status))) m.setStatus(d.getStatus());
|
||||||
|
if (fields.hasField(this.asIndexer(DescriptionTemplate._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
||||||
|
if (!definitionFields.isEmpty() && d.getDefinition() != null){
|
||||||
|
DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, d.getDefinition());
|
||||||
|
m.setDefinition(this.builderFactory.builder(DefinitionBuilder.class).authorize(this.authorize).build(definitionFields, definition));
|
||||||
|
}
|
||||||
|
if (!descriptionTemplateTypeFields.isEmpty() && descriptionTemplateTypeMap != null && descriptionTemplateTypeMap.containsKey(d.getType())) m.setType(descriptionTemplateTypeMap.get(d.getType()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<UUID, DescriptionTemplateType> collectDescriptionTemplateTypes(FieldSet fields, List<DescriptionTemplateEntity> datas) throws MyApplicationException {
|
||||||
|
if (fields.isEmpty() || datas.isEmpty()) return null;
|
||||||
|
this.logger.debug("checking related - {}", DescriptionTemplateType.class.getSimpleName());
|
||||||
|
|
||||||
|
Map<UUID, DescriptionTemplateType> itemMap = null;
|
||||||
|
if (!fields.hasOtherField(this.asIndexer(DescriptionTemplateType._id))) {
|
||||||
|
itemMap = this.asEmpty(
|
||||||
|
datas.stream().map(DescriptionTemplateEntity::getType).distinct().collect(Collectors.toList()),
|
||||||
|
x -> {
|
||||||
|
DescriptionTemplateType item = new DescriptionTemplateType();
|
||||||
|
item.setId(x);
|
||||||
|
return item;
|
||||||
|
},
|
||||||
|
x -> x.getId());
|
||||||
|
} else {
|
||||||
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplateType._id);
|
||||||
|
DescriptionTemplateTypeQuery q = this.queryFactory.query(DescriptionTemplateTypeQuery.class).ids(datas.stream().map(DescriptionTemplateEntity::getType).distinct().collect(Collectors.toList()));
|
||||||
|
itemMap = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).asForeignKey(q, clone, DescriptionTemplateType::getId);
|
||||||
|
}
|
||||||
|
if (!fields.hasField(DescriptionTemplateType._id)) {
|
||||||
|
itemMap.values().stream().filter(x -> x != null).map(x -> {
|
||||||
|
x.setId(null);
|
||||||
|
return x;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemMap;
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,6 +48,7 @@ public class DmpBlueprintBuilder extends BaseBuilder<DmpBlueprint, DmpBlueprintE
|
||||||
this.logger.trace(new DataLogEntry("requested fields", fields));
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
if (fields == null || data == null || fields.isEmpty())
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
|
||||||
FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(DmpBlueprint._definition));
|
FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(DmpBlueprint._definition));
|
||||||
List<DmpBlueprint> models = new ArrayList<>();
|
List<DmpBlueprint> models = new ArrayList<>();
|
||||||
for (DmpBlueprintEntity d : data) {
|
for (DmpBlueprintEntity d : data) {
|
||||||
|
@ -60,7 +61,7 @@ public class DmpBlueprintBuilder extends BaseBuilder<DmpBlueprint, DmpBlueprintE
|
||||||
if (fields.hasField(this.asIndexer(DmpBlueprint._status))) m.setStatus(d.getStatus());
|
if (fields.hasField(this.asIndexer(DmpBlueprint._status))) m.setStatus(d.getStatus());
|
||||||
if (fields.hasField(this.asIndexer(DmpBlueprint._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
if (fields.hasField(this.asIndexer(DmpBlueprint._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
|
||||||
if (!definitionFields.isEmpty() && d.getDefinition() != null){
|
if (!definitionFields.isEmpty() && d.getDefinition() != null){
|
||||||
DefinitionEntity definition = this.xmlHandlingService.xmlSerializableFromXmlSafe(DefinitionEntity.class, d.getDefinition());
|
DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(DefinitionEntity.class, d.getDefinition());
|
||||||
m.setDefinition(this.builderFactory.builder(DefinitionBuilder.class).authorize(this.authorize).build(definitionFields, definition));
|
m.setDefinition(this.builderFactory.builder(DefinitionBuilder.class).authorize(this.authorize).build(definitionFields, definition));
|
||||||
}
|
}
|
||||||
models.add(m);
|
models.add(m);
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity>{
|
||||||
if (fields.hasField(this.asIndexer(Reference._abbreviation))) m.setAbbreviation(d.getAbbreviation());
|
if (fields.hasField(this.asIndexer(Reference._abbreviation))) m.setAbbreviation(d.getAbbreviation());
|
||||||
if (fields.hasField(this.asIndexer(Reference._description))) m.setDescription(d.getDescription());
|
if (fields.hasField(this.asIndexer(Reference._description))) m.setDescription(d.getDescription());
|
||||||
if (fields.hasField(this.asIndexer(Reference._source))) m.setSource(d.getSource());
|
if (fields.hasField(this.asIndexer(Reference._source))) m.setSource(d.getSource());
|
||||||
if (fields.hasField(this.asIndexer(Reference._sourceType))) m.setSourceType(d.getSourceType());
|
if (fields.hasField(this.asIndexer(Reference._sourceType))) m.setReferenceSourceType(d.getReferenceSourceType());
|
||||||
if (fields.hasField(this.asIndexer(Reference._type))) m.setType(d.getType());
|
if (fields.hasField(this.asIndexer(Reference._type))) m.setType(d.getType());
|
||||||
// if (!userInfoFields.isEmpty() && d.getCreatedBy() != null){
|
// if (!userInfoFields.isEmpty() && d.getCreatedBy() != null){
|
||||||
// //ToDo
|
// //ToDo
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.DefinitionEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Definition;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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("descriptiontemplatedefinitionbuilder")
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DefinitionBuilder extends BaseBuilder<Definition, DefinitionEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DefinitionBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DefinitionBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefinitionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Definition> build(FieldSet fields, List<DefinitionEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
//Not Bulk Build because is XML no interaction with db
|
||||||
|
FieldSet sectionsFields = fields.extractPrefixed(this.asPrefix(Definition._sections));
|
||||||
|
FieldSet pagesFields = fields.extractPrefixed(this.asPrefix(Definition._pages));
|
||||||
|
|
||||||
|
List<Definition> models = new ArrayList<>();
|
||||||
|
for (DefinitionEntity d : data) {
|
||||||
|
Definition m = new Definition();
|
||||||
|
if (!sectionsFields.isEmpty() && d.getSections() != null) m.setSections(this.builderFactory.builder(SectionBuilder.class).authorize(this.authorize).build(sectionsFields, d.getSections()));
|
||||||
|
if (!pagesFields.isEmpty() && d.getPages() != null) m.setPages(this.builderFactory.builder(PageBuilder.class).authorize(this.authorize).build(pagesFields, d.getPages()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.FieldEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperService;
|
||||||
|
import eu.eudat.service.fielddatahelper.FieldDataHelperServiceProvider;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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 eu.eudat.model.descriptiontemplatedefinition.Field;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Component("descriptiontemplatedefinitionfieldbuilder")
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class FieldBuilder extends BaseBuilder<Field, FieldEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private final FieldDataHelperServiceProvider fieldDataHelperServiceProvider;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public FieldBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory, FieldDataHelperServiceProvider fieldDataHelperServiceProvider) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(FieldBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
this.fieldDataHelperServiceProvider = fieldDataHelperServiceProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FieldBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Field> build(FieldSet fields, List<FieldEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
//Not Bulk Build because is XML no interaction with db
|
||||||
|
FieldSet visibilityRulesFields = fields.extractPrefixed(this.asPrefix(Field._visibilityRules));
|
||||||
|
FieldSet dataFields = fields.extractPrefixed(this.asPrefix(Field._data));
|
||||||
|
|
||||||
|
List<Field> models = new ArrayList<>();
|
||||||
|
for (FieldEntity d : data) {
|
||||||
|
Field m = new Field();
|
||||||
|
if (fields.hasField(this.asIndexer(Field._id))) m.setId(d.getId());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._ordinal))) m.setOrdinal(d.getOrdinal());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._schematics))) m.setSchematics(d.getSchematics());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._defaultValue))) m.setDefaultValue(d.getDefaultValue());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._fieldType))) m.setFieldType(d.getFieldType());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._includeInExport))) m.setIncludeInExport(d.getIncludeInExport());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._validations))) m.setValidations(d.getValidations());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering());
|
||||||
|
if (fields.hasField(this.asIndexer(Field._numbering))) m.setNumbering(d.getNumbering());
|
||||||
|
if (!visibilityRulesFields.isEmpty() && d.getVisibilityRules() != null) m.setVisibilityRules(this.builderFactory.builder(RuleBuilder.class).authorize(this.authorize).build(visibilityRulesFields, d.getVisibilityRules()));
|
||||||
|
if (!dataFields.isEmpty() && d.getData() != null){
|
||||||
|
FieldDataHelperService fieldDataHelperService = this.fieldDataHelperServiceProvider.get(d.getFieldType());
|
||||||
|
if (fieldDataHelperService.requireSubType()) fieldDataHelperService.setSubType(d.getData().getSubType());
|
||||||
|
m.setData(fieldDataHelperService.buildOne(dataFields, d.getData(), this.authorize));
|
||||||
|
}
|
||||||
|
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.FieldSetEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Field;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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 FieldSetBuilder extends BaseBuilder<eu.eudat.model.descriptiontemplatedefinition.FieldSet, FieldSetEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public FieldSetBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(FieldSetBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FieldSetBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<eu.eudat.model.descriptiontemplatedefinition.FieldSet> build(FieldSet fields, List<FieldSetEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
FieldSet fieldsFields = fields.extractPrefixed(this.asPrefix(eu.eudat.model.descriptiontemplatedefinition.FieldSet._fields));
|
||||||
|
|
||||||
|
List<eu.eudat.model.descriptiontemplatedefinition.FieldSet> models = new ArrayList<>();
|
||||||
|
for (FieldSetEntity d : data) {
|
||||||
|
eu.eudat.model.descriptiontemplatedefinition.FieldSet m = new eu.eudat.model.descriptiontemplatedefinition.FieldSet();
|
||||||
|
if (fields.hasField(this.asIndexer(eu.eudat.model.descriptiontemplatedefinition.FieldSet._id))) m.setId(d.getId());
|
||||||
|
if (fields.hasField(this.asIndexer(eu.eudat.model.descriptiontemplatedefinition.FieldSet._ordinal))) m.setOrdinal(d.getOrdinal());
|
||||||
|
if (fields.hasField(this.asIndexer(eu.eudat.model.descriptiontemplatedefinition.FieldSet._title))) m.setTitle(d.getTitle());
|
||||||
|
if (fields.hasField(this.asIndexer(eu.eudat.model.descriptiontemplatedefinition.FieldSet._numbering))) m.setNumbering(d.getNumbering());
|
||||||
|
if (fields.hasField(this.asIndexer(eu.eudat.model.descriptiontemplatedefinition.FieldSet._description))) m.setDescription(d.getDescription());
|
||||||
|
if (fields.hasField(this.asIndexer(eu.eudat.model.descriptiontemplatedefinition.FieldSet._extendedDescription))) m.setExtendedDescription(d.getExtendedDescription());
|
||||||
|
if (fields.hasField(this.asIndexer(eu.eudat.model.descriptiontemplatedefinition.FieldSet._additionalInformation))) m.setAdditionalInformation(d.getAdditionalInformation());
|
||||||
|
if (fields.hasField(this.asIndexer(eu.eudat.model.descriptiontemplatedefinition.FieldSet._hasCommentField))) m.setHasCommentField(d.getHasCommentField());
|
||||||
|
if (!fieldsFields.isEmpty() && d.getFields() != null) m.setFields(this.builderFactory.builder(FieldBuilder.class).authorize(this.authorize).build(fieldsFields, d.getFields()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.PageEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Page;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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 PageBuilder extends BaseBuilder<Page, PageEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public PageBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(PageBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public PageBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Page> build(FieldSet fields, List<PageEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<Page> models = new ArrayList<>();
|
||||||
|
for (PageEntity d : data) {
|
||||||
|
Page m = new Page();
|
||||||
|
if (fields.hasField(this.asIndexer(Page._id))) m.setId(d.getId());
|
||||||
|
if (fields.hasField(this.asIndexer(Page._ordinal))) m.setOrdinal(d.getOrdinal());
|
||||||
|
if (fields.hasField(this.asIndexer(Page._title))) m.setTitle(d.getTitle());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.RuleEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Rule;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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 RuleBuilder extends BaseBuilder<Rule, RuleEntity> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RuleBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(RuleBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RuleBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Rule> build(FieldSet fields, List<RuleEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<Rule> models = new ArrayList<>();
|
||||||
|
for (RuleEntity d : data) {
|
||||||
|
Rule m = new Rule();
|
||||||
|
if (fields.hasField(this.asIndexer(Rule._target))) m.setTarget(d.getTarget());
|
||||||
|
if (fields.hasField(this.asIndexer(Rule._value))) m.setValue(d.getValue());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.SectionEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.Section;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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("descriptiontemplatedefinitionsectionbuilder")
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class SectionBuilder extends BaseBuilder<Section, SectionEntity> {
|
||||||
|
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SectionBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(SectionBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SectionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Section> build(FieldSet fields, List<SectionEntity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
//Not Bulk Build because is XML no interaction with db
|
||||||
|
FieldSet fieldSetsFields = fields.extractPrefixed(this.asPrefix(Section._fieldSets));
|
||||||
|
|
||||||
|
List<Section> models = new ArrayList<>();
|
||||||
|
for (SectionEntity d : data) {
|
||||||
|
Section m = new Section();
|
||||||
|
if (fields.hasField(this.asIndexer(Section._id))) m.setId(d.getId());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._description))) m.setDescription(d.getDescription());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._ordinal))) m.setOrdinal(d.getOrdinal());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._defaultVisibility))) m.setDefaultVisibility(d.isDefaultVisibility());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._multiplicity))) m.setMultiplicity(d.getMultiplicity());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._numbering))) m.setNumbering(d.getNumbering());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._page))) m.setPage(d.getPage());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._title))) m.setTitle(d.getTitle());
|
||||||
|
if (fields.hasField(this.asIndexer(Section._extendedDescription))) m.setExtendedDescription(d.getExtendedDescription());
|
||||||
|
if (d.getSections() != null) m.setSections(this.builderFactory.builder(SectionBuilder.class).authorize(this.authorize).build(fields, d.getSections()));
|
||||||
|
if (!fieldSetsFields.isEmpty() && d.getFieldSets() != null) m.setFieldSets(this.builderFactory.builder(FieldSetBuilder.class).authorize(this.authorize).build(fieldSetsFields, d.getFieldSets()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AuthAutoCompleteData;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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 AuthAutoCompleteDataBuilder extends BaseBuilder<AuthAutoCompleteData, AutoCompleteDataEntity.AuthAutoCompleteData> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public AuthAutoCompleteDataBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(AuthAutoCompleteDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthAutoCompleteDataBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AuthAutoCompleteData> build(FieldSet fields, List<AutoCompleteDataEntity.AuthAutoCompleteData> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<AuthAutoCompleteData> models = new ArrayList<>();
|
||||||
|
for (AutoCompleteDataEntity.AuthAutoCompleteData d : data) {
|
||||||
|
AuthAutoCompleteData m = new AuthAutoCompleteData();
|
||||||
|
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._url))) m.setUrl(d.getUrl());
|
||||||
|
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._method))) m.setMethod(d.getMethod());
|
||||||
|
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._body))) m.setBody(d.getBody());
|
||||||
|
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._path))) m.setPath(d.getPath());
|
||||||
|
if (fields.hasField(this.asIndexer(AuthAutoCompleteData._type))) m.setType(d.getType());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteData;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class AutoCompleteDataBuilder extends ComboBoxDataBuilder<AutoCompleteData, AutoCompleteDataEntity> {
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
@Autowired
|
||||||
|
public AutoCompleteDataBuilder(ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(AutoCompleteDataBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AutoCompleteData getInstance() {
|
||||||
|
return new AutoCompleteData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildComboBoxChild(FieldSet fields, AutoCompleteDataEntity d, AutoCompleteData m) {
|
||||||
|
FieldSet autoCompleteSingleDataListFields = fields.extractPrefixed(this.asPrefix(AutoCompleteData._autoCompleteSingleDataList));
|
||||||
|
if (fields.hasField(this.asIndexer(AutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
|
||||||
|
if (!autoCompleteSingleDataListFields.isEmpty() && d.getAutoCompleteSingleDataList() != null) m.setAutoCompleteSingleDataList(this.builderFactory.builder(AutoCompleteSingleDataBuilder.class).authorize(this.authorize).build(autoCompleteSingleDataListFields, d.getAutoCompleteSingleDataList()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.AutoCompleteDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.AutoCompleteSingleData;
|
||||||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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 AutoCompleteSingleDataBuilder extends BaseBuilder<AutoCompleteSingleData, AutoCompleteDataEntity.AutoCompleteSingleData> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
private final BuilderFactory builderFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public AutoCompleteSingleDataBuilder(
|
||||||
|
ConventionService conventionService, BuilderFactory builderFactory) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(AutoCompleteSingleDataBuilder.class)));
|
||||||
|
this.builderFactory = builderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AutoCompleteSingleDataBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AutoCompleteSingleData> build(FieldSet fields, List<AutoCompleteDataEntity.AutoCompleteSingleData> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
FieldSet autoCompleteOptionsFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._autoCompleteOptions));
|
||||||
|
FieldSet authFields = fields.extractPrefixed(this.asPrefix(AutoCompleteSingleData._auth));
|
||||||
|
List<AutoCompleteSingleData> models = new ArrayList<>();
|
||||||
|
for (AutoCompleteDataEntity.AutoCompleteSingleData d : data) {
|
||||||
|
AutoCompleteSingleData m = new AutoCompleteSingleData();
|
||||||
|
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._autocompleteType))) m.setAutocompleteType(d.getAutocompleteType());
|
||||||
|
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._url))) m.setUrl(d.getUrl());
|
||||||
|
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._optionsRoot))) m.setOptionsRoot(d.getOptionsRoot());
|
||||||
|
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._hasAuth))) m.setHasAuth(d.getHasAuth());
|
||||||
|
if (fields.hasField(this.asIndexer(AutoCompleteSingleData._method))) m.setMethod(d.getMethod());
|
||||||
|
if (!autoCompleteOptionsFields.isEmpty() && d.getAutoCompleteOptions() != null) m.setAutoCompleteOptions(this.builderFactory.builder(ComboBoxOptionBuilder.class).authorize(this.authorize).build(autoCompleteOptionsFields, d.getAutoCompleteOptions()));
|
||||||
|
if (!authFields.isEmpty() && d.getAuth() != null) m.setAuth(this.builderFactory.builder(AuthAutoCompleteDataBuilder.class).authorize(this.authorize).build(authFields, d.getAuth()));
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
public abstract class BaseFieldDataBuilder<Model extends BaseFieldData, Entity extends BaseFieldDataEntity<?>> extends BaseBuilder<Model, Entity> {
|
||||||
|
|
||||||
|
protected EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public BaseFieldDataBuilder(
|
||||||
|
ConventionService conventionService,
|
||||||
|
LoggerService logger) {
|
||||||
|
super(conventionService, logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseFieldDataBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract Model getInstance();
|
||||||
|
|
||||||
|
protected abstract void buildChild(FieldSet fields, Entity d, Model m);
|
||||||
|
@Override
|
||||||
|
public List<Model> build(FieldSet fields, List<Entity> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<Model> models = new ArrayList<>();
|
||||||
|
for (Entity d : data) {
|
||||||
|
Model m = this.getInstance();
|
||||||
|
if (fields.hasField(this.asIndexer(Model._label))) m.setLabel(d.getLabel());
|
||||||
|
this.buildChild(fields, d, m);
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.BooleanDecisionDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BooleanDecisionData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class BooleanDecisionDataBuilder extends BaseFieldDataBuilder<BooleanDecisionData, BooleanDecisionDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public BooleanDecisionDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(BooleanDecisionDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BooleanDecisionData getInstance() {
|
||||||
|
return new BooleanDecisionData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, BooleanDecisionDataEntity d, BooleanDecisionData model) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.CheckBoxDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.CheckBoxData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class CheckBoxDataBuilder extends BaseFieldDataBuilder<CheckBoxData, CheckBoxDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public CheckBoxDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(CheckBoxDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CheckBoxData getInstance() {
|
||||||
|
return new CheckBoxData();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, CheckBoxDataEntity d, CheckBoxData m) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.LoggerService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
public abstract class ComboBoxDataBuilder<M extends ComboBoxData, D extends ComboBoxDataEntity<?>> extends BaseFieldDataBuilder<M, D> {
|
||||||
|
|
||||||
|
protected abstract void buildComboBoxChild(FieldSet fields, D d, M m);
|
||||||
|
@Autowired
|
||||||
|
public ComboBoxDataBuilder(ConventionService conventionService, LoggerService logger) {
|
||||||
|
super(conventionService, logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void buildChild(FieldSet fields, D d, M m) {
|
||||||
|
if (fields.hasField(this.asIndexer(ComboBoxData._type))) m.setType(d.getType());
|
||||||
|
this.buildComboBoxChild(fields, d, m);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.ComboBoxDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.builder.BaseBuilder;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
|
||||||
|
import gr.cite.tools.exception.MyApplicationException;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
import gr.cite.tools.logging.DataLogEntry;
|
||||||
|
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 ComboBoxOptionBuilder extends BaseBuilder<ComboBoxOption, ComboBoxDataEntity.Option> {
|
||||||
|
|
||||||
|
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ComboBoxOptionBuilder(
|
||||||
|
ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(ComboBoxOptionBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComboBoxOptionBuilder authorize(EnumSet<AuthorizationFlags> values) {
|
||||||
|
this.authorize = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ComboBoxOption> build(FieldSet fields, List<ComboBoxDataEntity.Option> data) throws MyApplicationException {
|
||||||
|
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||||
|
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||||
|
if (fields == null || data == null || fields.isEmpty())
|
||||||
|
return new ArrayList<>();
|
||||||
|
|
||||||
|
List<ComboBoxOption> models = new ArrayList<>();
|
||||||
|
for (ComboBoxDataEntity.Option d : data) {
|
||||||
|
ComboBoxOption m = new ComboBoxOption();
|
||||||
|
if (fields.hasField(this.asIndexer(ComboBoxOption._label))) m.setLabel(d.getLabel());
|
||||||
|
if (fields.hasField(this.asIndexer(ComboBoxOption._source))) m.setSource(d.getSource());
|
||||||
|
if (fields.hasField(this.asIndexer(ComboBoxOption._uri))) m.setUri(d.getUri());
|
||||||
|
if (fields.hasField(this.asIndexer(ComboBoxOption._value))) m.setValue(d.getValue());
|
||||||
|
models.add(m);
|
||||||
|
}
|
||||||
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
return models;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.CurrencyDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.CurrencyData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class CurrencyDataBuilder extends BaseFieldDataBuilder<CurrencyData, CurrencyDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public CurrencyDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(CurrencyDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CurrencyData getInstance() {
|
||||||
|
return new CurrencyData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, CurrencyDataEntity d, CurrencyData m) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.DataRepositoryDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DataRepositoryData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DataRepositoryDataBuilder extends BaseFieldDataBuilder<DataRepositoryData, DataRepositoryDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DataRepositoryDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DataRepositoryDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DataRepositoryData getInstance() {
|
||||||
|
return new DataRepositoryData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, DataRepositoryDataEntity d, DataRepositoryData m) {
|
||||||
|
if (fields.hasField(this.asIndexer(DataRepositoryData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.DatasetAutoCompleteDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatasetAutoCompleteData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DatasetAutoCompleteDataBuilder extends InternalDmpBaseDataBuilder<DatasetAutoCompleteData, DatasetAutoCompleteDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DatasetAutoCompleteDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DatasetAutoCompleteDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DatasetAutoCompleteData getInstance() {
|
||||||
|
return new DatasetAutoCompleteData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildInternalDmpChild(FieldSet fields, DatasetAutoCompleteDataEntity m, DatasetAutoCompleteData d) {
|
||||||
|
if (fields.hasField(this.asIndexer(DatasetAutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.DatasetIdentifierDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatasetIdentifierData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DatasetIdentifierDataBuilder extends BaseFieldDataBuilder<DatasetIdentifierData, DatasetIdentifierDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DatasetIdentifierDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DatasetIdentifierDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DatasetIdentifierData getInstance() {
|
||||||
|
return new DatasetIdentifierData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, DatasetIdentifierDataEntity d, DatasetIdentifierData m) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.DatePickerDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DatePickerData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DatePickerDataBuilder extends BaseFieldDataBuilder<DatePickerData, DatePickerDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DatePickerDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DatePickerDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DatePickerData getInstance() {
|
||||||
|
return new DatePickerData();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, DatePickerDataEntity d, DatePickerData m) {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.DmpAutoCompleteDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.DmpAutoCompleteData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class DmpAutoCompleteDataBuilder extends InternalDmpBaseDataBuilder<DmpAutoCompleteData, DmpAutoCompleteDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DmpAutoCompleteDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(DmpAutoCompleteDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DmpAutoCompleteData getInstance() {
|
||||||
|
return new DmpAutoCompleteData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildInternalDmpChild(FieldSet fields, DmpAutoCompleteDataEntity m, DmpAutoCompleteData d) {
|
||||||
|
if (fields.hasField(this.asIndexer(DmpAutoCompleteData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.ExternalDatasetDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ComboBoxOption;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.ExternalDatasetData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class ExternalDatasetDataBuilder extends BaseFieldDataBuilder<ExternalDatasetData, ExternalDatasetDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ExternalDatasetDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(ExternalDatasetDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ExternalDatasetData getInstance() {
|
||||||
|
return new ExternalDatasetData();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, ExternalDatasetDataEntity d, ExternalDatasetData m) {
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalDatasetData._multiAutoComplete))) m.setMultiAutoComplete(d.getMultiAutoComplete());
|
||||||
|
if (fields.hasField(this.asIndexer(ExternalDatasetData._type))) m.setType(d.getType());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package eu.eudat.model.builder.descriptiontemplatedefinition.fielddata;
|
||||||
|
|
||||||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.FreeTextDataEntity;
|
||||||
|
import eu.eudat.convention.ConventionService;
|
||||||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.FreeTextData;
|
||||||
|
import gr.cite.tools.fieldset.FieldSet;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class FreeTextDataBuilder extends BaseFieldDataBuilder<FreeTextData, FreeTextDataEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public FreeTextDataBuilder(ConventionService conventionService) {
|
||||||
|
super(conventionService, new LoggerService(LoggerFactory.getLogger(FreeTextDataBuilder.class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected FreeTextData getInstance() {
|
||||||
|
return new FreeTextData();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void buildChild(FieldSet fields, FreeTextDataEntity d, FreeTextData m) {
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue