Adds "RDA Common Standard" as a property of Dataset Template's Field.

This commit is contained in:
gkolokythas 2019-10-15 13:38:51 +03:00
parent f5aeb56133
commit ae6db14ac6
15 changed files with 190 additions and 103 deletions

View File

@ -13,6 +13,7 @@ import eu.eudat.models.data.admin.composite.DatasetProfile;
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel; import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
import eu.eudat.models.data.helpers.common.DataTableData; import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.helpers.responses.ResponseItem; import eu.eudat.models.data.helpers.responses.ResponseItem;
import org.springframework.core.env.Environment;
import eu.eudat.models.data.security.Principal; import eu.eudat.models.data.security.Principal;
import eu.eudat.models.data.user.composite.PagedDatasetProfile; import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.types.ApiMessageCode; import eu.eudat.types.ApiMessageCode;
@ -37,12 +38,14 @@ public class Admin extends BaseController {
private DatasetProfileManager datasetProfileManager; private DatasetProfileManager datasetProfileManager;
private UserManager userManager; private UserManager userManager;
private Environment environment;
@Autowired @Autowired
public Admin(ApiContext apiContext, DatasetProfileManager datasetProfileManager, UserManager userManager, Logger logger) { public Admin(ApiContext apiContext, DatasetProfileManager datasetProfileManager, UserManager userManager, Logger logger, Environment environment) {
super(apiContext); super(apiContext);
this.datasetProfileManager = datasetProfileManager; this.datasetProfileManager = datasetProfileManager;
this.userManager = userManager; this.userManager = userManager;
this.environment = environment;
} }
@Transactional @Transactional
@ -149,4 +152,9 @@ public class Admin extends BaseController {
.status(ApiMessageCode.SUCCESS_MESSAGE).message("")); .status(ApiMessageCode.SUCCESS_MESSAGE).message(""));
} }
@RequestMapping(method = RequestMethod.GET, value = {"/getRDACommonStandards"}, produces = "application/json")
public ResponseEntity getRDACommonStandards(@ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<String>>().status(ApiMessageCode.SUCCESS_MESSAGE).payload(this.datasetProfileManager.getRDACommonStandards(environment)));
}
} }

View File

@ -19,11 +19,11 @@ import eu.eudat.models.data.datasetprofile.DatasetProfileAutocompleteItem;
import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel; import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
import eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field; import eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field;
import eu.eudat.models.data.externaldataset.ExternalAutocompleteFieldModel; import eu.eudat.models.data.externaldataset.ExternalAutocompleteFieldModel;
import eu.eudat.models.data.helpermodels.Tuple;
import eu.eudat.models.data.helpers.common.DataTableData; import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.security.Principal;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@ -190,4 +190,23 @@ public class DatasetProfileManager {
throw new DatasetProfileNewVersionException("Version to update not the latest."); throw new DatasetProfileNewVersionException("Version to update not the latest.");
} }
} }
public List<String> getRDACommonStandards(Environment environment) {
String filePath = environment.getProperty("configuration.resources.path") + "RDACommonStandards.txt";
BufferedReader reader;
List<String> rdaList = new LinkedList<>();
try {
reader = new BufferedReader(new FileReader(filePath));
String line = reader.readLine();
while (line != null) {
rdaList.add(line);
line = reader.readLine();
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
return rdaList;
}
} }

View File

@ -11,6 +11,7 @@ import java.util.List;
public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet> { public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet> {
private String id; private String id;
private Integer ordinal; private Integer ordinal;
private String rdaCommonStandard;
private Multiplicity multiplicity; private Multiplicity multiplicity;
private String title; private String title;
private String description; private String description;
@ -22,7 +23,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public List<Field> getFields() { public List<Field> getFields() {
return fields; return fields;
} }
public void setFields(List<Field> fields) { public void setFields(List<Field> fields) {
this.fields = fields; this.fields = fields;
} }
@ -30,7 +30,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public String getId() { public String getId() {
return id; return id;
} }
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
@ -38,27 +37,30 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public Integer getOrdinal() { public Integer getOrdinal() {
return ordinal; return ordinal;
} }
public void setOrdinal(int ordinal) { public void setOrdinal(int ordinal) {
this.ordinal = ordinal; this.ordinal = ordinal;
} }
public void setOrdinal(Integer ordinal) {
this.ordinal = ordinal;
}
public String getRdaCommonStandard() {
return rdaCommonStandard;
}
public void setRdaCommonStandard(String rdaCommonStandard) {
this.rdaCommonStandard = rdaCommonStandard;
}
public Multiplicity getMultiplicity() { public Multiplicity getMultiplicity() {
return multiplicity; return multiplicity;
} }
public void setMultiplicity(Multiplicity multiplicity) { public void setMultiplicity(Multiplicity multiplicity) {
this.multiplicity = multiplicity; this.multiplicity = multiplicity;
} }
public void setOrdinal(Integer ordinal) {
this.ordinal = ordinal;
}
public String getTitle() { public String getTitle() {
return title; return title;
} }
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
@ -66,7 +68,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public String getDescription() { public String getDescription() {
return description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
@ -74,7 +75,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public String getExtendedDescription() { public String getExtendedDescription() {
return extendedDescription; return extendedDescription;
} }
public void setExtendedDescription(String extendedDescription) { public void setExtendedDescription(String extendedDescription) {
this.extendedDescription = extendedDescription; this.extendedDescription = extendedDescription;
} }
@ -82,7 +82,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public boolean getHasCommentField() { public boolean getHasCommentField() {
return hasCommentField; return hasCommentField;
} }
public void setHasCommentField(boolean hasCommentField) { public void setHasCommentField(boolean hasCommentField) {
this.hasCommentField = hasCommentField; this.hasCommentField = hasCommentField;
} }
@ -90,7 +89,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public String getAdditionalInformation() { public String getAdditionalInformation() {
return additionalInformation; return additionalInformation;
} }
public void setAdditionalInformation(String additionalInformation) { public void setAdditionalInformation(String additionalInformation) {
this.additionalInformation = additionalInformation; this.additionalInformation = additionalInformation;
} }
@ -98,8 +96,8 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
@Override @Override
public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet item) { public eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
if (this.id == null || this.id.isEmpty()) this.id = "fieldSet_" + RandomStringUtils.random(5, true, true); if (this.id == null || this.id.isEmpty()) this.id = "fieldSet_" + RandomStringUtils.random(5, true, true);
List<eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field> viewStylefields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field.class); List<eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field> viewStyleFields = new ModelBuilder().toViewStyleDefinition(this.fields, eu.eudat.models.data.entities.xmlmodels.datasetprofiledefinition.Field.class);
item.setFields(viewStylefields); item.setFields(viewStyleFields);
item.setId(this.id); item.setId(this.id);
item.setDescription(this.description); item.setDescription(this.description);
item.setTitle(this.title); item.setTitle(this.title);
@ -108,6 +106,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
item.setOrdinal(this.ordinal); item.setOrdinal(this.ordinal);
item.setMultiplicity(this.multiplicity); item.setMultiplicity(this.multiplicity);
item.setHasCommentField(this.hasCommentField); item.setHasCommentField(this.hasCommentField);
item.setRdaCommonStandard(this.rdaCommonStandard);
return item; return item;
} }
@ -122,6 +121,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
this.title = item.getTitle(); this.title = item.getTitle();
this.multiplicity = item.getMultiplicity(); this.multiplicity = item.getMultiplicity();
this.hasCommentField = item.getHasCommentField(); this.hasCommentField = item.getHasCommentField();
this.rdaCommonStandard = item.getRdaCommonStandard();
} }
@Override @Override
@ -130,7 +130,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
} }
public FieldSet toShort(){ public FieldSet toShort() {
FieldSet shortenFieldSet = new FieldSet(); FieldSet shortenFieldSet = new FieldSet();
shortenFieldSet.setId(this.id); shortenFieldSet.setId(this.id);
shortenFieldSet.setMultiplicity(this.multiplicity); shortenFieldSet.setMultiplicity(this.multiplicity);
@ -139,6 +139,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
shortenFieldSet.setExtendedDescription(this.extendedDescription); shortenFieldSet.setExtendedDescription(this.extendedDescription);
shortenFieldSet.setAdditionalInformation(this.additionalInformation); shortenFieldSet.setAdditionalInformation(this.additionalInformation);
shortenFieldSet.setHasCommentField(this.hasCommentField); shortenFieldSet.setHasCommentField(this.hasCommentField);
shortenFieldSet.setRdaCommonStandard(this.rdaCommonStandard);
List<Field> fieldToShort = this.fields; List<Field> fieldToShort = this.fields;
Collections.sort(fieldToShort); Collections.sort(fieldToShort);

View File

@ -14,6 +14,7 @@ import java.util.List;
public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<FieldSet> { public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<FieldSet> {
private String id; private String id;
private int ordinal; private int ordinal;
private String rdaCommonStandard;
private List<Field> fields; private List<Field> fields;
private String numbering; private String numbering;
private String title; private String title;
@ -27,7 +28,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public List<Field> getFields() { public List<Field> getFields() {
return fields; return fields;
} }
public void setFields(List<Field> fields) { public void setFields(List<Field> fields) {
this.fields = fields; this.fields = fields;
} }
@ -35,7 +35,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public String getId() { public String getId() {
return id; return id;
} }
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
@ -43,15 +42,20 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public int getOrdinal() { public int getOrdinal() {
return ordinal; return ordinal;
} }
public void setOrdinal(int ordinal) { public void setOrdinal(int ordinal) {
this.ordinal = ordinal; this.ordinal = ordinal;
} }
public String getRdaCommonStandard() {
return rdaCommonStandard;
}
public void setRdaCommonStandard(String rdaCommonStandard) {
this.rdaCommonStandard = rdaCommonStandard;
}
public String getTitle() { public String getTitle() {
return title; return title;
} }
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
@ -59,7 +63,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public String getDescription() { public String getDescription() {
return description; return description;
} }
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
@ -67,7 +70,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public String getExtendedDescription() { public String getExtendedDescription() {
return extendedDescription; return extendedDescription;
} }
public void setExtendedDescription(String extendedDescription) { public void setExtendedDescription(String extendedDescription) {
this.extendedDescription = extendedDescription; this.extendedDescription = extendedDescription;
} }
@ -75,7 +77,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public Multiplicity getMultiplicity() { public Multiplicity getMultiplicity() {
return multiplicity; return multiplicity;
} }
public void setMultiplicity(Multiplicity multiplicity) { public void setMultiplicity(Multiplicity multiplicity) {
this.multiplicity = multiplicity; this.multiplicity = multiplicity;
} }
@ -83,7 +84,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public boolean getHasCommentField() { public boolean getHasCommentField() {
return hasCommentField; return hasCommentField;
} }
public void setHasCommentField(boolean hasCommentField) { public void setHasCommentField(boolean hasCommentField) {
this.hasCommentField = hasCommentField; this.hasCommentField = hasCommentField;
} }
@ -91,7 +91,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
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;
} }
@ -99,7 +98,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public String getNumbering() { public String getNumbering() {
return numbering; return numbering;
} }
public void setNumbering(String numbering) { public void setNumbering(String numbering) {
this.numbering = numbering; this.numbering = numbering;
} }
@ -107,7 +105,6 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
public String getAdditionalInformation() { public String getAdditionalInformation() {
return additionalInformation; return additionalInformation;
} }
public void setAdditionalInformation(String additionalInformation) { public void setAdditionalInformation(String additionalInformation) {
this.additionalInformation = additionalInformation; this.additionalInformation = additionalInformation;
} }
@ -120,6 +117,9 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
Element title = doc.createElement("title"); Element title = doc.createElement("title");
title.setTextContent(this.title); title.setTextContent(this.title);
Element rdaCommonStandard = doc.createElement("rdaCommonStandard");
rdaCommonStandard.setTextContent(this.rdaCommonStandard);
Element description = doc.createElement("description"); Element description = doc.createElement("description");
description.setTextContent(this.description); description.setTextContent(this.description);
@ -151,6 +151,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
fieldSet.appendChild(fieldsElement); fieldSet.appendChild(fieldsElement);
fieldSet.appendChild(multiplicity); fieldSet.appendChild(multiplicity);
fieldSet.appendChild(title); fieldSet.appendChild(title);
fieldSet.appendChild(rdaCommonStandard);
fieldSet.appendChild(description); fieldSet.appendChild(description);
fieldSet.appendChild(extendedDescription); fieldSet.appendChild(extendedDescription);
fieldSet.appendChild(additionalInformation); fieldSet.appendChild(additionalInformation);
@ -162,19 +163,21 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
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();
Element title = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title"); Element title = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
this.title = title.getTextContent(); this.title = title.getTextContent();
Element description = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description"); Element description = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
this.description = description.getTextContent(); this.description = description.getTextContent();
Element extendedDescription = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription"); Element extendedDescription = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "extendedDescription");
this.extendedDescription = extendedDescription.getTextContent(); this.extendedDescription = extendedDescription.getTextContent();
Element additionalInformation = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "additionalInformation"); Element additionalInformation = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "additionalInformation");
if (additionalInformation != null) if (additionalInformation != null)
this.additionalInformation = additionalInformation.getTextContent(); this.additionalInformation = additionalInformation.getTextContent();
Element commentField = (Element) 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 = (Element) XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields"); Element fields = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "fields");
Element rdaCommonStandard = XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "rdaCommonStandard");
if (rdaCommonStandard != null) this.rdaCommonStandard = rdaCommonStandard.getTextContent();
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();
@ -190,12 +193,11 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
} }
this.multiplicity = new Multiplicity(); this.multiplicity = new Multiplicity();
Element multiplicity = (Element) 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")));
this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max"))); this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max")));
return this; return this;
} }
} }

View File

@ -0,0 +1,31 @@
dmp
dmp_id
dmp_id.dmp_id
dmp_id.dmp_id_type
title
created
modified
language
ethical_issues_exist
cost
cost.title
cost.description
cost.value
cost.currency_code
contact
contact.mail
contact.name
contact.contact_id
contact.contact_id.contact_id
contact.contact_id.contact_id_type
project
project.title
project.project_start
project.project_end
project.funding
project.funding.funder_id
project.funding.funder_id.funder_id
project.funding.funder_id.funder_id_type
project.funding.grant_id
project.funding.grant_id.grant_id
project.funding.grant_id.grant_id_type

View File

@ -36,6 +36,7 @@ export interface FieldSet {
additionalInformation:string; additionalInformation:string;
hasCommentField: boolean; hasCommentField: boolean;
fields: Field[]; fields: Field[];
rdaCommonStandard: string;
} }
export interface Multiplicity { export interface Multiplicity {

View File

@ -70,4 +70,8 @@ export class DatasetProfileService {
formData.append('file', file[0], labelSent); formData.append('file', file[0], labelSent);
return this.http.post(this.actionUrl + "upload", formData, { params: params }); return this.http.post(this.actionUrl + "upload", formData, { params: params });
} }
getRDACommonStandards(): Observable<String[]> {
return this.http.get(this.actionUrl + "getRDACommonStandards");
}
} }

View File

@ -16,6 +16,7 @@ export class FieldSetEditorModel extends BaseFormModel {
public extendedDescription: string; public extendedDescription: string;
public additionalInformation: string; public additionalInformation: string;
public hasCommentField: boolean; public hasCommentField: boolean;
public rdaCommonStandard: string;
fromModel(item: FieldSet): FieldSetEditorModel { fromModel(item: FieldSet): FieldSetEditorModel {
@ -28,6 +29,7 @@ export class FieldSetEditorModel extends BaseFormModel {
this.extendedDescription = item.extendedDescription; this.extendedDescription = item.extendedDescription;
this.additionalInformation = item.additionalInformation; this.additionalInformation = item.additionalInformation;
this.hasCommentField = item.hasCommentField; this.hasCommentField = item.hasCommentField;
this.rdaCommonStandard = item.rdaCommonStandard;
return this; return this;
} }
@ -39,7 +41,8 @@ export class FieldSetEditorModel extends BaseFormModel {
description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.description')) }], description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.description')) }],
extendedDescription: [{ value: this.extendedDescription, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.extendedDescription')) }], extendedDescription: [{ value: this.extendedDescription, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.extendedDescription')) }],
additionalInformation: [{ value: this.additionalInformation, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.additionalInformation')) }], additionalInformation: [{ value: this.additionalInformation, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.additionalInformation')) }],
hasCommentField: [{ value: this.hasCommentField, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.hasCommentField')) }] hasCommentField: [{ value: this.hasCommentField, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.hasCommentField')) }],
rdaCommonStandard: [{value: this.rdaCommonStandard, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.rdaCommonStandard')) }]
}); });
const fieldsFormArray = new Array<FormGroup>(); const fieldsFormArray = new Array<FormGroup>();
this.fields.forEach(item => { this.fields.forEach(item => {

View File

@ -36,6 +36,14 @@
<input matInput type="number" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ORDER' | translate}}" <input matInput type="number" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ORDER' | translate}}"
[formControl]="this.form.get('ordinal')"> [formControl]="this.form.get('ordinal')">
</mat-form-field> </mat-form-field>
<mat-form-field class="col">
<mat-label>{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.RDA-COMMON-STANDARDS' | translate}}</mat-label>
<mat-select [formControl]="this.form.get('rdaCommonStandard')">
<mat-option *ngFor="let property of rdaCommonStandards" [value]="property">
{{property}}
</mat-option>
</mat-select>
</mat-form-field>
</div> </div>
<div class="row"> <div class="row">
<mat-form-field class="col"> <mat-form-field class="col">

View File

@ -13,6 +13,7 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit {
@Input() form: FormGroup; @Input() form: FormGroup;
@Input() indexPath: string; @Input() indexPath: string;
@Input() viewOnly: boolean; @Input() viewOnly: boolean;
@Input() rdaCommonStandards: String[];
isComposite = false; isComposite = false;
isMultiplicityEnabled = false; isMultiplicityEnabled = false;

View File

@ -42,7 +42,7 @@
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="deleteFieldSet(i);" [disabled]="viewOnly"> <button mat-icon-button type="button" class="deleteBtn col-auto" (click)="deleteFieldSet(i);" [disabled]="viewOnly">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
</button> </button>
<app-dataset-profile-editor-composite-field-component class="col-12" [form]="fieldControl" [indexPath]="indexPath + 'cf' + i" [viewOnly]="viewOnly"></app-dataset-profile-editor-composite-field-component> <app-dataset-profile-editor-composite-field-component class="col-12" [form]="fieldControl" [indexPath]="indexPath + 'cf' + i" [viewOnly]="viewOnly" [rdaCommonStandards]="rdaCommonStandards"></app-dataset-profile-editor-composite-field-component>
</div> </div>
</mat-card> </mat-card>
</div> </div>

View File

@ -18,6 +18,7 @@ export class DatasetProfileEditorSectionComponent extends BaseComponent implemen
@Input() dataModel: SectionEditorModel; @Input() dataModel: SectionEditorModel;
@Input() indexPath: string; @Input() indexPath: string;
@Input() viewOnly: boolean; @Input() viewOnly: boolean;
@Input() rdaCommonStandards: String[];
constructor() { super(); } constructor() { super(); }

View File

@ -46,7 +46,7 @@
</button> </button>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<div id="{{'s' + i}}" class="row" *ngIf="panel.expanded"> <div id="{{'s' + i}}" class="row" *ngIf="panel.expanded">
<app-dataset-profile-editor-section-component class="col-12" [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i" [viewOnly]="viewOnly"> <app-dataset-profile-editor-section-component class="col-12" [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i" [viewOnly]="viewOnly" [rdaCommonStandards]="rdaCommonStandards">
</app-dataset-profile-editor-section-component> </app-dataset-profile-editor-section-component>
</div> </div>
</mat-expansion-panel> </mat-expansion-panel>

View File

@ -1,5 +1,5 @@
import {of as observableOf, Observable } from 'rxjs'; import { of as observableOf, Observable } from 'rxjs';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { FormArray, FormControl, FormGroup } from '@angular/forms'; import { FormArray, FormControl, FormGroup } from '@angular/forms';
@ -46,6 +46,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
breadCrumbs: Observable<BreadcrumbItem[]>; breadCrumbs: Observable<BreadcrumbItem[]>;
@ViewChild('stepper', { static: false }) stepper: MatHorizontalStepper; @ViewChild('stepper', { static: false }) stepper: MatHorizontalStepper;
viewOnly = false; viewOnly = false;
rdaCommonStandards: String[];
constructor( constructor(
private datasetProfileService: DatasetProfileService, private datasetProfileService: DatasetProfileService,
@ -72,67 +73,67 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
this.datasetProfileService.getDatasetProfileById(this.datasetProfileId) this.datasetProfileService.getDatasetProfileById(this.datasetProfileId)
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed)) .pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
.subscribe( .subscribe(
data => { data => {
try { try {
this.dataModel = new DatasetProfileEditorModel().fromModel(data); this.dataModel = new DatasetProfileEditorModel().fromModel(data);
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive; // this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
if (this.dataModel.status === DatasetProfileEnum.FINALIZED) { if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
this.form = this.dataModel.buildForm(true, skipDisable); this.form = this.dataModel.buildForm(true, skipDisable);
this.viewOnly = true; this.viewOnly = true;
} else { } else {
this.form = this.dataModel.buildForm(); this.form = this.dataModel.buildForm();
}
this.prepareForm();
} catch {
this.logger.error('Could not parse MasterItem: ' + data);
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
} }
this.prepareForm(); },
} catch { error => this.onCallbackError(error)
this.logger.error('Could not parse MasterItem: ' + data);
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
}
},
error => this.onCallbackError(error)
); );
this.breadCrumbs = observableOf([{ this.breadCrumbs = observableOf([{
parentComponentName: 'DatasetProfileListingComponent', parentComponentName: 'DatasetProfileListingComponent',
label: this.language.instant('NAV-BAR.TEMPLATE'), label: this.language.instant('NAV-BAR.TEMPLATE'),
url: '/dataset-profiles/' + this.datasetProfileId url: '/dataset-profiles/' + this.datasetProfileId
}]); }]);
} else if (cloneId != null) { } else if (cloneId != null) {
this.isClone = true; this.isClone = true;
this.datasetProfileService.clone(cloneId) this.datasetProfileService.clone(cloneId)
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed)) .pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
.subscribe( .subscribe(
data => { data => {
try { try {
this.dataModel = new DatasetProfileEditorModel().fromModel(data); this.dataModel = new DatasetProfileEditorModel().fromModel(data);
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive; // this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
this.dataModel.status = DatasetProfileEnum.SAVED; this.dataModel.status = DatasetProfileEnum.SAVED;
this.form = this.dataModel.buildForm(); this.form = this.dataModel.buildForm();
this.prepareForm(); this.prepareForm();
} catch { } catch {
this.logger.error('Could not parse MasterItem: ' + data); this.logger.error('Could not parse MasterItem: ' + data);
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
} }
}, },
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );
} else if (this.newVersionId != null) { } else if (this.newVersionId != null) {
this.isNewVersion = true; this.isNewVersion = true;
this.datasetProfileService.getDatasetProfileById(this.newVersionId) this.datasetProfileService.getDatasetProfileById(this.newVersionId)
.pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed)) .pipe(map(data => data as DatasetProfile), takeUntil(this._destroyed))
.subscribe( .subscribe(
data => { data => {
try { try {
this.dataModel = new DatasetProfileEditorModel().fromModel(data); this.dataModel = new DatasetProfileEditorModel().fromModel(data);
// this.isDeleted = this.masterItem.isActive === IsActive.Inactive; // this.isDeleted = this.masterItem.isActive === IsActive.Inactive;
this.form = this.dataModel.buildForm(); this.form = this.dataModel.buildForm();
this.form.get('version').setValue(this.form.get('version').value + 1); this.form.get('version').setValue(this.form.get('version').value + 1);
this.form.controls['label'].disable(); this.form.controls['label'].disable();
this.prepareForm(); this.prepareForm();
} catch { } catch {
this.logger.error('Could not parse MasterItem: ' + data); this.logger.error('Could not parse MasterItem: ' + data);
this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(this.language.instant('NOTIFICATIONS.DEFAULT.ERROR'), SnackBarNotificationLevel.Error);
} }
}, },
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );
} else { } else {
this.dataModel = new DatasetProfileEditorModel(); this.dataModel = new DatasetProfileEditorModel();
@ -145,6 +146,12 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
this.addPage(); this.addPage();
} }
}); });
this.datasetProfileService.getRDACommonStandards()
.subscribe(
data => {
this.rdaCommonStandards = data;
}
);
} }
prepareForm() { prepareForm() {
@ -201,7 +208,7 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
.subscribe(() => { .subscribe(() => {
this.router.navigate(['/dataset-profiles']); this.router.navigate(['/dataset-profiles']);
}, },
error => this.onCallbackErrorNewVersion(error) error => this.onCallbackErrorNewVersion(error)
); );
} else { } else {
this.form.get('status').setValue(DatasetStatus.Draft); this.form.get('status').setValue(DatasetStatus.Draft);
@ -262,18 +269,18 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
this.datasetProfileService.delete(this.datasetProfileId, this.form.value) this.datasetProfileService.delete(this.datasetProfileId, this.form.value)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => { complete => {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success); this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.router.navigate(['/dataset-profiles']); this.router.navigate(['/dataset-profiles']);
}, },
error => { error => {
this.onCallbackError(error); this.onCallbackError(error);
if (error.error.statusCode == 674) { if (error.error.statusCode == 674) {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Error);
} else { } else {
this.uiNotificationService.snackBarNotification(this.language.instant(error.message), SnackBarNotificationLevel.Error); this.uiNotificationService.snackBarNotification(this.language.instant(error.message), SnackBarNotificationLevel.Error);
}
} }
}
); );
} }
}); });

View File

@ -239,7 +239,8 @@
"MULTIPLICITY-ADD-ONE-FIELD": "Add one more fieldset", "MULTIPLICITY-ADD-ONE-FIELD": "Add one more fieldset",
"ORDER": "Order", "ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify", "COMMENT-PLACEHOLDER": "Please Specify",
"COMMENT-HINT": "Provide additional information or justification about your selection" "COMMENT-HINT": "Provide additional information or justification about your selection",
"RDA-COMMON-STANDARDS": "RDA Common Standards"
}, },
"ACTIONS": { "ACTIONS": {
"ADD-CHILD-FIELD": "Add Child Field +" "ADD-CHILD-FIELD": "Add Child Field +"