api: Annotate project API cmd and response

Signed-off-by: Rohit Yadav <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/3e292869
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/3e292869
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/3e292869

Branch: refs/heads/api_refactoring
Commit: 3e292869eb34d804e27358e4ba596adf589d2a67
Parents: 32ca9e2
Author: Rohit Yadav <[email protected]>
Authored: Tue Dec 18 18:07:37 2012 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Tue Dec 18 18:07:37 2012 -0800

----------------------------------------------------------------------
 .../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 ++---
 .../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(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
----------------------------------------------------------------------
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 40535d8..8821be9 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;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
----------------------------------------------------------------------
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 c979158..8a20fe6 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")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
----------------------------------------------------------------------
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 0c489fb..8555f13 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;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
----------------------------------------------------------------------
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 0efe491..f493cd9 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;
 
     // ///////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
----------------------------------------------------------------------
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 b315ab0..1d92bea 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;
 
     // ///////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
----------------------------------------------------------------------
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 285844f..276fe72 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")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
----------------------------------------------------------------------
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 4de4f04..d4a1390 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;
 
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
----------------------------------------------------------------------
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 8b3e636..c85b9a9 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")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
----------------------------------------------------------------------
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 279e4a2..7baab71 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")

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3e292869/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java
----------------------------------------------------------------------
diff --git 
a/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java 
b/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java
index 1c616d1..9d91c07 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")

Reply via email to