All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.phasetwo.service.model.jpa.entity.ExtOrganizationEntity Maven / Gradle / Ivy
package io.phasetwo.service.model.jpa.entity;
import static io.phasetwo.service.model.jpa.entity.Entities.setCollection;
import jakarta.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
import org.hibernate.annotations.Nationalized;
/** */
@NamedQueries({
@NamedQuery(
name = "getOrganizationbyRealmIdAndId",
query = "SELECT o FROM ExtOrganizationEntity o WHERE o.realmId = :realmId AND o.id = :id"),
@NamedQuery(
name = "getOrganizationsByRealmId",
query = "SELECT o FROM ExtOrganizationEntity o WHERE o.realmId = :realmId"),
@NamedQuery(
name = "getOrganizationsByRealmIdAndName",
query =
"SELECT o FROM ExtOrganizationEntity o WHERE o.realmId = :realmId AND lower(o.name) LIKE lower(:search) ORDER BY o.name"),
@NamedQuery(
name = "countOrganizationsByRealmIdAndName",
query =
"SELECT count(o) FROM ExtOrganizationEntity o WHERE o.realmId = :realmId AND lower(o.name) LIKE lower(:search)"),
@NamedQuery(
name = "getOrganizationCount",
query = "select count(o) from ExtOrganizationEntity o where o.realmId = :realmId"),
@NamedQuery(
name = "removeAllOrganizations",
query = "delete from ExtOrganizationEntity o where o.realmId = :realmId")
})
@Entity
@Table(
name = "ORGANIZATION",
uniqueConstraints = {@UniqueConstraint(columnNames = {"REALM_ID", "NAME"})})
public class ExtOrganizationEntity {
@Id
@Column(name = "ID", length = 36)
@Access(
AccessType.PROPERTY) // we do this because relationships often fetch id, but not entity. This
// avoids an extra SQL
protected String id;
@Column(name = "NAME", nullable = false)
protected String name;
@Nationalized
@Column(name = "DISPLAY_NAME")
protected String displayName;
@Column(name = "URL")
protected String url;
@Column(name = "REALM_ID", nullable = false)
protected String realmId;
@Column(name = "CREATED_BY_USER_ID")
protected String createdBy;
@OneToMany(
fetch = FetchType.LAZY,
cascade = CascadeType.ALL,
orphanRemoval = true,
mappedBy = "organization")
protected Collection domains = new ArrayList();
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "organization")
protected Collection attributes =
new ArrayList();
@OneToMany(
fetch = FetchType.LAZY,
cascade = CascadeType.ALL,
orphanRemoval = true,
mappedBy = "organization")
protected Collection members =
new ArrayList();
@OneToMany(
fetch = FetchType.LAZY,
cascade = CascadeType.ALL,
orphanRemoval = true,
mappedBy = "organization")
protected Collection roles = new ArrayList();
@OneToMany(
fetch = FetchType.LAZY,
cascade = CascadeType.ALL,
orphanRemoval = true,
mappedBy = "organization")
protected Collection invitations = new ArrayList();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Collection getDomains() {
return domains;
}
public void setDomains(Collection domains) {
setCollection(domains, this.domains);
}
public Collection getAttributes() {
return attributes;
}
public void setAttributes(Collection attributes) {
setCollection(attributes, this.attributes);
}
public Collection getMembers() {
return members;
}
public void setMembers(Collection members) {
setCollection(members, this.members);
}
public Collection getRoles() {
return roles;
}
public void setRoles(Collection roles) {
setCollection(roles, this.roles);
}
public Collection getInvitations() {
return invitations;
}
public void setInvitations(Collection invitations) {
setCollection(invitations, this.invitations);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getRealmId() {
return realmId;
}
public void setRealmId(String realmId) {
this.realmId = realmId;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof ExtOrganizationEntity)) return false;
ExtOrganizationEntity that = (ExtOrganizationEntity) o;
if (!id.equals(that.id)) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
}