/** * Retrieve a collection of components - where the lead of each component is the specified user. * * @param userKey the lead user's key * @return collection of components - where the lead of each component is the specified user */ public Collection findComponentsBylead(String userKey) { return getComponentConverter().convertToComponents(findComponentGVs(FIELD_LEAD, userKey)); }
public Collection<MutableProjectComponent> findByComponentNameCaseInSensitive(String componentName) { if (componentName == null) { throw new IllegalArgumentException("Component Name is required, was null."); } final Collection<MutableProjectComponent> components = getComponentConverter().convertToComponents(delegator.findAll(OfBizDelegator.PROJECT_COMPONENT)); List<MutableProjectComponent> matched = new ArrayList<MutableProjectComponent>(); for (MutableProjectComponent component : components) { if (componentName.equalsIgnoreCase(component.getName())) { matched.add(component); } } return matched; }
/** * Retrieve all components that are related to the project with given ID and sort by name. * * @param projectId project ID * @return a collection of ProjectComponent objects that are related to the project with given ID */ public Collection<MutableProjectComponent> findAllForProject(Long projectId) { return getComponentConverter().convertToComponents(findComponentGVs(FIELD_PROJECT, projectId,FIELD_NAME)); }
/** * Retrieve all ProjectComponent objects stored and sort by name. * * @return all ProjectComponent objects stored */ public Collection findAll() { return getComponentConverter().convertToComponents(delegator.findAll(OfBizDelegator.PROJECT_COMPONENT, CollectionBuilder.list(FIELD_NAME))); }
public MutableProjectComponent findByComponentName(Long projectId, String componentName) throws IllegalArgumentException { if (projectId == null) { throw new IllegalArgumentException("Project ID is required, was null."); } if (componentName == null) { throw new IllegalArgumentException("Component Name is required, was null."); } List components = delegator.findByAnd(OfBizDelegator.PROJECT_COMPONENT, MapBuilder.<String, Object>newBuilder().add(FIELD_PROJECT, projectId).add(FIELD_NAME, componentName).toMap()); // should only be one or none since component name is unique per project if (components.size() == 1) { return getComponentConverter().convertToComponent((GenericValue) components.get(0)); } else if (components.size() == 0) { return null; } else { log.error("found " + components.size() + " components with name " + componentName + " in project with id " + projectId); return (MutableProjectComponent) components.get(0); } }
/** * Retrieve the MutableProjectComponent with the specified ID. An EntityNotFoundException is thrown if the component * is not found. * * @param id component ID to search for * @return MutableProjectComponent component with the specified ID * @throws EntityNotFoundException if the component is not found */ public MutableProjectComponent find(Long id) throws EntityNotFoundException { validateId(id); GenericValue componentGV = findComponentGV(FIELD_ID, id); if (componentGV == null) { throw new EntityNotFoundException("Component with ID = '" + id + "' does not exist."); } else { return getComponentConverter().convertToComponent(componentGV); } }