if (collection.getParentType() != NO_PARENT) { BaseResource parent = getParentModel(model, collection.getParentType()); String path = getPath(collection.getCollectionType(), parentCollection.getResourceType(), model.getClass()); String path = getPath(collection.getCollectionType()); uriBuilder = uriInfo != null ? UriBuilder.fromPath(uriInfo.getBaseUri().getPath()).path(path)
/** * 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()); } }
public void add(Class<?> resourceType, Class<?> collectionType, Class<? extends BaseResource> parentType) { put(parentType, new Collection(resourceType, collectionType, parentType)); } }