Package org.rhq.core.domain.criteria

Examples of org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria


            log.debug("Received request to generate report for " + caller);
        }
        return new StreamingOutput() {
            @Override
            public void write(OutputStream stream) throws IOException, WebApplicationException {
                final ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
                criteria.addSortEndTime(PageOrdering.DESC);

                if(startTime != null){
                    criteria.addFilterStartTime(startTime);
                }
                if(endTime != null){
                    criteria.addFilterEndTime(endTime);
                }
                // lets default the end time for them to now if they didn't enter it
                if(startTime != null && endTime == null){
                    Date today = new Date();
                    criteria.addFilterEndTime(today.getTime());
                }


                List<OperationRequestStatus> operationRequestStatusList = new ArrayList<OperationRequestStatus>(10);
                String statuses[] = operationRequestStatus.split(",");
                for (String requestStatus : statuses) {
                    log.info("OperationRequestStatus Filter set for: " + requestStatus);
                    operationRequestStatusList.add(OperationRequestStatus.valueOf(requestStatus.toUpperCase()));
                }
                criteria.addFilterStatuses(operationRequestStatusList.toArray(new OperationRequestStatus[operationRequestStatusList.size()]));

                CriteriaQueryExecutor<ResourceOperationHistory, ResourceOperationHistoryCriteria> queryExecutor =
                        new CriteriaQueryExecutor<ResourceOperationHistory, ResourceOperationHistoryCriteria>() {
                            @Override
                            public PageList<ResourceOperationHistory> execute(ResourceOperationHistoryCriteria criteria) {
View Full Code Here


            @Context UriInfo uriInfo,
            @Context HttpHeaders httpHeaders) {

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

        ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
        JobId jobId = new JobId(jobName);
        criteria.addFilterJobId(jobId);

        ResourceOperationHistory history ;//= opsManager.getOperationHistoryByJobId(caller,jobName);
        List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
        if (list==null || list.isEmpty()) {
            log.info("No history with id " + jobId + " found");
View Full Code Here

            @ApiParam("Page size for paging") @QueryParam("ps") @DefaultValue("20") int pageSize,
            @ApiParam("Page for paging, 0-based") @QueryParam("page") Integer page,
            @Context UriInfo uriInfo,
            @Context HttpHeaders httpHeaders) {

        ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
        criteria.addSortStartTime(PageOrdering.ASC);
        if (resourceId>0) {
            criteria.addFilterResourceIds(resourceId);
        }
        if (page!=null) {
            criteria.setPaging(page,pageSize);
        }

        criteria.addSortEndTime(PageOrdering.DESC);

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

        List<OperationHistoryRest> result = new ArrayList<OperationHistoryRest>();
        for (ResourceOperationHistory roh : histories) {
View Full Code Here

        @ApiError(code = 406, reason = "Passed Job ID did not pass name validation")
    })
    public Response deleteOperationHistoryItem(@ApiParam("Name fo the submitted job") @PathParam("id") String jobName,
                                               @ApiParam("Validate if the job exists") @QueryParam("validate") @DefaultValue("false") boolean validate) {

        ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
        JobId filterJobId;
        try {
            filterJobId = new JobId(jobName);
        } catch (Exception e) {
            // jobName most likely did not match the expected format
            throw new BadArgumentException("jobName","Does not match the format for job history items");
        }
        criteria.addFilterJobId(filterJobId);
        criteria.clearPaging();//disable paging as the code assumes all the results will be returned.

        List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
        if ((list != null && !list.isEmpty())) {

            ResourceOperationHistory history = list.get(0);
View Full Code Here

        //waiting for the operation result then return it
        int iteration = 0;
        boolean successResultFound = false;
        while (iteration < maxIterations && !successResultFound) {
            ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
            criteria.addFilterResourceIds(storageNodeResource.getId());
            criteria.addFilterStartTime(operationStartTime);
            criteria.addFilterOperationName(operationToRun);
            criteria.addFilterStatus(OperationRequestStatus.SUCCESS);
            criteria.setPageControl(PageControl.getUnlimitedInstance());

            PageList<ResourceOperationHistory> results = operationManager.findResourceOperationHistoriesByCriteria(
                subject, criteria);

            if (results != null && results.size() > 0) {
View Full Code Here

                        log.debug("Found operation schedule, unscheduling " + schedule);
                    }
                    operationManager.unscheduleResourceOperation(subject, schedule.getJobId().toString(),
                        resource.getId());
                    // delete history items that have been scheduled but not yet started
                    ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
                    criteria.setPageControl(PageControl.getUnlimitedInstance());
                    criteria.addFilterJobId(schedule.getJobId());
                    criteria.addFilterStatus(OperationRequestStatus.INPROGRESS);
                    criteria.addFilterStartTime(Long.valueOf(0));
                    PageList<ResourceOperationHistory> historyItems = operationManager
                        .findResourceOperationHistoriesByCriteria(subject, criteria);
                    Iterator<ResourceOperationHistory> iter = historyItems.iterator();
                    if (iter.hasNext()) {
                        if (log.isDebugEnabled()) {
View Full Code Here

        System.out.println(generator.getQueryString(false));
        System.out.println(generator.getQueryString(true));
    }

    public static void testInheritanceCriteria() {
        ResourceOperationHistoryCriteria historyCriteria = new ResourceOperationHistoryCriteria();
        historyCriteria.addFilterResourceIds(1);
        historyCriteria.addFilterStatus(OperationRequestStatus.FAILURE);

        Subject overlord = LookupUtil.getSubjectManager().getOverlord();
        CriteriaQueryGenerator generator = new CriteriaQueryGenerator(overlord, historyCriteria);
        System.out.println(generator.getQueryString(false));
        System.out.println(generator.getQueryString(true));
View Full Code Here

    protected ResourceOperationHistory findOperationHistory(String name, String group,
        OperationManagerLocal operationManager, ResourceOperationSchedule schedule) {

        JobId jobId = new JobId(name, group);

        ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
        criteria.addFilterJobId(jobId);
        criteria.fetchOperationDefinition(true);
        criteria.fetchParameters(true);
        criteria.fetchResults(true);

        ResourceOperationHistory history;
        List<ResourceOperationHistory> list = operationManager.findResourceOperationHistoriesByCriteria(
            schedule.getSubject(), criteria);
        if (list == null || list.isEmpty()) {
View Full Code Here

                public void execute() {
                    ResourceOperationScheduleDetailsView.super.init(isReadOnly);
                }
            });

            ResourceOperationHistoryCriteria historyCriteria = new ResourceOperationHistoryCriteria();
            historyCriteria.addFilterId(getOperationExampleId());
            historyCriteria.fetchOperationDefinition(true);
            historyCriteria.fetchParameters(true);
            historyCriteria.setPageControl(PageControl.getSingleRowInstance());
            GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(historyCriteria,
                new LoadExampleCallback(latch));

        } else {
            super.init(isReadOnly);
View Full Code Here

        return items;
    }

    protected void lookupDetails(int historyId) {
        ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();

        criteria.addFilterId(historyId);

        criteria.fetchOperationDefinition(true);
        criteria.fetchParameters(true);
        criteria.fetchResults(true);

        GWTServiceLookup.getOperationService().findResourceOperationHistoriesByCriteria(criteria,
            new AsyncCallback<PageList<ResourceOperationHistory>>() {
                public void onFailure(Throwable caught) {
                    CoreGUI.getErrorHandler()
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria

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.