public static void setSupplierRole(String string) {
   try {
     role = Role.valueOf(string);
   } catch (Exception e) {
     role = Role.caretaker;
   }
 }
 /** @return the role of the user performing the action. Role is null if not provided. */
 public Role getRole() {
   if (this.role != null) {
     return Role.valueOf(role);
   } else {
     return null;
   }
 }
 public static Role getSupplierRole() {
   if (role == null) {
     try {
       role = Role.valueOf(androidPreference.getValue(SupplierConfig.CURRENT_CENTER_ROLE, ""));
     } catch (Exception e) {
       e.printStackTrace();
       role = Role.caretaker;
     }
   }
   return role;
 }
示例#4
0
 @Override
 protected Role fieldForName(String fieldName) {
   return Role.valueOf(fieldName.toUpperCase());
 }
示例#5
0
 /** Returns the role for the user. Simplest implementation. */
 public static Role forUser(String username) {
   return Role.valueOf(username.toUpperCase());
 }