private void checkProjectAdminPermission(Handler handler, ProjectComponent component, ApplicationUser user) { if (component == null) { handler.addErrorKey(KEY_NO_SUCH_COMPONENT, null, ErrorCollection.Reason.FORBIDDEN); } else { Long projectId = component.getProjectId(); checkProjectAdminPermission(handler, projectId, user); } }
/** * 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 */ public ProjectComponent convertToProjectComponent(MutableProjectComponent value) { return new ProjectComponentImpl(value.getId(), value.getName(), value.getDescription(), value.getLead(), value.getAssigneeType(), value.getProjectId(), value.getGenericValue()); }
/** * 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)); }
/** * Copy given component * * @param c component to copy * @return new instance of MutableProjectComponent set with values of the given component */ public static MutableProjectComponent copy(final ProjectComponent c) { MutableProjectComponent mutableProjectComponent = new MutableProjectComponent(c.getId(), c.getName(), c.getDescription(), c.getLead(), c.getAssigneeType(), c.getProjectId()); mutableProjectComponent.setGenericValue(c.getGenericValue()); return mutableProjectComponent; }
/** * Convert the specified ProjectComponent to a MutableProjectComponent object and sets its project ID with the given * value. * * @param value ProjectComponent to be converted into a MutableProjectComponent. * @return new instance of MutableProjectComponent with same values as given in the parameter object and with * project ID set */ protected MutableProjectComponent convertToMutableProjectComponent(ProjectComponent value) { return new MutableProjectComponent(value.getId(), value.getName(), value.getDescription(), value.getLead(), value.getAssigneeType(), value.getProjectId()); }
@Override public Long get(final ProjectComponent input) { return input.getId(); } };
private void checkProjectAdminPermission(ErrorCollection errorCollection, ProjectComponent component, ApplicationUser user) { if (component == null) { errorCollection.addErrorMessage(translateKeyToMessage(KEY_NO_SUCH_COMPONENT, null), ErrorCollection.Reason.FORBIDDEN); } else { Long projectId = component.getProjectId(); checkProjectAdminPermission(errorCollection, projectId, user); } }
public GenericValue convertToGenericValue(ProjectComponent projectComponent) { if (projectComponent == null) { return null; } return projectComponent.getGenericValue(); }
@Override void validateData() { validateProjectId(this, projectId); validateName(this, null, name, projectId); validateLead(this, lead); validateAssigneeType(this, assigneeType); }
/** * 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)); }
/** * 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); }
/** * 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); }
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)); }
public Collection<ProjectComponent> findAll() { return convertToProjectComponents(store.findAll()); }
public MutableProjectComponent(Long id, String name, String description, String lead, long assigneeType, Long projectId) { this.id = id; setDescription(description); this.lead = lead; this.name = name; this.projectId = projectId; this.assigneeType = assigneeType; }
public Collection<ProjectComponent> getAll() { return componentManager.findAll(); } ///CLOVER:ON
protected ComponentConverter getComponentConverter() { return new ComponentConverter(); } }
/** * 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)); }