2019-11-04 10:03:49 +01:00
|
|
|
package eu.dnetlib.uoamonitorservice.entities;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import org.springframework.data.annotation.Id;
|
|
|
|
|
2019-12-19 16:04:25 +01:00
|
|
|
import java.util.ArrayList;
|
2019-11-04 10:03:49 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
enum IndicatorType {
|
|
|
|
// Do not rename or remove existring values. This may cause problems with already stored values in DB
|
|
|
|
number, chart;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum IndicatorWidth {
|
|
|
|
// Do not rename or remove existring values. This may cause problems with already stored values in DB
|
|
|
|
small, medium, large;
|
|
|
|
}
|
|
|
|
|
|
|
|
public class Indicator {
|
|
|
|
@Id
|
|
|
|
@JsonProperty("_id")
|
|
|
|
private String id;
|
|
|
|
|
|
|
|
private String name;
|
|
|
|
private String description;
|
|
|
|
private IndicatorType type; //number,chart
|
|
|
|
private IndicatorWidth width; //small,medium,large
|
2019-12-19 16:04:25 +01:00
|
|
|
private List<String> tags; // this field is not used anywhere now
|
2019-11-04 10:03:49 +01:00
|
|
|
private boolean isActive;
|
|
|
|
private boolean isPublic;
|
2019-12-19 16:04:25 +01:00
|
|
|
private String defaultId;
|
2019-11-04 10:03:49 +01:00
|
|
|
private List<IndicatorPath> indicatorPaths;
|
|
|
|
|
2019-12-19 16:04:25 +01:00
|
|
|
public void copyFromDefault(Indicator defaultIndicator) {
|
|
|
|
setName(defaultIndicator.getName());
|
|
|
|
setDescription(defaultIndicator.getDescription());
|
|
|
|
setType(defaultIndicator.getType()));
|
|
|
|
setWidth(defaultIndicator.getWidth());
|
|
|
|
setTags(defaultIndicator.getTags());
|
|
|
|
setIsActive(false);
|
|
|
|
setIsPublic(false);
|
|
|
|
setDefaultId(defaultIndicator.id);
|
|
|
|
setIndicatorPaths(defaultIndicator.getIndicatorPaths());
|
|
|
|
}
|
|
|
|
|
2019-11-04 10:03:49 +01:00
|
|
|
public String getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setId(String id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
2019-11-22 16:50:59 +01:00
|
|
|
public String getType() {
|
2019-12-19 16:04:25 +01:00
|
|
|
if(type == null) {
|
|
|
|
return null;
|
|
|
|
}
|
2019-11-22 16:50:59 +01:00
|
|
|
return type.name();
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|
|
|
|
|
2019-12-19 16:04:25 +01:00
|
|
|
// public String getStringType() {
|
|
|
|
// return type.name();
|
|
|
|
// }
|
|
|
|
|
|
|
|
// public void setType(IndicatorType type) {
|
|
|
|
// this.type = type;
|
|
|
|
// }
|
|
|
|
public void setType(String type) {
|
|
|
|
if(type == null) {
|
|
|
|
this.type = null;
|
|
|
|
} else {
|
|
|
|
IndicatorType indicatorType = IndicatorType.valueOf(type);
|
|
|
|
this.type = indicatorType;
|
|
|
|
}
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public IndicatorWidth getWidth() {
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setWidth(IndicatorWidth width) {
|
|
|
|
this.width = width;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<String> getTags() {
|
|
|
|
return tags;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTags(List<String> tags) {
|
|
|
|
this.tags = tags;
|
|
|
|
}
|
|
|
|
|
1. Stakeholder.java: Create constructor and copy constructor & change getters-setters for 'isDeafult', 'isPublic' and 'isActive' fields.
2. Topic.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields.
3. Category.java: Create constructor and copy constructor & change getters-setters for 'isOverview, 'isPublic' and 'isActive' fields & remove field 'description'.
4. SubCategory.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields & remove field 'description' &
make charts and numbers (List) generic (String or Indicator).
5. Indicator.java: Change getters-setters for 'indicatorPaths', 'isPublic' and 'isActive' fields & create method: public boolean hasType(String str), to check if "chart" or "number".
6. IndicatorPath.java: Add fields in schema (chartObject, parameters, filters) & add in enum IndicatorPathType types: pie, line, image.
7. MongoDBStakeholderDAO.java & StakeholderDAO.java: Add method: Stakeholder findByAlias(String Alias)
8. StakeholderController.java:
a. Add method: public Stakeholder setIndicatorsForStakeholder(Stakeholder stakeholder) to replace indicator ids with Indicator objects
(used by: getAllStakeholders, getAllDefaultStakeholders, getAllRealStakeholders, getStakeholder (by alias))
b. Add method: public Stakeholder getStakeholder(@PathVariable("alias") String alias) - /stakeholder/{alias}
c. Add method: public Stakeholder saveStakeholder(@RequestBody Stakeholder stakeholder) - /stakeholder/save
d. Add method: public boolean deleteIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/{id}
e. Add method: public Indicator saveIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/save (in body send Indicator object)
2019-11-11 17:38:36 +01:00
|
|
|
public boolean getIsActive() {
|
2019-11-04 10:03:49 +01:00
|
|
|
return isActive;
|
|
|
|
}
|
|
|
|
|
1. Stakeholder.java: Create constructor and copy constructor & change getters-setters for 'isDeafult', 'isPublic' and 'isActive' fields.
2. Topic.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields.
3. Category.java: Create constructor and copy constructor & change getters-setters for 'isOverview, 'isPublic' and 'isActive' fields & remove field 'description'.
4. SubCategory.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields & remove field 'description' &
make charts and numbers (List) generic (String or Indicator).
5. Indicator.java: Change getters-setters for 'indicatorPaths', 'isPublic' and 'isActive' fields & create method: public boolean hasType(String str), to check if "chart" or "number".
6. IndicatorPath.java: Add fields in schema (chartObject, parameters, filters) & add in enum IndicatorPathType types: pie, line, image.
7. MongoDBStakeholderDAO.java & StakeholderDAO.java: Add method: Stakeholder findByAlias(String Alias)
8. StakeholderController.java:
a. Add method: public Stakeholder setIndicatorsForStakeholder(Stakeholder stakeholder) to replace indicator ids with Indicator objects
(used by: getAllStakeholders, getAllDefaultStakeholders, getAllRealStakeholders, getStakeholder (by alias))
b. Add method: public Stakeholder getStakeholder(@PathVariable("alias") String alias) - /stakeholder/{alias}
c. Add method: public Stakeholder saveStakeholder(@RequestBody Stakeholder stakeholder) - /stakeholder/save
d. Add method: public boolean deleteIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/{id}
e. Add method: public Indicator saveIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/save (in body send Indicator object)
2019-11-11 17:38:36 +01:00
|
|
|
public void setIsActive(boolean isActive) {
|
2019-11-04 10:03:49 +01:00
|
|
|
this.isActive = isActive;
|
|
|
|
}
|
|
|
|
|
1. Stakeholder.java: Create constructor and copy constructor & change getters-setters for 'isDeafult', 'isPublic' and 'isActive' fields.
2. Topic.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields.
3. Category.java: Create constructor and copy constructor & change getters-setters for 'isOverview, 'isPublic' and 'isActive' fields & remove field 'description'.
4. SubCategory.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields & remove field 'description' &
make charts and numbers (List) generic (String or Indicator).
5. Indicator.java: Change getters-setters for 'indicatorPaths', 'isPublic' and 'isActive' fields & create method: public boolean hasType(String str), to check if "chart" or "number".
6. IndicatorPath.java: Add fields in schema (chartObject, parameters, filters) & add in enum IndicatorPathType types: pie, line, image.
7. MongoDBStakeholderDAO.java & StakeholderDAO.java: Add method: Stakeholder findByAlias(String Alias)
8. StakeholderController.java:
a. Add method: public Stakeholder setIndicatorsForStakeholder(Stakeholder stakeholder) to replace indicator ids with Indicator objects
(used by: getAllStakeholders, getAllDefaultStakeholders, getAllRealStakeholders, getStakeholder (by alias))
b. Add method: public Stakeholder getStakeholder(@PathVariable("alias") String alias) - /stakeholder/{alias}
c. Add method: public Stakeholder saveStakeholder(@RequestBody Stakeholder stakeholder) - /stakeholder/save
d. Add method: public boolean deleteIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/{id}
e. Add method: public Indicator saveIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/save (in body send Indicator object)
2019-11-11 17:38:36 +01:00
|
|
|
public boolean getIsPublic() {
|
2019-11-04 10:03:49 +01:00
|
|
|
return isPublic;
|
|
|
|
}
|
|
|
|
|
1. Stakeholder.java: Create constructor and copy constructor & change getters-setters for 'isDeafult', 'isPublic' and 'isActive' fields.
2. Topic.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields.
3. Category.java: Create constructor and copy constructor & change getters-setters for 'isOverview, 'isPublic' and 'isActive' fields & remove field 'description'.
4. SubCategory.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields & remove field 'description' &
make charts and numbers (List) generic (String or Indicator).
5. Indicator.java: Change getters-setters for 'indicatorPaths', 'isPublic' and 'isActive' fields & create method: public boolean hasType(String str), to check if "chart" or "number".
6. IndicatorPath.java: Add fields in schema (chartObject, parameters, filters) & add in enum IndicatorPathType types: pie, line, image.
7. MongoDBStakeholderDAO.java & StakeholderDAO.java: Add method: Stakeholder findByAlias(String Alias)
8. StakeholderController.java:
a. Add method: public Stakeholder setIndicatorsForStakeholder(Stakeholder stakeholder) to replace indicator ids with Indicator objects
(used by: getAllStakeholders, getAllDefaultStakeholders, getAllRealStakeholders, getStakeholder (by alias))
b. Add method: public Stakeholder getStakeholder(@PathVariable("alias") String alias) - /stakeholder/{alias}
c. Add method: public Stakeholder saveStakeholder(@RequestBody Stakeholder stakeholder) - /stakeholder/save
d. Add method: public boolean deleteIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/{id}
e. Add method: public Indicator saveIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/save (in body send Indicator object)
2019-11-11 17:38:36 +01:00
|
|
|
public void setIsPublic(boolean isPublic) {
|
2019-11-04 10:03:49 +01:00
|
|
|
this.isPublic = isPublic;
|
|
|
|
}
|
|
|
|
|
2019-12-19 16:04:25 +01:00
|
|
|
public String getDefaultId() {
|
|
|
|
return defaultId;
|
2019-11-19 14:05:43 +01:00
|
|
|
}
|
|
|
|
|
2019-12-19 16:04:25 +01:00
|
|
|
public void setDefaultId(String defaultId) {
|
|
|
|
this.defaultId = defaultId;
|
2019-11-19 14:05:43 +01:00
|
|
|
}
|
|
|
|
|
1. Stakeholder.java: Create constructor and copy constructor & change getters-setters for 'isDeafult', 'isPublic' and 'isActive' fields.
2. Topic.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields.
3. Category.java: Create constructor and copy constructor & change getters-setters for 'isOverview, 'isPublic' and 'isActive' fields & remove field 'description'.
4. SubCategory.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields & remove field 'description' &
make charts and numbers (List) generic (String or Indicator).
5. Indicator.java: Change getters-setters for 'indicatorPaths', 'isPublic' and 'isActive' fields & create method: public boolean hasType(String str), to check if "chart" or "number".
6. IndicatorPath.java: Add fields in schema (chartObject, parameters, filters) & add in enum IndicatorPathType types: pie, line, image.
7. MongoDBStakeholderDAO.java & StakeholderDAO.java: Add method: Stakeholder findByAlias(String Alias)
8. StakeholderController.java:
a. Add method: public Stakeholder setIndicatorsForStakeholder(Stakeholder stakeholder) to replace indicator ids with Indicator objects
(used by: getAllStakeholders, getAllDefaultStakeholders, getAllRealStakeholders, getStakeholder (by alias))
b. Add method: public Stakeholder getStakeholder(@PathVariable("alias") String alias) - /stakeholder/{alias}
c. Add method: public Stakeholder saveStakeholder(@RequestBody Stakeholder stakeholder) - /stakeholder/save
d. Add method: public boolean deleteIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/{id}
e. Add method: public Indicator saveIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/save (in body send Indicator object)
2019-11-11 17:38:36 +01:00
|
|
|
public List<IndicatorPath> getIndicatorPaths() {
|
2019-11-04 10:03:49 +01:00
|
|
|
return indicatorPaths;
|
|
|
|
}
|
|
|
|
|
1. Stakeholder.java: Create constructor and copy constructor & change getters-setters for 'isDeafult', 'isPublic' and 'isActive' fields.
2. Topic.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields.
3. Category.java: Create constructor and copy constructor & change getters-setters for 'isOverview, 'isPublic' and 'isActive' fields & remove field 'description'.
4. SubCategory.java: Create constructor and copy constructor & change getters-setters for 'isPublic' and 'isActive' fields & remove field 'description' &
make charts and numbers (List) generic (String or Indicator).
5. Indicator.java: Change getters-setters for 'indicatorPaths', 'isPublic' and 'isActive' fields & create method: public boolean hasType(String str), to check if "chart" or "number".
6. IndicatorPath.java: Add fields in schema (chartObject, parameters, filters) & add in enum IndicatorPathType types: pie, line, image.
7. MongoDBStakeholderDAO.java & StakeholderDAO.java: Add method: Stakeholder findByAlias(String Alias)
8. StakeholderController.java:
a. Add method: public Stakeholder setIndicatorsForStakeholder(Stakeholder stakeholder) to replace indicator ids with Indicator objects
(used by: getAllStakeholders, getAllDefaultStakeholders, getAllRealStakeholders, getStakeholder (by alias))
b. Add method: public Stakeholder getStakeholder(@PathVariable("alias") String alias) - /stakeholder/{alias}
c. Add method: public Stakeholder saveStakeholder(@RequestBody Stakeholder stakeholder) - /stakeholder/save
d. Add method: public boolean deleteIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/{id}
e. Add method: public Indicator saveIndicator(...) - /{stakeholder}/{topic}/{category}/{subcategory}/indicator/save (in body send Indicator object)
2019-11-11 17:38:36 +01:00
|
|
|
public void setIndicatorPaths(List<IndicatorPath> indicatorPaths) {
|
|
|
|
this.indicatorPaths = indicatorPaths;
|
|
|
|
}
|
|
|
|
|
2019-11-22 16:50:59 +01:00
|
|
|
// public String hasType() {
|
|
|
|
// return this.type.name();
|
|
|
|
// }
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|