+ private int checkStateChangeNomRef(String propertyPath){
+
+ if(oldState == null){
+ return -1;
+ }
+
+ try {
+ String[] path = propertyPath.split("\\.");
+ for (int i=1; i < propertyNames.length; i++) {
+ if(propertyNames[i].equals(path[0])){
+ if (oldState[i] == null && state[i] == null){
+ return -1;
+ }else{
+ //TODO make it recursive (until now only a 2 step path is allowed, but should be enough for the given use-case)
+ Object oldStatePathObj = (oldState[i]==null) ? null: BeanUtils.getProperty(oldState[i],path[1]);
+ Object newStatePathObj = (state[i]==null) ? null: BeanUtils.getProperty(state[i],path[1]);
+ if (oldStatePathObj == null && newStatePathObj == null){
+ return -1;
+ }else{
+ if(!Objects.equals(oldStatePathObj, newStatePathObj)){
+ return 0;
+ }else{
+ return -1;
+ }
+ }
+ }
+ }
+ }
+ } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+ throw new RuntimeException("The nomenclatural reference path seems to be invalid: " + propertyPath);
+ }
+ // this exception should be raised during the unit tests already and thus will never occur in production
+ throw new RuntimeException("TaxonName class misses at least one property of: " + propertyPath);
+ }
+