Project

General

Profile

Revision 20ffe9b7

ID20ffe9b7dab7abc056b751d16e7381803800fac8
Parent 19628913
Child b1d5cef3

Added by Andreas Müller about 1 year ago

ref #7099 , ref #8464 some adaptions on constraints for CdmAuthority

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/permission/AuthorityBase.java
9 9
package eu.etaxonomy.cdm.model.permission;
10 10

  
11 11
import javax.persistence.Entity;
12
import javax.persistence.Inheritance;
13
import javax.persistence.InheritanceType;
12 14
import javax.persistence.Table;
15
import javax.persistence.UniqueConstraint;
13 16
import javax.xml.bind.annotation.XmlAccessType;
14 17
import javax.xml.bind.annotation.XmlAccessorType;
15 18
import javax.xml.bind.annotation.XmlRootElement;
......
30 33
         }
31 34
)
32 35
@XmlRootElement(name = "Authority")
33
@Table(name="Authority")
36
@Table(name="Authority"
37
//for some reason this does not work, see comment #8464#note-6
38
,uniqueConstraints=@UniqueConstraint(columnNames={"property","permissionClass","targetUuid","operations"})
39
)
34 40
@Entity
41
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
35 42
public abstract class AuthorityBase extends CdmBase{
36 43

  
37 44
    private static final long serialVersionUID = -3786639494325014624L;
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/permission/CdmAuthority.java
54 54
     * and in it's {@link TermVocabulary vocabulary}.
55 55
     */
56 56
    @XmlAttribute(name ="PermissionClass")
57
    @Column(name="permissionClass")
58
    @NotNull
57
//    @NotNull
59 58
    @Type(type = "eu.etaxonomy.cdm.hibernate.EnumUserType",
60 59
        parameters = {@org.hibernate.annotations.Parameter(name  = "enumClass", value = "eu.etaxonomy.cdm.model.permission.PermissionClass")}
61 60
    )
......
65 64
    private String property;
66 65

  
67 66
    @XmlAttribute(name ="Operations")
68
    @NotNull
67
    @NotNull  //an empty operations set will result in "#"
69 68
    @Type(type = "eu.etaxonomy.cdm.hibernate.EnumSetUserType",
70 69
        parameters = {@org.hibernate.annotations.Parameter(name  = "enumClass", value = "eu.etaxonomy.cdm.model.permission.CRUD")}
71 70
    )
......
135 134
        this.operations.remove(operation);
136 135
    }
137 136

  
137
// ************************* CLONE *****************************/
138

  
139
    @Override
140
    public Object clone() throws CloneNotSupportedException {
141
        CdmAuthority result = (CdmAuthority)super.clone();
142

  
143
        result.operations = this.operations.clone();
144

  
145
        return result;
146
    }
147

  
148

  
149

  
150

  
138 151
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/permission/Role.java
8 8
*/
9 9
package eu.etaxonomy.cdm.model.permission;
10 10

  
11
import javax.persistence.Column;
12 11
import javax.persistence.Entity;
13
import javax.validation.constraints.NotNull;
14 12
import javax.xml.bind.annotation.XmlAccessType;
15 13
import javax.xml.bind.annotation.XmlAccessorType;
16 14
import javax.xml.bind.annotation.XmlRootElement;
......
35 33

  
36 34
    private static final long serialVersionUID = -1897282896233162691L;
37 35

  
38
    @Column(unique = true)
39
    @NotNull
36
//    @Column(unique = true)
37
//    @NotNull
40 38
    private String role;
41 39

  
42 40
// *************************** Factory Methods ********************************/

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)