@Override public boolean test(final ProjectRole projectRole) { return projectRole.getName().equalsIgnoreCase(name); } });
public String getArgumentDisplay(String roleTypeId) { ProjectRole projectRole = projectRoleManager.getProjectRole(new Long(roleTypeId)); return projectRole.getName(); }
public ProjectRole getProjectRole(String name) { for (final Object o : getProjectRoles()) { ProjectRole role = (ProjectRole) o; if (role.getName().equals(name)) { return role; } } return null; }
private void checkRoleNameUnique(String name) { for (final Object o : getProjectRoles()) { ProjectRole role = (ProjectRole) o; if (name != null && name.equals(role.getName())) { throw new IllegalArgumentException("Cannot have two roles with the same name"); } } }
AllProjectRoles(Collection<ProjectRole> projectRoles) { final ImmutableMap.Builder<Long,ProjectRole> byId = ImmutableMap.builder(); final ImmutableMap.Builder<String,ProjectRole> byName = ImmutableMap.builder(); for (ProjectRole projectRole : projectRoles) { byId.put(projectRole.getId(), projectRole); byName.put(projectRole.getName(), projectRole); } this.projectRoles = ImmutableList.copyOf(projectRoles); this.projectRolesById = byId.build(); this.projectRolesByName = byName.build(); }
@Override public void updateRole(ProjectRole projectRole) { if (projectRole == null) { throw new IllegalArgumentException("ProjectRole can not be null"); } if (projectRole.getName() == null) { throw new IllegalArgumentException("ProjectRole name can not be null"); } projectRoleAndActorStore.updateProjectRole(projectRole); }
protected void getVelocityParamsForInput(Map velocityParams) { Map projectRoleMap = new ListOrderedMap(); ProjectRoleManager projectRoleManager = ComponentAccessor.getComponentOfType(ProjectRoleManager.class); final Collection<ProjectRole> projectRoles = projectRoleManager.getProjectRoles(); for (final ProjectRole projectRole : projectRoles) { projectRoleMap.put(projectRole.getId().toString(), projectRole.getName()); } velocityParams.put("key", InProjectRoleCondition.KEY_PROJECT_ROLE_ID); velocityParams.put("projectroles", projectRoleMap); }
public RemoteProjectRole[] getProjectRoles(User currentUser) throws RemoteException { SimpleErrorCollection errorCollection = new SimpleErrorCollection(); Collection remoteRoles = new ArrayList(); Collection realRoles = projectRoleService.getProjectRoles(currentUser, errorCollection); checkAndThrowErrors("Error getting project role", errorCollection); for (Iterator iterator = realRoles.iterator(); iterator.hasNext();) { ProjectRole projectRole = (ProjectRole) iterator.next(); remoteRoles.add(new RemoteProjectRole(projectRole.getId(), projectRole.getName(), projectRole.getDescription())); } return (RemoteProjectRole[]) remoteRoles.toArray(new RemoteProjectRole[remoteRoles.size()]); }
private String getRole(final String roleId, final I18nHelper i18nHelper) { final ProjectRole role = projectRoleManager.getProjectRole(new Long(roleId)); if (role == null) { return i18nHelper.getText("common.sharing.shared.role.not.found"); } return TextUtil.escapeHTML(role.getName()); }
public void addRole(ProjectRole projectRole) { checkRoleNameUnique(projectRole.getName()); if (getProjectRole(projectRole.getId()) != null) { throw new IllegalArgumentException("Role with id '" + projectRole.getId() + "' already exists."); } projectRoles.add(projectRole); }
public String doDefault() throws Exception { ProjectRole roleType = getRole(); name = roleType.getName(); description = roleType.getDescription(); return super.doDefault(); }
public ProjectRole createRole(ProjectRole projectRole) { MockProjectRole role = new MockProjectRole(++idCounter, projectRole.getName(), projectRole.getDescription()); addRole(projectRole); return role; }
public static Builder from(ProjectRole role) { return new Builder(role.getId(), role.getName(), role.getDescription()); }
@Override public RecordRequest onProjectRoleDeletedEvent(final ProjectRoleDeletedEvent event) { return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.project.role.deleted") .forObject(AssociatedItem.Type.PROJECT_ROLE, event.getProjectRole().getName(), event.getProjectRole().getId().toString()); }
public CommentSecurityLevel apply(final ProjectRole from) { String label = jiraAuthenticationContext.getI18nHelper().getText(CommentSecurityType.ROLE.getLabelKey(), from.getName()); return new CommentSecurityLevel(String.valueOf(from.getId()), label, CommentSecurityType.ROLE); } });
public RemoteProjectRole getProjectRole(User currentUser, Long id) throws RemoteException { SimpleErrorCollection errorCollection = new SimpleErrorCollection(); ProjectRole realRole = projectRoleService.getProjectRole(currentUser, id, errorCollection); checkAndThrowErrors("Error getting project role", errorCollection); return new RemoteProjectRole(realRole.getId(), realRole.getName(), realRole.getDescription()); }
public RemoteProjectRole createProjectRole(User currentUser, RemoteProjectRole projectRole) throws RemoteException { SimpleErrorCollection errorCollection = new SimpleErrorCollection(); ProjectRole realRole = getProjectRoleFromRemoteProjectRole(projectRole); realRole = projectRoleService.createProjectRole(currentUser, realRole, errorCollection); checkAndThrowErrors("Error creating project role", errorCollection); return new RemoteProjectRole(realRole.getId(), realRole.getName(), realRole.getDescription()); }
@Override public RecordRequest onProjectRoleUpdatedEvent(final ProjectRoleUpdatedEvent event) { return new RecordRequest(AuditingCategory.PROJECTS, "jira.auditing.project.roles.changed") .forObject(AssociatedItem.Type.PROJECT_ROLE, event.getProjectRole().getName(), event.getProjectRole().getId().toString()) .withAssociatedItem(AssociatedItem.Type.PROJECT, event.getProject().getName(), event.getProject().getId().toString()) .withChangedValues(computeChangedValues(event.getOriginalRoleActors(), event.getRoleActors())); }
public void updateProjectRole(final ProjectRole projectRole) { try { final GenericValue projectRoleGv = ofBizDelegator.findById(ENTITY_NAME, projectRole.getId()); projectRoleGv.set(PROJECT_ROLE_FIELD_NAME, projectRole.getName()); projectRoleGv.set(PROJECT_ROLE_FIELD_DESCRIPTION, projectRole.getDescription()); projectRoleGv.store(); } catch (final GenericEntityException e) { throw new DataAccessException(e); } }