Clover icon

sunshower-core

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

File Workspace.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart5.png
36% of files have more coverage

Code metrics

2
12
9
1
73
58
10
0.83
1.33
9
1.11

Classes

Class Line # Actions
Workspace 16 12 10
0.4782608747.8%
 

Contributing tests

This file is covered by 5 tests. .

Source view

1    package io.sunshower.service.workspace.model;
2   
3    import io.sunshower.model.core.Schemata;
4    import io.sunshower.service.model.BaseModelObject;
5    import io.sunshower.service.orchestration.model.Template;
6    import io.sunshower.service.revision.model.Repository;
7    import java.util.HashSet;
8    import java.util.Set;
9    import javax.persistence.*;
10    import javax.validation.constraints.NotNull;
11    import javax.validation.constraints.Size;
12   
13    @Entity
14    @Cacheable
15    @Table(name = "WORKSPACE", schema = Schemata.SUNSHOWER)
 
16    public class Workspace extends BaseModelObject {
17   
18    @Basic
19    @NotNull
20    @Column(name = "key", unique = true)
21    @Size(min = 3, max = 255)
22    private String key;
23   
24    @OneToOne(cascade = CascadeType.ALL)
25    @JoinColumn(name = "repository_id")
26    private Repository repository;
27   
28    @Enumerated private WorkspaceClassification classification;
29   
30    @OneToMany(mappedBy = "workspace", cascade = CascadeType.ALL, orphanRemoval = true)
31    private Set<Template> templates;
32   
 
33  5 toggle {
34  5 classification = WorkspaceClassification.Project;
35    }
36   
 
37  3 toggle public void addTemplate(Template template) {
38  3 if (templates == null) {
39  2 templates = new HashSet<>();
40    }
41  3 template.setWorkspace(this);
42  3 templates.add(template);
43    }
44   
 
45  0 toggle public Repository getRepository() {
46  0 return repository;
47    }
48   
 
49  0 toggle public void setRepository(Repository repository) {
50  0 this.repository = repository;
51    }
52   
 
53  0 toggle public Set<Template> getTemplates() {
54  0 return templates;
55    }
56   
 
57  0 toggle public void setTemplates(Set<Template> templates) {
58  0 this.templates = templates;
59    }
60   
 
61  0 toggle public String getKey() {
62  0 return key;
63    }
64   
 
65  4 toggle public void setKey(String key) {
66  4 this.key = key;
67    }
68   
 
69  0 toggle @Override
70    public String toString() {
71  0 return "Workspace{" + "key='" + key + '\'' + '}';
72    }
73    }