/** * Lookup the #Collection instance which represents this object * * i.e. for a VM tag (i.e. a Tag object which its VM property set) * return the #Collection instance which encapsulates AssignedTagResource, * AssignedTagsResource and VM. * * @param model the object to query for * @return the #Collection instance representing the object's collection */ private static Collection getCollection(BaseResource model) { return getCollection(model, null); }
Collection collection = getCollection(model, suggestedParentType); if (collection == null) { return null; BaseResource parent = getParentModel(model, collection.getParentType()); Collection parentCollection = getCollection(parent, suggestedParentType);
/** * Construct the set of action links for an object * * @param uriInfo the URI info * @param model the object * @param suggestedParentType the suggested parent type * @return the object, including its set of action links */ private static <R extends BaseResource> void setActions(UriInfo uriInfo, R model, Class<? extends BaseResource> suggestedParentType) { Collection collection = getCollection(model); UriBuilder uriBuilder = getUriBuilder(uriInfo, model, suggestedParentType); if (uriBuilder != null) { ActionsBuilder actionsBuilder = new ActionsBuilder(uriBuilder, collection.getResourceType()); model.setActions(actionsBuilder.build()); } }