Project

General

Profile

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.Date;
7
import java.util.List;
8

    
9
enum IndicatorType {
10
    // Do not rename or remove existring values. This may cause problems with already stored values in DB
11
    number, chart,
12
    NUMBER, CHART;
13
}
14

    
15
enum IndicatorSize {
16
    // Do not rename or remove existring values. This may cause problems with already stored values in DB
17
    small, medium, large,
18
    SMALL, MEDIUM, LARGE;
19
}
20

    
21
public class Indicator {
22
    @Id
23
    @JsonProperty("_id")
24
    private String id;
25

    
26
    private String name;
27
    private String description;
28
    private String additionalDescription;
29
    private IndicatorType type; //number,chart
30
    private IndicatorSize width; //small,medium,large
31
    private IndicatorSize height = IndicatorSize.MEDIUM; //small,medium,large
32
    private List<String> tags;  // this field is not used anywhere now
33
    private Visibility visibility = Visibility.PRIVATE;
34
    private Date creationDate;
35
    private Date updateDate;
36
    private String defaultId;
37
    private List<IndicatorPath> indicatorPaths;
38

    
39
    public void copyFromDefault(Indicator defaultIndicator) {
40
        setName(defaultIndicator.getName());
41
        setDescription(defaultIndicator.getDescription());
42
        setAdditionalDescription(defaultIndicator.getAdditionalDescription());
43
        setType(defaultIndicator.getType());
44
        setWidth(defaultIndicator.getWidth());
45
        setHeight(defaultIndicator.getHeight());
46
        setTags(defaultIndicator.getTags());
47
        setVisibility(defaultIndicator.getVisibility());
48
        setCreationDate(defaultIndicator.getCreationDate());
49
        setUpdateDate(defaultIndicator.getUpdateDate());
50
        setDefaultId(defaultIndicator.getId());
51
        setIndicatorPaths(defaultIndicator.getIndicatorPaths());
52
    }
53

    
54
    public String getId() {
55
        return id;
56
    }
57

    
58
    public void setId(String id) {
59
        this.id = id;
60
    }
61

    
62
    public String getName() {
63
        return name;
64
    }
65

    
66
    public void setName(String name) {
67
        this.name = name;
68
    }
69

    
70
    public String getDescription() {
71
        return description;
72
    }
73

    
74
    public void setDescription(String description) {
75
        this.description = description;
76
    }
77

    
78
    public String getAdditionalDescription() {
79
        return additionalDescription;
80
    }
81

    
82
    public void setAdditionalDescription(String description) {
83
        this.additionalDescription = description;
84
    }
85

    
86
    public String getType() {
87
        if(type == null) {
88
            return null;
89
        }
90
        return type.name();
91
    }
92

    
93
//    public String getStringType() {
94
//        return type.name();
95
//    }
96

    
97
//    public void setType(IndicatorType type) {
98
//        this.type = type;
99
//    }
100
    public void setType(String type) {
101
        if(type == null) {
102
            this.type = null;
103
        } else {
104
            IndicatorType indicatorType = IndicatorType.valueOf(type);
105
            this.type = indicatorType;
106
        }
107
    }
108

    
109
    public IndicatorSize getWidth() {
110
        return width;
111
    }
112

    
113
    public void setWidth(IndicatorSize width) {
114
        this.width = width;
115
    }
116

    
117
    public IndicatorSize getHeight() {
118
        return height;
119
    }
120

    
121
    public void setHeight(IndicatorSize height) {
122
        this.height = height;
123
    }
124

    
125
    public List<String> getTags() {
126
        return tags;
127
    }
128

    
129
    public void setTags(List<String> tags) {
130
        this.tags = tags;
131
    }
132

    
133
    public Visibility getVisibility() {
134
        return visibility;
135
    }
136

    
137
    public void setVisibility(Visibility visibility) {
138
        this.visibility = visibility;
139
    }
140

    
141
    public Date getCreationDate() {
142
        return creationDate;
143
    }
144

    
145
    public void setCreationDate(Date creationDate) {
146
        this.creationDate = creationDate;
147
    }
148

    
149
    public Date getUpdateDate() {
150
        return updateDate;
151
    }
152

    
153
    public void setUpdateDate(Date updateDate) {
154
        this.updateDate = updateDate;
155
    }
156

    
157
    public String getDefaultId() {
158
        return defaultId;
159
    }
160

    
161
    public void setDefaultId(String defaultId) {
162
        this.defaultId = defaultId;
163
    }
164

    
165
    public List<IndicatorPath> getIndicatorPaths() {
166
        return indicatorPaths;
167
    }
168

    
169
    public void setIndicatorPaths(List<IndicatorPath> indicatorPaths) {
170
        this.indicatorPaths = indicatorPaths;
171
    }
172

    
173
//    public String hasType() {
174
//        return this.type.name();
175
//    }
176
}
(2-2/8)