View Javadoc
1   /**
2    * Copyright 2005-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.rice.krms.impl.repository;
17  
18  import org.kuali.rice.core.api.mo.common.Versioned;
19  import org.kuali.rice.krms.api.repository.BaseAttributeContract;
20  
21  import javax.persistence.Column;
22  import javax.persistence.MappedSuperclass;
23  import javax.persistence.Version;
24  
25  /**
26   * This class contains the common elements of a KRMS attribute.
27   * <p>
28   * Attributes provide a way to attach custom data to an entity based on that entity's type.
29   * Rules, Actions, Contexts, Agendas and Term Resolvers have their own specific
30   * attribute types. This class contains their common fields.
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  @MappedSuperclass
35  public abstract class BaseAttributeBo implements BaseAttributeContract, Versioned {
36  
37      @Column(name="ATTR_VAL")
38      private String value;
39  
40      @Version
41      @Column(name="VER_NBR", length=8)
42      protected Long versionNumber;
43  
44      public String getAttributeDefinitionId() {
45          if (getAttributeDefinition() != null) {
46              return getAttributeDefinition().getId();
47          }
48  
49          return null;
50      }
51  
52      public String getValue() {
53          return value;
54      }
55  
56      public void setValue(String value) {
57          this.value = value;
58      }
59  
60      public Long getVersionNumber() {
61          return versionNumber;
62      }
63  
64      public void setVersionNumber(Long versionNumber) {
65          this.versionNumber = versionNumber;
66      }
67  }