be.personify.iam.model.provisioning.ProvisionDecision 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.ArrayList;
import java.util.List;
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.ManyToOne;
import be.personify.iam.model.util.Persisted;
import be.personify.util.Action;
import be.personify.util.State;
import be.personify.util.generator.MetaInfo;
@Entity
@MetaInfo( group="provisioning", frontendGroup="TargetSystem", name="ProvisionDecision", description="A ProvisionDecision",
iconClass = "location-arrow",
afterDeleteGoToLink="targetSystem",
afterCreateGoToLink="targetSystem",
sortOrderInGroup=5,
number=5,
rst_include_extra=true,
showOnHomePage=false
)
public class ProvisionDecision extends Persisted implements Serializable {
private static final long serialVersionUID = 5580752115001592184L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@MetaInfo(name="id", description="The id of the object", showInSearchResultGrid=false)
private long id;
@ManyToOne( targetEntity=TargetSystem.class)
@MetaInfo( showInSearchResultGrid=false, name="targetsystem",description="the targetsystem linked to this decision. See targetsystem_", searchable = false)
private TargetSystem targetSystem;
@Enumerated(EnumType.STRING)
@MetaInfo(name="remoteState",description="the state of the object in the remote system")
private State remoteState;
@MetaInfo(name="localState",description="the state of the object in the local system. See the implementation of targetsystemlink_")
@Enumerated(EnumType.STRING)
private State localState;
@Enumerated(EnumType.STRING)
@MetaInfo(name="action",description="the action to be taken when the local state and the remote state matches")
private Action action;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public State getRemoteState() {
return remoteState;
}
public void setRemoteState(State remoteState) {
this.remoteState = remoteState;
}
public State getLocalState() {
return localState;
}
public void setLocalState(State localState) {
this.localState = localState;
}
public Action getAction() {
return action;
}
public void setAction(Action action) {
this.action = action;
}
public TargetSystem getTargetSystem() {
return targetSystem;
}
public void setTargetSystem(TargetSystem targetSystem) {
this.targetSystem = targetSystem;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((action == null) ? 0 : action.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((localState == null) ? 0 : localState.hashCode());
result = prime * result + ((remoteState == null) ? 0 : remoteState.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;
ProvisionDecision other = (ProvisionDecision) obj;
if (action != other.action)
return false;
if (id != other.id)
return false;
if (localState != other.localState)
return false;
if (remoteState != other.remoteState)
return false;
if (targetSystem == null) {
if (other.targetSystem != null)
return false;
} else if (!targetSystem.equals(other.targetSystem))
return false;
return true;
}
public static List toGenericList( List provisionDecisions) {
List genericList = new ArrayList();
for ( ProvisionDecision p : provisionDecisions) {
genericList.add(p.toGeneric());
}
return genericList;
}
private be.personify.util.provisioning.ProvisionDecision toGeneric() {
be.personify.util.provisioning.ProvisionDecision generic = new be.personify.util.provisioning.ProvisionDecision();
generic.setAction(action);
generic.setId(id);
generic.setLocalState(localState);
generic.setRemoteState(remoteState);
return generic;
}
}