/** * Helper class to test parameterized subclass/superclass hierarchies. */ @Include(rootLevel = true) @Entity public class Employee extends Peon<Manager> { }
/** * Tests a parameterized superclass. */ @Include(rootLevel = true) @Entity public class Manager extends Overlord<Employee> { }
@Entity @Table(name = "child_field_level") @Include(rootLevel = true, type = "fieldLevelChild") public class FieldLevelChildEntity extends FieldLevelParentSuperclass { private String childField; }
/** * Entity that does not have the Paginate annotation that modifies pagination behavior. */ @Entity @Include(rootLevel = true) public class EntityWithoutPaginate extends BaseId { @Getter @Setter private String name; }
/** * Embedded test bean. */ @Include(rootLevel = true) @Entity public class Embedded extends BaseId { private Set<Long> segmentIds; @ElementCollection public Set<Long> getSegmentIds() { return segmentIds; } public void setSegmentIds(Set<Long> segmentIds) { this.segmentIds = segmentIds; } public void addSegmentId(long segmentId) { segmentIds.add(segmentId); } }
/** * DisallowShare bean. */ @Entity @Table(name = "unshareable") @Include(rootLevel = true, type = "unshareable") public class Unshareable extends BaseId { private Container container; @ManyToOne(fetch = FetchType.LAZY) public Container getContainer() { return container; } public void setContainer(Container container) { this.container = container; } }
@Entity @Include(rootLevel = true) @Paginate(defaultLimit = 5) public class EntityWithPaginateDefaultLimit extends BaseId { @Getter @Setter private String name; }
@Entity @Include(rootLevel = true) @Paginate(maxLimit = 10) public class EntityWithPaginateMaxLimit extends BaseId { @Getter @Setter private String name; }
@Entity @Include(rootLevel = true, type = "noShareBid") @SharePermission(sharable = false) public class NoShareBiDirectional extends BaseId { private NoShareBiDirectional other; @OneToOne(fetch = FetchType.LAZY) public NoShareBiDirectional getOther() { return other; } public void setOther(NoShareBiDirectional other) { this.other = other; } }
/** * No Create test bean. */ @CreatePermission(expression = "deny all") @Include(rootLevel = true, type = "nocreate") // optional here because class has this name // Hibernate @Entity @Table(name = "nocreate") public class NoCreateEntity extends BaseId { }
@Entity @Include(rootLevel = true) @Paginate(countable = false) public class EntityWithPaginateCountableFalse extends BaseId { @Getter @Setter private String name; }
/** * No Update test bean. */ @UpdatePermission(expression = "deny all") @Include(rootLevel = true, type = "noupdate") // optional here because class has this name // Hibernate @Entity @Table(name = "noupdate") public class NoUpdateEntity extends BaseId { @OneToMany() public Set<Child> children; }
/** * No Delete test bean. */ @DeletePermission(expression = "deny all") @Include(rootLevel = true, type = "nodelete") // optional here because class has this name // Hibernate @Entity @Table(name = "nodelete") public class NoDeleteEntity extends BaseId { }
@Entity @Include(rootLevel = true, type = "tractor") @SharePermission public class Tractor extends BaseId implements Device { @Getter @Setter private int horsepower; }
/** * No Read test bean. */ @ReadPermission(expression = "deny all") @Include(rootLevel = true, type = "noread") // optional here because class has this name // Hibernate @Entity @Table(name = "noread") public class NoReadEntity extends BaseId { public String field; @OneToOne(fetch = FetchType.LAZY) public Child child; }
@Entity @Include(rootLevel = true, type = "property") @SharePermission public class Property extends BaseId { @Setter private Device myStuff; @Any(metaColumn = @Column(name = "property_type")) @AnyMetaDef(idType = "long", metaType = "string", metaValues = { @MetaValue(targetEntity = example.Tractor.class, value = "tractor"), @MetaValue(targetEntity = example.Smartphone.class, value = "smartphone") }) @JoinColumn(name = "property_id") @ToOne public Device getMyStuff() { return myStuff; } }
/** * A model intended to be ONLY created and read, but never updated */ @Include(rootLevel = true) @Entity @CreatePermission(expression = "allow all") public class CreateButNoReadChild extends BaseId { private CreateButNoRead otherObject; @ManyToOne() @ReadPermission(expression = "allow all") public CreateButNoRead getOtherObject() { return otherObject; } public void setOtherObject(CreateButNoRead otherObject) { this.otherObject = otherObject; } }
/** * A shareable bean. */ @Entity @SharePermission @Table(name = "shareable") @Include(rootLevel = true, type = "shareable") public class Shareable extends BaseId { private Container container; @ManyToOne(fetch = FetchType.LAZY) public Container getContainer() { return container; } public void setContainer(Container container) { this.container = container; } }
/** * Bean with Map of Enums. */ @Entity @Table(name = "color_shape") @Include(rootLevel = true) @SharePermission public class MapColorShape extends BaseId { private Map<Color, Shape> colorShapeMap = new LinkedHashMap<>(); @ElementCollection @MapKeyColumn(name = "color") @Column(name = "shape") public Map<Color, Shape> getColorShapeMap() { return colorShapeMap; } public void setColorShapeMap(Map<Color, Shape> colorShapeMap) { this.colorShapeMap = colorShapeMap; } }
/** * No Update test bean. */ @CreatePermission(expression = "allow all AND noCommit") @UpdatePermission(expression = "allow all AND noCommit") @Include(rootLevel = true, type = "nocommit") // Hibernate @Entity @Table(name = "nocommit") public class NoCommitEntity extends BaseId { static public class NoCommitCheck<T> extends CommitCheck<T> { @Override public boolean ok(T record, RequestScope requestScope, Optional<ChangeSpec> changeSpec) { return false; } } }