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

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


        UriBuilder uriBuilder;
        if (originalList.getTotalSize() > (page +1 ) * pageControl.getPageSize()) {
            int nextPage = page +1;
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",nextPage);
            pColl.addLink(new Link("next",uriBuilder.build().toString()));
        }
        if (page > 0) {
            int prevPage = page -1;
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",prevPage);
            pColl.addLink(new Link("prev",uriBuilder.build().toString()));
        }

        // A link to the last page
        if (!pageControl.isUnlimited()) {
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",lastPage);
            pColl.addLink( new Link("last",uriBuilder.build().toString()));
        }

        // A link to the current page
        uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
        pColl.addLink(new Link("current",uriBuilder.build().toString()));

        builder.entity(pColl);
    }
View Full Code Here


        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

        URI uri = uriBuilder.build();

        String href = uri.toString();
        href = href.replaceAll("%2F","/");
        Link link = new Link("coregui", href);

        return link;

    }
View Full Code Here

        URI uri;
        if (definition.getDataType() == DataType.MEASUREMENT) {
            uriBuilder = uriInfo.getBaseUriBuilder();
            uriBuilder.path("/metric/data/{id}");
            uri = uriBuilder.build(schedule.getId());
            Link metricLink = new Link("metric", uri.toString());
            ms.addLink(metricLink);
            uriBuilder = uriInfo.getBaseUriBuilder();
            uriBuilder.path("/metric/data/{id}/raw");
            uri = uriBuilder.build(schedule.getId());
            metricLink = new Link("metric-raw", uri.toString());
            ms.addLink(metricLink);
        }
        // create link to the resource
        uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("resource/" + schedule.getResource().getId());
        uri = uriBuilder.build();
        Link link = new Link("resource", uri.toString());
        ms.addLink(link);
        return ms;
    }
View Full Code Here

                target += ".xml";
            } else {
                log.error("Unknown media type " + mediaType);
                throw new WebApplicationException(Response.Status.NOT_ACCEPTABLE);
            }
            Link link = new Link(rel,target);
            links.add(link);
        }

        if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) {
            builder = Response.ok(renderTemplate("index",links));
View Full Code Here

            // Add some links
            if (resourceId!=null) {
                UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
                uriBuilder.path("/operation/definition/{id}");
                uriBuilder.queryParam("resourceId",resourceId);
                Link createLink = new Link("create",uriBuilder.build(definitionId).toString());
                odr.addLink(createLink);
            }

        }
View Full Code Here

                copyParamsForDefinition(def,odr);

                UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
                uriBuilder.path("/operation/definition/{id}");
                uriBuilder.queryParam("resourceId",resourceId);
                Link createLink = new Link("create",uriBuilder.build(def.getId()).toString());
                odr.addLink(createLink);

                resultList.add(odr);
            }
View Full Code Here

        }

        UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/operation/{id}");
        URI uri = uriBuilder.build(operationRest.getId());
        Link editLink = new Link("edit",uri.toString());
        operationRest.addLink(editLink);
        Response.ResponseBuilder builder = Response.ok(operationRest);

        putToCache(operationRest.getId(),OperationRest.class,operationRest);
View Full Code Here

                    parameters,"Test");
            JobId jobId = new JobId(sched.getJobName(),sched.getJobGroup());
            UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
            uriBuilder.path("/operation/history/{id}");
            URI uri = uriBuilder.build(jobId);
            Link histLink = new Link("history",uri.toString());
            operation.addLink(histLink);

        }
        else {
            UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
            uriBuilder.path("/operation/{id}");
            URI uri = uriBuilder.build(operationId);
            Link editLink = new Link("edit",uri.toString());
            operation.addLink(editLink);
        }
        // Update item in cache
        putToCache(operationId,OperationRest.class,operation);
        Response.ResponseBuilder builder = Response.ok(operation);
View Full Code Here

        hist.setJobId(jobId.toString());

        UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
        uriBuilder.path("/operation/history/{id}");
        URI url = uriBuilder.build(jobId);
        Link self = new Link("self",url.toString());
        hist.getLinks().add(self);
        return hist;
    }
View Full Code Here

TOP

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

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.