1
|
package eu.dnetlib.uoamonitorservice.entities;
|
2
|
|
3
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
4
|
import org.springframework.data.annotation.Id;
|
5
|
|
6
|
import java.util.ArrayList;
|
7
|
import java.util.List;
|
8
|
|
9
|
enum SectionType {
|
10
|
// Do not rename or remove existring values. This may cause problems with already stored values in DB
|
11
|
number, chart;
|
12
|
}
|
13
|
|
14
|
public class Section<StringOrIndicator> {
|
15
|
@Id
|
16
|
@JsonProperty("_id")
|
17
|
private String id;
|
18
|
|
19
|
private String title;
|
20
|
private String defaultId;
|
21
|
private String stakeholderAlias;
|
22
|
private SectionType type;
|
23
|
private List<StringOrIndicator> indicators;
|
24
|
|
25
|
public Section() {}
|
26
|
|
27
|
public Section(Section section) {
|
28
|
id = section.getId();
|
29
|
title = section.getTitle();
|
30
|
defaultId = section.getDefaultId();
|
31
|
stakeholderAlias = section.getStakeholderAlias();
|
32
|
setType(section.getType());
|
33
|
}
|
34
|
|
35
|
public void copyFromDefault(Section defaultSection) {
|
36
|
setTitle(defaultSection.getTitle());
|
37
|
setType(defaultSection.getType());
|
38
|
setDefaultId(defaultSection.id);
|
39
|
setIndicators(new ArrayList<>());
|
40
|
}
|
41
|
|
42
|
public String getId() {
|
43
|
return id;
|
44
|
}
|
45
|
|
46
|
public void setId(String id) {
|
47
|
this.id = id;
|
48
|
}
|
49
|
|
50
|
public String getTitle() {
|
51
|
return title;
|
52
|
}
|
53
|
|
54
|
public void setTitle(String title) {
|
55
|
this.title = title;
|
56
|
}
|
57
|
|
58
|
public String getDefaultId() {
|
59
|
return defaultId;
|
60
|
}
|
61
|
|
62
|
public void setDefaultId(String defaultId) {
|
63
|
this.defaultId = defaultId;
|
64
|
}
|
65
|
|
66
|
public String getStakeholderAlias() {
|
67
|
return stakeholderAlias;
|
68
|
}
|
69
|
|
70
|
public void setStakeholderAlias(String stakeholderAlias) {
|
71
|
this.stakeholderAlias = stakeholderAlias;
|
72
|
}
|
73
|
|
74
|
public String getType() {
|
75
|
if(type == null) {
|
76
|
return null;
|
77
|
}
|
78
|
return type.name();
|
79
|
}
|
80
|
|
81
|
public void setType(String type) {
|
82
|
if(type == null) {
|
83
|
this.type = null;
|
84
|
} else {
|
85
|
SectionType sectionType = SectionType.valueOf(type);
|
86
|
this.type = sectionType;
|
87
|
}
|
88
|
}
|
89
|
|
90
|
public List<StringOrIndicator> getIndicators() {
|
91
|
return indicators;
|
92
|
}
|
93
|
|
94
|
public void setIndicators(List<StringOrIndicator> indicators) {
|
95
|
this.indicators = indicators;
|
96
|
}
|
97
|
}
|