Clover icon

sunshower-core

  1. Project Clover database Fri Apr 6 2018 03:27:42 UTC
  2. Package io.sunshower.model.core.auth

File Group.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart2.png
54% of files have more coverage

Code metrics

2
7
5
1
47
38
6
0.86
1.4
5
1.2

Classes

Class Line # Actions
Group 11 7 6
0.1428571514.3%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    package io.sunshower.model.core.auth;
2   
3    import io.sunshower.model.core.Schemata;
4    import io.sunshower.persistence.core.DistributableEntity;
5    import java.util.HashSet;
6    import java.util.Set;
7    import javax.persistence.*;
8   
9    @Entity
10    @Table(name = "GROUPS", schema = Schemata.SUNSHOWER)
 
11    public class Group extends DistributableEntity {
12   
13    @Column(name = "group_name")
14    private String name;
15   
16    @ManyToMany(targetEntity = User.class)
17    @JoinTable(
18    schema = Schemata.SUNSHOWER,
19    name = "group_members",
20    joinColumns = {@JoinColumn(name = "group_id", referencedColumnName = "id")},
21    inverseJoinColumns = @JoinColumn(name = "username", referencedColumnName = "username")
22    )
23    private Set<User> members;
24   
 
25  0 toggle public String getName() {
26  0 return name;
27    }
28   
 
29  1 toggle public void setName(String name) {
30  1 this.name = name;
31    }
32   
 
33  0 toggle public Set<User> getMembers() {
34  0 return members;
35    }
36   
 
37  0 toggle public void setMembers(Set<User> members) {
38  0 this.members = members;
39    }
40   
 
41  0 toggle public void addMember(User member) {
42  0 if (member == null) {
43  0 members = new HashSet<>();
44    }
45  0 members.add(member);
46    }
47    }