2019-11-04 10:03:49 +01:00
|
|
|
package eu.dnetlib.uoamonitorservice.entities;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
2024-03-08 19:55:51 +01:00
|
|
|
import eu.dnetlib.uoamonitorservice.generics.Common;
|
2024-03-06 00:48:31 +01:00
|
|
|
import eu.dnetlib.uoamonitorservice.primitives.IndicatorPath;
|
|
|
|
import eu.dnetlib.uoamonitorservice.primitives.IndicatorSize;
|
|
|
|
import eu.dnetlib.uoamonitorservice.primitives.IndicatorType;
|
2024-03-08 19:55:51 +01:00
|
|
|
import eu.dnetlib.uoamonitorservice.primitives.Visibility;
|
|
|
|
import org.springframework.data.annotation.CreatedDate;
|
2019-11-04 10:03:49 +01:00
|
|
|
import org.springframework.data.annotation.Id;
|
2024-03-08 19:55:51 +01:00
|
|
|
import org.springframework.data.annotation.LastModifiedDate;
|
2019-11-04 10:03:49 +01:00
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
import java.util.Date;
|
2019-11-04 10:03:49 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
2024-03-08 19:55:51 +01:00
|
|
|
public class Indicator extends Common {
|
2019-11-04 10:03:49 +01:00
|
|
|
@Id
|
|
|
|
@JsonProperty("_id")
|
|
|
|
private String id;
|
2020-11-11 12:20:10 +01:00
|
|
|
private String additionalDescription;
|
2019-11-04 10:03:49 +01:00
|
|
|
private IndicatorType type; //number,chart
|
2020-11-11 12:20:10 +01:00
|
|
|
private IndicatorSize width; //small,medium,large
|
|
|
|
private IndicatorSize height = IndicatorSize.MEDIUM; //small,medium,large
|
2019-12-19 16:04:25 +01:00
|
|
|
private List<String> tags; // this field is not used anywhere now
|
2024-03-08 19:55:51 +01:00
|
|
|
@CreatedDate
|
2020-11-11 12:20:10 +01:00
|
|
|
private Date creationDate;
|
2024-03-08 19:55:51 +01:00
|
|
|
@LastModifiedDate
|
2020-11-11 12:20:10 +01:00
|
|
|
private Date updateDate;
|
2019-12-19 16:04:25 +01:00
|
|
|
private String defaultId;
|
2019-11-04 10:03:49 +01:00
|
|
|
private List<IndicatorPath> indicatorPaths;
|
|
|
|
|
2023-07-03 09:42:46 +02:00
|
|
|
public void copyFromDefault(Indicator defaultIndicator, Visibility visibility) {
|
2019-12-19 16:04:25 +01:00
|
|
|
setName(defaultIndicator.getName());
|
|
|
|
setDescription(defaultIndicator.getDescription());
|
2020-11-11 12:20:10 +01:00
|
|
|
setAdditionalDescription(defaultIndicator.getAdditionalDescription());
|
2019-12-19 16:05:39 +01:00
|
|
|
setType(defaultIndicator.getType());
|
2019-12-19 16:04:25 +01:00
|
|
|
setWidth(defaultIndicator.getWidth());
|
2020-11-11 12:20:10 +01:00
|
|
|
setHeight(defaultIndicator.getHeight());
|
2019-12-19 16:04:25 +01:00
|
|
|
setTags(defaultIndicator.getTags());
|
2023-07-03 09:42:46 +02:00
|
|
|
setVisibility(visibility);
|
2020-11-11 12:20:10 +01:00
|
|
|
setCreationDate(defaultIndicator.getCreationDate());
|
|
|
|
setUpdateDate(defaultIndicator.getUpdateDate());
|
2020-06-17 13:37:42 +02:00
|
|
|
setDefaultId(defaultIndicator.getId());
|
2019-12-19 16:04:25 +01:00
|
|
|
setIndicatorPaths(defaultIndicator.getIndicatorPaths());
|
|
|
|
}
|
|
|
|
|
2019-11-04 10:03:49 +01:00
|
|
|
public String getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setId(String id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public String getAdditionalDescription() {
|
|
|
|
return additionalDescription;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAdditionalDescription(String description) {
|
|
|
|
this.additionalDescription = 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 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
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public IndicatorSize getWidth() {
|
2019-11-04 10:03:49 +01:00
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public void setWidth(IndicatorSize width) {
|
2019-11-04 10:03:49 +01:00
|
|
|
this.width = width;
|
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public IndicatorSize getHeight() {
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setHeight(IndicatorSize height) {
|
|
|
|
this.height = height;
|
|
|
|
}
|
|
|
|
|
2019-11-04 10:03:49 +01:00
|
|
|
public List<String> getTags() {
|
|
|
|
return tags;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTags(List<String> tags) {
|
|
|
|
this.tags = tags;
|
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public Date getCreationDate() {
|
|
|
|
return creationDate;
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public void setCreationDate(Date creationDate) {
|
|
|
|
this.creationDate = creationDate;
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public Date getUpdateDate() {
|
|
|
|
return updateDate;
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public void setUpdateDate(Date updateDate) {
|
|
|
|
this.updateDate = updateDate;
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|