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

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


            log.info("No history with id " + jobId + " found");
            throw new StuffNotFoundException("OperationHistory with id " + jobId);
        }

        history = list.get(0);
        OperationHistoryRest hist = historyToHistoryRest(history, uriInfo);
        Response.ResponseBuilder builder;
        if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) {
            builder = Response.ok(renderTemplate("operationHistory.ftl",hist));
        } else {
            builder = Response.ok(hist);
View Full Code Here


        PageList<ResourceOperationHistory> histories = opsManager.findResourceOperationHistoriesByCriteria(caller, criteria);

        List<OperationHistoryRest> result = new ArrayList<OperationHistoryRest>();
        for (ResourceOperationHistory roh : histories) {
            OperationHistoryRest historyRest = historyToHistoryRest(roh,uriInfo);
            result.add(historyRest);
        }

        MediaType mediaType = httpHeaders.getAcceptableMediaTypes().get(0);
        Response.ResponseBuilder builder = Response.ok();
View Full Code Here

        }
        else {
            status = history.getStatus().getDisplayName();
        }

        OperationHistoryRest hist = new OperationHistoryRest();
        hist.setStatus(status);
        if (history.getResource()!=null) {
            hist.setResourceName(history.getResource().getName());
        }
        hist.setOperationName(history.getOperationDefinition().getName());
        hist.lastModified(history.getModifiedTime());
        if (history.getErrorMessage()!=null) {
            hist.setErrorMessage(history.getErrorMessage());
        }
        if (history.getResults()!=null) {
            Configuration results = history.getResults();
            for (Property p : results.getProperties()) {
                String val;
                if (p instanceof PropertySimple) {
                    val = ((PropertySimple)p).getStringValue();
                }
                else {
                    val = p.toString();
                }
                hist.getResult().put(p.getName(),val);
            }
        }

        String jobName = history.getJobName();
        String jobGroup = history.getJobGroup();
        JobId jobId = new JobId(jobName, jobGroup);
        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.OperationHistoryRest

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.