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;
@Column(name="DESCRIPTION")
private String description;
@Column(name="PERMANENT")
@Column(name="PERMANENT", nullable = false)
private boolean permanent;

View File

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

View File

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

View File

@ -42,15 +42,15 @@ public class JpaRole extends AbstractRole implements Serializable {
private String name;
@Column(name="DESCRIPTION")
private String description;
@Column(name="ASSIGNABLE")
@Column(name="ASSIGNABLE",nullable = false)
private boolean assignable;
@Column(name="PERMANENT")
@Column(name="PERMANENT", nullable = false)
private boolean permanent;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@OrderColumn(name="INTEGER_IDX")
@OrderColumn(name="INTEGER_IDX", nullable = false)
@JoinTable(
name="SECURITY_ROLE_PERMISSION_MAP",
joinColumns={ @JoinColumn(name="NAME_OID", referencedColumnName="NAME") },
joinColumns={ @JoinColumn(name="NAME_OID", referencedColumnName="NAME", nullable = false) },
inverseJoinColumns = {
@JoinColumn(name="NAME_EID",referencedColumnName = "NAME")
}
@ -58,11 +58,12 @@ public class JpaRole extends AbstractRole implements Serializable {
List<JpaPermission> permissions = new ArrayList<JpaPermission>();
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn(name="INTEGER_IDX")
@OrderColumn(name="INTEGER_IDX",nullable = false)
@Column(name="STRING_ELE")
@CollectionTable(
name="SECURITY_ROLE_CHILDROLE_MAP",
joinColumns = {
@JoinColumn(name="NAME_OID",referencedColumnName = "NAME")
@JoinColumn(name="NAME_OID",referencedColumnName = "NAME", nullable = false)
}
)
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.UserAssignment;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
@ -32,6 +33,7 @@ import javax.persistence.OrderColumn;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -39,7 +41,7 @@ import java.util.List;
*/
@Entity
@Table(name="SECURITY_USER_ASSIGNMENTS")
public class JpaUserAssignment extends AbstractUserAssignment implements Serializable {
public class JpaUserAssignment extends AbstractUserAssignment implements UserAssignment,Serializable {
@Id
@ -47,17 +49,20 @@ public class JpaUserAssignment extends AbstractUserAssignment implements Seriali
private String principal;
@ElementCollection(fetch = FetchType.EAGER)
@Column(name="STRING_ELE")
@OrderColumn(name="INTEGER_IDX")
@OrderColumn(name="INTEGER_IDX", nullable = false)
@CollectionTable(
name="SECURITY_USERASSIGNMENT_ROLENAMES",
joinColumns = {
@JoinColumn(name = "PRINCIPAL_OID", referencedColumnName = "PRINCIPAL")
@JoinColumn(name = "PRINCIPAL_OID", referencedColumnName = "PRINCIPAL", nullable = false)
}
)
private List<String> roleNames = new ArrayList<String>();
@Column(name="PERMANENT")
@Column(name="PERMANENT", nullable = false)
private boolean permanent = false;
@Column(name="LAST_UPDATED")
private Date timestamp;
@Override
public String getPrincipal() {
return principal;
@ -103,4 +108,14 @@ public class JpaUserAssignment extends AbstractUserAssignment implements Seriali
public int 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")
private Date lastPasswordChange;
@ElementCollection(fetch = FetchType.EAGER)
@OrderColumn(name="INTEGER_IDX")
@OrderColumn(name="INTEGER_IDX", nullable = false)
@Column(name="STRING_ELE")
@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>();
@Column(name="PERMANENT")
@Column(name="PERMANENT", nullable = false)
private boolean permanent;
@Column(name="LOCKED")
@Column(name="LOCKED", nullable = false)
private boolean locked;
@Column(name="PASSWORD_CHANGE_REQUIRED")
@Column(name="PASSWORD_CHANGE_REQUIRED", nullable = false)
private boolean passwordChangeRequired;
@Column(name="VALIDATED")
@Column(name="VALIDATED", nullable = false)
private boolean validated;
@Column(name="COUNT_FAILED_LOGIN_ATTEMPTS")
@Column(name="COUNT_FAILED_LOGIN_ATTEMPTS",nullable = false)
private int countFailedLoginAttempts;
@Column(name="ACCOUNT_CREATION_DATE")
private Date accountCreationDate;