Fixes bug on setting Dynamic configuration of a DMP.

This commit is contained in:
gkolokythas 2019-09-13 13:08:37 +03:00
parent 61bc10d922
commit c9ca55fd76
4 changed files with 21 additions and 21 deletions

View File

@ -41,7 +41,7 @@ public class DynamicFunderConfigurationProdImpl implements DynamicFunderConfigur
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class); JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream(); is = new URL("file:///" + this.environment.getProperty("configuration.resources.path") + "FunderConfiguration.xml").openStream();
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is); this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();

View File

@ -48,7 +48,7 @@ public class DynamicGrantConfigurationProdImpl implements DynamicGrantConfigurat
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class); JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream(); is = new URL("file:///" + this.environment.getProperty("configuration.resources.path") + "GrantConfiguration.xml").openStream();
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is); this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();

View File

@ -45,7 +45,7 @@ public class DynamicProjectConfigurationProdImpl implements DynamicProjectConfig
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class); JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream(); is = new URL("file:///" + this.environment.getProperty("configuration.resources.path") + "ProjectConfiguration.xml").openStream();
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is); this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();

View File

@ -284,15 +284,15 @@ public class DataManagementPlanManager {
eu.eudat.models.data.dmp.DataManagementPlan datamanagementPlan = new eu.eudat.models.data.dmp.DataManagementPlan(); eu.eudat.models.data.dmp.DataManagementPlan datamanagementPlan = new eu.eudat.models.data.dmp.DataManagementPlan();
datamanagementPlan.fromDataModel(dataManagementPlanEntity); datamanagementPlan.fromDataModel(dataManagementPlanEntity);
Map dmpProperties = dataManagementPlanEntity.getDmpProperties() != null ? new org.json.JSONObject(dataManagementPlanEntity.getDmpProperties()).toMap() : null; Map dmpProperties = dataManagementPlanEntity.getDmpProperties() != null ? new org.json.JSONObject(dataManagementPlanEntity.getDmpProperties()).toMap() : null;
datamanagementPlan.setDynamicFields(dynamicGrantConfiguration.getFields().stream().map(item -> { // datamanagementPlan.setDynamicFields(dynamicGrantConfiguration.getFields().stream().map(item -> {
DynamicFieldWithValue fieldWithValue = new DynamicFieldWithValue(); // DynamicFieldWithValue fieldWithValue = new DynamicFieldWithValue();
fieldWithValue.setId(item.getId()); // fieldWithValue.setId(item.getId());
fieldWithValue.setDependencies(item.getDependencies()); // fieldWithValue.setDependencies(item.getDependencies());
fieldWithValue.setName(item.getName()); // fieldWithValue.setName(item.getName());
fieldWithValue.setQueryProperty(item.getQueryProperty()); // fieldWithValue.setQueryProperty(item.getQueryProperty());
fieldWithValue.setRequired(item.getRequired()); // fieldWithValue.setRequired(item.getRequired());
return fieldWithValue; // return fieldWithValue;
}).collect(Collectors.toList())); // }).collect(Collectors.toList()));
if (dmpProperties != null && datamanagementPlan.getDynamicFields() != null) if (dmpProperties != null && datamanagementPlan.getDynamicFields() != null)
datamanagementPlan.getDynamicFields().forEach(item -> { datamanagementPlan.getDynamicFields().forEach(item -> {
@ -323,15 +323,15 @@ public class DataManagementPlanManager {
datamanagementPlan.fromDataModel(dataManagementPlanEntity); datamanagementPlan.fromDataModel(dataManagementPlanEntity);
datamanagementPlan.setDatasets(datamanagementPlan.getDatasets().stream().filter(dataset -> dataset.getStatus() == Dataset.Status.FINALISED.getValue()).collect(Collectors.toList())); datamanagementPlan.setDatasets(datamanagementPlan.getDatasets().stream().filter(dataset -> dataset.getStatus() == Dataset.Status.FINALISED.getValue()).collect(Collectors.toList()));
Map dmpProperties = dataManagementPlanEntity.getDmpProperties() != null ? new org.json.JSONObject(dataManagementPlanEntity.getDmpProperties()).toMap() : null; Map dmpProperties = dataManagementPlanEntity.getDmpProperties() != null ? new org.json.JSONObject(dataManagementPlanEntity.getDmpProperties()).toMap() : null;
datamanagementPlan.setDynamicFields(dynamicGrantConfiguration.getFields().stream().map(item -> { // datamanagementPlan.setDynamicFields(dynamicGrantConfiguration.getFields().stream().map(item -> {
DynamicFieldWithValue fieldWithValue = new DynamicFieldWithValue(); // DynamicFieldWithValue fieldWithValue = new DynamicFieldWithValue();
fieldWithValue.setId(item.getId()); // fieldWithValue.setId(item.getId());
fieldWithValue.setDependencies(item.getDependencies()); // fieldWithValue.setDependencies(item.getDependencies());
fieldWithValue.setName(item.getName()); // fieldWithValue.setName(item.getName());
fieldWithValue.setQueryProperty(item.getQueryProperty()); // fieldWithValue.setQueryProperty(item.getQueryProperty());
fieldWithValue.setRequired(item.getRequired()); // fieldWithValue.setRequired(item.getRequired());
return fieldWithValue; // return fieldWithValue;
}).collect(Collectors.toList())); // }).collect(Collectors.toList()));
if (dmpProperties != null && datamanagementPlan.getDynamicFields() != null) if (dmpProperties != null && datamanagementPlan.getDynamicFields() != null)
datamanagementPlan.getDynamicFields().forEach(item -> { datamanagementPlan.getDynamicFields().forEach(item -> {