/** * Find the component with the specified ID * * @param id component ID to search for * @return ProjectComponent with the specified ID * @throws EntityNotFoundException if the component is not found */ public ProjectComponent find(Long id) throws EntityNotFoundException { return convertToProjectComponent(store.find(id)); }
/** * Find all components associated with the project with the ID specified * * @param projectId ID of project to search for * @return collection of ProjectComponent objects associated with the project with the ID specified */ public Collection<ProjectComponent> findAllForProject(Long projectId) { return convertToProjectComponents(store.findAllForProject(projectId)); }
public List<ProjectComponent> getComponents(List<Long> ids) throws EntityNotFoundException { final List<ProjectComponent> components = new ArrayList<ProjectComponent>(ids.size()); for (final Long id : ids) { components.add(find(id)); } return components; }
@Override public List<ChangeItemBean> updateIssueProjectComponents(final Issue issue, final Collection<ProjectComponent> newValue) { return updateIssueValue(issue, newValue, findComponentsByIssue(issue), NodeAssocationType.ISSUE_TO_COMPONENT, ComponentsSystemField.CHANGE_ITEM_FIELD); }
/** * Update the component specified with the values given. * * @param component component to be updated * @return ProjectComponent with updated values as specified * @throws EntityNotFoundException if component is not found */ public ProjectComponent update(MutableProjectComponent component) throws EntityNotFoundException { ProjectComponent oldProjectComponent = find(component.getId()); store.store(component); ProjectComponent projectComponent = convertToProjectComponent(component); eventPublisher.publish(new ProjectComponentUpdatedEvent(projectComponent, oldProjectComponent)); return projectComponent; }
/** * Convert a collection of MutableProjectComponent objects to a collection of ProjectComponent objects. * * @param mutables collection of MutableProjectComponent objects to convert * @return collection of new ProjectComponent objects that represent objects in the given MutableProjectComponent * collection */ private Collection<ProjectComponent> convertToProjectComponents(Collection<MutableProjectComponent> mutables) { return getComponentConverter().convertToProjectComponents(mutables); }
/** * Convert the specified MutableProjectComponent to a ProjectComponent object. * * @param value MutableProjectComponent to be converted into a ProjectComponent. * @return new instance of ProjectComponent with same values as given in the parameter object */ protected ProjectComponent convertToProjectComponent(MutableProjectComponent value) { return getComponentConverter().convertToProjectComponent(value); }
public ProjectComponent findByComponentName(Long projectId, String componentName) { MutableProjectComponent pc; try { pc = store.findByComponentName(projectId, componentName); return pc == null ? null : convertToProjectComponent(pc); } catch (EntityNotFoundException e) { return null; } }
public Collection<ProjectComponent> findByComponentNameCaseInSensitive(String componentName) { return convertToProjectComponents(store.findByComponentNameCaseInSensitive(componentName)); }
/** * Delete the component. * * @param componentId component id * @throws EntityNotFoundException if the component is not found */ public void delete(Long componentId) throws EntityNotFoundException { ProjectComponent projectComponent = null; if (componentId != null) { projectComponent = find(componentId); } store.delete(componentId); if (componentId != null) { eventPublisher.publish(new ProjectComponentDeletedEvent(projectComponent)); } }
/** * Create a new ProjectComponent object associated with the project with the ID specified and with the values given. * * @param name name of component * @param description description of component * @param lead user name associated with component * @param projectId ID of project that component is associated with * @return new instance of ProjectComponent with the values specified */ public ProjectComponent create(String name, String description, String lead, long assigneeType, Long projectId) throws IllegalArgumentException { try { MutableProjectComponent component = new MutableProjectComponent(null, name, description, lead, assigneeType, projectId); ProjectComponent projectComponent = convertToProjectComponent(store.store(component)); eventPublisher.publish(new ProjectComponentCreatedEvent(projectComponent)); return projectComponent; } catch (EntityNotFoundException e) { // Insert should never cause this exception - so this return statement should never be reached return null; } }
public Collection<ProjectComponent> findAll() { return convertToProjectComponents(store.findAll()); }