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