/** * A Movie node entity. * * @author Luanne Misquitta * @author Oliver Gierke * @author Michael J. Simons */ @NodeEntity(label = "Movie") @NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) @Getter public class Movie { private @Id @GeneratedValue Long id; private String title; private @Relationship(type = "ACTED_IN", direction = "INCOMING") Set<Role> roles = new HashSet<>(); public Movie(String title) { this.title = title; } }
/** * An Actor node entity. * * @author Luanne Misquitta * @author Oliver Gierke * @author Michael J. Simons */ @NodeEntity(label = "Actor") @NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) @Getter public class Actor { private @Id @GeneratedValue Long id; private String name; private @Relationship(type = "ACTED_IN") Set<Role> roles = new HashSet<>(); public Actor(String name) { this.name = name; } public void actedIn(Movie movie, String roleName) { Role role = new Role(this, roleName, movie); roles.add(role); movie.getRoles().add(role); } }
/** * A Role relationship entity between an actor and movie. * * @author Luanne Misquitta * @author Michael J. Simons */ @RelationshipEntity(type = "ACTED_IN") @NoArgsConstructor(force = true, access = AccessLevel.PRIVATE) @Getter public class Role { private @Id @GeneratedValue Long id; private @StartNode Actor actor; private String role; private @EndNode Movie movie; Role(Actor actor, String role, Movie movie) { this.actor = actor; this.role = role; this.movie = movie; } }
public static class WithoutId { //@Id not implemented yet @Id public String identifier; }
public static class Basic { public Long id; @Id public String identifier; }
public static class IdAndGenerationType { public Long id; @Id @GeneratedValue(strategy = UuidStrategy.class) public String identifier; }
public static class WithCustomIdStrategy { public Long id; @Id @GeneratedValue(strategy = CustomIdStrategy.class) public String identifier; }
/** * @author Michael J. Simons */ @NodeEntity public abstract class LabeledEntity { @Id protected String uuid; }
/** * @author Andreas Berger */ abstract class BaseEntity { @Id @GeneratedValue private Long id; public Long getId() { return id; } }
public abstract class MostBasicEntity { @Id @Convert(UuidStringConverter.class) private UUID myId; public UUID getMyId() { return myId; } public void setMyId(UUID myId) { this.myId = myId; } }
public static class WithCustomInstanceIdStrategy { public Long id; @Id @GeneratedValue(strategy = IdGenerationTest.CustomInstanceIdStrategy.class) public String identifier; }
/** * @author Michael J. Simons */ public abstract class AbstractBaseUser { @Id @GeneratedValue private Long id; public Long getId() { return id; } }
public static class UuidGenerationStrategyWithIdTypeNotUuid { @Id @GeneratedValue(strategy = UuidStrategy.class) public int identifier; } }
public static class BothIdAndPrimaryIndexOnDifferentProperty { @Id public String identifier; @Index(primary = true, unique = true) public String other; }
/** * @author Vince Bickers */ public abstract class Activity { private Date date; @Id @GeneratedValue private Long id; public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } }
public static class InternalIdWithAnnotation { @Id @GeneratedValue public Long identifier; }
/** * @author vince */ public abstract class AbstractStateNode<R extends InterfaceTimeRelation> implements InterfaceStateNode<R> { @Id @GeneratedValue private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Override public abstract R getIdentityRelation(); @Override public abstract void setIdentityRelation(R identityRelation); }
/** * @author vince */ public abstract class AbstractIdentityNode<R extends InterfaceTimeRelation> implements InterfaceIdentityNode { @Id @GeneratedValue private Long id; @Override public Long getId() { return id; } @Override public void setId(Long id) { this.id = id; } public abstract Set<R> getStates(); public abstract void setStates(Set<R> states); }
@NodeEntity public static class Something { @Id @GeneratedValue private Long id; private String name; } }