There is an ENUM that maps classification text to its Id.
POWER(3, "Power")
private final Integer code;
private final String name;
ProblemReproducible(final int code, final String name) {
this.code = code;
this.name = name;
}
getCodeByName(context.getSource()){
Optional< Classification > classification = Arrays.asList(Classification.values()).stream()
.filter(item -> item.getName().equalsIgnoreCase(name))
.findFirst();
return classification.isPresent() ? classification.get().getCode() : null;
}
ModelMapper is not mapping values. I have added converted like below.