Coverage Report - org.kuali.student.common.rice.authorization.PermissionType
 
Classes in this File Line Coverage Branch Coverage Complexity
PermissionType
0%
0/29
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"),OPEN("View","KS-SYS","Open Document"),EDIT("Edit","KS-SYS","Edit Document"),
 24  0
         ADD_COMMENT("Comment","KS-SYS","Comment on Document"),ADD_ADHOC_REVIEWER("Add Reviewer","KS-SYS","Add Adhoc Reviewer"), WITHDRAW("Withdraw","KS-SYS","Withdraw Document"),
 25  0
         SECTION_MAINTENANCE("Section Maintenance","KS-SYS","Section Maintenance"), FIELD_ACCESS("Access Permission","KS-SYS","Access Permission"), SEARCH("Lookup",null,null),
 26  0
         REMOVE_ADHOC_REVIEWERS("Remove Reviewers","KS-SYS","Remove Reviewers"), BLANKET_APPROVE("Blanket Approve","KS-SYS","Blanket Approve"),
 27  0
         UPLOAD_DOCUMENTS("Upload","KS-SYS","Upload to Document");
 28  
 
 29  0
         private String label = "";
 30  0
         private String permissionNamespace = "";
 31  0
         private String permissionTemplateName = "";
 32  
 
 33  0
         private PermissionType(String label, String permissionNamespace, String permissionTemplateName) {
 34  0
         this.label = label;
 35  0
         this.permissionNamespace = permissionNamespace;
 36  0
         this.permissionTemplateName = permissionTemplateName;
 37  0
     }
 38  
 
 39  
         public String getLabel() {
 40  0
             return label;
 41  
     }
 42  
 
 43  
         public void setLabel(String label) {
 44  0
             this.label = label;
 45  0
     }
 46  
 
 47  
         public String getPermissionNamespace() {
 48  0
             return permissionNamespace;
 49  
     }
 50  
 
 51  
         public void setPermissionNamespace(String permissionNamespace) {
 52  0
             this.permissionNamespace = permissionNamespace;
 53  0
     }
 54  
 
 55  
         public String getPermissionTemplateName() {
 56  0
             return permissionTemplateName;
 57  
     }
 58  
 
 59  
         public void setPermissionTemplateName(String permissionTemplateName) {
 60  0
             this.permissionTemplateName = permissionTemplateName;
 61  0
     }
 62  
 
 63  
         public String getCode() {
 64  0
                 return permissionNamespace + "~" + permissionTemplateName;
 65  
         }
 66  
 
 67  
         public static PermissionType getByCode(String code) {
 68  0
                 for (PermissionType type : PermissionType.values()) {
 69  0
                         if (type.getCode().equals(code)) {
 70  0
                                 return type;
 71  
                         }
 72  
                 }
 73  0
                 return null;
 74  
         }
 75  
 
 76  
         @Override
 77  
     public String toString() {
 78  0
         return label;
 79  
     }
 80  
 }