ravening commented on a change in pull request #6048:
URL: https://github.com/apache/cloudstack/pull/6048#discussion_r819371984
##########
File path: api/src/main/java/com/cloud/user/Account.java
##########
@@ -16,35 +16,55 @@
// under the License.
package com.cloud.user;
-import java.util.Date;
-
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-public interface Account extends ControlledEntity, InternalIdentity, Identity {
+import java.util.Date;
+import java.util.HashMap;
+public interface Account extends ControlledEntity, InternalIdentity, Identity {
- public enum State {
- disabled, enabled, locked
+ /**
+ * Account states.
+ * */
+ enum State {
+ DISABLED, ENABLED, LOCKED;
+
+ /**
+ * The toString method was overridden to maintain consistency in the
DB, as the GenericDaoBase uses toString in the enum value to make the sql
statements
+ * and previously the enum was in lowercase.
+ * */
+ @Override
+ public String toString(){
+ return super.toString().toLowerCase();
+ }
}
- public static final short ACCOUNT_TYPE_NORMAL = 0;
- public static final short ACCOUNT_TYPE_ADMIN = 1;
- public static final short ACCOUNT_TYPE_DOMAIN_ADMIN = 2;
- public static final short ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN = 3;
- public static final short ACCOUNT_TYPE_READ_ONLY_ADMIN = 4;
- public static final short ACCOUNT_TYPE_PROJECT = 5;
+ /**
+ * Account types.
+ * */
+ enum Type {
+ NORMAL, ADMIN, DOMAIN_ADMIN, RESOURCE_DOMAIN_ADMIN, READ_ONLY_ADMIN,
PROJECT;
+
+ private static HashMap<Integer,Type> ACCOUNT_TYPE_MAP = new
HashMap<>();
Review comment:
Better to use `private static Map<Integer, Type>` rather than `HashMap`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]