package org.wamblee.security.authorization;
-import org.wamblee.security.AbstractPersistent;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
import org.wamblee.usermgt.User;
/**
*
* @author Erik Brakkee
*/
-public class AnyUserCondition extends AbstractPersistent implements
- UserCondition {
+@Entity
+@DiscriminatorValue("ANYUSER")
+public class AnyUserCondition extends UserCondition {
/**
* Constructs the condition.
*
package org.wamblee.security.authorization;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
import org.wamblee.security.AbstractPersistent;
import org.wamblee.usermgt.User;
*
* @author Erik Brakkee
*/
-public class GroupUserCondition extends AbstractPersistent implements
- UserCondition {
+@Entity
+@DiscriminatorValue("GROUP")
+public class GroupUserCondition extends UserCondition {
/**
* Group the user must be in.
*/
+ @Column(name = "GRP")
private String group;
/**
*/
package org.wamblee.security.authorization;
+import javax.persistence.Access;
+import javax.persistence.AccessType;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
import org.wamblee.security.AbstractPersistent;
/**
* Determiens if an operation is a subclass of a specified operation.
*/
-public class IsaOperationCondition extends AbstractPersistent implements
- OperationCondition {
+@Entity
+@DiscriminatorValue("ISA")
+@Access(AccessType.PROPERTY)
+public class IsaOperationCondition extends OperationCondition {
/**
* Operation that the other operation must be a subclass of.
*/
*
* @return Operation string.
*/
+ @Column(name = "CLASSNAME")
protected String getOperationString() {
if (operation == null) {
return null;
*/
package org.wamblee.security.authorization;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
import org.wamblee.persistence.Persistent;
/**
*
* @author Erik Brakkee
*/
-public interface OperationCondition extends Persistent {
+@Entity
+@Table(name = "SEC_OPERATION_CONDITION")
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYPE")
+public abstract class OperationCondition {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long primaryKey;
+
+ @Version
+ private int version;
+
+ public OperationCondition() {
+ // Empty
+ }
+
+ public OperationCondition(OperationCondition aCondition) {
+ primaryKey = aCondition.primaryKey;
+ version = aCondition.version;
+ }
+
/**
* Determines if the operation matches.
*
*
* @return True iff the operation matches.
*/
- boolean matches(Operation aOperation);
+ public abstract boolean matches(Operation aOperation);
}
*/
package org.wamblee.security.authorization;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
import org.wamblee.persistence.Persistent;
/**
*
* @author Erik Brakkee
*/
-public interface PathCondition extends Persistent {
+@Entity
+@Table(name = "SEC_PATH_CONDITION")
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYPE")
+public abstract class PathCondition {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long primaryKey;
+
+ @Version
+ private int version;
+
+ public PathCondition() {
+ // Empty
+ }
+
+ public PathCondition(PathCondition aCondition) {
+ primaryKey = aCondition.primaryKey;
+ version = aCondition.version;
+ }
+
/**
* Checks if the path matches the condition.
*
*
* @return True iff the path matches.
*/
- boolean matches(String aPath);
+ public abstract boolean matches(String aPath);
}
*/
package org.wamblee.security.authorization;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
import org.wamblee.security.AbstractPersistent;
/**
*
* @author Erik Brakkee
*/
-public class RegexpPathCondition extends AbstractPersistent implements
- PathCondition {
+@Entity
+@DiscriminatorValue("REGEXP")
+public class RegexpPathCondition extends PathCondition {
/**
* String the path must start with.
*/
*/
package org.wamblee.security.authorization;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
/**
* Condition to check whether a path starts with a given string.
*
* @author Erik Brakkee
*/
+@Entity
+@DiscriminatorValue("STARTSWITH")
public class StartsWithPathCondition extends RegexpPathCondition {
/**
* Constructs the condition.
*/
package org.wamblee.security.authorization;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
import org.wamblee.persistence.Persistent;
import org.wamblee.usermgt.User;
*
* @author Erik Brakkee
*/
-public interface UserCondition extends Persistent {
+@Entity
+@Table(name = "SEC_USER_CONDITION")
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYPE")
+public abstract class UserCondition {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long primaryKey;
+
+ @Version
+ private int version;
+
+ public UserCondition() {
+ // Empty.
+ }
+
+ public UserCondition(UserCondition aCondition) {
+ primaryKey = aCondition.primaryKey;
+ version = aCondition.version;
+ }
+
/**
* Determines if the condition matches.
*
*
* @return True if the condition matches, false otherwise.
*/
- boolean matches(User aUser);
+ public abstract boolean matches(User aUser);
}
<class>org.wamblee.usermgt.User</class>
<class>org.wamblee.usermgt.Group</class>
+ <class>org.wamblee.security.authorization.UserCondition</class>
+ <class>org.wamblee.security.authorization.AnyUserCondition</class>
+ <class>org.wamblee.security.authorization.GroupUserCondition</class>
+ <class>org.wamblee.security.authorization.OperationCondition</class>
+ <class>org.wamblee.security.authorization.IsaOperationCondition</class>
+ <class>org.wamblee.security.authorization.PathCondition</class>
+ <class>org.wamblee.security.authorization.RegexpPathCondition</class>
+ <class>org.wamblee.security.authorization.StartsWithPathCondition</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>