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.ArrayList;
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
}
13

    
14
enum IndicatorWidth {
15
    // Do not rename or remove existring values. This may cause problems with already stored values in DB
16
    small, medium, large;
17
}
18

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

    
24
    private String name;
25
    private String description;
26
    private IndicatorType type; //number,chart
27
    private IndicatorWidth width; //small,medium,large
28
    private List<String> tags;  // this field is not used anywhere now
29
    private boolean isActive;
30
    private boolean isPublic;
31
    private String defaultId;
32
    private List<IndicatorPath> indicatorPaths;
33

    
34
    public void copyFromDefault(Indicator defaultIndicator) {
35
        setName(defaultIndicator.getName());
36
        setDescription(defaultIndicator.getDescription());
37
        setType(defaultIndicator.getType());
38
        setWidth(defaultIndicator.getWidth());
39
        setTags(defaultIndicator.getTags());
40
        setIsActive(false);
41
        setIsPublic(false);
42
        setDefaultId(defaultIndicator.id);
43
        setIndicatorPaths(defaultIndicator.getIndicatorPaths());
44
    }
45

    
46
    public String getId() {
47
        return id;
48
    }
49

    
50
    public void setId(String id) {
51
        this.id = id;
52
    }
53

    
54
    public String getName() {
55
        return name;
56
    }
57

    
58
    public void setName(String name) {
59
        this.name = name;
60
    }
61

    
62
    public String getDescription() {
63
        return description;
64
    }
65

    
66
    public void setDescription(String description) {
67
        this.description = description;
68
    }
69

    
70
    public String getType() {
71
        if(type == null) {
72
            return null;
73
        }
74
        return type.name();
75
    }
76

    
77
//    public String getStringType() {
78
//        return type.name();
79
//    }
80

    
81
//    public void setType(IndicatorType type) {
82
//        this.type = type;
83
//    }
84
    public void setType(String type) {
85
        if(type == null) {
86
            this.type = null;
87
        } else {
88
            IndicatorType indicatorType = IndicatorType.valueOf(type);
89
            this.type = indicatorType;
90
        }
91
    }
92

    
93
    public IndicatorWidth getWidth() {
94
        return width;
95
    }
96

    
97
    public void setWidth(IndicatorWidth width) {
98
        this.width = width;
99
    }
100

    
101
    public List<String> getTags() {
102
        return tags;
103
    }
104

    
105
    public void setTags(List<String> tags) {
106
        this.tags = tags;
107
    }
108

    
109
    public boolean getIsActive() {
110
        return isActive;
111
    }
112

    
113
    public void setIsActive(boolean isActive) {
114
        this.isActive = isActive;
115
    }
116

    
117
    public boolean getIsPublic() {
118
        return isPublic;
119
    }
120

    
121
    public void setIsPublic(boolean isPublic) {
122
        this.isPublic = isPublic;
123
    }
124

    
125
    public String getDefaultId() {
126
        return defaultId;
127
    }
128

    
129
    public void setDefaultId(String defaultId) {
130
        this.defaultId = defaultId;
131
    }
132

    
133
    public List<IndicatorPath> getIndicatorPaths() {
134
        return indicatorPaths;
135
    }
136

    
137
    public void setIndicatorPaths(List<IndicatorPath> indicatorPaths) {
138
        this.indicatorPaths = indicatorPaths;
139
    }
140

    
141
//    public String hasType() {
142
//        return this.type.name();
143
//    }
144
}
(2-2/6)