private boolean isPresent(String constraint, TaskConstraints t) { if (t == null) { return false; } if (t.getConstraint(constraint) == null) { return false; } return true; }
public boolean checkConstraints(BoundContact resource, TaskConstraints tc) { if (isPresent("trfqn", tc)) { FQN tr = (FQN) tc.getConstraint("trfqn"); try { List l = this.tc.getTCEntries(tr, resource.getHost(), TCType.INSTALLED); if (l == null || l.isEmpty()) { return false; } else { return true; } } catch (Exception e) { logger.warn("Exception caught while querying TC", e); return false; } } else { return true; } }