@Override
        public void render(Listitem item, Object data) {
            Resource resource = (Resource) data;
            item.setValue(data);

            item.appendChild(new Listcell(resource.getShortDescription()));
        }
 private List<Resource> reloadResources(
         Collection<? extends Resource> resources) {
     List<Resource> result = new ArrayList<Resource>();
     for (Resource each: resources) {
         result.add(resourceDAO.findExistingEntity(each.getId()));
     }
     return result;
 }
 private boolean areAllLimitingResources(
         Collection<? extends Resource> resources) {
     for (Resource resource : resources) {
         if (!resource.isLimitingResource()) {
             return false;
         }
     }
     return true;
 }
    private boolean isNew(Resource resource) {
        LimitingAllocationRow allocationRow = getLimitingAllocationRow();

        if (allocationRow == null || allocationRow.isGeneric()) {
            return true;
        }

        final Resource taskResource = getAssociatedResource();
        if (taskResource != null) {
            return (!resource.getId().equals(taskResource.getId()));
        }
        return true;
    }
 private void searchInResources(String filter) {
   Map<Class<?>, List<Resource>> mapResources = databaseSnapshots.snapshotMapResources();
   for (Class<?> className : mapResources.keySet()) {
     for (Resource resource : mapResources.get(className)) {
       String name = StringUtils.deleteWhitespace(resource.getName().toLowerCase());
       if (name.contains(filter)) {
         addResource(className, resource);
         if ((filter.length() < 3) && (getListMatching().size() > 9)) {
           return;
         }
       }
     }
   }
 }
 private void addResource(Class className, Resource resource) {
   String pattern = resource.getName();
   getListMatching()
       .add(
           new FilterPair(
               TaskElementFilterEnum.Resource, className.getSimpleName(), pattern, resource));
 }
    private boolean isNew(Collection<? extends Criterion> criteria,
            Collection<? extends Resource> resources) {
        LimitingAllocationRow allocationRow = getLimitingAllocationRow();

        if (allocationRow == null || allocationRow.isSpecific()) {
            return true;
        }

        Set<Long> allocatedResourcesIds = allocationRow.getResourcesIds();
        for (Resource each: resources) {
            if (!allocatedResourcesIds.contains(each.getId())) {
                return true;
            }
        }

        Set<Long> allocatedCriteriaIds = allocationRow.getCriteriaIds();
        for (Criterion each: criteria) {
            if (!allocatedCriteriaIds.contains(each.getId())) {
                return true;
            }
        }
        return false;
    }
 @Override
 public String objectToString(Object obj) {
     Resource resource = (Resource) obj;
     return resource.getShortDescription();
 }
 @Override
 public boolean entryMatchesText(Object obj, String text) {
     Resource resource = (Resource) obj;
     text = StringUtils.trim(text.toLowerCase());
     return checkContainsText(resource.getShortDescription(), text);
 }