be.personify.iam.model.authentication.Session 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.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedAttributeNode;
import javax.persistence.NamedEntityGraph;
import javax.persistence.OneToOne;
import be.personify.iam.model.util.Persisted;
import be.personify.util.generator.MetaInfo;
@Entity
@NamedEntityGraph(name = "Session.detail",
attributeNodes = @NamedAttributeNode("accessToken")
)
@MetaInfo( name="Session", group="authentication",
frontendGroup = "Authentication", description="A session", iconClass = "clock", number=2,
editable = false, creatable = false,showEditButtonOnSearchResult = false,
addable = false, showInMenu = true
)
public class Session extends Persisted implements Serializable{
private static final long serialVersionUID = -9117263262021019065L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@MetaInfo(name="id", description="The id of the object", showInSearchResultGrid = false)
private long id;
@MetaInfo(name="identifier", description="The identifier linked to the session.", searchable = true, showInSearchResultGrid = true)
private String identifier;
@MetaInfo(name="tokenType", description="The tokenType linked to the session.", searchable = true, showInSearchResultGrid = true)
private String tokenType;
@OneToOne(mappedBy = "session", cascade = CascadeType.ALL,
fetch = FetchType.LAZY, optional = false)
@MetaInfo(name="accessToken", description="The access token linked to the session. See accessToken_", searchable = false, showInSearchResultGrid = false)
private AccessToken accessToken;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public AccessToken getAccessToken() {
return accessToken;
}
public void setAccessToken(AccessToken accessToken) {
this.accessToken = accessToken;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((accessToken == null) ? 0 : accessToken.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
result = prime * result + ((tokenType == null) ? 0 : tokenType.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;
Session other = (Session) obj;
if (accessToken == null) {
if (other.accessToken != null)
return false;
} else if (!accessToken.equals(other.accessToken))
return false;
if (id != other.id)
return false;
if (identifier == null) {
if (other.identifier != null)
return false;
} else if (!identifier.equals(other.identifier))
return false;
if (tokenType == null) {
if (other.tokenType != null)
return false;
} else if (!tokenType.equals(other.tokenType))
return false;
return true;
}
}