Package org.rhq.enterprise.server.rest.domain

Examples of org.rhq.enterprise.server.rest.domain.GroupRest


                             @Context HttpHeaders headers,
                             @Context UriInfo uriInfo) {

        ResourceGroup group = fetchGroup(id, false);

        GroupRest groupRest = fillGroup(group, uriInfo);

        MediaType mediaType = headers.getAcceptableMediaTypes().get(0);

        Response.ResponseBuilder builder = Response.ok();
        builder.type(mediaType);
View Full Code Here


        // TODO if comp group and no resourceTypeId set, shall we allow to have it change to a mixed group?
        resourceGroupManager.addResourcesToGroup(caller,id,new int[]{resourceId});

        resourceGroup = fetchGroup(id, false);
        GroupRest gr = fillGroup(resourceGroup,uriInfo);

        Response.ResponseBuilder builder = Response.ok();
        builder.entity(gr);
        builder.type(mediaType);
        return builder.build();
View Full Code Here

            try {
                /*
                * In theory we should not have any bad group ids in favorites, but ...
                */
                ResourceGroup res = resourceGroupManager.getResourceGroup(caller, id);
                GroupRest rwt = fillGroup(res, uriInfo);
                ret.add(rwt);
            }
            catch (ResourceGroupNotFoundException e) {
                log.debug("Favorite group with id " + id + " not found - not returning to the user");
            }
View Full Code Here

        return resourceGroup;
    }

    protected GroupRest fillGroup(ResourceGroup group, UriInfo uriInfo) {

        GroupRest gr = new GroupRest(group.getName());
        gr.setId(group.getId());
        gr.setCategory(group.getGroupCategory());
        gr.setRecursive(group.isRecursive());
        if (group.getGroupDefinition()!=null) {
            gr.setDynaGroupDefinitionId(group.getGroupDefinition().getId());
        }
        gr.setExplicitCount(group.getExplicitResources().size());
        gr.setImplicitCount(group.getImplicitResources().size());
        UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/group/{id}");
        URI uri = uriBuilder.build(group.getId());
        Link link = new Link("edit",uri.toASCIIString());
        gr.getLinks().add(link);
        gr.getLinks().add(getLinkToGroup(group,uriInfo, "self"));

        uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/group/{id}/metricDefinitions");
        uri = uriBuilder.build(group.getId());
        link = new Link("metricDefinitions",uri.toASCIIString());
        gr.getLinks().add(link);

        gr.getLinks().add(createUILink(uriInfo,UILinkTemplate.GROUP,group.getId()));

        return gr;
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.rest.domain.GroupRest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.