@Override public String toString() { return "AllRestriction [restrictions=" + getRestrictions() + "]"; } }
public static AllRestriction and(final Restriction... restrictions) { return new AllRestriction(restrictions); }
@Override public String toString() { return "AllRestriction [restrictions=" + getRestrictions() + "]"; } }
public static AllRestriction all(final Restriction... restrictions) { return new AllRestriction(restrictions); }
@Override public void visitAll(final AllRestriction restriction) { for (final Restriction r : restriction.getRestrictions()) { r.visit(this); } } @Override public void visitAllComplete(final AllRestriction restriction) {}
public static AllRestriction and(final Restriction... restrictions) { return new AllRestriction(restrictions); }
@Override public void visitAll(final AllRestriction restriction) { for (final Restriction r : restriction.getRestrictions()) { r.visit(this); } } @Override public void visitAllComplete(final AllRestriction restriction) {}
public static AllRestriction all(final Restriction... restrictions) { return new AllRestriction(restrictions); }
@Override public void visitAllComplete(final AllRestriction restriction) { final int restrictionSize = restriction.getRestrictions().size(); final int criterionSize = m_criterions.size(); if (criterionSize < restrictionSize) { throw new IllegalStateException("AllRestriction with " + restrictionSize + " entries encountered, but we only have " + criterionSize + " criterions!"); } final List<Criterion> criterions = m_criterions.subList(criterionSize - restrictionSize, criterionSize); final Junction j = org.hibernate.criterion.Restrictions.conjunction(); for (final Criterion crit : criterions) { j.add(crit); } criterions.clear(); m_criterions.add(j); }
public static AllRestriction all(final Collection<Restriction> restrictions) { return new AllRestriction(restrictions.toArray(EMPTY_RESTRICTION_ARRAY)); }
@Override public void visit(final RestrictionVisitor visitor) { visitor.visitAll(this); for (final Restriction restriction : getRestrictions()) { restriction.visit(visitor); } visitor.visitAllComplete(this); }
public static AllRestriction all(final Collection<Restriction> restrictions) { return new AllRestriction(restrictions.toArray(EMPTY_RESTRICTION_ARRAY)); }
@Override public void visit(final RestrictionVisitor visitor) { visitor.visitAll(this); for (final Restriction restriction : getRestrictions()) { restriction.visit(visitor); } visitor.visitAllComplete(this); }
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)); }