@Override public long getEntityOwnerId() { Project project = _projectService.getProject(projectId); //verify input parameters if (project == null) { throw new InvalidParameterValueException("Unable to find project by ID " + projectId); } return _projectService.getProjectOwner(projectId).getId(); }
public static Project findProjectByProjectAccountId(long projectAccountId) { return s_projectMgr.findByProjectAccountId(projectAccountId); }
public static Project findProjectById(long projectId) { return s_projectMgr.getProject(projectId); }
public static Account getProjectOwner(long projectId) { return s_projectMgr.getProjectOwner(projectId); }
@Override public void execute() { CallContext.current().setEventDetails("Project id: " + getId()); Project project = _projectService.activateProject(getId()); if (project != null) { ProjectResponse response = _responseGenerator.createProjectResponse(project); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to activate a project"); } }
@Override public void create() throws ResourceAllocationException { CallContext.current().setEventDetails("Project Name: " + getName()); Project project = _projectService.createProject(getName(), getDisplayText(), getAccountName(), getDomainId()); if (project != null) { this.setEntityId(project.getId()); this.setEntityUuid(project.getUuid()); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a project"); } }
@Override public void execute() { CallContext.current().setEventDetails("Project ID: " + projectId + "; accountName " + accountName); boolean result = _projectService.deleteAccountFromProject(projectId, accountName); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete account from the project"); } }
@Override public void execute() { CallContext.current().setEventDetails("Project Id: " + id); boolean result = _projectService.deleteProject(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete project"); } }
@Override public void execute() { CallContext.current().setEventDetails("Project invitation id " + id); boolean result = _projectService.deleteProjectInvitation(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete the project invitation"); } }
@Override public void execute() { Project project = _projectService.enableProject(this.getEntityId()); if (project != null) { ProjectResponse response = _responseGenerator.createProjectResponse(project); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a project"); } }
@Override public void execute() { if (accountName == null && email == null) { throw new InvalidParameterValueException("Either accountName or email is required"); } CallContext.current().setEventDetails("Project ID: " + projectId + "; accountName " + accountName); boolean result = _projectService.addAccountToProject(getProjectId(), getAccountName(), getEmail()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add account to the project"); } }
@Test public void testGetEntityOwnerIdForNullProject() { ProjectService projectService = Mockito.mock(ProjectService.class); Mockito.when(projectService.getProject(Matchers.anyLong())).thenReturn(null); activateProjectCmd._projectService = projectService; try { activateProjectCmd.getEntityOwnerId(); } catch (InvalidParameterValueException exception) { Assert.assertEquals("Unable to find project by id 2", exception.getLocalizedMessage()); } }
public static long getProjectOwnwerId(long projectId) { return s_projectMgr.getProjectOwner(projectId).getId(); }
@Override public void execute() { CallContext.current().setEventDetails("Project id: " + getId()); final Project project = _projectService.activateProject(getId()); if (project != null) { final ProjectResponse response = _responseGenerator.createProjectResponse(project); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to activate a project"); } }
@Override public void create() throws ResourceAllocationException { CallContext.current().setEventDetails("Project Name: " + getName()); final Project project = _projectService.createProject(getName(), getDisplayText(), getAccountName(), getDomainId()); if (project != null) { this.setEntityId(project.getId()); this.setEntityUuid(project.getUuid()); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a project"); } }
@Override public void execute() { CallContext.current().setEventDetails("Project ID: " + projectId + "; accountName " + accountName); final boolean result = _projectService.deleteAccountFromProject(projectId, accountName); if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete account from the project"); } }
@Override public void execute() { CallContext.current().setEventDetails("Project Id: " + id); final boolean result = _projectService.deleteProject(id); if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete project"); } }
@Override public void execute() { CallContext.current().setEventDetails("Project invitation id " + id); final boolean result = _projectService.deleteProjectInvitation(id); if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete the project invitation"); } }
@Override public void execute() { final Project project = _projectService.enableProject(this.getEntityId()); if (project != null) { final ProjectResponse response = _responseGenerator.createProjectResponse(project); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a project"); } }
@Override public void execute() { if (accountName == null && email == null) { throw new InvalidParameterValueException("Either accountName or email is required"); } CallContext.current().setEventDetails("Project ID: " + projectId + "; accountName " + accountName); final boolean result = _projectService.addAccountToProject(getProjectId(), getAccountName(), getEmail()); if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add account to the project"); } }