/** * Use the given predicate in executing this graph policy. * @param predicate a graph policy predicate */ public void registerPredicate(GraphPolicyRulePredicate predicate) { predicates.put(predicate.getName(), predicate); }
/** * Any model object about which policy may be asked is first passed to {@link #noteDetails(Session, IObject, String, long)} * before {@link GraphPolicy#review(Map, Details, Map, Set, boolean)}. Each object is passed only once. * Subclasses overriding this method probably ought also override {@link #getCleanInstance()}. * @param session the Hibernate session, for obtaining more information about the object * @param object an unloaded model object about which policy may be asked * @param realClass the real class name of the object * @param id the ID of the object */ public void noteDetails(Session session, IObject object, String realClass, long id) { for (final GraphPolicyRulePredicate predicate : predicates.values()) { predicate.noteDetails(session, object, realClass, id); } }
throw new GraphException("unknown predicate: " + predicateName); if (!predicate.isMatch(details, predicateValue)) { return false;