use of com.cloud.api.response.ProjectResponse in project CloudStack-archive by CloudStack-extras.
the class CreateProjectCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@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(BaseCmd.INTERNAL_ERROR, "Failed to create a project");
}
}
use of com.cloud.api.response.ProjectResponse in project CloudStack-archive by CloudStack-extras.
the class ActivateProjectCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
UserContext.current().setEventDetails("Project id: " + getId());
Project project = _projectService.activateProject(id);
if (project != null) {
ProjectResponse response = _responseGenerator.createProjectResponse(project);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to activate a project");
}
}
use of com.cloud.api.response.ProjectResponse in project cosmic by MissionCriticalCloud.
the class UpdateProjectCmd method execute.
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceAllocationException {
CallContext.current().setEventDetails("Project id: " + getId());
final Project project = _projectService.updateProject(getId(), getDisplayText(), getAccountName());
if (project != null) {
final ProjectResponse response = _responseGenerator.createProjectResponse(project);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update a project");
}
}
use of com.cloud.api.response.ProjectResponse in project cosmic by MissionCriticalCloud.
the class CreateProjectCmd method execute.
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@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");
}
}
use of com.cloud.api.response.ProjectResponse in project CloudStack-archive by CloudStack-extras.
the class ListProjectsCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
List<? extends Project> projects = _projectService.listProjects(id, name, displayText, state, this.getAccountName(), this.getDomainId(), this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), this.listAll(), this.isRecursive());
ListResponse<ProjectResponse> response = new ListResponse<ProjectResponse>();
List<ProjectResponse> projectResponses = new ArrayList<ProjectResponse>();
for (Project project : projects) {
ProjectResponse projectResponse = _responseGenerator.createProjectResponse(project);
projectResponses.add(projectResponse);
}
response.setResponses(projectResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
Aggregations