Fix schema settings

This commit is contained in:
Martin Stockhammer 2016-11-16 21:07:08 +01:00
parent 78e37f700a
commit 7482c06fcd
6 changed files with 37 additions and 21 deletions

View File

@ -39,7 +39,7 @@ public class JpaOperation implements Operation, Serializable {
private String name; private String name;
@Column(name="DESCRIPTION") @Column(name="DESCRIPTION")
private String description; private String description;
@Column(name="PERMANENT") @Column(name="PERMANENT", nullable = false)
private boolean permanent; private boolean permanent;

View File

@ -39,7 +39,7 @@ public class JpaPermission implements Permission,Serializable {
private String name; private String name;
@Column(name="DESCRIPTION") @Column(name="DESCRIPTION")
private String description; private String description;
@Column(name="PERMANENT") @Column(name="PERMANENT", nullable = false)
private boolean permanent; private boolean permanent;
@ManyToOne(cascade = CascadeType.ALL) @ManyToOne(cascade = CascadeType.ALL)
@JoinColumn( @JoinColumn(

View File

@ -37,9 +37,9 @@ public class JpaResource implements Resource, Serializable {
@Id @Id
@Column(name="IDENTIFIER") @Column(name="IDENTIFIER")
private String identifier; private String identifier;
@Column(name="PATTERN") @Column(name="PATTERN", nullable = false)
private boolean pattern; private boolean pattern;
@Column(name="PERMANENT") @Column(name="PERMANENT", nullable = false)
private boolean permanent; private boolean permanent;

View File

@ -42,15 +42,15 @@ public class JpaRole extends AbstractRole implements Serializable {
private String name; private String name;
@Column(name="DESCRIPTION") @Column(name="DESCRIPTION")
private String description; private String description;
@Column(name="ASSIGNABLE") @Column(name="ASSIGNABLE",nullable = false)
private boolean assignable; private boolean assignable;
@Column(name="PERMANENT") @Column(name="PERMANENT", nullable = false)
private boolean permanent; private boolean permanent;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@OrderColumn(name="INTEGER_IDX") @OrderColumn(name="INTEGER_IDX", nullable = false)
@JoinTable( @JoinTable(
name="SECURITY_ROLE_PERMISSION_MAP", name="SECURITY_ROLE_PERMISSION_MAP",
joinColumns={ @JoinColumn(name="NAME_OID", referencedColumnName="NAME") }, joinColumns={ @JoinColumn(name="NAME_OID", referencedColumnName="NAME", nullable = false) },
inverseJoinColumns = { inverseJoinColumns = {
@JoinColumn(name="NAME_EID",referencedColumnName = "NAME") @JoinColumn(name="NAME_EID",referencedColumnName = "NAME")
} }
@ -58,11 +58,12 @@ public class JpaRole extends AbstractRole implements Serializable {
List<JpaPermission> permissions = new ArrayList<JpaPermission>(); List<JpaPermission> permissions = new ArrayList<JpaPermission>();
@ElementCollection(fetch = FetchType.EAGER) @ElementCollection(fetch = FetchType.EAGER)
@OrderColumn(name="INTEGER_IDX") @OrderColumn(name="INTEGER_IDX",nullable = false)
@Column(name="STRING_ELE")
@CollectionTable( @CollectionTable(
name="SECURITY_ROLE_CHILDROLE_MAP", name="SECURITY_ROLE_CHILDROLE_MAP",
joinColumns = { joinColumns = {
@JoinColumn(name="NAME_OID",referencedColumnName = "NAME") @JoinColumn(name="NAME_OID",referencedColumnName = "NAME", nullable = false)
} }
) )
List<String> childRoleNames = new ArrayList<String>(); List<String> childRoleNames = new ArrayList<String>();

View File

@ -20,6 +20,7 @@ package org.apache.archiva.redback.rbac.jpa.model;
*/ */
import org.apache.archiva.redback.rbac.AbstractUserAssignment; import org.apache.archiva.redback.rbac.AbstractUserAssignment;
import org.apache.archiva.redback.rbac.UserAssignment;
import javax.persistence.CollectionTable; import javax.persistence.CollectionTable;
import javax.persistence.Column; import javax.persistence.Column;
@ -32,6 +33,7 @@ import javax.persistence.OrderColumn;
import javax.persistence.Table; import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -39,7 +41,7 @@ import java.util.List;
*/ */
@Entity @Entity
@Table(name="SECURITY_USER_ASSIGNMENTS") @Table(name="SECURITY_USER_ASSIGNMENTS")
public class JpaUserAssignment extends AbstractUserAssignment implements Serializable { public class JpaUserAssignment extends AbstractUserAssignment implements UserAssignment,Serializable {
@Id @Id
@ -47,17 +49,20 @@ public class JpaUserAssignment extends AbstractUserAssignment implements Seriali
private String principal; private String principal;
@ElementCollection(fetch = FetchType.EAGER) @ElementCollection(fetch = FetchType.EAGER)
@Column(name="STRING_ELE") @Column(name="STRING_ELE")
@OrderColumn(name="INTEGER_IDX") @OrderColumn(name="INTEGER_IDX", nullable = false)
@CollectionTable( @CollectionTable(
name="SECURITY_USERASSIGNMENT_ROLENAMES", name="SECURITY_USERASSIGNMENT_ROLENAMES",
joinColumns = { joinColumns = {
@JoinColumn(name = "PRINCIPAL_OID", referencedColumnName = "PRINCIPAL") @JoinColumn(name = "PRINCIPAL_OID", referencedColumnName = "PRINCIPAL", nullable = false)
} }
) )
private List<String> roleNames = new ArrayList<String>(); private List<String> roleNames = new ArrayList<String>();
@Column(name="PERMANENT") @Column(name="PERMANENT", nullable = false)
private boolean permanent = false; private boolean permanent = false;
@Column(name="LAST_UPDATED")
private Date timestamp;
@Override @Override
public String getPrincipal() { public String getPrincipal() {
return principal; return principal;
@ -103,4 +108,14 @@ public class JpaUserAssignment extends AbstractUserAssignment implements Seriali
public int hashCode() { public int hashCode() {
return principal.hashCode(); return principal.hashCode();
} }
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
} }

View File

@ -51,21 +51,21 @@ public class JpaUser implements org.apache.archiva.redback.users.User {
@Column(name="LAST_PASSWORD_CHANGE") @Column(name="LAST_PASSWORD_CHANGE")
private Date lastPasswordChange; private Date lastPasswordChange;
@ElementCollection(fetch = FetchType.EAGER) @ElementCollection(fetch = FetchType.EAGER)
@OrderColumn(name="INTEGER_IDX") @OrderColumn(name="INTEGER_IDX", nullable = false)
@Column(name="STRING_ELE") @Column(name="STRING_ELE")
@CollectionTable(name="JDOUSER_PREVIOUSENCODEDPASSWORDS", @CollectionTable(name="JDOUSER_PREVIOUSENCODEDPASSWORDS",
joinColumns = @JoinColumn(name = "USERNAME_OID", referencedColumnName = "USERNAME") joinColumns = @JoinColumn(name = "USERNAME_OID", nullable = false, referencedColumnName = "USERNAME")
) )
private List<String> previousEncodedPasswords = new ArrayList<String>(); private List<String> previousEncodedPasswords = new ArrayList<String>();
@Column(name="PERMANENT") @Column(name="PERMANENT", nullable = false)
private boolean permanent; private boolean permanent;
@Column(name="LOCKED") @Column(name="LOCKED", nullable = false)
private boolean locked; private boolean locked;
@Column(name="PASSWORD_CHANGE_REQUIRED") @Column(name="PASSWORD_CHANGE_REQUIRED", nullable = false)
private boolean passwordChangeRequired; private boolean passwordChangeRequired;
@Column(name="VALIDATED") @Column(name="VALIDATED", nullable = false)
private boolean validated; private boolean validated;
@Column(name="COUNT_FAILED_LOGIN_ATTEMPTS") @Column(name="COUNT_FAILED_LOGIN_ATTEMPTS",nullable = false)
private int countFailedLoginAttempts; private int countFailedLoginAttempts;
@Column(name="ACCOUNT_CREATION_DATE") @Column(name="ACCOUNT_CREATION_DATE")
private Date accountCreationDate; private Date accountCreationDate;