View Javadoc

1   /**
2    * Copyright 2005-2015 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.rice.krad.uif.field;
17  
18  import org.kuali.rice.krad.datadictionary.AttributeSecurity;
19  import org.kuali.rice.krad.datadictionary.parse.BeanTag;
20  import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
21  
22  /**
23   * Data field security adds attribute security to the standard component security
24   *
25   * <p>
26   * The {@link AttributeSecurity} can be configured for the field to indicate there is security at the data layer
27   * (configured by component (class) and property). If the field is backed by a data dictionary
28   * {@link org.kuali.rice.krad.datadictionary.AttributeDefinition} the attribute security can be configured there and
29   * will be picked up and inserted into the field security
30   * </p>
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  @BeanTag(name = "dataFieldSecurity-bean")
35  public class DataFieldSecurity extends FieldSecurity {
36      private static final long serialVersionUID = 585138507596582667L;
37  
38      private AttributeSecurity attributeSecurity;
39  
40      public DataFieldSecurity() {
41          super();
42      }
43  
44      /**
45       * Attribute security instance configured or picked up for the field
46       *
47       * @return AttributeSecurity instance
48       */
49      @BeanTagAttribute(name="attributeSecurity",type= BeanTagAttribute.AttributeType.SINGLEBEAN)
50      public AttributeSecurity getAttributeSecurity() {
51          return attributeSecurity;
52      }
53  
54      /**
55       * Setter for the fields attribute security
56       *
57       * @param attributeSecurity
58       */
59      public void setAttributeSecurity(AttributeSecurity attributeSecurity) {
60          this.attributeSecurity = attributeSecurity;
61      }
62  
63      /**
64       * @see org.kuali.rice.krad.uif.component.ComponentSecurity#copy()
65       */
66      @Override
67      protected <T> void copyProperties(T componentSecurity) {
68          super.copyProperties(componentSecurity);
69          DataFieldSecurity dataFieldCopy = (DataFieldSecurity) componentSecurity;
70  
71          if (this.attributeSecurity != null) {
72              dataFieldCopy.setAttributeSecurity((AttributeSecurity)this.attributeSecurity.copy());
73          }
74      }
75  }