use of org.apache.cloudstack.api.response.ProjectAccountResponse in project cloudstack by apache.
the class ApiResponseHelper method createProjectAccountResponse.
@Override
public ProjectAccountResponse createProjectAccountResponse(ProjectAccount projectAccount) {
ProjectAccountJoinVO vProj = ApiDBUtils.newProjectAccountView(projectAccount);
List<ProjectAccountResponse> listProjs = ViewResponseHelper.createProjectAccountResponse(vProj);
assert listProjs != null && listProjs.size() == 1 : "There should be one project account returned";
return listProjs.get(0);
}
use of org.apache.cloudstack.api.response.ProjectAccountResponse in project cloudstack by apache.
the class ViewResponseHelper method createProjectAccountResponse.
public static List<ProjectAccountResponse> createProjectAccountResponse(ProjectAccountJoinVO... projectAccounts) {
List<ProjectAccountResponse> responseList = new ArrayList<ProjectAccountResponse>();
for (ProjectAccountJoinVO proj : projectAccounts) {
ProjectAccountResponse resp = ApiDBUtils.newProjectAccountResponse(proj);
// update user list
Account caller = CallContext.current().getCallingAccount();
if (ApiDBUtils.isAdmin(caller)) {
List<UserAccountJoinVO> users = ApiDBUtils.findUserViewByAccountId(proj.getAccountId());
resp.setUsers(ViewResponseHelper.createUserResponse(users.toArray(new UserAccountJoinVO[users.size()])));
}
responseList.add(resp);
}
return responseList;
}
use of org.apache.cloudstack.api.response.ProjectAccountResponse in project cloudstack by apache.
the class ProjectAccountJoinDaoImpl method newProjectAccountResponse.
@Override
public ProjectAccountResponse newProjectAccountResponse(ProjectAccountJoinVO proj) {
ProjectAccountResponse projectAccountResponse = new ProjectAccountResponse();
projectAccountResponse.setProjectId(proj.getProjectUuid());
projectAccountResponse.setProjectName(proj.getProjectName());
projectAccountResponse.setAccountId(proj.getAccountUuid());
projectAccountResponse.setAccountName(proj.getAccountName());
projectAccountResponse.setAccountType(proj.getAccountType());
projectAccountResponse.setRole(proj.getAccountRole().toString());
projectAccountResponse.setDomainId(proj.getDomainUuid());
projectAccountResponse.setDomainName(proj.getDomainName());
projectAccountResponse.setObjectName("projectaccount");
return projectAccountResponse;
}
Aggregations