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.