UserProperty.java 2.83 KB
package org.legrog.entities;

import javax.persistence.*;

@Entity
public class UserProperty {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)  /* Permet la population */
    @Column(name="USER_PROPERTY_ID")
    private int userPropertyId;

    /**
     *
     * hibernate.id
     *  	generator-class="identity"
     *  	column="ID_PROP"
     *  	access="property"
     */
    public Integer getUserPropertyId() {
        return userPropertyId;
    }

    /**
     * The property name.
     */
    private String name;

    /**
     * Returns the property name.
     * @return the {@link String} attribute identifier.
     * @see #setName(String)
     * hibernate.property
     *  	column="ATTR_NAME"
     *  	not-null="true"
     *      unique="true"
     *  	access="property"
     *  	length="50"
     */
    public String getName() {
        return name;
    }

    /**
     * Initializes the property name.
     * @param name the new {@link String} identifier.
     * @see #getName()
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * The property tag.
     */
    private String tag;

    /**
     * Returns the property tag.
     * @return the {@link String} value.
     * @see #setTag(String)
     * hibernate.property
     *  	column="PROP_TAG"
     *  	access="property"
     *  	length="100"
     */
    public String getTag() {
        return tag;
    }

    /**
     * Initializes property tag.
     * @param tag the new {@link String} tag.
     * @see #getTag()
     */
    public void setTag(String tag) {
        this.tag = tag;
    }

    /**
     * The property validation status.
     * A property may be temporarily deactivated.
     */
    private boolean visible;

    /**
     * Indicates if the property is visible / usable.
     * If not, users should not be able to access the privileges
     * they inherit from having this property set.
     * @return the visible flag.
     * @see #setVisible(boolean)
     * hibernate.property
     *  	column="IND_VISIBLE"
     *  	access="property"
     */
    public boolean isVisible() {
        return visible;
    }

    /**
     * Initializes the property visible flag.
     * @param visible the new flag value.
     * @see #isVisible
     */
    public void setVisible(boolean visible) {
        this.visible = visible;
    }

    /**
     * Returns a string representation of this property definition.
     * @return a string representing this property definition.
     * hidden
     */
    public String toString()
    {
        StringBuilder sb = new StringBuilder();

        sb.append("ID_PROP=");
        sb.append(getUserPropertyId());

        sb.append(" PROP_NAME=");
        sb.append(name);

        sb.append(" PROP_TAG=");
        sb.append(tag);

        sb.append(" IND_VISIBLE=");
        sb.append(visible);

        return sb.toString();
    }

}