be.personify.iam.model.authentication.RuleCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of personify-model Show documentation
Show all versions of personify-model Show documentation
a possible model for personify
package be.personify.iam.model.authentication;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import be.personify.iam.model.util.Persisted;
import be.personify.util.generator.MetaInfo;
@Entity
@MetaInfo( name="RuleCondition", group="authentication",
frontendGroup = "Authorization", description="A rule condition", iconClass = "exclamation", number=5,
afterCreateGoToLink = "rule",
afterDeleteGoToLink = "rule",
afterUpdateGoToLink = "rule"
)
public class RuleCondition extends Persisted implements Serializable {
private static final long serialVersionUID = -4307881300882194550L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@MetaInfo(name="The id of the object", description="The id of the object", showInSearchResultGrid = false)
private long id;
@MetaInfo(name="The conditionexpression", description="The condition expression for the rule condition", customRenderer = "text_area|rows:5")
private String conditionExpression;
/**
* Evaluator which verifies the expression.
*/
@Enumerated(EnumType.STRING)
@MetaInfo(name="The ruleExpressionTypeEvaluator", description="The ruleExpressionTypeEvaluator for the rule condition", showInSearchResultGrid = false)
private RuleExpressionTypeEvaluator ruleExpressionTypeEvaluator;
/**
* Rule to which this rule condition belongs.
*/
@ManyToOne
@JoinColumn(name = "rule_id")
@MetaInfo(name="rule", description="the rule_ linked to the condition", searchable = false, editable = false)
private Rule rule;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getConditionExpression() {
return conditionExpression;
}
public void setConditionExpression(String conditionExpression) {
this.conditionExpression = conditionExpression;
}
public RuleExpressionTypeEvaluator getRuleExpressionTypeEvaluator() {
return ruleExpressionTypeEvaluator;
}
public void setRuleExpressionTypeEvaluator(RuleExpressionTypeEvaluator ruleExpressionTypeEvaluator) {
this.ruleExpressionTypeEvaluator = ruleExpressionTypeEvaluator;
}
public Rule getRule() {
return rule;
}
public void setRule(Rule rule) {
this.rule = rule;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((conditionExpression == null) ? 0 : conditionExpression.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((rule == null) ? 0 : rule.hashCode());
result = prime * result + ((ruleExpressionTypeEvaluator == null) ? 0 : ruleExpressionTypeEvaluator.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
RuleCondition other = (RuleCondition) obj;
if (conditionExpression == null) {
if (other.conditionExpression != null)
return false;
} else if (!conditionExpression.equals(other.conditionExpression))
return false;
if (id != other.id)
return false;
if (rule == null) {
if (other.rule != null)
return false;
} else if (!rule.equals(other.rule))
return false;
if (ruleExpressionTypeEvaluator != other.ruleExpressionTypeEvaluator)
return false;
return true;
}
}