Coverage Report - org.kuali.student.common.rice.authorization.PermissionType
 
Classes in this File Line Coverage Branch Coverage Complexity
PermissionType
0%
0/37
0%
0/4
1.3
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.common.rice.authorization;
 17  
 
 18  
 /**
 19  
  * Enum to be used for Permission constants
 20  
  *
 21  
  */
 22  0
 public enum PermissionType {
 23  0
         INITIATE("Initiate","KR-SYS","Initiate Document"),
 24  0
         OPEN("View","KS-SYS","Open Document"),
 25  0
         EDIT("Edit","KS-SYS","Edit Document"),
 26  0
         ADD_COMMENT("Comment","KS-SYS","Comment on Document"),
 27  0
         ADD_ADHOC_REVIEWER("Add Reviewer","KS-SYS","Add Adhoc Reviewer"), 
 28  0
         WITHDRAW("Withdraw","KS-SYS","Withdraw Document"),
 29  0
         SECTION_MAINTENANCE("Section Maintenance","KS-SYS","Section Maintenance"), 
 30  0
         FIELD_ACCESS("Access Permission","KS-SYS","Access Permission"), 
 31  0
         SEARCH("Lookup",null,null),
 32  0
         REMOVE_ADHOC_REVIEWERS("Remove Reviewers","KS-SYS","Remove Reviewers"), 
 33  0
         BLANKET_APPROVE("Blanket Approve","KS-SYS","Blanket Approve"),
 34  0
         UPLOAD_DOCUMENTS("Upload","KS-SYS","Upload to Document"),
 35  0
         KS_ADMIN_SCREEN("KS Admin Screen","KS-SYS","KS Admin Screens");
 36  
 
 37  0
         private String label = "";
 38  0
         private String permissionNamespace = "";
 39  0
         private String permissionTemplateName = "";
 40  
 
 41  0
         private PermissionType(String label, String permissionNamespace, String permissionTemplateName) {
 42  0
         this.label = label;
 43  0
         this.permissionNamespace = permissionNamespace;
 44  0
         this.permissionTemplateName = permissionTemplateName;
 45  0
     }
 46  
 
 47  
         public String getLabel() {
 48  0
             return label;
 49  
     }
 50  
 
 51  
         public void setLabel(String label) {
 52  0
             this.label = label;
 53  0
     }
 54  
 
 55  
         public String getPermissionNamespace() {
 56  0
             return permissionNamespace;
 57  
     }
 58  
 
 59  
         public void setPermissionNamespace(String permissionNamespace) {
 60  0
             this.permissionNamespace = permissionNamespace;
 61  0
     }
 62  
 
 63  
         public String getPermissionTemplateName() {
 64  0
             return permissionTemplateName;
 65  
     }
 66  
 
 67  
         public void setPermissionTemplateName(String permissionTemplateName) {
 68  0
             this.permissionTemplateName = permissionTemplateName;
 69  0
     }
 70  
 
 71  
         public String getCode() {
 72  0
                 return permissionNamespace + "~" + permissionTemplateName;
 73  
         }
 74  
 
 75  
         public static PermissionType getByCode(String code) {
 76  0
                 for (PermissionType type : PermissionType.values()) {
 77  0
                         if (type.getCode().equals(code)) {
 78  0
                                 return type;
 79  
                         }
 80  
                 }
 81  0
                 return null;
 82  
         }
 83  
 
 84  
         @Override
 85  
     public String toString() {
 86  0
         return label;
 87  
     }
 88  
 }