|
|
|
@ -158,6 +158,21 @@ public class ModelSupport {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Helper method: lookup relation inverse, given the direct relation encoding (case insensitive)
|
|
|
|
|
* @param encoding
|
|
|
|
|
* @return the relation inverse descriptor, throws @IllegalArgumentException when not found.
|
|
|
|
|
*/
|
|
|
|
|
public static RelationInverse findInverse(String encoding) {
|
|
|
|
|
return ModelSupport.relationInverseMap
|
|
|
|
|
.entrySet()
|
|
|
|
|
.stream()
|
|
|
|
|
.filter(r -> encoding.equalsIgnoreCase(r.getKey()))
|
|
|
|
|
.findFirst()
|
|
|
|
|
.map(r -> r.getValue())
|
|
|
|
|
.orElseThrow(() -> new IllegalArgumentException("invalid relationship: " + encoding));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Helper method: fina a relation filtering by a relation name
|
|
|
|
|
* @param relationName
|
|
|
|
|