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.helpers.common.DataTableData;
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.user.composite.PagedDatasetProfile;
import eu.eudat.types.ApiMessageCode;
@ -37,12 +38,14 @@ public class Admin extends BaseController {
private DatasetProfileManager datasetProfileManager;
private UserManager userManager;
private Environment environment;
@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);
this.datasetProfileManager = datasetProfileManager;
this.userManager = userManager;
this.environment = environment;
}
@Transactional
@ -149,4 +152,9 @@ public class Admin extends BaseController {
.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.entities.xmlmodels.datasetprofiledefinition.Field;
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.security.Principal;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@ -190,4 +190,23 @@ public class DatasetProfileManager {
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> {
private String id;
private Integer ordinal;
private String rdaCommonStandard;
private Multiplicity multiplicity;
private String title;
private String description;
@ -22,7 +23,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public List<Field> getFields() {
return fields;
}
public void setFields(List<Field> fields) {
this.fields = fields;
}
@ -30,7 +30,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@ -38,27 +37,30 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public Integer getOrdinal() {
return ordinal;
}
public void setOrdinal(int 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() {
return multiplicity;
}
public void setMultiplicity(Multiplicity multiplicity) {
this.multiplicity = multiplicity;
}
public void setOrdinal(Integer ordinal) {
this.ordinal = ordinal;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@ -66,7 +68,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@ -74,7 +75,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public String getExtendedDescription() {
return extendedDescription;
}
public void setExtendedDescription(String extendedDescription) {
this.extendedDescription = extendedDescription;
}
@ -82,7 +82,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public boolean getHasCommentField() {
return hasCommentField;
}
public void setHasCommentField(boolean hasCommentField) {
this.hasCommentField = hasCommentField;
}
@ -90,7 +89,6 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
public String getAdditionalInformation() {
return additionalInformation;
}
public void setAdditionalInformation(String additionalInformation) {
this.additionalInformation = additionalInformation;
}
@ -98,8 +96,8 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
@Override
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);
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);
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.setId(this.id);
item.setDescription(this.description);
item.setTitle(this.title);
@ -108,6 +106,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
item.setOrdinal(this.ordinal);
item.setMultiplicity(this.multiplicity);
item.setHasCommentField(this.hasCommentField);
item.setRdaCommonStandard(this.rdaCommonStandard);
return item;
}
@ -122,6 +121,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
this.title = item.getTitle();
this.multiplicity = item.getMultiplicity();
this.hasCommentField = item.getHasCommentField();
this.rdaCommonStandard = item.getRdaCommonStandard();
}
@Override
@ -130,7 +130,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
}
public FieldSet toShort(){
public FieldSet toShort() {
FieldSet shortenFieldSet = new FieldSet();
shortenFieldSet.setId(this.id);
shortenFieldSet.setMultiplicity(this.multiplicity);
@ -139,6 +139,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.models
shortenFieldSet.setExtendedDescription(this.extendedDescription);
shortenFieldSet.setAdditionalInformation(this.additionalInformation);
shortenFieldSet.setHasCommentField(this.hasCommentField);
shortenFieldSet.setRdaCommonStandard(this.rdaCommonStandard);
List<Field> fieldToShort = this.fields;
Collections.sort(fieldToShort);

View File

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

View File

@ -70,4 +70,8 @@ export class DatasetProfileService {
formData.append('file', file[0], labelSent);
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 additionalInformation: string;
public hasCommentField: boolean;
public rdaCommonStandard: string;
fromModel(item: FieldSet): FieldSetEditorModel {
@ -28,6 +29,7 @@ export class FieldSetEditorModel extends BaseFormModel {
this.extendedDescription = item.extendedDescription;
this.additionalInformation = item.additionalInformation;
this.hasCommentField = item.hasCommentField;
this.rdaCommonStandard = item.rdaCommonStandard;
return this;
}
@ -39,7 +41,8 @@ export class FieldSetEditorModel extends BaseFormModel {
description: [{ value: this.description, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.description')) }],
extendedDescription: [{ value: this.extendedDescription, disabled: (disabled && !skipDisable.includes('FieldSetEditorModel.extendedDescription')) }],
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>();
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}}"
[formControl]="this.form.get('ordinal')">
</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 class="row">
<mat-form-field class="col">

View File

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

View File

@ -42,7 +42,7 @@
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="deleteFieldSet(i);" [disabled]="viewOnly">
<mat-icon>delete</mat-icon>
</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>
</mat-card>
</div>

View File

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

View File

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

View File

@ -239,7 +239,8 @@
"MULTIPLICITY-ADD-ONE-FIELD": "Add one more fieldset",
"ORDER": "Order",
"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": {
"ADD-CHILD-FIELD": "Add Child Field +"