@Override public String toString() { return "LeRestriction [attribute=" + getAttribute() + ", value=" + getValue() + "]"; } }
public static LeRestriction le(final String attribute, final Object comparator) { return new LeRestriction(attribute, comparator); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void visitLe(final LeRestriction restriction) { final Object o = getProperty(restriction); if (o instanceof java.lang.Number && restriction.getValue() instanceof java.lang.Number) { final BigDecimal left = new BigDecimal(((Number)o).doubleValue()); final BigDecimal right = new BigDecimal(((Number)restriction.getValue()).doubleValue()); if (left.compareTo(right) <= 0) return; } else if (o instanceof Comparable) { try { final Comparable oC = (Comparable)o; final Comparable oV = (Comparable)restriction.getValue(); if (oC.compareTo(oV) <= 0) { return; } } catch (final ClassCastException e) {} } fail(restriction); } @Override public void visitLeComplete(final LeRestriction restriction) {}
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void visitLe(final LeRestriction restriction) { final Object o = getProperty(restriction); if (o instanceof java.lang.Number && restriction.getValue() instanceof java.lang.Number) { final BigDecimal left = new BigDecimal(((Number)o).doubleValue()); final BigDecimal right = new BigDecimal(((Number)restriction.getValue()).doubleValue()); if (left.compareTo(right) <= 0) return; } else if (o instanceof Comparable) { try { final Comparable oC = (Comparable)o; final Comparable oV = (Comparable)restriction.getValue(); if (oC.compareTo(oV) <= 0) { return; } } catch (final ClassCastException e) {} } fail(restriction); } @Override public void visitLeComplete(final LeRestriction restriction) {}
@Override public String toString() { return "LeRestriction [attribute=" + getAttribute() + ", value=" + getValue() + "]"; } }
public static LeRestriction le(final String attribute, final Object comparator) { return new LeRestriction(attribute, comparator); }
@Override public void visitLe(final LeRestriction restriction) { m_criterions.add(org.hibernate.criterion.Restrictions.le(restriction.getAttribute(), restriction.getValue())); }
private Map<Integer, List<OnmsOutage>> getOutages(List<Integer> nodeIds, List<String> serviceNames, Date start, Date end) { if (nodeIds == null || nodeIds.size() == 0) { return Maps.newHashMap(); } final CriteriaBuilder builder = new CriteriaBuilder(OnmsOutage.class) // The outage must have started before the end of the window .le("ifLostService", end) .or(new NullRestriction("ifRegainedService"), // The outage is ongoing new AllRestriction( // or the outage was cleared somewhere in the window new GtRestriction("ifRegainedService", start), new LeRestriction("ifRegainedService", end)) ) // Only select outages affecting our nodes .alias("monitoredService", "monitoredService") .alias("monitoredService.ipInterface", "ipInterface") .alias("ipInterface.node", "node") .eq("ipInterface.isManaged", "M") .in("node.id", nodeIds); // Only select outages affecting services with the given names, if set if (serviceNames != null && serviceNames.size() > 0) { builder.alias("monitoredService.serviceType", "serviceType") .in("serviceType.name", serviceNames); } // Retrieve the outages and group them by node id return m_outageDao.findMatching(builder.toCriteria()).stream() .collect(Collectors.groupingBy(OnmsOutage::getNodeId)); }