@Entity
@FetchProfiles({
@FetchProfile(name = Location.FETCH_PROFILE_TREE, fetchOverrides = {
@FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_PARENT, mode = FetchMode.JOIN),
@FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_CHILDREN, mode = FetchMode.JOIN) }),
@FetchProfile(name = Location.FETCH_PROFILE_STANDLONE, fetchOverrides = {
@FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_TIMEZONE, mode = FetchMode.JOIN),
@FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_CALENDAR, mode = FetchMode.JOIN),
@FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_SYSTEMSTATE, mode = FetchMode.JOIN),
@FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_CLIENT, mode = FetchMode.JOIN),
@FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_ISSUER, mode = FetchMode.JOIN) }) })
@Table(name = "Location")
@Audited
@Indexed
public class Location extends BaseEntity implements IssuerAware, ClientAware
{
public final static String FETCH_PROFILE_TREE = "locationTree";
public final static String FETCH_PROFILE_STANDLONE = "locationStandalone";
public final static String PROPERTY_NAME = "name";
public final static String PROPERTY_LOCATION_TYPE = "locationType";
public final static String PROPERTY_RANK = "rank";
public final static String PROPERTY_DESCRIPTION = "description";
public final static String PROPERTY_GRAPHIC = "graphic";
public final static String PROPERTY_TIMEZONE = "timezone";
public final static String PROPERTY_CHILDREN = "children";
public final static String PROPERTY_PARENT = "parent";
public final static String PROPERTY_CALENDAR = "calendar";
public final static String PROPERTY_SYSTEMSTATE = "systemState";
public final static String PROPERTY_ISSUER = "issuer";
public final static String PROPERTY_CLIENT = "client";
@Column(length = 60, name = "name", nullable = false, unique = true)
@NotNull
@Size(max = 60)
@Field
@Viewable
private String name;
@Column(name = "locationType")
@NotNull
@Enumerated(EnumType.ORDINAL)
@Field
@Viewable
private LocationType locationType;
@Column(name = "rank")
@Range(max = Integer.MAX_VALUE)
@Field
@Viewable
private Integer rank = 0;
@Column(name = "description")
@Lob
@Field
@Viewable
private String description;
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "graphicId")
private Document graphic;
@JoinColumn(name = "timezoneId")
@ManyToOne(fetch = FetchType.LAZY)
@IndexedEmbedded
@Viewable
private Timezone timezone;
@JoinColumn(name = "parentId")
@ManyToOne(fetch = FetchType.LAZY)
@IndexedEmbedded(depth = 1)
@Viewable
private Location parent;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "parent")
private final Set<Location> children = new HashSet<Location>();
...
}