View Javadoc

1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.core.block;
17  
18  
19  
20  import org.kuali.kpme.core.util.HrConstants;
21  
22  import java.io.Serializable;
23  import java.util.HashMap;
24  import java.util.Map;
25  
26  public class CalendarBlockPermissions implements Serializable {
27      public static final String CACHE_NAME = HrConstants.CacheNamespace.NAMESPACE_PREFIX + "CalendarBlockPermission";
28  
29      private String blockId;
30      private Map<String, Boolean> canEdit = new HashMap<String, Boolean>();
31      private Map<String, Boolean> canEditAllFields = new HashMap<String, Boolean>();
32      private Map<String, Boolean> canDelete = new HashMap<String, Boolean>();
33      private Map<String, Boolean> canEditOvertimeEarnCode = new HashMap<String, Boolean>();
34  
35      public static CalendarBlockPermissions newInstance(String timeBlockId) {
36          return new CalendarBlockPermissions(timeBlockId);
37      }
38  
39      public CalendarBlockPermissions(String blockId) {
40          this.blockId = blockId;
41      }
42  
43      public String getBlockId() {
44          return blockId;
45      }
46  
47      public void setBlockId(String blockId) {
48          this.blockId = blockId;
49      }
50  
51      public Map<String, Boolean> getCanEdit() {
52          return canEdit;
53      }
54  
55      public Boolean isPrincipalCanEdit(String principalId) {
56          return getCanEdit().get(principalId);
57      }
58  
59      public void setCanEdit(Map<String, Boolean> canEdit) {
60          this.canEdit = canEdit;
61      }
62  
63      public void putCanEdit(String principalId, Boolean edit) {
64          this.canEdit.put(principalId, edit);
65      }
66  
67      public Map<String, Boolean> getCanEditAllFields() {
68          return canEditAllFields;
69      }
70  
71      public Boolean isPrincipalCanEditAllFields(String principalId) {
72          return getCanEditAllFields().get(principalId);
73      }
74  
75      public void setCanEditAllFields(Map<String, Boolean> canEditAllFields) {
76          this.canEditAllFields = canEditAllFields;
77      }
78  
79      public void putCanEditAllFields(String principalId, Boolean editAll) {
80          this.canEditAllFields.put(principalId, editAll);
81      }
82  
83      public Map<String, Boolean> getCanDelete() {
84          return canDelete;
85      }
86  
87      public Boolean isPrincipalCanDelete(String principalId) {
88          return getCanDelete().get(principalId);
89      }
90  
91      public void setCanDelete(Map<String, Boolean> canDelete) {
92          this.canDelete = canDelete;
93      }
94  
95      public void putCanDelete(String principalId, Boolean delete) {
96          this.canDelete.put(principalId, delete);
97      }
98  
99  
100     public Map<String, Boolean> getCanEditOvertimeEarnCode() {
101         return canEditOvertimeEarnCode;
102     }
103 
104     public Boolean isPrincipalCanEditOvertimeEarnCode(String principalId) {
105         return getCanEditOvertimeEarnCode().get(principalId);
106     }
107 
108     public void setCanEditOvertimeEarnCode(Map<String, Boolean> canEdit) {
109         this.canEditOvertimeEarnCode = canEdit;
110     }
111 
112     public void putCanEditOvertimeEarnCode(String principalId, Boolean edit) {
113         this.canEditOvertimeEarnCode.put(principalId, edit);
114     }
115 
116 //    public Boolean getCanEditRegEarnCode() {
117 //        return canEditRegEarnCode;
118 //    }
119 //
120 //    public void setCanEditRegEarnCode(Boolean canEditRegEarnCode) {
121 //        this.canEditRegEarnCode = canEditRegEarnCode;
122 //    }
123 }