Clover icon

sunshower-core

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

File Application.java

 

Coverage histogram

../../../../img/srcFileCovDistChart4.png
46% of files have more coverage

Code metrics

2
5
4
1
66
51
5
1
1.25
4
1.25

Classes

Class Line # Actions
Application 19 5 5
0.3636363736.4%
 

Contributing tests

This file is covered by 5 tests. .

Source view

1    package io.sunshower.model.core;
2   
3    import io.sunshower.common.Identifier;
4    import io.sunshower.model.core.auth.User;
5    import io.sunshower.persistence.core.DistributableEntity;
6    import java.util.*;
7    import javax.persistence.*;
8    import javax.xml.bind.annotation.*;
9    import lombok.Getter;
10    import lombok.Setter;
11   
12    @Getter
13    @Setter
14    @Entity
15    @Table(name = "APPLICATION", schema = Schemata.SUNSHOWER)
16    @XmlRootElement(name = "application")
17    @IdClass(Identifier.class)
18    @XmlAccessorType(XmlAccessType.NONE)
 
19    public class Application {
20   
21    @Id private byte[] id;
22   
23    @XmlAttribute private Boolean enabled;
24   
25    @XmlElement
26    @Column(name = "instance_id")
27    private String instanceId;
28   
29    @XmlElement private String location;
30   
31    @XmlElement
32    @Column(name = "`name`")
33    private String name;
34   
35    @XmlAttribute
36    @Column(name = "started_on")
37    private Date instanceStarted;
38   
39    @XmlElement
40    @Column(name = "last_shutdown")
41    private Date lastShutdown;
42   
43    @XmlElement
44    @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
45    private Version version;
46   
47    @Transient @XmlElement private List<User> administrators = new ArrayList<>();
48   
 
49  5 toggle public Application() {
50  5 this.id = DistributableEntity.sequence.next().value();
51    }
52   
 
53  1 toggle public void addAdministrator(User u) {
54  1 this.administrators.add(u);
55    }
56   
 
57  0 toggle public Identifier getId() {
58  0 return Identifier.valueOf(id);
59    }
60   
 
61  0 toggle public void setId(Identifier id) {
62  0 if (id != null) {
63  0 this.id = id.value();
64    }
65    }
66    }