/** * Get the model objects that link to the given object via the given property. * Provides a window into the model object cache accumulated in planning a graph operation. * @param propertyValueClass the full name of the model class that declares the given property * @param propertyName a property name, may be nested * @param id the ID of the model object being linked to * @return the class and ID of the model objects that link to the given object, never {@code null} */ public SetMultimap<String, Long> getLinkers(String propertyValueClass, String propertyName, Long id) { if (!progress.contains(Milestone.PLANNED)) { throw new IllegalStateException("operation not yet planned"); } final SetMultimap<String, Long> linkers = HashMultimap.create(); for (final CI linker : planning.backwardLinksCached.get(new CPI(propertyValueClass, propertyName, id))) { linkers.put(linker.className, linker.id); } return linkers; }
/** * Get the model objects that are linked to by the given object via the given property. * Provides a window into the model object cache accumulated in planning a graph operation. * @param propertyValueClass the full name of the model class that declares the given property * @param propertyName a property name, may be nested * @param id the ID of the model object doing the linking * @return the class and ID of the model objects that are linked to by the given object, never {@code null} */ public SetMultimap<String, Long> getLinkeds(String propertyValueClass, String propertyName, Long id) { if (!progress.contains(Milestone.PLANNED)) { throw new IllegalStateException("operation not yet planned"); } final SetMultimap<String, Long> linkeds = HashMultimap.create(); for (final CI linked : planning.forwardLinksCached.get(new CPI(propertyValueClass, propertyName, id))) { linkeds.put(linked.className, linked.id); } return linkeds; }
for (final Entry<String, String> forwardLink : model.getLinkedTo(superclassName)) { final CPI linkSource = new CPI (superclassName, forwardLink.getValue(), object.id); for (final CI linked : planning.forwardLinksCached.get(linkSource)) { final CPI linkTarget = new CPI (backwardLink.getKey(), backwardLink.getValue(), object.id); for (final CI linker : planning.backwardLinksCached.get(linkTarget)) {
/** * Construct a {@link CPI} from this {@link CP} and the given instance ID. * @param id an instance ID * @return a {@link CPI} with the corresponding values */ CPI toCPI(long id) { return new CPI(className, propertyName, id); }