From 3e292869eb34d804e27358e4ba596adf589d2a67 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 18 Dec 2012 18:07:37 -0800 Subject: [PATCH] api: Annotate project API cmd and response Signed-off-by: Rohit Yadav --- .../api/command/user/project/ActivateProjectCmd.java | 4 ++-- .../api/command/user/project/CreateProjectCmd.java | 6 +++--- .../api/command/user/project/DeleteProjectCmd.java | 5 +++-- .../user/project/DeleteProjectInvitationCmd.java | 6 +++--- .../user/project/ListProjectInvitationsCmd.java | 10 +++++----- .../api/command/user/project/ListProjectsCmd.java | 5 ++--- .../api/command/user/project/SuspendProjectCmd.java | 5 ++--- .../api/command/user/project/UpdateProjectCmd.java | 5 ++--- .../user/project/UpdateProjectInvitationCmd.java | 6 +++--- .../api/response/ProjectInvitationResponse.java | 4 +++- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java index 40535d84d30..8821be9a18d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java @@ -41,8 +41,8 @@ public class ActivateProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be modified") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=ProjectResponse.class, + required=true, description="id of the project to be modified") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java index c979158d916..8a20fe65af9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java @@ -21,10 +21,10 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -46,8 +46,8 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd { @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account who will be Admin for the project") private String accountName; - @IdentityMapper(entityTableName = "domain") - @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, description = "domain ID of the account owning a project") + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, + description = "domain ID of the account owning a project") private Long domainId; @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "name of the project") diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java index 0c489fbfdc7..8555f1310da 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.user.project; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; @@ -41,8 +42,8 @@ public class DeleteProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be deleted") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=ProjectResponse.class, + required=true, description="id of the project to be deleted") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java index 0efe491587d..f493cd95f50 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java @@ -16,12 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.user.project; +import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; @@ -38,8 +38,8 @@ public class DeleteProjectInvitationCmd extends BaseAsyncCmd { // /////////////////////////////////////////////////// // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "project_invitations") - @Parameter(name = ApiConstants.ID, required = true, type = CommandType.LONG, description = "id of the invitation") + @Parameter(name = ApiConstants.ID, type=CommandType.UUID, entityType=ProjectInvitationResponse.class, + required = true, description = "id of the invitation") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java index b315ab06047..1d92bea2e9d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java @@ -16,11 +16,11 @@ // under the License. package org.apache.cloudstack.api.command.user.project; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; @@ -34,8 +34,8 @@ public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd { // /////////////////////////////////////////////////// // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "projects") - @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.LONG, description = "list by project id") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, + description = "list by project id") private Long projectId; @Parameter(name = ApiConstants.ACTIVE_ONLY, type = CommandType.BOOLEAN, description = "if true, list only active invitations - having Pending state and ones that are not timed out yet") @@ -44,8 +44,8 @@ public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd { @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "list invitations by state") private String state; - @IdentityMapper(entityTableName = "project_invitations") - @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "list invitations by id") + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType=ProjectInvitationResponse.class, + description = "list invitations by id") private Long id; // /////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java index 285844f56d3..276fe728510 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java @@ -25,7 +25,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; @@ -42,8 +41,8 @@ public class ListProjectsCmd extends BaseListAccountResourcesCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="list projects by project ID") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=ProjectResponse.class, + description="list projects by project ID") private Long id; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list projects by name") diff --git a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java index 4de4f04fac7..d4a1390ff9a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java @@ -21,7 +21,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; @@ -43,8 +42,8 @@ public class SuspendProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be suspended") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=ProjectResponse.class, + required=true, description="id of the project to be suspended") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java index 8b3e6365457..c85b9a9bb00 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java @@ -21,7 +21,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; @@ -42,8 +41,8 @@ public class UpdateProjectCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="id of the project to be modified") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=ProjectResponse.class, + required=true, description="id of the project to be modified") private Long id; @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="new Admin account for the project") diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java index 279e4a27d61..7baab710be6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java @@ -16,12 +16,12 @@ // under the License. package org.apache.cloudstack.api.command.user.project; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.IdentityMapper; import org.apache.cloudstack.api.Implementation; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; @@ -38,8 +38,8 @@ public class UpdateProjectInvitationCmd extends BaseAsyncCmd { // /////////////////////////////////////////////////// // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName = "projects") - @Parameter(name = ApiConstants.PROJECT_ID, required = true, type = CommandType.LONG, description = "id of the project to join") + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, + required = true, description = "id of the project to join") private Long projectId; @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "account that is joining the project") diff --git a/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java b/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java index 1c616d1e866..9d91c070d72 100644 --- a/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java @@ -16,12 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; +import com.cloud.projects.ProjectInvitation; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.utils.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Entity; +@Entity(value=ProjectInvitation.class) @SuppressWarnings("unused") public class ProjectInvitationResponse extends BaseResponse implements ControlledViewEntityResponse{ @SerializedName(ApiConstants.ID) @Param(description="the id of the invitation")