You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2016/01/20 14:18:34 UTC

[03/10] git commit: updated refs/heads/master to 6f9215c

CLOUDSTACK-9239 throw exception on deprecated command


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

Branch: refs/heads/master
Commit: 9e72796e96161444b861b146c19d6c1f6d7aa88a
Parents: 57a2a0b
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Jan 18 15:01:33 2016 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Jan 19 10:29:43 2016 +0100

----------------------------------------------------------------------
 .../command/admin/account/LockAccountCmd.java   | 25 +++++++++-----------
 1 file changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e72796e/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
index 3c185e4..05b370a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
@@ -16,7 +16,7 @@
 // under the License.
 package org.apache.cloudstack.api.command.admin.account;
 
-import org.apache.log4j.Logger;
+import java.util.logging.Logger;
 
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
@@ -26,9 +26,14 @@ import org.apache.cloudstack.api.response.AccountResponse;
 import org.apache.cloudstack.api.response.DomainResponse;
 
 import com.cloud.user.Account;
-
-@APICommand(name = "lockAccount", description = "Locks an account", responseObject = AccountResponse.class, entityType = {Account.class},
-        requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name = "lockAccount",
+            description = "This deprecated function used to locks an account. Look for the API DisableAccount instead",
+            responseObject = AccountResponse.class,
+            entityType = {Account.class},
+            requestHasSensitiveInfo = false,
+            responseHasSensitiveInfo = true)
 public class LockAccountCmd extends BaseCmd {
     public static final Logger s_logger = Logger.getLogger(LockAccountCmd.class.getName());
 
@@ -71,7 +76,7 @@ public class LockAccountCmd extends BaseCmd {
 
     @Override
     public long getEntityOwnerId() {
-        Account account = _accountService.getActiveAccountByName(getAccountName(), getDomainId());
+        final Account account = _accountService.getActiveAccountByName(getAccountName(), getDomainId());
         if (account != null) {
             return account.getAccountId();
         }
@@ -81,14 +86,6 @@ public class LockAccountCmd extends BaseCmd {
 
     @Override
     public void execute() {
-//        Account result = null;
-        //result = _accountService.lockAccount(this);
-//        if (result != null){
-//            AccountResponse response = _responseGenerator.createAccountResponse(result);
-//            response.setResponseName(getCommandName());
-//            this.setResponseObject(response);
-//        } else {
-//            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock account");
-//        }
+        throw new CloudRuntimeException("LockAccount does not lock accounts. Its implementation is disabled. Use DisableAccount instead");
     }
 }