List of usage examples for org.apache.commons.collections CollectionUtils collect
public static Collection collect(Iterator inputIterator, final Transformer transformer, final Collection outputCollection)
From source file:org.kuali.mobility.news.service.NewsServiceImpl.java
@Override @GET/* www. j a v a 2s . c o m*/ @Path("/sources/getAllActive") public List<NewsSourceImpl> getAllActiveNewsSources(@QueryParam("compact") Boolean compact) { LOG.debug("Called getAllActiveNewsSources web service."); List<NewsSourceImpl> sources = new ArrayList<NewsSourceImpl>(); if (null == compact || !compact.booleanValue()) { LOG.debug("Returning list of sources not compacted."); CollectionUtils.collect(getDao().findAllActiveNewsSources(), new NewsSourceTransform(), sources); } else { LOG.debug("Returning list of sources compacted without articles."); CollectionUtils.collect(getDao().findAllActiveNewsSources(), new CompactNewsSourceTransform(), sources); } Collections.sort(sources, new NewsServiceSort()); return sources; }
From source file:org.kuali.mobility.news.service.NewsServiceImpl.java
@Override @GET/*from www . j ava 2 s . c om*/ @Path("/sources/getAllActive/{parentId}") public List<NewsSourceImpl> getAllActiveNewsSources(@PathParam("parentId") final Long parentId, @QueryParam("compact") Boolean compact) { LOG.debug("Called getAllActiveNewsSources web service."); List<NewsSourceImpl> sources = new ArrayList<NewsSourceImpl>(); if (null != compact && compact.booleanValue()) { CollectionUtils.collect(getDao().findAllActiveNewsSources(parentId), new CompactNewsSourceTransform(), sources); } else { CollectionUtils.collect(getDao().findAllActiveNewsSources(parentId), new NewsSourceTransform(), sources); } Collections.sort(sources, new NewsServiceSort()); return sources; }
From source file:org.kuali.mobility.news.service.NewsServiceImpl.java
@Override @GET/*from w w w .j a v a2 s . c o m*/ @Path("/sources/getChildNewsSource/{parentId}") public List<NewsSourceImpl> getNewsSources(@PathParam("parentId") final Long parentId, @QueryParam("active") final Boolean isActive) { List<NewsSourceImpl> sources = new ArrayList<NewsSourceImpl>(); CollectionUtils.collect(getDao().findNewsSources(parentId, isActive), new NewsSourceTransform(), sources); return sources; }
From source file:org.kuali.mobility.news.util.NewsSourceTransform.java
@Override public NewsSourceImpl transform(Object obj) { NewsSourceImpl proxy = null;//w w w. j a v a2 s .c o m if (obj != null) { if (obj instanceof NewsSourceImpl) { proxy = (NewsSourceImpl) obj; if (proxy.getChildren() != null && proxy.getChildren().size() > 0) { proxy.setHasChildren(true); } } else if (obj instanceof NewsSource) { proxy = new NewsSourceImpl(); proxy.setActive(((NewsSource) obj).isActive()); proxy.setAuthor(((NewsSource) obj).getAuthor()); proxy.setDescription(((NewsSource) obj).getDescription()); proxy.setId(((NewsSource) obj).getId()); proxy.setName(((NewsSource) obj).getName()); proxy.setOrder(((NewsSource) obj).getOrder()); proxy.setParentId(((NewsSource) obj).getParentId()); proxy.setTitle(((NewsSource) obj).getTitle()); proxy.setUrl(((NewsSource) obj).getUrl()); proxy.setHasChildren(((NewsSource) obj).hasChildren()); List<NewsSourceImpl> children = new ArrayList<NewsSourceImpl>(); CollectionUtils.collect(((NewsSource) obj).getChildren(), new NewsSourceTransform(), children); Collections.sort(children, NEWS_SERVICE_SORT); proxy.setChildren(children); if (children.size() > 0) { proxy.setHasChildren(true); } List<NewsArticleImpl> articles = new ArrayList<NewsArticleImpl>(); CollectionUtils.collect(((NewsSource) obj).getArticles(), new NewsArticleTransform(), articles); proxy.setArticles(articles); } } return proxy; }
From source file:org.kuali.mobility.people.entity.GroupImpl.java
public void setMembers(List<? extends Person> members) { CollectionUtils.collect(members, new PersonTransform(), this.members); }
From source file:org.kuali.mobility.people.entity.GroupImpl.java
public void setOwners(List<? extends Person> owners) { CollectionUtils.collect(owners, new PersonTransform(), this.owners); }
From source file:org.kuali.mobility.people.entity.GroupImpl.java
public void setSubGroups(List<? extends Group> subGroups) { CollectionUtils.collect(subGroups, new GroupTransform(), this.subGroups); }
From source file:org.kuali.mobility.people.entity.SearchResultImpl.java
@Override public void setPeople(List<? extends Person> people) { CollectionUtils.collect(people, new PersonTransform(), this.people); }
From source file:org.kuali.mobility.people.entity.SearchResultImpl.java
@Override public void setGroups(List<? extends Group> groups) { CollectionUtils.collect(groups, new GroupTransform(), this.groups); }
From source file:org.kuali.mobility.people.service.CXFPeopleService.java
/** * Searches for a person// w ww . j a v a2 s . c o m */ @POST @Path("/person/search") public List<PersonImpl> personSearch(@FormParam("searchText") final String searchText, @FormParam("firstName") final String firstName, @FormParam("lastName") final String lastName, @FormParam("username") final String username, @FormParam("exactness") final String exactness, @FormParam("status") final String status, @FormParam("location") final String location) { List<PersonImpl> people = new ArrayList<PersonImpl>(); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria = new SearchCriteria(); searchCriteria.setExactness(exactness); searchCriteria.setFirstName(firstName); searchCriteria.setLastName(lastName); searchCriteria.setLocation(location); searchCriteria.setSearchText(searchText); searchCriteria.setStatus(status); searchCriteria.setUserName(username); CollectionUtils.collect((getService().getDirectoryDao().findEntries(searchCriteria)).getPeople(), getService().getPersonTransform(), people); return people; }