Package org.rhq.core.domain.criteria

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


                    resId);
                assert currentAvailability != null : "Current Availability was null for " + resId;
                assert currentAvailability.getAvailabilityType() == UNKNOWN : "Current AvailabilityType should have been UNKNOWN for "
                    + resId;

                AvailabilityCriteria c = new AvailabilityCriteria();
                c.addFilterResourceId(resId);
                c.addFilterInterval(0L, Long.MAX_VALUE);
                c.addSortStartTime(PageOrdering.ASC);
                List<Availability> allData = availabilityManager.findAvailabilityByCriteria(overlord, c);
                assert allData != null : "All availabilities was null for " + resId;
                assert allData.size() == 1 : "All availabilities size was " + allData.size() + " for " + resId;

                ResourceAvailability currentResAvail = resourceAvailabilityManager.getLatestAvailability(resId);
View Full Code Here


     * @return the rowcount
     *
     * @throws Exception
     */
    private List<Availability> getResourceAvailabilities(Resource r) throws Exception {
        AvailabilityCriteria c = new AvailabilityCriteria();
        c.addFilterResourceId(r.getId());
        c.addSortStartTime(PageOrdering.ASC);
        return availabilityManager.findAvailabilityByCriteria(overlord, c);
    }
View Full Code Here

        List<Availability> result;
        Date startDate = new Date(startTime);
        Date endDate = new Date(endTime);

        AvailabilityCriteria c = new AvailabilityCriteria();
        c.addFilterResourceId(resourceId);
        c.addFilterInterval(startTime, endTime); // reduce by 1 ms to fake exclusive end time on the range.
        c.addSortStartTime(PageOrdering.ASC);
        result = findAvailabilityByCriteria(subject, c);

        // The criteria interval filter is inclusive.  But since availN(endTime) == availN+1(startTime) we can get
        // unwanted avails in the query result, when the range falls on an avail border.
        // For example, assume the following three Availability records exist:
View Full Code Here

        Date fullRangeBeginDate = new Date(fullRangeBeginTime);
        Date fullRangeEndDate = new Date(fullRangeEndTime);

        try {
            if (context.type == EntityContext.Type.Resource) {
                AvailabilityCriteria c = new AvailabilityCriteria();
                c.addFilterResourceId(context.resourceId);
                c.addFilterInterval(fullRangeBeginTime, fullRangeEndTime);
                c.addSortStartTime(PageOrdering.ASC);
                availabilities = findAvailabilityByCriteria(subject, c);

            } else if (context.type == EntityContext.Type.ResourceGroup) {
                availabilities = findResourceGroupAvailabilityWithinInterval(context.groupId, fullRangeBeginDate,
                    fullRangeEndDate);
View Full Code Here

        long duration = Long.valueOf(infoMap.get(DATAMAP_DURATION)); // in seconds
        long durationStart = Long.valueOf(infoMap.get(DATAMAP_START_TIME)); // in milliseconds
        AlertConditionOperator operator = AlertConditionOperator.valueOf(infoMap.get(DATAMAP_OPERATOR));

        // get the availabilities for the duration period, one consistent duration will indicate a duration condition
        AvailabilityCriteria criteria = new AvailabilityCriteria();
        criteria.addFilterResourceId(resourceId);
        long durationEnd = durationStart + (duration * 1000);
        criteria.addFilterInterval((durationStart + 1), (durationEnd - 1)); // reduced 1ms to fake exclusive interval filter.
        criteria.addSortStartTime(PageOrdering.ASC);
        List<Availability> avails = LookupUtil.getAvailabilityManager().findAvailabilityByCriteria(
            LookupUtil.getSubjectManager().getOverlord(), criteria);

        // Although unlikely, it's possible the resource has actually gone away while we waited out the duration period.
        // If we can't find any resource avail assume the resource is gone and just end the job.
View Full Code Here

            end = System.currentTimeMillis();

        if (start==0)
            start = end - (30*86400*1000L); // 30 days

        AvailabilityCriteria criteria = new AvailabilityCriteria();
        criteria.addFilterInterval(start,end);
        criteria.addFilterResourceId(resourceId);
        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;
View Full Code Here

TOP

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

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.