be.personify.iam.model.provisioning.Account 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.provisioning;
import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import be.personify.iam.model.util.Persisted;
import be.personify.util.generator.MetaInfo;
@Entity
@MetaInfo( group="provisioning", frontendGroup="Provisioning", name="account", description="A link between a targetsystem and a identity", number = 11,
showInMenu=true, sortOrderInGroup=4,
creatable = false,
iconClass = "stopwatch")
//not for the indexes : multiple accounts towards one targetsystem are supported
@Table(
indexes = {
@Index(name = "idx_account_targets_ident", columnList = "identityHref,target_system_id", unique=false),
@Index(name = "idx_account_targets_acctid", columnList = "accountId,target_system_id", unique=true)
}
)
public class Account extends Persisted implements Serializable{
private static final long serialVersionUID = 443147408145699678L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@MetaInfo(name="id", description="the id of the provisioning", searchable=false, showInSearchResultGrid=false)
private long id;
@MetaInfo(name="accountid", description="The accountid of the identity in the targetsystem", searchable=true, showInSearchResultGrid=true, editable = false)
private String accountId;
@ManyToOne( targetEntity=TargetSystem.class)
@MetaInfo( showInSearchResultGrid=true, name="targetsystem", description="the link to the targetsystem_", searchable = true, editable = false)
private TargetSystem targetSystem;
@MetaInfo(name="identityHref", description="The identityHref of the identity in the targetsystem", searchable=true, showInSearchResultGrid=false, editable = false)
private String identityHref;
@OneToMany(cascade=CascadeType.ALL, mappedBy="account")
@ElementCollection(targetClass=ProvisionAttempt.class)
@MetaInfo(name="provisionAttempts", description="A list containing the provisionAttempts for this account_. See provisionattempt_")
private List provisionAttempts;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getAccountId() {
return accountId;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
public String getIdentityHref() {
return identityHref;
}
public void setIdentityHref(String identityHref) {
this.identityHref = identityHref;
}
public TargetSystem getTargetSystem() {
return targetSystem;
}
public void setTargetSystem(TargetSystem targetSystem) {
this.targetSystem = targetSystem;
}
public List getProvisionAttempts() {
return provisionAttempts;
}
public void setProvisionAttempts(List provisionAttempts) {
this.provisionAttempts = provisionAttempts;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((accountId == null) ? 0 : accountId.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((identityHref == null) ? 0 : identityHref.hashCode());
result = prime * result + ((provisionAttempts == null) ? 0 : provisionAttempts.hashCode());
result = prime * result + ((targetSystem == null) ? 0 : targetSystem.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;
Account other = (Account) obj;
if (accountId == null) {
if (other.accountId != null)
return false;
} else if (!accountId.equals(other.accountId))
return false;
if (id != other.id)
return false;
if (identityHref == null) {
if (other.identityHref != null)
return false;
} else if (!identityHref.equals(other.identityHref))
return false;
if (provisionAttempts == null) {
if (other.provisionAttempts != null)
return false;
} else if (!provisionAttempts.equals(other.provisionAttempts))
return false;
if (targetSystem == null) {
if (other.targetSystem != null)
return false;
} else if (!targetSystem.equals(other.targetSystem))
return false;
return true;
}
}