Implemented Fixed Dataset Description Field Numbering
This commit is contained in:
parent
8955172fec
commit
ed46666a4f
|
@ -0,0 +1,38 @@
|
|||
package eu.eudat.document;
|
||||
|
||||
import org.apache.poi.ooxml.POIXMLDocument;
|
||||
import org.apache.poi.ooxml.POIXMLDocumentPart;
|
||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.apache.xmlbeans.XmlCursor;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 10/17/2018.
|
||||
*/
|
||||
public class DocxDocumentBuilderAdapter extends XWPFDocument {
|
||||
|
||||
public DocxDocumentBuilderAdapter(OPCPackage pkg) throws IOException {
|
||||
super(pkg);
|
||||
}
|
||||
|
||||
public DocxDocumentBuilderAdapter(InputStream is) throws IOException {
|
||||
super(is);
|
||||
}
|
||||
|
||||
public DocxDocumentBuilderAdapter() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createTOC() {
|
||||
super.createTOC();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,141 @@
|
|||
package eu.eudat.logic.managers;
|
||||
|
||||
import eu.eudat.data.dao.entities.DatasetDao;
|
||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||
import eu.eudat.logic.utilities.documents.helpers.FileEnvelope;
|
||||
import eu.eudat.logic.utilities.documents.word.WordBuilder;
|
||||
import eu.eudat.logic.utilities.documents.xml.ExportXmlBuilder;
|
||||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
/**
|
||||
* Created by ikalyvas on 10/16/2018.
|
||||
*/
|
||||
public class DocumentManager {
|
||||
public File getWordDocument(Environment environment, DatasetDao datatasetRepository, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException {
|
||||
WordBuilder wordBuilder = new WordBuilder();
|
||||
DatasetWizardModel dataset = new DatasetWizardModel();
|
||||
String fileUrl = environment.getProperty("configuration.h2020template");
|
||||
InputStream is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream();
|
||||
XWPFDocument document = new XWPFDocument(is);
|
||||
eu.eudat.data.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
if (datasetEntity.getProperties() != null) {
|
||||
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
|
||||
properties = jobject.toMap();
|
||||
}
|
||||
PagedDatasetProfile pagedDatasetProfile = new DatasetManager().getPagedProfile(dataset, datasetEntity);
|
||||
visibilityRuleService.setProperties(properties);
|
||||
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
|
||||
wordBuilder.build(document, pagedDatasetProfile, visibilityRuleService);
|
||||
File exportFile = new File(dataset.getLabel() + ".docx");
|
||||
FileOutputStream out = new FileOutputStream(exportFile);
|
||||
document.write(out);
|
||||
out.close();
|
||||
return exportFile;
|
||||
}
|
||||
|
||||
public FileEnvelope getXmlDocument(eu.eudat.data.entities.Dataset datasetEntity, String id, VisibilityRuleService visibilityRuleService) throws InstantiationException, IllegalAccessException, IOException {
|
||||
ExportXmlBuilder xmlBuilder = new ExportXmlBuilder();
|
||||
DatasetWizardModel dataset = new DatasetWizardModel();
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
if (datasetEntity.getProperties() != null) {
|
||||
JSONObject jobject = new JSONObject(datasetEntity.getProperties());
|
||||
properties = jobject.toMap();
|
||||
}
|
||||
PagedDatasetProfile pagedDatasetProfile = new DatasetManager().getPagedProfile(dataset, datasetEntity);
|
||||
visibilityRuleService.setProperties(properties);
|
||||
visibilityRuleService.buildVisibilityContext(pagedDatasetProfile.getRules());
|
||||
File file = xmlBuilder.build(pagedDatasetProfile, visibilityRuleService);
|
||||
FileEnvelope fileEnvelope = new FileEnvelope();
|
||||
fileEnvelope.setFile(file);
|
||||
fileEnvelope.setFilename(datasetEntity.getLabel());
|
||||
return fileEnvelope;
|
||||
}
|
||||
|
||||
public File convertToPDF(File file, Environment environment, String label) throws IOException, InterruptedException {
|
||||
LinkedMultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
|
||||
map.add("file", new FileSystemResource(file));
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
|
||||
headers.add("Content-disposition", "attachment; filename=" + label + ".docx");
|
||||
|
||||
headers.add("Content-type", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
|
||||
HttpEntity<LinkedMultiValueMap<String, Object>> requestEntity = new HttpEntity<LinkedMultiValueMap<String, Object>>(
|
||||
map, headers);
|
||||
|
||||
Map queueResult = new RestTemplate().postForObject(
|
||||
environment.getProperty("pdf.converter.url") +
|
||||
"api/v1/", requestEntity, Map.class);
|
||||
|
||||
Map mediaResult = new RestTemplate().getForObject(environment.getProperty("pdf.converter.url") +
|
||||
"/api/v1/" + queueResult.get("id"), Map.class);
|
||||
System.out.println("Status: " + mediaResult.get("status"));
|
||||
while (!mediaResult.get("status").equals("finished")) {
|
||||
Thread.sleep(500);
|
||||
mediaResult = new RestTemplate().getForObject(environment.getProperty("pdf.converter.url") +
|
||||
"api/v1/" + queueResult.get("id"), Map.class);
|
||||
System.out.println("Polling");
|
||||
}
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
restTemplate.getMessageConverters().add(new ByteArrayHttpMessageConverter());
|
||||
HttpHeaders headers2 = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.APPLICATION_OCTET_STREAM));
|
||||
HttpEntity<String> entity = new HttpEntity<String>(headers2);
|
||||
|
||||
ResponseEntity<byte[]> response = restTemplate.exchange(environment.getProperty("pdf.converter.url") +
|
||||
mediaResult.get("result_url"), HttpMethod.GET, entity, byte[].class, "1");
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
File zip = new File(uuid + ".zip");
|
||||
if (response.getStatusCode().equals(HttpStatus.OK)) {
|
||||
FileOutputStream output = new FileOutputStream(zip);
|
||||
IOUtils.write(response.getBody(), output);
|
||||
}
|
||||
return extractFromZip(zip, label + ".pdf");
|
||||
}
|
||||
|
||||
private File extractFromZip(File file, String filename) throws IOException {
|
||||
byte[] buffer = new byte[1024];
|
||||
File newFile = new File(filename);
|
||||
ZipInputStream zis = new ZipInputStream(new FileInputStream(file));
|
||||
ZipEntry zipEntry = zis.getNextEntry();
|
||||
while (zipEntry != null) {
|
||||
String zippedFileName = zipEntry.getName();
|
||||
if (zippedFileName.equals("pdf")) {
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(newFile);
|
||||
int len;
|
||||
while ((len = zis.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len);
|
||||
}
|
||||
fos.close();
|
||||
zipEntry = zis.getNextEntry();
|
||||
}
|
||||
}
|
||||
zis.closeEntry();
|
||||
zis.close();
|
||||
return newFile;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import eu.eudat.logic.builders.model.models.DataTableDataBuilder;
|
|||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.operations.AuthenticationServiceImpl;
|
||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
||||
import eu.eudat.models.HintedModelFactory;
|
||||
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||
import eu.eudat.models.data.login.Credentials;
|
||||
|
@ -41,7 +42,7 @@ public class UserManager {
|
|||
}
|
||||
|
||||
public static DataTableData<UserListingModel> getPaged(ApiContext apiContext, UserInfoTableRequestItem userInfoTableRequestItem) throws Exception {
|
||||
QueryableList<eu.eudat.data.entities.UserInfo> users = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().getWithCriteria(userInfoTableRequestItem.getCriteria());
|
||||
QueryableList<eu.eudat.data.entities.UserInfo> users = apiContext.getOperationsContext().getDatabaseRepository().getUserInfoDao().getWithCriteria(userInfoTableRequestItem.getCriteria()).withHint(HintedModelFactory.getHint(UserListingModel.class));
|
||||
QueryableList<eu.eudat.data.entities.UserInfo> pagedUsers = PaginationManager.applyPaging(users, userInfoTableRequestItem);
|
||||
|
||||
List<UserListingModel> modelUsers = pagedUsers.select(item -> new UserListingModel().fromDataModel(item));
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
|||
public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field> {
|
||||
private String id;
|
||||
private int ordinal;
|
||||
private String numbering;
|
||||
private ViewStyle viewStyle;
|
||||
private DefaultValue defaultValue;
|
||||
private Visibility visible;
|
||||
|
@ -80,6 +81,14 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
|||
this.validations = validations;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("field");
|
||||
|
@ -103,6 +112,10 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
|||
validations.appendChild(validation);
|
||||
}
|
||||
|
||||
Element numbering = doc.createElement("numbering");
|
||||
numbering.setTextContent(this.numbering);
|
||||
|
||||
rootElement.appendChild(numbering);
|
||||
rootElement.appendChild(validations);
|
||||
rootElement.appendChild(defaultValue);
|
||||
rootElement.appendChild(visibility);
|
||||
|
@ -116,6 +129,7 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
|||
this.id = element.getAttribute("id");
|
||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||
|
||||
|
||||
this.viewStyle = new ViewStyle();
|
||||
Element viewStyle = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "viewStyle");
|
||||
|
||||
|
@ -126,6 +140,9 @@ public class Field implements DatabaseViewStyleDefinition, XmlSerializable<Field
|
|||
|
||||
this.visible = new Visibility().fromXml(visibility);
|
||||
|
||||
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
||||
if (numbering != null) this.numbering = numbering.getTextContent();
|
||||
|
||||
Element dataElement = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "data");
|
||||
|
||||
Element defaultValue = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "defaultValue");
|
||||
|
|
|
@ -15,6 +15,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
|||
private String id;
|
||||
private int ordinal;
|
||||
private List<Field> fields;
|
||||
private String numbering;
|
||||
private String title;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
|
@ -94,6 +95,14 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
|||
this.commentFieldValue = commentFieldValue;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element fieldSet = doc.createElement("fieldSet");
|
||||
|
@ -116,11 +125,16 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
|||
commentField.setAttribute("hasCommentField", "" + this.hasCommentField);
|
||||
commentField.setAttribute("commentFieldValue", this.commentFieldValue);
|
||||
|
||||
Element numbering = doc.createElement("numbering");
|
||||
numbering.setTextContent(this.numbering);
|
||||
|
||||
Element fieldsElement = doc.createElement("fields");
|
||||
for (Field field : fields) {
|
||||
field.setNumbering(this.numbering + "." + (this.fields.indexOf(field) + 1));
|
||||
fieldsElement.appendChild(field.toXml(doc));
|
||||
}
|
||||
|
||||
fieldSet.appendChild(numbering);
|
||||
fieldSet.appendChild(commentField);
|
||||
fieldSet.appendChild(fieldsElement);
|
||||
fieldSet.appendChild(multiplicity);
|
||||
|
@ -146,6 +160,9 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
|
|||
this.commentFieldValue = commentField.getAttribute("commentFieldValue");
|
||||
Element fields = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
|
||||
|
||||
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
||||
if (numbering != null) this.numbering = numbering.getTextContent();
|
||||
|
||||
if (fields != null) {
|
||||
NodeList fieldElements = fields.getChildNodes();
|
||||
for (int temp = 0; temp < fieldElements.getLength(); temp++) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
||||
|
||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -14,6 +14,7 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
|||
private String id;
|
||||
private int ordinal;
|
||||
private boolean defaultVisibility;
|
||||
private String numbering;
|
||||
private String page;
|
||||
private String title;
|
||||
private String description;
|
||||
|
@ -93,6 +94,14 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
|||
this.extendedDescription = extendedDescription;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element toXml(Document doc) {
|
||||
Element rootElement = doc.createElement("section");
|
||||
|
@ -107,12 +116,16 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
|||
Element extendedDescription = doc.createElement("extendedDescription");
|
||||
extendedDescription.setTextContent(this.extendedDescription);
|
||||
|
||||
Element numbering = doc.createElement("numbering");
|
||||
numbering.setTextContent(this.numbering);
|
||||
|
||||
Element title = doc.createElement("title");
|
||||
title.setTextContent(this.title);
|
||||
|
||||
if (sections != null) {
|
||||
Element sections = doc.createElement("sections");
|
||||
for (Section section : this.sections) {
|
||||
section.setNumbering(this.numbering + "." + (this.sections.indexOf(section) + 1));
|
||||
sections.appendChild(section.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(sections);
|
||||
|
@ -121,11 +134,13 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
|||
if (this.fieldSets != null) {
|
||||
Element formGroups = doc.createElement("fieldSets");
|
||||
for (FieldSet fieldSet : this.fieldSets) {
|
||||
fieldSet.setNumbering(this.numbering + "." + (this.fieldSets.indexOf(fieldSet) + 1));
|
||||
formGroups.appendChild(fieldSet.toXml(doc));
|
||||
}
|
||||
rootElement.appendChild(formGroups);
|
||||
}
|
||||
|
||||
rootElement.appendChild(numbering);
|
||||
rootElement.appendChild(title);
|
||||
rootElement.appendChild(extendedDescription);
|
||||
rootElement.appendChild(description);
|
||||
|
@ -147,6 +162,9 @@ public class Section implements DatabaseViewStyleDefinition, XmlSerializable<Sec
|
|||
Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription");
|
||||
if (extendedDescription != null) this.extendedDescription = extendedDescription.getTextContent();
|
||||
|
||||
Element numbering = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "numbering");
|
||||
if (numbering != null) this.numbering = numbering.getTextContent();
|
||||
|
||||
Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
|
||||
if (title != null) this.title = title.getTextContent();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition;
|
||||
|
||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
||||
import eu.eudat.logic.utilities.builders.XmlBuilder;
|
||||
import eu.eudat.logic.utilities.interfaces.XmlSerializable;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -36,6 +36,7 @@ public class ViewStyleModel implements XmlSerializable<ViewStyleModel> {
|
|||
Element sections = doc.createElement("sections");
|
||||
Element pages = doc.createElement("pages");
|
||||
for (Section section : this.sections) {
|
||||
section.setNumbering("" + (this.sections.indexOf(section) + 1));
|
||||
sections.appendChild(section.toXml(doc));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|||
private String value;
|
||||
private ViewStyle viewStyle;
|
||||
private String datatype;
|
||||
private String numbering;
|
||||
private int page;
|
||||
private DefaultValue defaultValue;
|
||||
private Multiplicity multiplicity;
|
||||
|
@ -128,6 +129,13 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|||
this.validations = eu.eudat.models.data.admin.components.datasetprofile.Field.ValidationType.fromIntegers(validations);
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public Field cloneForMultiplicity(String key, Map<String, Object> properties) {
|
||||
Field newField = new Field();
|
||||
|
@ -160,6 +168,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
|||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
this.viewStyle = item.getViewStyle();
|
||||
this.numbering = item.getNumbering();
|
||||
this.data = item.getData();
|
||||
this.defaultValue = item.getDefaultValue();
|
||||
this.visible = item.getVisible();
|
||||
|
|
|
@ -13,6 +13,7 @@ public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDe
|
|||
private String id;
|
||||
private Integer ordinal;
|
||||
private String title;
|
||||
private String numbering;
|
||||
private String description;
|
||||
private String extendedDescription;
|
||||
private Multiplicity multiplicity;
|
||||
|
@ -83,6 +84,14 @@ public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDe
|
|||
return multiplicityItems;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
public void setMultiplicityItems(List<FieldSet> multiplicityItems) {
|
||||
this.multiplicityItems = multiplicityItems;
|
||||
}
|
||||
|
@ -126,6 +135,7 @@ public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDe
|
|||
this.ordinal = item.getOrdinal();
|
||||
this.title = item.getTitle();
|
||||
this.description = item.getDescription();
|
||||
this.numbering = item.getNumbering();
|
||||
this.extendedDescription = item.getExtendedDescription();
|
||||
this.hasCommentField = item.getHasCommentField();
|
||||
this.multiplicity = item.getMultiplicity();
|
||||
|
|
|
@ -13,6 +13,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
|||
private List<Section> sections;
|
||||
private List<FieldSet> compositeFields;
|
||||
private Boolean defaultVisibility;
|
||||
private String numbering;
|
||||
private String page;
|
||||
private Integer ordinal;
|
||||
private String id;
|
||||
|
@ -85,6 +86,14 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
|||
this.ordinal = ordinal;
|
||||
}
|
||||
|
||||
public String getNumbering() {
|
||||
return numbering;
|
||||
}
|
||||
|
||||
public void setNumbering(String numbering) {
|
||||
this.numbering = numbering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Section item) {
|
||||
item.setDefaultVisibility(this.defaultVisibility);
|
||||
|
@ -107,6 +116,7 @@ public class Section implements Comparable, ViewStyleDefinition<eu.eudat.models.
|
|||
this.compositeFields = new ModelBuilder().fromViewStyleDefinition(item.getFieldSets(), FieldSet.class);
|
||||
this.id = item.getId();
|
||||
this.ordinal = item.getOrdinal();
|
||||
this.numbering = item.getNumbering();
|
||||
this.page = item.getPage();
|
||||
this.sections = new ModelBuilder().fromViewStyleDefinition(item.getSections(), Section.class);
|
||||
this.title = item.getTitle();
|
||||
|
|
|
@ -122,6 +122,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
|
|||
|
||||
@Override
|
||||
public String getHint() {
|
||||
return null;
|
||||
return "userInfo";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public abstract class FluentValidator<T> implements Validator {
|
|||
@Override
|
||||
public void validate(Object target, Errors errors) {
|
||||
List<FluentValidatorResult> validatorResults = new LinkedList<>();
|
||||
this.fluentValidatorBuilders.forEach(x-> validatorResults.addAll(x.validate(target)));
|
||||
validatorResults.forEach(x-> errors.rejectValue(x.getField(),x.getError()));
|
||||
//this.fluentValidatorBuilders.forEach(x-> validatorResults.addAll(x.validate(target)));
|
||||
//validatorResults.forEach(x-> errors.rejectValue(x.getField(),x.getError()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="container" [formGroup]='form'>
|
||||
<mat-form-field class="full-width">
|
||||
<input matInput formControlName="label" placeholder="{{'FORM.LABEL' | translate}}" required>
|
||||
<input matInput formControlName="label" placeholder="{{'DYNAMIC-FORM.FIELDS.LABEL' | translate}}" required>
|
||||
<mat-error *ngIf="form.get('label').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-horizontal-stepper [linear]="true" #stepper>
|
||||
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
||||
<button mat-button (click)="addPage()" style="cursor: pointer">
|
||||
Add Page +
|
||||
{{'DYNAMIC-FORM.ACTIONS.ADD-PAGE' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</mat-step>
|
||||
|
@ -50,11 +50,11 @@
|
|||
</div>
|
||||
<div style="margin-top:20px; padding-left: 15px;" class="row">
|
||||
<button mat-button (click)="addSection()" style="cursor: pointer">
|
||||
Add Section +
|
||||
{{'DYNAMIC-FORM.ACTIONS.ADD-SECTION' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</mat-step>
|
||||
</mat-horizontal-stepper>
|
||||
<button mat-button (click)="preview()">Preview</button>
|
||||
<button mat-raised-button color="primary" type="button" (click)='onSubmit()' [disabled]="form.valid">Save</button>
|
||||
<button mat-button (click)="preview()">{{'DYNAMIC-FORM.ACTIONS.PREVIEW' | translate}}</button>
|
||||
<button mat-raised-button color="primary" type="button" (click)='onSubmit()' [disabled]="!form.valid">Save</button>
|
||||
</div>
|
||||
|
|
|
@ -97,11 +97,11 @@ export class FormComponent implements OnInit {
|
|||
|
||||
if (this.profileID) {
|
||||
this.updateForm(this.profileID, data).subscribe(() => {
|
||||
this.router.navigate(['/datasetsProfiles']);
|
||||
this.router.navigate(['/dataset-profile']);
|
||||
});
|
||||
} else {
|
||||
this.createForm(data).subscribe(() => {
|
||||
this.router.navigate(['/datasetsProfiles']);
|
||||
this.router.navigate(['/dataset-profile']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div *ngIf="form" [id]="compositeField.id" [formGroup]="form">
|
||||
|
||||
<div *ngIf="compositeField.fields.length == 1" class="fieldset-component">
|
||||
<h5 *ngIf="compositeField.title" style="font-weight:bold; color: #3a3737;">{{compositeField.title}}</h5>
|
||||
<h5 *ngIf="compositeField.title" style="font-weight:bold; color: #3a3737;">{{compositeField.numbering}} {{compositeField.title}}</h5>
|
||||
<div class="content-left-margin">
|
||||
<h5 *ngIf="compositeField.description">{{compositeField.description}}</h5>
|
||||
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
|
||||
<div *ngIf="compositeField.fields.length > 1" class="fieldset-component">
|
||||
<h5 *ngIf="compositeField.title" style="font-weight:bold; color: #3a3737;">{{compositeField.title}}</h5>
|
||||
<h5 *ngIf="compositeField.title" style="font-weight:bold; color: #3a3737;">{{compositeField.numbering}}{{compositeField.title}}</h5>
|
||||
<div class="content-left-margin">
|
||||
<h5 *ngIf="compositeField.description">{{compositeField.description}}</h5>
|
||||
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<mat-expansion-panel expanded=true>
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
{{path}} {{section.title}}
|
||||
{{section.numbering}} {{section.title}}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description>
|
||||
<h3 *ngIf="section.description">{{section.description}}</h3>
|
||||
|
|
|
@ -8,6 +8,7 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
|
|||
public fields: Array<Field> = new Array<Field>();
|
||||
public ordinal: number;
|
||||
public id: string;
|
||||
public numbering: string;
|
||||
public multiplicity: Multiplicity;
|
||||
public multiplicityItems: Array<CompositeField> = new Array<CompositeField>();
|
||||
public title: string;
|
||||
|
@ -22,6 +23,7 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
|
|||
this.ordinal = item.ordinal;
|
||||
this.id = item.id;
|
||||
this.title = item.title;
|
||||
this.numbering = item.numbering;
|
||||
this.description = item.description;
|
||||
this.extendedDescription = item.extendedDescription;
|
||||
this.hasCommentField = item.hasCommentField;
|
||||
|
|
|
@ -15,6 +15,7 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
|
|||
public value: any;
|
||||
public defaultValue: DefaultValue;
|
||||
public description: string;
|
||||
public numbering: string;
|
||||
public extendedDescription: string;
|
||||
public viewStyle: ViewStyle;
|
||||
public defaultVisibility: boolean;
|
||||
|
@ -29,6 +30,7 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
|
|||
this.id = item.id;
|
||||
this.title = item.title;
|
||||
//this.value = item.value;
|
||||
this.numbering = item.numbering;
|
||||
this.description = item.description;
|
||||
this.extendedDescription = item.extendedDescription;
|
||||
this.viewStyle = item.viewStyle;
|
||||
|
|
|
@ -11,6 +11,7 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
|
|||
//public fieldGroups: Array<FieldGroup>;
|
||||
public defaultVisibility: boolean;
|
||||
public page: number;
|
||||
public numbering: string;
|
||||
public ordinal: number;
|
||||
public id: string;
|
||||
public title: string;
|
||||
|
@ -22,6 +23,7 @@ export class Section extends BaseModel implements Serializable<Section>, FormGen
|
|||
//this.fieldGroups = new JsonSerializer<FieldGroup>().fromJSONArray(item.fieldGroups, FieldGroup);
|
||||
this.page = item.page;
|
||||
this.defaultVisibility = item.defaultVisibility;
|
||||
this.numbering = item.numbering;
|
||||
this.id = item.id;
|
||||
this.title = item.title;
|
||||
this.ordinal = item.ordinal;
|
||||
|
|
|
@ -9,9 +9,9 @@ import { DataTableData } from '../../models/data-table/DataTableData';
|
|||
import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel';
|
||||
import { DataManagementPlanListingModel } from '../../models/data-managemnt-plans/DataManagementPlanListingModel';
|
||||
import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria';
|
||||
import { DatasetProfileCriteria } from '../../models/criteria/dataset/DatasetProfileCriteria';
|
||||
import { RequestItem } from '../../models/criteria/RequestItem';
|
||||
import { DatasetProfileModel } from '../../models/datasets/DatasetProfileModel';
|
||||
import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria';
|
||||
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -132,6 +132,30 @@
|
|||
"DATASET-PUBLIC-LISTING": {
|
||||
"TITLE": "Published dataset descriptions"
|
||||
},
|
||||
"DATASET-PROFILE-LISTING": {
|
||||
"TITLE": "Dataset Profiles",
|
||||
"COLUMNS": {
|
||||
"NAME": "Name",
|
||||
"REFERNCE": "Reference",
|
||||
"PROJECT": "Project",
|
||||
"URI": "Uri",
|
||||
"STATUS": "Status",
|
||||
"DESCRIPTION": "Description",
|
||||
"CREATED": "Created",
|
||||
"ACTIONS": "Actions",
|
||||
"DMP": "Dmp",
|
||||
"PROFILE": "Profile",
|
||||
"DATAREPOSITORIES": "Data Repositories",
|
||||
"REGISTRIES": "Registries",
|
||||
"SERVICES": "Services"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"EDIT": "Edit",
|
||||
"MAKE-IT-PUBLIC": "Make it public",
|
||||
"VIEW": "View",
|
||||
"CLONE": "Clone"
|
||||
}
|
||||
},
|
||||
"DMP-PROFILE-EDITOR": {
|
||||
"TITLE": {
|
||||
"NEW": "New DMP Profile",
|
||||
|
@ -195,6 +219,16 @@
|
|||
"FINALISE": "Finalise"
|
||||
}
|
||||
},
|
||||
"DYNAMIC-FORM": {
|
||||
"FIELDS": {
|
||||
"LABEL": "Label"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"PREVIEW": "Preview",
|
||||
"ADD-PAGE": "Add Page +",
|
||||
"ADD-SECTION": "Add Section +"
|
||||
}
|
||||
},
|
||||
"CRITERIA": {
|
||||
"FILTERS": "Filters",
|
||||
"PROJECTS": {
|
||||
|
@ -207,8 +241,10 @@
|
|||
"FINISHED": "Finished"
|
||||
}
|
||||
},
|
||||
"DATASET-PROFILE": {
|
||||
"LIKE": "Search"
|
||||
},
|
||||
"DATA-SETS": {
|
||||
"LIKE": "Search",
|
||||
"PERIOD-FROM": "Start",
|
||||
"PERIOD-TO": "End",
|
||||
"STATUS": "Status",
|
||||
|
|
Loading…
Reference in New Issue