/*******************************************************************************
* Copyright (c) 2015 Development Gateway, Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License (MIT)
* which accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*
* Contributors:
* Development Gateway - initial API and implementation
*******************************************************************************/
package org.devgateway.toolkit.persistence.dao.categories;
import java.io.Serializable;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import org.devgateway.toolkit.persistence.dao.AbstractAuditableEntity;
import org.devgateway.toolkit.persistence.dao.Labelable;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.envers.Audited;
/**
* @author idobre
* @since 11/18/14
*/
@Entity
@Audited
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@DiscriminatorColumn(length = Category.DTYPE_COLUMN_LENGTH)
@Table(indexes = { @Index(columnList = "label"), @Index(columnList = "DTYPE") })
public class Category extends AbstractAuditableEntity implements Serializable, Labelable {
static final int DTYPE_COLUMN_LENGTH = 100;
private static final long serialVersionUID = 1L;
protected String label;
protected String description;
public Category(final String label) {
this.label = label;
}
public Category() {
}
@Override
public String getLabel() {
return label;
}
@Override
public void setLabel(final String label) {
this.label = label;
}
public String getDescription() {
return description;
}
public void setDescription(final String description) {
this.description = description;
}
@Override
public String toString() {
return getLabel();
}
@Override
public AbstractAuditableEntity getParent() {
return null;
}
}