@Override public int compare(Criterion o1, Criterion o2) { if (o1.getName() == null) { return 1; } if (o2.getName() == null) { return -1; } return o1.getName().toLowerCase() .compareTo(o2.getName().toLowerCase()); }
private void addCriterion(CriterionType type, Criterion criterion) { String pattern = criterion.getName() + " ( " + type.getName() + " )"; getListMatching() .add( new FilterPair( TaskElementFilterEnum.Criterion, type.getResource().toLowerCase(), pattern, criterion)); }
@Test public void ifItsDifferentThereIsOther() { Criterion c = transactionService.runOnTransaction( new IOnTransaction<Criterion>() { @Override public Criterion execute() { return givenASavedCriterionWithAnExistentType(); } }); Criterion copy = Criterion.create(c.getName(), c.getType()); assertTrue(criterionDAO.thereIsOtherWithSameNameAndType(copy)); }
private void searchInCriterions(CriterionType type, String filter) { List<Criterion> list = getMapCriterions().get(type); if (list == null) { return; } for (Criterion criterion : list) { String name = StringUtils.deleteWhitespace(criterion.getName().toLowerCase()); if (name.contains(filter)) { addCriterion(type, criterion); if ((filter.length() < 3) && (getListMatching().size() > 9)) { return; } } } }
private void reattachCriterion(Criterion criterion) { criterionDAO.reattachUnmodifiedEntity(criterion); criterion.getName(); reattachCriterionType(criterion.getType()); }
private Criterion anotherCriterionWithSameNameAndType(Criterion c) { return Criterion.create(c.getName(), c.getType()); }
public boolean isEquivalent(Criterion other) { return new EqualsBuilder().append(getName(), other.getName()) .append(getType(), other.getType()).isEquals(); }