Blame view

src/main/java/org/legrog/entities/AccountAttribute.java 3.52 KB
1 2 3 4
package org.legrog.entities;

import javax.persistence.*;

5 6 7 8
/*
    Entité persistante représentant les propriétés qui sont paramétrées pour un utilisateur.
    Migréee depuis la v2.
 */
9
@Entity
10
public class AccountAttribute {
11
    @Id
12
    @GeneratedValue(strategy = GenerationType.IDENTITY)
13 14 15 16 17 18 19
    private int userAttributeId;

    public int getUserAttributeId() {
        return userAttributeId;
    }

    /**
20
     * The linked account.
21 22
     */
    @ManyToOne
23
    private Account account;
24 25

    /**
26
     * Retrieve the account this attribute is attached to.
27
     * hibernate.many-to-one
28
     * 		column="ID_UTILISATEUR"
29
     * 		class="org.roliste.data.db.Account"
30 31 32 33 34
     *      not-null="true"
     *  	access="property"
     *  	lazy="proxy"
     *      properties-name="PropertyPerUser"
     *      foreign-key="FK_ATTRIBUTUTILISATEUR_UTILISATEUR"
35
     * @return the {link org.roliste.data.db.Account} this attribute is attached to.
36
     * Shall not be <code>null</code>.
37
     * see #setAccount(org.roliste.data.db.Account)
38
     */
39 40
    public Account getAccount() {
        return account;
41 42 43
    }

    /**
44 45 46
     * Set the account this attribute is attached to.
     * @param account the new {link org.roliste.data.db.Account} this attribute will be attached to. Shall not be <code>null</code>.
     * @see #getAccount()
47
     */
48 49
    public void setAccount(Account account) {
        this.account = account;
50 51 52 53 54 55
    }

    /**
     * The linked property.
     */
    @ManyToOne
56
    private AccountProperty accountProperty;
57 58 59

    /**
     * Retrieve the property this attribute is attached to.
60
     * hibernate.many-to-one
61
     * 		column="ID_PROP"
62
     * 		class="org.roliste.data.db.AccountProperty"
63 64 65 66 67
     *      not-null="true"
     *  	access="property"
     *  	lazy="false"
     *      properties-name="PropertyPerUser"
     *      foreign-key="FK_ATTRIBUTUTILISATEUR_PROPRIETE"
68
     * @return the {link org.roliste.data.db.AccountProperty} this attribute is attached to.
69
     * Shall not be <code>null</code>.
70
     * see #setProperty(org.roliste.data.db.AccountProperty)
71
     */
72 73
    public AccountProperty getProperty() {
        return accountProperty;
74 75 76 77
    }

    /**
     * Set the property this attribute is attached to.
78
     * @param prop the new {link org.roliste.data.db.AccountProperty} this attribute will be attached to. Shall not be <code>null</code>.
79 80
     * @see #getProperty()
     */
81 82
    public void setProperty(AccountProperty prop) {
        accountProperty = prop;
83 84 85 86 87 88 89 90 91 92 93 94 95
    }

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

    /**
     * Returns the property value.
     * @return the {@link String} value. If property is known to be some other kind of value, you shall
     * convert it yourself. May be <code>null</code>, in cases where the sole existence of the attribute
     * is the value, or for unset attributes.
     * @see #setValue(String)
96
     * hibernate.property
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
     *  	column="ATTR_VALUE"
     *  	access="property"
     *  	length="200"
     */
    public String getValue() {
        return value;
    }

    /**
     * Initializes attribute value.
     * @param value the new {@link String} value.
     * @see #getValue()
     */
    public void setValue(String value) {
        this.value = value;
    }

    /**
115 116
     * Returns a string representation of this account attribute definition.
     * @return a string representing this account attribute definition.
117
     * hidden
118
     */
119
    @Override
120 121
    public String toString()
    {
122
        return "ID_ATTR=" + getUserAttributeId() + " ATTR_PROP=" + accountProperty + " ATTR_VALUE=" + value;
123 124 125
    }

}