}
@Override
public ProjectAccountResponse createProjectAccountResponse(ProjectAccount projectAccount) {
Account account = ApiDBUtils.findAccountById(projectAccount.getAccountId());
ProjectAccountResponse projectAccountResponse = new ProjectAccountResponse();
long projectId = projectAccount.getProjectId();
projectAccountResponse.setProjectId(projectId);
projectAccountResponse.setProjectName(ApiDBUtils.findProjectById(projectId).getName());
projectAccountResponse.setId(account.getId());
projectAccountResponse.setAccountName(account.getAccountName());
projectAccountResponse.setAccountType(account.getType());
projectAccountResponse.setRole(projectAccount.getAccountRole().toString());
populateDomain(projectAccountResponse, account.getDomainId());
// add all the users for an account as part of the response obj
List<UserVO> usersForAccount = ApiDBUtils.listUsersByAccount(account.getAccountId());
List<UserResponse> userResponseList = new ArrayList<UserResponse>();
for (UserVO user : usersForAccount) {
UserResponse userResponse = createUserResponse(user);
userResponseList.add(userResponse);
}
projectAccountResponse.setUsers(userResponseList);
projectAccountResponse.setObjectName("projectaccount");
return projectAccountResponse;
}