2019-11-04 10:03:49 +01:00
|
|
|
package eu.dnetlib.uoamonitorservice.entities;
|
|
|
|
|
2019-11-19 14:05:43 +01:00
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import org.springframework.data.annotation.Id;
|
|
|
|
|
2019-12-19 16:04:25 +01:00
|
|
|
import java.util.ArrayList;
|
2020-11-11 12:20:10 +01:00
|
|
|
import java.util.Date;
|
2019-11-04 10:03:49 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
2020-01-10 11:48:24 +01:00
|
|
|
public class SubCategory<StringOrSection> {
|
2019-11-19 14:05:43 +01:00
|
|
|
@Id
|
|
|
|
@JsonProperty("_id")
|
|
|
|
private String id;
|
|
|
|
|
2019-11-04 10:03:49 +01:00
|
|
|
private String name;
|
|
|
|
private String alias;
|
2019-12-19 16:04:25 +01:00
|
|
|
private String description;
|
2020-11-11 12:20:10 +01:00
|
|
|
private Visibility visibility = Visibility.PRIVATE;
|
|
|
|
private Date creationDate;
|
|
|
|
private Date updateDate;
|
2019-12-19 16:04:25 +01:00
|
|
|
private String defaultId;
|
2020-01-10 11:48:24 +01:00
|
|
|
private List<StringOrSection> charts;
|
|
|
|
private List<StringOrSection> numbers;
|
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 SubCategory() {}
|
|
|
|
public SubCategory(SubCategory subCategory) {
|
2019-11-22 16:50:59 +01:00
|
|
|
id = subCategory.getId();
|
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
|
|
|
name = subCategory.getName();
|
|
|
|
alias = subCategory.getAlias();
|
2019-12-19 16:04:25 +01:00
|
|
|
description = subCategory.getDescription();
|
2020-11-11 12:20:10 +01:00
|
|
|
setVisibility(subCategory.getVisibility());
|
|
|
|
creationDate = subCategory.getCreationDate();
|
|
|
|
updateDate = subCategory.getUpdateDate();
|
2019-12-19 16:04:25 +01:00
|
|
|
defaultId = subCategory.getDefaultId();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void createOverviewSubCategory(Category category) {
|
|
|
|
setName("Overview");
|
|
|
|
setAlias("overview");
|
2020-11-11 12:20:10 +01:00
|
|
|
setVisibility(category.getVisibility());
|
|
|
|
setCreationDate(category.getCreationDate());
|
|
|
|
setUpdateDate(category.getUpdateDate());
|
2019-12-19 16:04:25 +01:00
|
|
|
setCharts(new ArrayList<>());
|
|
|
|
setNumbers(new ArrayList<>());
|
|
|
|
}
|
|
|
|
|
|
|
|
public void copyFromDefault(SubCategory defaultSubCategory) {
|
|
|
|
setName(defaultSubCategory.getName());
|
|
|
|
setAlias(defaultSubCategory.getAlias());
|
|
|
|
setDescription(defaultSubCategory.getDescription());
|
2020-11-11 12:20:10 +01:00
|
|
|
setVisibility(defaultSubCategory.getVisibility());
|
|
|
|
setCreationDate(defaultSubCategory.getCreationDate());
|
|
|
|
setUpdateDate(defaultSubCategory.getUpdateDate());
|
2019-12-19 16:04:25 +01:00
|
|
|
setDefaultId(defaultSubCategory.getId());
|
|
|
|
setCharts(new ArrayList());
|
|
|
|
setNumbers(new ArrayList());
|
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
|
|
|
}
|
2019-11-04 10:03:49 +01:00
|
|
|
|
2019-11-22 16:50:59 +01:00
|
|
|
public String getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setId(String id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
2019-11-04 10:03:49 +01:00
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getAlias() {
|
|
|
|
return alias;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAlias(String alias) {
|
|
|
|
this.alias = alias;
|
|
|
|
}
|
|
|
|
|
2019-12-19 16:04:25 +01:00
|
|
|
public String getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public Visibility getVisibility() {
|
|
|
|
return visibility;
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|
|
|
|
|
2020-11-11 12:20:10 +01:00
|
|
|
public void setVisibility(Visibility visibility) {
|
|
|
|
this.visibility = visibility;
|
2019-11-04 10:03:49 +01:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getUpdateDate() {
|
|
|
|
return updateDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDefaultId(String defaultId) {
|
|
|
|
this.defaultId = defaultId;
|
|
|
|
}
|
|
|
|
|
2020-01-10 11:48:24 +01:00
|
|
|
public List<StringOrSection> getCharts() {
|
2019-11-04 10:03:49 +01:00
|
|
|
return charts;
|
|
|
|
}
|
|
|
|
|
2020-01-10 11:48:24 +01:00
|
|
|
public void setCharts(List<StringOrSection> charts) {
|
2019-11-04 10:03:49 +01:00
|
|
|
this.charts = charts;
|
|
|
|
}
|
|
|
|
|
2020-01-10 11:48:24 +01:00
|
|
|
public List<StringOrSection> getNumbers() {
|
2019-11-04 10:03:49 +01:00
|
|
|
return numbers;
|
|
|
|
}
|
|
|
|
|
2020-01-10 11:48:24 +01:00
|
|
|
public void setNumbers(List<StringOrSection> numbers) {
|
2019-11-04 10:03:49 +01:00
|
|
|
this.numbers = numbers;
|
|
|
|
}
|
|
|
|
}
|