Fixed issue not passing DMP Extra Properties on clones and new Versions
This commit is contained in:
parent
2ca9eede14
commit
346c731aae
|
@ -7,6 +7,7 @@ import eu.eudat.models.data.funder.FunderDMPEditorModel;
|
|||
import eu.eudat.models.data.grant.GrantDMPEditorModel;
|
||||
import eu.eudat.models.data.project.ProjectDMPEditorModel;
|
||||
import eu.eudat.models.data.userinfo.UserInfo;
|
||||
import net.minidev.json.JSONObject;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -31,6 +32,7 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
private List<Dataset> datasets;
|
||||
private ProjectDMPEditorModel project;
|
||||
private FunderDMPEditorModel funder;
|
||||
private Map<String, Object> extraProperties;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
@ -144,6 +146,14 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
this.funder = funder;
|
||||
}
|
||||
|
||||
public Map<String, Object> getExtraProperties() {
|
||||
return extraProperties;
|
||||
}
|
||||
|
||||
public void setExtraProperties(Map<String, Object> extraProperties) {
|
||||
this.extraProperties = extraProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataManagementPlanNewVersionModel fromDataModel(DMP entity) {
|
||||
return null;
|
||||
|
@ -244,6 +254,7 @@ public class DataManagementPlanNewVersionModel implements DataModel<DMP, DataMan
|
|||
}
|
||||
}
|
||||
|
||||
entity.setExtraProperties(this.extraProperties != null ? JSONObject.toJSONString(this.extraProperties) : null);
|
||||
if (this.profiles != null)
|
||||
entity.setAssociatedDmps(this.profiles.stream().map(x -> x.toData()).collect(Collectors.toSet()));
|
||||
return entity;
|
||||
|
|
|
@ -17,6 +17,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { map, takeUntil } from 'rxjs/operators';
|
||||
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||
import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties-form.model';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -60,6 +61,7 @@ export class DmpCloneComponent extends BaseComponent implements OnInit {
|
|||
this.dmp.grant = new GrantTabModel();
|
||||
this.dmp.project = new ProjectFormModel();
|
||||
this.dmp.funder = new FunderFormModel();
|
||||
this.dmp.extraProperties = new ExtraPropertiesFormModel();
|
||||
this.dmp.fromModel(data);
|
||||
this.dmp.status = DmpStatus.Draft;
|
||||
this.formGroup = this.dmp.buildForm();
|
||||
|
|
|
@ -21,6 +21,7 @@ import { BackendErrorValidator } from '@common/forms/validation/custom-validator
|
|||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||
import { ValidationContext } from '@common/forms/validation/validation-context';
|
||||
import { ExtraPropertiesFormModel } from './general-tab/extra-properties-form.model';
|
||||
import { isNullOrUndefined } from 'util';
|
||||
|
||||
export class DmpEditorModel {
|
||||
public id: string;
|
||||
|
@ -71,7 +72,9 @@ export class DmpEditorModel {
|
|||
if (item.dynamicFields) { item.dynamicFields.map(x => this.dynamicFields.push(new DmpDynamicFieldEditorModel().fromModel(x))); }
|
||||
this.creator = item.creator;
|
||||
this.modified = new Date(item.modified);
|
||||
if (!isNullOrUndefined(item.extraProperties)) {
|
||||
this.extraProperties.fromModel(item.extraProperties);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import { BackendErrorValidator } from '@common/forms/validation/custom-validator
|
|||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||
import { ValidationContext } from '@common/forms/validation/validation-context';
|
||||
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
||||
import { ExtraPropertiesFormModel } from '../editor/general-tab/extra-properties-form.model';
|
||||
|
||||
export class DmpWizardEditorModel {
|
||||
public id: string;
|
||||
|
@ -36,6 +37,7 @@ export class DmpWizardEditorModel {
|
|||
public definition: DmpProfileDefinition;
|
||||
public dynamicFields: Array<DmpDynamicFieldEditorModel> = [];
|
||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
|
||||
public extraProperties: ExtraPropertiesFormModel;
|
||||
|
||||
fromModel(item: DmpModel): DmpWizardEditorModel {
|
||||
this.id = item.id;
|
||||
|
@ -56,6 +58,7 @@ export class DmpWizardEditorModel {
|
|||
if (item.definition) { this.definition = item.definition; }
|
||||
if (item.dynamicFields) { item.dynamicFields.map(x => this.dynamicFields.push(new DmpDynamicFieldEditorModel().fromModel(x))); }
|
||||
this.creator = item.creator;
|
||||
this.extraProperties.fromModel(item.extraProperties);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -78,6 +81,7 @@ export class DmpWizardEditorModel {
|
|||
researchers: [{ value: this.researchers, disabled: disabled }, context.getValidation('researchers').validators],
|
||||
profiles: [{ value: this.profiles, disabled: disabled }, context.getValidation('profiles').validators],
|
||||
associatedUsers: [{ value: this.associatedUsers, disabled: disabled }, context.getValidation('associatedUsers').validators],
|
||||
extraProperties: this.extraProperties.buildForm(),
|
||||
});
|
||||
|
||||
const dynamicFields = new Array<FormGroup>();
|
||||
|
|
Loading…
Reference in New Issue