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

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


    @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID)
    @ApiOperation(value = "Return the current availability for the passed resource", responseClass = "AvailabilityRest")
    public Response getAvailability(@ApiParam("Id of the resource to query") @PathParam("id") int resourceId, @Context HttpHeaders headers) {

        Availability avail = availMgr.getCurrentAvailabilityForResource(caller, resourceId);
        AvailabilityRest availabilityRest;
        if (avail.getAvailabilityType() != null)
            availabilityRest = new AvailabilityRest(avail.getAvailabilityType(), avail.getStartTime(), avail
                .getResource().getId());
        else
            availabilityRest = new AvailabilityRest(avail.getStartTime(), resourceId);

        MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
        Response.ResponseBuilder builder;

        if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) {
View Full Code Here


        criteria.addSortStartTime(PageOrdering.DESC);

        List<Availability> points = availMgr.findAvailabilityByCriteria(caller, criteria);
        List<AvailabilityRest> ret = new ArrayList<AvailabilityRest>(points.size());
        for (Availability avail : points) {
            AvailabilityRest availabilityRest;
            if (avail.getAvailabilityType() != null) {
                availabilityRest = new AvailabilityRest(avail.getAvailabilityType(), avail.getStartTime(), avail
                    .getResource().getId());
            }
            else {
                availabilityRest = new AvailabilityRest(avail.getStartTime(), resourceId);
            }
            if (avail.getEndTime()!=null)
                availabilityRest.setUntil(avail.getEndTime());
            ret.add(availabilityRest);
        }
        MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
        Response.ResponseBuilder builder;
View Full Code Here

TOP

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

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.