View Javadoc
1   /*
2    * Copyright 2008 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.ole.sys.businessobject;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.ole.sys.context.SpringContext;
20  import org.kuali.ole.sys.service.OleBusinessObjectMetaDataService;
21  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
22  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
23  
24  public class FunctionalFieldDescription extends PersistableBusinessObjectBase implements MutableInactivatable {
25      private String namespaceCode;
26      private String componentClass;
27      private String propertyName;
28      private String description;
29      private boolean active;
30  
31      private BusinessObjectProperty businessObjectProperty;
32  
33      public FunctionalFieldDescription() {
34      }
35  
36      public FunctionalFieldDescription(String componentClass, String propertyName) {
37          setComponentClass(componentClass);
38          setPropertyName(propertyName);
39      }
40  
41  
42      @Override
43      public void refreshNonUpdateableReferences() {
44          if (StringUtils.isNotBlank(getComponentClass()) && StringUtils.isNotBlank(getPropertyName()) && ((businessObjectProperty == null) || !getPropertyName().equals(businessObjectProperty.getPropertyName()) || (businessObjectProperty.getBusinessObjectComponent() == null) || !getComponentClass().equals(businessObjectProperty.getBusinessObjectComponent().getComponentClass()))) {
45              setBusinessObjectProperty(SpringContext.getBean(OleBusinessObjectMetaDataService.class).getBusinessObjectProperty(getComponentClass(), getPropertyName()));
46              setNamespaceCode(businessObjectProperty.getNamespaceCode());
47          }
48      }
49  
50      public String getNamespaceCode() {
51          return namespaceCode;
52      }
53  
54      public void setNamespaceCode(String namespaceCode) {
55          this.namespaceCode = namespaceCode;
56      }
57  
58      public String getComponentClass() {
59          return componentClass;
60      }
61  
62      public void setComponentClass(String componentClass) {
63          this.componentClass = componentClass;
64      }
65  
66      public String getPropertyName() {
67          return propertyName;
68      }
69  
70      public void setPropertyName(String propertyName) {
71          this.propertyName = propertyName;
72      }
73  
74      public String getDescription() {
75          return description;
76      }
77  
78      public void setDescription(String description) {
79          this.description = description;
80      }
81  
82      @Override
83      public boolean isActive() {
84          return active;
85      }
86  
87      @Override
88      public void setActive(boolean active) {
89          this.active = active;
90      }
91  
92      public BusinessObjectProperty getBusinessObjectProperty() {
93          refreshNonUpdateableReferences();
94          return businessObjectProperty;
95      }
96  
97      public void setBusinessObjectProperty(BusinessObjectProperty businessObjectProperty) {
98          this.businessObjectProperty = businessObjectProperty;
99      }
100 
101 }