Search in sources :

Example 1 with ManagedItemCollection

use of org.platformlayer.core.model.ManagedItemCollection in project platformlayer by platformlayer.

the class ManagedItemResource method listChildren.

@GET
@Produces({ XML, JSON })
@Path("children")
public ManagedItemCollection<ItemBase> listChildren(@QueryParam("deleted") boolean includeDeleted) throws OpsException, RepositoryException {
    boolean fetchTags = true;
    ItemBase item = getManagedItem(fetchTags);
    Tag parentTag = Tag.buildParentTag(item.getKey());
    Filter filter = TagFilter.byTag(parentTag);
    if (!includeDeleted) {
        filter = StateFilter.excludeDeleted(filter);
    }
    List<ItemBase> roots = itemService.listAll(getProjectAuthorization(), filter);
    ManagedItemCollection<ItemBase> collection = new ManagedItemCollection<ItemBase>();
    collection.items = roots;
    return cleanup(collection);
}
Also used : ItemBase(org.platformlayer.core.model.ItemBase) StateFilter(org.platformlayer.StateFilter) TagFilter(org.platformlayer.TagFilter) Filter(org.platformlayer.Filter) ManagedItemCollection(org.platformlayer.core.model.ManagedItemCollection) Tag(org.platformlayer.core.model.Tag) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Filter (org.platformlayer.Filter)1 StateFilter (org.platformlayer.StateFilter)1 TagFilter (org.platformlayer.TagFilter)1 ItemBase (org.platformlayer.core.model.ItemBase)1 ManagedItemCollection (org.platformlayer.core.model.ManagedItemCollection)1 Tag (org.platformlayer.core.model.Tag)1