Merge branch 'dmp-refactoring' of code-repo.d4science.org:MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
4d0b71db20
|
@ -212,7 +212,7 @@ public class DepositServiceImpl implements DepositService {
|
|||
}
|
||||
|
||||
private void sendNotification(DmpEntity dmpEntity) throws InvalidApplicationException {
|
||||
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).ids(dmpEntity.getId()).isActives(IsActive.Active).collect();
|
||||
List<DmpUserEntity> dmpUsers = this.queryFactory.query(DmpUserQuery.class).dmpIds(dmpEntity.getId()).isActives(IsActive.Active).collect();
|
||||
if (this.conventionService.isListNullOrEmpty(dmpUsers)){
|
||||
throw new MyNotFoundException("Dmp does not have Users");
|
||||
}
|
||||
|
|
|
@ -1074,7 +1074,7 @@ public class DmpServiceImpl implements DmpService {
|
|||
if (!this.conventionService.isListNullOrEmpty(sectionEntity.getFields())){
|
||||
for (eu.eudat.commons.types.dmpblueprint.FieldEntity fieldEntity: sectionEntity.getFields()) {
|
||||
|
||||
if (!this.conventionService.isListNullOrEmpty(dmpReferenceEntities)) {
|
||||
if (!this.conventionService.isListNullOrEmpty(dmpReferenceEntities) && fieldEntity.getCategory().equals(DmpBlueprintFieldCategory.ReferenceType)) {
|
||||
List<ReferencePersist> referencePersists = new ArrayList<>();
|
||||
for (DmpReferenceEntity dmpReferenceEntity : dmpReferenceEntities) {
|
||||
DmpReferenceData referenceData = this.jsonHandlingService.fromJsonSafe(DmpReferenceData.class, dmpReferenceEntity.getData());
|
||||
|
@ -1082,21 +1082,21 @@ public class DmpServiceImpl implements DmpService {
|
|||
ReferenceEntity reference = referencesFromAllFields.stream().filter(x -> x.getId().equals(dmpReferenceEntity.getReferenceId())).collect(Collectors.toList()).getFirst();
|
||||
if (referenceData.getBlueprintFieldId().equals(fieldEntity.getId()) && reference != null) {
|
||||
referencePersists.add(this.buildReferencePersist(reference));
|
||||
// found reference
|
||||
dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, referencePersists));
|
||||
}
|
||||
// put references
|
||||
dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, referencePersists, ((ReferenceTypeFieldEntity)fieldEntity).getMultipleSelect()));
|
||||
}
|
||||
} else if (!this.conventionService.isListNullOrEmpty(data.getDmpBlueprintValues())) {
|
||||
for (DmpBlueprintValueEntity value : data.getDmpBlueprintValues()) {
|
||||
if (value.getFieldId().equals(fieldEntity.getId())) {
|
||||
// found value
|
||||
dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), value.getValue(), null));
|
||||
dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), value.getValue(), null, null));
|
||||
} else {
|
||||
dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, null));
|
||||
dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, null, null));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, null));
|
||||
dmpBlueprintValues.put(fieldEntity.getId(), this.buildDmpBlueprintValuePersist(fieldEntity.getId(), null, null, null));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1157,13 +1157,15 @@ public class DmpServiceImpl implements DmpService {
|
|||
return persist;
|
||||
}
|
||||
|
||||
private @NotNull DmpBlueprintValuePersist buildDmpBlueprintValuePersist(UUID fieldId, String fieldValue, List<ReferencePersist> referencePersists){
|
||||
private @NotNull DmpBlueprintValuePersist buildDmpBlueprintValuePersist(UUID fieldId, String fieldValue, List<ReferencePersist> referencePersists, Boolean multipleSelect){
|
||||
DmpBlueprintValuePersist persist = new DmpBlueprintValuePersist();
|
||||
|
||||
persist.setFieldId(fieldId);
|
||||
|
||||
if (!this.conventionService.isListNullOrEmpty(referencePersists)){
|
||||
if (!this.conventionService.isListNullOrEmpty(referencePersists) && multipleSelect){
|
||||
persist.setReferences(referencePersists);
|
||||
}else if (!this.conventionService.isListNullOrEmpty(referencePersists)){
|
||||
persist.setReference(referencePersists.getFirst());
|
||||
}else if (fieldValue != null){
|
||||
persist.setFieldValue(fieldValue);
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ export class ResultFieldsMappingConfigurationEditorModel implements ResultFields
|
|||
}
|
||||
|
||||
return this.formBuilder.group({
|
||||
code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators],
|
||||
code: [{ value: this.code, disabled: true }, context.getValidation('code').validators],
|
||||
responsePath: [{ value: this.responsePath, disabled: disabled }, context.getValidation('responsePath').validators],
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue