diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java index e7cd44be04a..a1461fbba12 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java @@ -20,10 +20,10 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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.UserResponse; import com.cloud.user.Account; import com.cloud.user.User; @@ -42,8 +42,8 @@ public class CreateUserCmd extends BaseCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, required=true, description="Creates the user under the specified account. If no account is specified, the username will be used as the account name.") private String accountName; - @IdentityMapper(entityTableName="domain") - @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="Creates the user under the specified domain. Has to be accompanied with the account parameter") + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, + description="Creates the user under the specified domain. Has to be accompanied with the account parameter") private Long domainId; @Parameter(name=ApiConstants.EMAIL, type=CommandType.STRING, required=true, description="email") diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java index ba9cafb32e3..8c85bc6965f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java @@ -20,7 +20,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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; @@ -39,8 +38,7 @@ public class DeleteUserCmd extends BaseCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="user") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Deletes a user") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="Deletes a user") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java index b726b913d2f..403014bb6c5 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.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 DisableUserCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="user") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Disables user by user ID.") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, + required=true, description="Disables user by user ID.") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java index 0ac28c33089..0e88627c43a 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java @@ -20,7 +20,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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; @@ -39,8 +38,8 @@ public class EnableUserCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="user") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Enables user by user ID.") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, + required=true, description="Enables user by user ID.") private Long id; diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java index 7d918b2090d..fba7a62eedd 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java @@ -20,7 +20,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; @@ -39,8 +38,7 @@ public class ListUsersCmd extends BaseListAccountResourcesCmd { @Parameter(name=ApiConstants.ACCOUNT_TYPE, type=CommandType.LONG, description="List users by account type. Valid types include admin, domain-admin, read-only-admin, or user.") private Long accountType; - @IdentityMapper(entityTableName="user") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="List user by ID.") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, description="List user by ID.") private Long id; @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="List users by state of the user account.") @@ -81,7 +79,6 @@ public class ListUsersCmd extends BaseListAccountResourcesCmd { @Override public void execute(){ - ListResponse response = _queryService.searchForUsers(this); response.setResponseName(getCommandName()); this.setResponseObject(response); diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java index 30cfd15650b..a29739385c1 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java @@ -20,7 +20,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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; @@ -39,8 +38,8 @@ public class LockUserCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="user") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="Locks user by user ID.") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, + required=true, description="Locks user by user ID.") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java index becba814bc4..b762ac66e99 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java @@ -20,10 +20,10 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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.response.RegisterResponse; +import org.apache.cloudstack.api.response.UserResponse; import com.cloud.user.Account; import com.cloud.user.User; @@ -37,8 +37,8 @@ public class RegisterCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="user") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="User id") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, + required=true, description="User id") private Long id; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java index 8a6789d34d6..b2f4399d172 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java @@ -20,7 +20,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; 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; @@ -49,8 +48,8 @@ public class UpdateUserCmd extends BaseCmd { @Parameter(name=ApiConstants.FIRSTNAME, type=CommandType.STRING, description="first name") private String firstname; - @IdentityMapper(entityTableName="user") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="User id") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, + required=true, description="User uuid") private Long id; @Parameter(name=ApiConstants.LASTNAME, type=CommandType.STRING, description="last name") diff --git a/api/src/org/apache/cloudstack/api/command/user/user/AddVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/user/AddVpnUserCmd.java index abd58b897c0..f72b8a9df9b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/user/AddVpnUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/user/AddVpnUserCmd.java @@ -21,10 +21,11 @@ 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 org.apache.cloudstack.api.response.VpnUsersResponse; import com.cloud.domain.Domain; import com.cloud.event.EventTypes; @@ -50,12 +51,12 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the vpn user. Must be used with domainId.") private String accountName; - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="add vpn user to the specific project") + @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType=ProjectResponse.class, + description="add vpn user to the specific project") private Long projectId; - @IdentityMapper(entityTableName="domain") - @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.") + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, + description="an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.") private Long domainId; ///////////////////////////////////////////////////// diff --git a/api/src/org/apache/cloudstack/api/command/user/user/ListVpnUsersCmd.java b/api/src/org/apache/cloudstack/api/command/user/user/ListVpnUsersCmd.java index 1fa15b597f9..f98d3c8ec7b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/user/ListVpnUsersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/user/ListVpnUsersCmd.java @@ -23,7 +23,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; -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; @@ -40,8 +39,8 @@ public class ListVpnUsersCmd extends BaseListProjectAndAccountResourcesCmd { ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @IdentityMapper(entityTableName="vpn_users") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the ID of the vpn user") + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=VpnUsersResponse.class, + description="The uuid of the Vpn user") private Long id; @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username of the vpn user.") diff --git a/api/src/org/apache/cloudstack/api/command/user/user/RemoveVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/user/RemoveVpnUserCmd.java index 5e144bdaf76..eee343ce760 100644 --- a/api/src/org/apache/cloudstack/api/command/user/user/RemoveVpnUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/user/RemoveVpnUserCmd.java @@ -21,10 +21,11 @@ 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; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -45,12 +46,12 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="an optional account for the vpn user. Must be used with domainId.") private String accountName; - @IdentityMapper(entityTableName="projects") - @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.LONG, description="remove vpn user from the project") + @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType=ProjectResponse.class, + description="remove vpn user from the project") private Long projectId; - @IdentityMapper(entityTableName="domain") - @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.") + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, + description="an optional domainId for the vpn user. If the account parameter is used, domainId must also be used.") private Long domainId; ///////////////////////////////////////////////////// @@ -99,7 +100,6 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd { return "Remove Remote Access VPN user for account " + getEntityOwnerId() + " username= " + getUserName(); } - @Override public String getEventType() { return EventTypes.EVENT_VPN_USER_REMOVE;