started invitation relationship
This commit is contained in:
parent
a4213198ba
commit
3921fe1330
1 changed files with 38 additions and 0 deletions
|
@ -0,0 +1,38 @@
|
||||||
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/** Represents a recursive invitation relationship between two users. */
|
||||||
|
@Entity
|
||||||
|
public class Invited {
|
||||||
|
|
||||||
|
/** A host user who can invite guests to their smart house */
|
||||||
|
@OneToMany private Set<User> host;
|
||||||
|
|
||||||
|
/** Guests that have been invited to the host's house */
|
||||||
|
@OneToMany(mappedBy = "host", orphanRemoval = true)
|
||||||
|
private Set<User> guest;
|
||||||
|
|
||||||
|
/** Host ID */
|
||||||
|
@Id
|
||||||
|
@Column(nullable = false)
|
||||||
|
private int hostId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Probably unnecessary, Invited can be identified through the Host ID and the IDs from the
|
||||||
|
* guests collection which we can query for
|
||||||
|
*/
|
||||||
|
// @Id @Column
|
||||||
|
// private int guestId;
|
||||||
|
|
||||||
|
/** Determines whether a guest can access security cameras */
|
||||||
|
@Column @NotNull private boolean cameraEnabled;
|
||||||
|
|
||||||
|
/** Determines whether a guest can access scenes */
|
||||||
|
@Column @NotNull private boolean sceneEnabled;
|
||||||
|
}
|
Loading…
Reference in a new issue