001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.kfs.sec.businessobject;
017    
018    import java.util.ArrayList;
019    import java.util.LinkedHashMap;
020    import java.util.List;
021    
022    import org.kuali.kfs.sys.KFSPropertyConstants;
023    import org.kuali.rice.kns.bo.Inactivateable;
024    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
025    import org.kuali.rice.kns.util.KualiInteger;
026    import org.kuali.rice.kns.util.TypedArrayList;
027    
028    /**
029     * Defines a restriction that can be given to a model or principal. A restriction defines the attribute that is restricted on, and the action(s) that are being restricted. A KIM
030     * permission and role is created from a definition record
031     */
032    public class SecurityDefinition extends PersistableBusinessObjectBase implements Inactivateable {
033        private KualiInteger id;
034        private String name;
035        private String description;
036        private String roleId;
037        private KualiInteger attributeId;
038        private boolean restrictViewAccountingLine;
039        private boolean restrictEditAccountingLine;
040        private boolean restrictViewDocument;
041        private boolean restrictEditDocument;
042        private boolean restrictViewNotesAndAttachments;
043        private boolean restrictLookup;
044        private boolean restrictGLInquiry;
045        private boolean restrictLaborInquiry;
046        private boolean active;
047    
048        private SecurityAttribute securityAttribute;
049    
050        private List<SecurityDefinitionDocumentType> definitionDocumentTypes;
051    
052        public SecurityDefinition() {
053            super();
054    
055            definitionDocumentTypes = new TypedArrayList(SecurityDefinitionDocumentType.class);
056    
057            restrictViewAccountingLine = false;
058            restrictEditAccountingLine = false;
059            restrictViewDocument = false;
060            restrictEditDocument = false;
061            restrictViewNotesAndAttachments = false;
062            restrictLookup = false;
063            restrictGLInquiry = false;
064            restrictLaborInquiry = false;
065        }
066    
067        /**
068         * Gets the id attribute.
069         * 
070         * @return Returns the id.
071         */
072        public KualiInteger getId() {
073            return id;
074        }
075    
076    
077        /**
078         * Sets the id attribute value.
079         * 
080         * @param id The id to set.
081         */
082        public void setId(KualiInteger id) {
083            this.id = id;
084        }
085    
086    
087        /**
088         * Gets the name attribute.
089         * 
090         * @return Returns the name.
091         */
092        public String getName() {
093            return name;
094        }
095    
096    
097        /**
098         * Sets the name attribute value.
099         * 
100         * @param name The name to set.
101         */
102        public void setName(String name) {
103            this.name = name;
104        }
105    
106    
107        /**
108         * Gets the description attribute.
109         * 
110         * @return Returns the description.
111         */
112        public String getDescription() {
113            return description;
114        }
115    
116    
117        /**
118         * Sets the description attribute value.
119         * 
120         * @param description The description to set.
121         */
122        public void setDescription(String description) {
123            this.description = description;
124        }
125    
126    
127        /**
128         * Gets the roleId attribute.
129         * 
130         * @return Returns the roleId.
131         */
132        public String getRoleId() {
133            return roleId;
134        }
135    
136        /**
137         * Sets the roleId attribute value.
138         * 
139         * @param roleId The roleId to set.
140         */
141        public void setRoleId(String roleId) {
142            this.roleId = roleId;
143        }
144    
145        /**
146         * Gets the attributeId attribute.
147         * 
148         * @return Returns the attributeId.
149         */
150        public KualiInteger getAttributeId() {
151            return attributeId;
152        }
153    
154    
155        /**
156         * Sets the attributeId attribute value.
157         * 
158         * @param attributeId The attributeId to set.
159         */
160        public void setAttributeId(KualiInteger attributeId) {
161            this.attributeId = attributeId;
162        }
163    
164    
165        /**
166         * Gets the restrictViewAccountingLine attribute.
167         * 
168         * @return Returns the restrictViewAccountingLine.
169         */
170        public boolean isRestrictViewAccountingLine() {
171            return restrictViewAccountingLine;
172        }
173    
174    
175        /**
176         * Sets the restrictViewAccountingLine attribute value.
177         * 
178         * @param restrictViewAccountingLine The restrictViewAccountingLine to set.
179         */
180        public void setRestrictViewAccountingLine(boolean restrictViewAccountingLine) {
181            this.restrictViewAccountingLine = restrictViewAccountingLine;
182        }
183    
184    
185        /**
186         * Gets the restrictEditAccountingLine attribute.
187         * 
188         * @return Returns the restrictEditAccountingLine.
189         */
190        public boolean isRestrictEditAccountingLine() {
191            return restrictEditAccountingLine;
192        }
193    
194    
195        /**
196         * Sets the restrictEditAccountingLine attribute value.
197         * 
198         * @param restrictEditAccountingLine The restrictEditAccountingLine to set.
199         */
200        public void setRestrictEditAccountingLine(boolean restrictEditAccountingLine) {
201            this.restrictEditAccountingLine = restrictEditAccountingLine;
202        }
203    
204    
205        /**
206         * Gets the restrictViewDocument attribute.
207         * 
208         * @return Returns the restrictViewDocument.
209         */
210        public boolean isRestrictViewDocument() {
211            return restrictViewDocument;
212        }
213    
214    
215        /**
216         * Sets the restrictViewDocument attribute value.
217         * 
218         * @param restrictViewDocument The restrictViewDocument to set.
219         */
220        public void setRestrictViewDocument(boolean restrictViewDocument) {
221            this.restrictViewDocument = restrictViewDocument;
222        }
223    
224    
225        /**
226         * Gets the restrictViewNotesAndAttachments attribute.
227         * 
228         * @return Returns the restrictViewNotesAndAttachments.
229         */
230        public boolean isRestrictViewNotesAndAttachments() {
231            return restrictViewNotesAndAttachments;
232        }
233    
234    
235        /**
236         * Sets the restrictViewNotesAndAttachments attribute value.
237         * 
238         * @param restrictViewNotesAndAttachments The restrictViewNotesAndAttachments to set.
239         */
240        public void setRestrictViewNotesAndAttachments(boolean restrictViewNotesAndAttachments) {
241            this.restrictViewNotesAndAttachments = restrictViewNotesAndAttachments;
242        }
243    
244    
245        /**
246         * Gets the restrictLookup attribute.
247         * 
248         * @return Returns the restrictLookup.
249         */
250        public boolean isRestrictLookup() {
251            return restrictLookup;
252        }
253    
254    
255        /**
256         * Sets the restrictLookup attribute value.
257         * 
258         * @param restrictLookup The restrictLookup to set.
259         */
260        public void setRestrictLookup(boolean restrictLookup) {
261            this.restrictLookup = restrictLookup;
262        }
263    
264    
265        /**
266         * Gets the restrictGLInquiry attribute.
267         * 
268         * @return Returns the restrictGLInquiry.
269         */
270        public boolean isRestrictGLInquiry() {
271            return restrictGLInquiry;
272        }
273    
274    
275        /**
276         * Sets the restrictGLInquiry attribute value.
277         * 
278         * @param restrictGLInquiry The restrictGLInquiry to set.
279         */
280        public void setRestrictGLInquiry(boolean restrictGLInquiry) {
281            this.restrictGLInquiry = restrictGLInquiry;
282        }
283    
284    
285        /**
286         * Gets the restrictLaborInquiry attribute.
287         * 
288         * @return Returns the restrictLaborInquiry.
289         */
290        public boolean isRestrictLaborInquiry() {
291            return restrictLaborInquiry;
292        }
293    
294    
295        /**
296         * Sets the restrictLaborInquiry attribute value.
297         * 
298         * @param restrictLaborInquiry The restrictLaborInquiry to set.
299         */
300        public void setRestrictLaborInquiry(boolean restrictLaborInquiry) {
301            this.restrictLaborInquiry = restrictLaborInquiry;
302        }
303    
304    
305        /**
306         * Gets the active attribute.
307         * 
308         * @return Returns the active.
309         */
310        public boolean isActive() {
311            return active;
312        }
313    
314    
315        /**
316         * Sets the active attribute value.
317         * 
318         * @param active The active to set.
319         */
320        public void setActive(boolean active) {
321            this.active = active;
322        }
323    
324    
325        /**
326         * Gets the securityAttribute attribute.
327         * 
328         * @return Returns the securityAttribute.
329         */
330        public SecurityAttribute getSecurityAttribute() {
331            return securityAttribute;
332        }
333    
334    
335        /**
336         * Sets the securityAttribute attribute value.
337         * 
338         * @param securityAttribute The securityAttribute to set.
339         */
340        public void setSecurityAttribute(SecurityAttribute securityAttribute) {
341            this.securityAttribute = securityAttribute;
342        }
343    
344    
345        /**
346         * Gets the restrictEditDocument attribute.
347         * 
348         * @return Returns the restrictEditDocument.
349         */
350        public boolean isRestrictEditDocument() {
351            return restrictEditDocument;
352        }
353    
354    
355        /**
356         * Sets the restrictEditDocument attribute value.
357         * 
358         * @param restrictEditDocument The restrictEditDocument to set.
359         */
360        public void setRestrictEditDocument(boolean restrictEditDocument) {
361            this.restrictEditDocument = restrictEditDocument;
362        }
363    
364    
365        /**
366         * Gets the definitionDocumentTypes attribute.
367         * 
368         * @return Returns the definitionDocumentTypes.
369         */
370        public List<SecurityDefinitionDocumentType> getDefinitionDocumentTypes() {
371            return definitionDocumentTypes;
372        }
373    
374    
375        /**
376         * Sets the definitionDocumentTypes attribute value.
377         * 
378         * @param definitionDocumentTypes The definitionDocumentTypes to set.
379         */
380        public void setDefinitionDocumentTypes(List<SecurityDefinitionDocumentType> definitionDocumentTypes) {
381            this.definitionDocumentTypes = definitionDocumentTypes;
382        }
383    
384        /**
385         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
386         */
387        @Override
388        protected LinkedHashMap toStringMapper() {
389            LinkedHashMap m = new LinkedHashMap();
390    
391            m.put(KFSPropertyConstants.ID, this.id);
392    
393            return m;
394        }
395    
396    }