001/**
002 * Copyright 2005-2017 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 */
016package org.kuali.rice.krms.impl.repository;
017
018import org.kuali.rice.core.api.mo.common.Versioned;
019import org.kuali.rice.krms.api.repository.BaseAttributeContract;
020
021import javax.persistence.Column;
022import javax.persistence.MappedSuperclass;
023import javax.persistence.Version;
024import java.io.Serializable;
025
026/**
027 * This class contains the common elements of a KRMS attribute.
028 * <p>
029 * Attributes provide a way to attach custom data to an entity based on that entity's type.
030 * Rules, Actions, Contexts, Agendas and Term Resolvers have their own specific
031 * attribute types. This class contains their common fields.
032 *
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 */
035@MappedSuperclass
036public abstract class BaseAttributeBo implements BaseAttributeContract, Versioned, Serializable {
037
038    private static final long serialVersionUID = 3820684124163057591L;
039    @Column(name="ATTR_VAL")
040    private String value;
041
042    @Version
043    @Column(name="VER_NBR", length=8)
044    protected Long versionNumber;
045
046    public String getAttributeDefinitionId() {
047        if (getAttributeDefinition() != null) {
048            return getAttributeDefinition().getId();
049        }
050
051        return null;
052    }
053
054    public String getValue() {
055        return value;
056    }
057
058    public void setValue(String value) {
059        this.value = value;
060    }
061
062    public Long getVersionNumber() {
063        return versionNumber;
064    }
065
066    public void setVersionNumber(Long versionNumber) {
067        this.versionNumber = versionNumber;
068    }
069}