Minor improvement for dataset prefilling

This commit is contained in:
George Kalampokis 2022-01-07 18:06:19 +02:00
parent e1a4a64d81
commit 1d68b2a379
1 changed files with 4 additions and 3 deletions

View File

@ -327,10 +327,11 @@ public class DatasetWizardModel implements DataModel<Dataset, DatasetWizardModel
if (prefillingMapping.getTarget() != null) {
try {
String methodName = "set" + prefillingMapping.getTarget().substring(0, 1).toUpperCase(Locale.ROOT) + prefillingMapping.getTarget().substring(1);
Method setterMethod = DatasetWizardModel.class.getMethod(methodName, String.class);
Method setterMethod = Arrays.stream(DatasetWizardModel.class.getDeclaredMethods())
.filter(method -> method.getName().equals(methodName)).collect(Collectors.toList()).get(0);
setterMethod.invoke(datasetWizardModel, sourceValue);
}catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}catch (InvocationTargetException | IllegalAccessException e) {
throw e;
}
} else {
List<JsonNode> nodes = JsonSearcher.findNodes(parentNode, "rdaProperty", prefillingMapping.getMaDmpTarget());