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)
This commit is contained in:
parent
1ff5f13223
commit
4adda29adc
|
@ -1,7 +1,10 @@
|
|||
package eu.dnetlib.uoamonitorservice.controllers;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.dnetlib.uoamonitorservice.dao.IndicatorDAO;
|
||||
import eu.dnetlib.uoamonitorservice.dao.StakeholderDAO;
|
||||
import eu.dnetlib.uoamonitorservice.entities.Stakeholder;
|
||||
import eu.dnetlib.uoamonitorservice.entities.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -9,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
|
@ -19,6 +23,39 @@ public class StakeholderController {
|
|||
@Autowired
|
||||
private StakeholderDAO stakeholderDAO;
|
||||
|
||||
@Autowired
|
||||
private IndicatorDAO indicatorDAO;
|
||||
|
||||
public Stakeholder setIndicatorsForStakeholder(Stakeholder stakeholder) {
|
||||
for (Topic topic: stakeholder.getTopics()) {
|
||||
for(Category category : topic.getCategories()) {
|
||||
List<SubCategory> subCategories = new ArrayList<>();
|
||||
|
||||
for(SubCategory<String> subCategory : category.getSubCategories()) {
|
||||
SubCategory subCategoryFull = new SubCategory<Indicator>(subCategory);
|
||||
|
||||
List<Indicator> charts = new ArrayList<>();
|
||||
for(String indicatorId : subCategory.getCharts()) {
|
||||
charts.add(indicatorDAO.findById(indicatorId));
|
||||
}
|
||||
subCategoryFull.setCharts(charts);
|
||||
|
||||
List<Indicator> numbers = new ArrayList<>();
|
||||
for(String indicatorId : subCategory.getNumbers()) {
|
||||
numbers.add(indicatorDAO.findById(indicatorId));
|
||||
}
|
||||
subCategoryFull.setNumbers(numbers);
|
||||
|
||||
subCategories.add(subCategoryFull);
|
||||
}
|
||||
|
||||
category.setSubCategories(subCategories);
|
||||
}
|
||||
|
||||
}
|
||||
return stakeholder;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/stakeholder/all", method = RequestMethod.GET)
|
||||
public List<Stakeholder> getAllStakeholders(@RequestParam(required = false) String type) {
|
||||
List<Stakeholder> stakeholders;
|
||||
|
@ -27,6 +64,11 @@ public class StakeholderController {
|
|||
} else {
|
||||
stakeholders = stakeholderDAO.findByType(type);
|
||||
}
|
||||
|
||||
for(Stakeholder stakeholder : stakeholders) {
|
||||
this.setIndicatorsForStakeholder(stakeholder);
|
||||
}
|
||||
|
||||
return stakeholders;
|
||||
}
|
||||
|
||||
|
@ -38,6 +80,10 @@ public class StakeholderController {
|
|||
} else {
|
||||
stakeholders = stakeholderDAO.findByIsDefaultProfileAndType(true, type);
|
||||
}
|
||||
|
||||
for(Stakeholder stakeholder : stakeholders) {
|
||||
this.setIndicatorsForStakeholder(stakeholder);
|
||||
}
|
||||
return stakeholders;
|
||||
}
|
||||
|
||||
|
@ -49,11 +95,375 @@ public class StakeholderController {
|
|||
} else {
|
||||
stakeholders = stakeholderDAO.findByIsDefaultProfileAndType(false, type);
|
||||
}
|
||||
|
||||
for(Stakeholder stakeholder : stakeholders) {
|
||||
this.setIndicatorsForStakeholder(stakeholder);
|
||||
}
|
||||
log.debug(new Date());
|
||||
|
||||
return stakeholders;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/stakeholder/{alias}", method = RequestMethod.GET)
|
||||
public Stakeholder getStakeholder(@PathVariable("alias") String alias) {
|
||||
Stakeholder stakeholder = stakeholderDAO.findByAlias(alias);
|
||||
this.setIndicatorsForStakeholder(stakeholder);
|
||||
|
||||
return stakeholder;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/stakeholder/save", method = RequestMethod.POST)
|
||||
public Stakeholder saveStakeholder(@RequestBody Stakeholder stakeholder) {
|
||||
log.debug("save stakeholder");
|
||||
|
||||
Stakeholder stakeholderFull = new Stakeholder(stakeholder);
|
||||
|
||||
//this.minimizeIndicatorsForStakeholder(stakeholder);
|
||||
List<Topic> topicsFull = new ArrayList<>();
|
||||
|
||||
for (Topic topic: stakeholder.getTopics()) {
|
||||
Topic topicFull = new Topic(topic);
|
||||
|
||||
List<Category> categoriesFull = new ArrayList<>();
|
||||
|
||||
for(Category category : topic.getCategories()) {
|
||||
Category categoryFull = new Category(category);
|
||||
|
||||
List<SubCategory> subCategories = new ArrayList<>();
|
||||
List<SubCategory> subCategoriesFull = new ArrayList<>();
|
||||
|
||||
for(SubCategory<Indicator> subCategoryFull : category.getSubCategories()) {
|
||||
SubCategory subCategory = new SubCategory<String>(subCategoryFull);
|
||||
|
||||
List<String> charts = new ArrayList<>();
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
//Jackson's use of generics
|
||||
List<Indicator> chartsFull = mapper.convertValue(subCategoryFull.getCharts(), new TypeReference<List<Indicator>>(){});
|
||||
|
||||
//List<Indicator> chartsFull = (List<Indicator>)subCategoryFull.getCharts();
|
||||
//log.debug(chartsFull);
|
||||
|
||||
for(Indicator indicator : chartsFull) {
|
||||
charts.add(indicator.getId());
|
||||
}
|
||||
|
||||
subCategory.setCharts(charts);
|
||||
subCategoryFull.setCharts(chartsFull);
|
||||
|
||||
List<String> numbers = new ArrayList<>();
|
||||
List<Indicator> numbersFull = mapper.convertValue(subCategoryFull.getNumbers(), new TypeReference<List<Indicator>>(){});
|
||||
|
||||
for(Indicator indicator : numbersFull) {
|
||||
numbers.add(indicator.getId());
|
||||
}
|
||||
subCategory.setNumbers(numbers);
|
||||
subCategoryFull.setNumbers(numbersFull);
|
||||
|
||||
subCategories.add(subCategory);
|
||||
subCategoriesFull.add(subCategoryFull);
|
||||
}
|
||||
|
||||
category.setSubCategories(subCategories);
|
||||
categoryFull.setSubCategories(subCategoriesFull);
|
||||
|
||||
categoriesFull.add(categoryFull);
|
||||
}
|
||||
topicFull.setCategories(categoriesFull);
|
||||
topicsFull.add(topicFull);
|
||||
}
|
||||
stakeholderFull.setTopics(topicsFull);
|
||||
|
||||
log.debug("after minimize stakeholder");
|
||||
Stakeholder stakeholderSaved = stakeholderDAO.save(stakeholder);
|
||||
log.debug("stakeholder saved!");
|
||||
|
||||
stakeholderFull.setId(stakeholderSaved.getId());
|
||||
return stakeholderFull;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{stakeholder}/{topic}/{category}/{subcategory}/indicator/{id}", method = RequestMethod.DELETE)
|
||||
public boolean deleteIndicator(@PathVariable("stakeholder") String stakeholder,
|
||||
@PathVariable("topic") String topic,
|
||||
@PathVariable("category") String category,
|
||||
@PathVariable("subcategory") String subcategory,
|
||||
@PathVariable("id") String id) {
|
||||
|
||||
Stakeholder _stakeholder = stakeholderDAO.findByAlias(stakeholder);
|
||||
if(_stakeholder != null) {
|
||||
Topic _topic = _stakeholder.getTopics().stream()
|
||||
.filter(current_topic -> current_topic.getAlias().equals(topic))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if(_topic != null) {
|
||||
Category _category = _topic.getCategories().stream()
|
||||
.filter(current_category -> current_category.getAlias().equals(category))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if(_category != null) {
|
||||
SubCategory _subCategory = _category.getSubCategories().stream()
|
||||
.filter(current_subCategory -> current_subCategory.getAlias().equals(subcategory))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if(_subCategory != null) {
|
||||
List<String> indicators = null;
|
||||
|
||||
Indicator indicator = indicatorDAO.findById(id);
|
||||
if(indicator.hasType("chart")) {
|
||||
indicators =_subCategory.getCharts();
|
||||
} else if(indicator.hasType("number")) {
|
||||
indicators =_subCategory.getNumbers();
|
||||
}
|
||||
|
||||
if(indicators == null) {
|
||||
// EXCEPTION - No indicators found
|
||||
}
|
||||
|
||||
//List<String> finalIndicators = indicators;
|
||||
//log.debug("Indicators size: "+finalIndicators.size());
|
||||
// int index = IntStream.range(0, indicators.size())
|
||||
// .filter(i -> indicatorId.equals(finalIndicators.get(i)))
|
||||
// .findFirst()
|
||||
// .orElse(-1); // return -1 if target is not found
|
||||
|
||||
boolean indicatorFound = false;
|
||||
Iterator<String> indicatorIterator = indicators.iterator();
|
||||
while (indicatorIterator.hasNext()) {
|
||||
String indicatorId = indicatorIterator.next();
|
||||
log.debug(id + " vs "+indicatorId);
|
||||
if(id.equals(indicatorId)) {
|
||||
indicatorIterator.remove();
|
||||
indicatorFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
log.debug(indicatorFound);
|
||||
if(!indicatorFound) {
|
||||
return false;
|
||||
// EXCEPTION - Indicator not found
|
||||
}
|
||||
//indicators.remove(index);
|
||||
|
||||
stakeholderDAO.save(_stakeholder);
|
||||
indicatorDAO.delete(id);
|
||||
} else {
|
||||
// EXCEPTION - Subcategory not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Category not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Topic not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Stakeholder not found
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// @RequestMapping(value = "/{stakeholder}/{topic}/{category}/{subcategory}/indicator/delete", method = RequestMethod.POST)
|
||||
// public boolean deleteChartPost(@PathVariable("stakeholder") String stakeholder,
|
||||
// @PathVariable("topic") String topic,
|
||||
// @PathVariable("category") String category,
|
||||
// @PathVariable("subcategory") String subcategory,
|
||||
// @RequestBody String indicatorId) {
|
||||
// //String id = chart.getId();
|
||||
// return deleteIndicator(stakeholder, topic, category, subcategory, indicatorId);
|
||||
// }
|
||||
|
||||
|
||||
// path variables are alias-es. Each alias must be unique.
|
||||
@RequestMapping(value = "/{stakeholder}/{topic}/{category}/{subcategory}/indicator/save", method = RequestMethod.POST)
|
||||
public Indicator saveIndicator(@PathVariable("stakeholder") String stakeholder,
|
||||
@PathVariable("topic") String topic,
|
||||
@PathVariable("category") String category,
|
||||
@PathVariable("subcategory") String subcategory,
|
||||
@RequestBody Indicator indicator) {
|
||||
|
||||
Indicator indicatorSaved = null;
|
||||
if(indicator.getId() != null) {
|
||||
log.debug("indicator is already saved");
|
||||
indicatorSaved = indicatorDAO.save(indicator);
|
||||
} else {
|
||||
log.debug("to save indicator");
|
||||
Stakeholder _stakeholder = stakeholderDAO.findByAlias(stakeholder);
|
||||
if (_stakeholder != null) {
|
||||
Topic _topic = _stakeholder.getTopics().stream()
|
||||
.filter(current_topic -> current_topic.getAlias().equals(topic))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (_topic != null) {
|
||||
Category _category = _topic.getCategories().stream()
|
||||
.filter(current_category -> current_category.getAlias().equals(category))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (_category != null) {
|
||||
SubCategory _subCategory = _category.getSubCategories().stream()
|
||||
.filter(current_subCategory -> current_subCategory.getAlias().equals(subcategory))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (_subCategory != null) {
|
||||
indicatorSaved = indicatorDAO.save(indicator);
|
||||
|
||||
List<String> indicators = null;
|
||||
|
||||
if (indicator.hasType("chart")) {
|
||||
indicators = _subCategory.getCharts();
|
||||
} else if (indicator.hasType("number")) {
|
||||
indicators = _subCategory.getNumbers();
|
||||
}
|
||||
|
||||
String indicatorId;
|
||||
if (indicator.getId() != null) {
|
||||
indicatorId = indicators.stream()
|
||||
.filter(current_indicator -> current_indicator.equals(indicator.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (indicatorId == null) { // indicator is not already at this position
|
||||
indicators.add(indicator.getId());
|
||||
}
|
||||
}
|
||||
stakeholderDAO.save(_stakeholder);
|
||||
} else {
|
||||
// EXCEPTION - Subcategory not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Category not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Topic not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Stakeholder not found
|
||||
}
|
||||
}
|
||||
|
||||
return indicatorSaved;
|
||||
}
|
||||
|
||||
|
||||
// The following are not supposed to be used
|
||||
|
||||
// should i delete indicators that were in the list but they are not in the new list?
|
||||
@RequestMapping(value = "/{stakeholder}/{topic}/{category}/{subcategory}/charts/save", method = RequestMethod.POST)
|
||||
public List<Indicator> saveCharts(@PathVariable("stakeholder") String stakeholder,
|
||||
@PathVariable("topic") String topic,
|
||||
@PathVariable("category") String category,
|
||||
@PathVariable("subcategory") String subcategory,
|
||||
@RequestBody List<Indicator> charts) {
|
||||
log.debug(charts);
|
||||
log.debug(charts.size());
|
||||
log.debug(charts.getClass().getName());
|
||||
log.debug(charts.get(0).getClass().getName());
|
||||
return saveIndicators(stakeholder, topic, category, subcategory, charts, "chart");
|
||||
}
|
||||
|
||||
// should i delete indicators that were in the list but they are not in the new list?
|
||||
@RequestMapping(value = "/{stakeholder}/{topic}/{category}/{subcategory}/numbers/save", method = RequestMethod.POST)
|
||||
public List<Indicator> saveNumbers(@PathVariable("stakeholder") String stakeholder,
|
||||
@PathVariable("topic") String topic,
|
||||
@PathVariable("category") String category,
|
||||
@PathVariable("subcategory") String subcategory,
|
||||
@RequestBody List<Indicator> numbers) {
|
||||
return saveIndicators(stakeholder, topic, category, subcategory, numbers, "number");
|
||||
}
|
||||
|
||||
public List<Indicator> saveIndicators(String stakeholder, String topic,
|
||||
String category, String subcategory,
|
||||
List<Indicator> indicators, String type) {
|
||||
log.debug("to save indicators: "+indicators.size());
|
||||
List<Indicator> indicatorsSaved = new ArrayList<>();
|
||||
for(Indicator indicator : indicators) {
|
||||
indicatorsSaved.add(indicatorDAO.save(indicator));
|
||||
}
|
||||
log.debug("saved indicators: "+indicators.size());
|
||||
|
||||
Stakeholder _stakeholder = stakeholderDAO.findByAlias(stakeholder);
|
||||
if(_stakeholder != null) {
|
||||
Topic _topic = _stakeholder.getTopics().stream()
|
||||
.filter(current_topic -> current_topic.getAlias().equals(topic))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if(_topic != null) {
|
||||
Category _category = _topic.getCategories().stream()
|
||||
.filter(current_category -> current_category.getAlias().equals(category))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if(_category != null) {
|
||||
SubCategory _subCategory = _category.getSubCategories().stream()
|
||||
.filter(current_subCategory -> current_subCategory.getAlias().equals(subcategory))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if(_subCategory != null) {
|
||||
List<String> _indicators = null;
|
||||
if(type.equals("chart")) {
|
||||
_indicators = _subCategory.getCharts();
|
||||
} else if(type.equals("number")) {
|
||||
_indicators = _subCategory.getNumbers();
|
||||
}
|
||||
|
||||
_indicators.clear();
|
||||
for(Indicator indicator : indicators) {
|
||||
_indicators.add(indicator.getId());
|
||||
}
|
||||
stakeholderDAO.save(_stakeholder);
|
||||
} else {
|
||||
// EXCEPTION - Subcategory not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Vategory not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Topic not found
|
||||
}
|
||||
} else {
|
||||
// EXCEPTION - Stakeholder not found
|
||||
}
|
||||
|
||||
return indicatorsSaved;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Remember to check if alias is not already used before saving
|
||||
@RequestMapping(value = "/{stakeholder}/topic/save", method = RequestMethod.POST)
|
||||
public Stakeholder saveTopic(@PathVariable("stakeholder") String stakeholder,
|
||||
@RequestBody Topic topic) {
|
||||
Stakeholder stakeholderSaved = null;
|
||||
Stakeholder _stakeholder = stakeholderDAO.findByAlias(stakeholder);
|
||||
if (stakeholder != null) {
|
||||
List<Topic> topics = _stakeholder.getTopics();
|
||||
Topic _topic = topics.stream()
|
||||
.filter(current_topic -> current_topic.getAlias().equals(topic.getAlias()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if(_topic != null) {
|
||||
_topic = topic;
|
||||
} else {
|
||||
topics.add(topic);
|
||||
_stakeholder.setTopics(topics);
|
||||
}
|
||||
stakeholderSaved = stakeholderDAO.save(_stakeholder);
|
||||
}
|
||||
return stakeholderSaved;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{stakeholder}/topics/save", method = RequestMethod.POST)
|
||||
public Stakeholder saveTopics(@PathVariable("stakeholder") String stakeholder,
|
||||
@RequestBody List<Topic> topics) {
|
||||
Stakeholder stakeholderSaved = null;
|
||||
Stakeholder _stakeholder = stakeholderDAO.findByAlias(stakeholder);
|
||||
if (stakeholder != null) {
|
||||
_stakeholder.setTopics(topics);
|
||||
stakeholderSaved = stakeholderDAO.save(_stakeholder);
|
||||
}
|
||||
return stakeholderSaved;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/stakeholder/dates", method = RequestMethod.GET)
|
||||
public List<Date> getAllStakeholderDates() {
|
||||
List<Stakeholder> profiles = stakeholderDAO.findAll();
|
||||
|
@ -93,14 +503,4 @@ public class StakeholderController {
|
|||
}
|
||||
return profileDates;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/stakeholder/save", method = RequestMethod.POST)
|
||||
public Stakeholder insertStakeholder(@RequestBody Stakeholder stakeholder) {
|
||||
//Stakeholder stakeholder = new Stakeholder();
|
||||
|
||||
Stakeholder stakeholderSaved = stakeholderDAO.save(stakeholder);
|
||||
|
||||
return stakeholderSaved;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,12 @@ import java.util.List;
|
|||
|
||||
public interface MongoDBStakeholderDAO extends StakeholderDAO, MongoRepository<Stakeholder, String> {
|
||||
List<Stakeholder> findAll();
|
||||
List<Stakeholder> findByType(String type);
|
||||
List<Stakeholder> findByType(String Type);
|
||||
|
||||
List<Stakeholder> findByIsDefaultProfile(boolean isDefaultProfile);
|
||||
List<Stakeholder> findByIsDefaultProfileAndType(boolean isDefaultProfile, String type);
|
||||
List<Stakeholder> findByIsDefaultProfile(boolean IsDefaultProfile);
|
||||
List<Stakeholder> findByIsDefaultProfileAndType(boolean IsDefaultProfile, String Type);
|
||||
|
||||
Stakeholder findByAlias(String Alias);
|
||||
|
||||
Stakeholder save(Stakeholder stakeholder);
|
||||
}
|
||||
|
|
|
@ -6,10 +6,12 @@ import java.util.List;
|
|||
|
||||
public interface StakeholderDAO {
|
||||
List<Stakeholder> findAll();
|
||||
List<Stakeholder> findByType(String type);
|
||||
List<Stakeholder> findByType(String Type);
|
||||
|
||||
List<Stakeholder> findByIsDefaultProfile(boolean isDefaultProfile);
|
||||
List<Stakeholder> findByIsDefaultProfileAndType(boolean isDefaultProfile, String type);
|
||||
List<Stakeholder> findByIsDefaultProfile(boolean IsDefaultProfile);
|
||||
List<Stakeholder> findByIsDefaultProfileAndType(boolean IsDefaultProfile, String Type);
|
||||
|
||||
Stakeholder findByAlias(String Alias);
|
||||
|
||||
Stakeholder save(Stakeholder stakeholder);
|
||||
}
|
||||
|
|
|
@ -5,12 +5,20 @@ import java.util.List;
|
|||
public class Category {
|
||||
private String name;
|
||||
private String alias;
|
||||
private String description;
|
||||
private boolean isActive;
|
||||
private boolean isPublic;
|
||||
private boolean isOverview;
|
||||
private List<SubCategory> subCategories;
|
||||
|
||||
public Category() {}
|
||||
public Category(Category category) {
|
||||
name = category.getName();
|
||||
alias = category.getAlias();
|
||||
isActive = category.getIsActive();
|
||||
isPublic = category.getIsPublic();
|
||||
isOverview = category.getIsOverview();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -27,36 +35,28 @@ public class Category {
|
|||
this.alias = alias;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
public boolean getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setActive(boolean active) {
|
||||
isActive = active;
|
||||
public void setIsActive(boolean isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
public boolean getIsPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
public void setIsPublic(boolean isPublic) {
|
||||
this.isPublic = isPublic;
|
||||
}
|
||||
|
||||
public boolean isOverview() {
|
||||
public boolean getIsOverview() {
|
||||
return isOverview;
|
||||
}
|
||||
|
||||
public void setOverview(boolean overview) {
|
||||
isOverview = overview;
|
||||
public void setIsOverview(boolean isOverview) {
|
||||
this.isOverview = isOverview;
|
||||
}
|
||||
|
||||
public List<SubCategory> getSubCategories() {
|
||||
|
|
|
@ -77,27 +77,31 @@ public class Indicator {
|
|||
this.tags = tags;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
public boolean getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setActive(boolean isActive) {
|
||||
public void setIsActive(boolean isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
public boolean getIsPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(boolean isPublic) {
|
||||
public void setIsPublic(boolean isPublic) {
|
||||
this.isPublic = isPublic;
|
||||
}
|
||||
|
||||
public List<IndicatorPath> getNdicatorPaths() {
|
||||
public List<IndicatorPath> getIndicatorPaths() {
|
||||
return indicatorPaths;
|
||||
}
|
||||
|
||||
public void setNdicatorPaths(List<IndicatorPath> ndicatorPaths) {
|
||||
this.indicatorPaths = ndicatorPaths;
|
||||
public void setIndicatorPaths(List<IndicatorPath> indicatorPaths) {
|
||||
this.indicatorPaths = indicatorPaths;
|
||||
}
|
||||
|
||||
public boolean hasType(String str) {
|
||||
return this.type.equals(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package eu.dnetlib.uoamonitorservice.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
enum IndicatorPathType {
|
||||
// Do not rename or remove existring values. This may cause problems with already stored values in DB
|
||||
table, bar, column;
|
||||
table, bar, column, pie, line, image;
|
||||
}
|
||||
|
||||
public class IndicatorPath {
|
||||
|
@ -12,6 +13,9 @@ public class IndicatorPath {
|
|||
private String source; // for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
|
||||
private String url;
|
||||
private List<String> jsonPath;
|
||||
private String chartObject;
|
||||
private Map<String, String> parameters;
|
||||
private Map<String, Map<String, String>> filters;
|
||||
|
||||
public IndicatorPathType getType() {
|
||||
return type;
|
||||
|
@ -44,4 +48,28 @@ public class IndicatorPath {
|
|||
public void setJsonPath(List<String> jsonPath) {
|
||||
this.jsonPath = jsonPath;
|
||||
}
|
||||
|
||||
public String getChartObject() {
|
||||
return chartObject;
|
||||
}
|
||||
|
||||
public void setChartObject(String chartObject) {
|
||||
this.chartObject = chartObject;
|
||||
}
|
||||
|
||||
public Map<String, String> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(Map<String, String> parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
public Map<String, Map<String, String>> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(Map<String, Map<String, String>> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,21 @@ public class Stakeholder {
|
|||
|
||||
private List<Topic> topics;
|
||||
|
||||
public Stakeholder() {}
|
||||
public Stakeholder(Stakeholder stakeholder) {
|
||||
type = stakeholder.getType();
|
||||
index_id = stakeholder.getIndex_id();
|
||||
index_name = stakeholder.getIndex_name();
|
||||
index_shortName = stakeholder.getIndex_shortName();
|
||||
alias = stakeholder.getAlias();
|
||||
isDefaultProfile = stakeholder.getIsDefaultProfile();
|
||||
isActive = stakeholder.getIsActive();
|
||||
isPublic = stakeholder.getIsPublic();
|
||||
creationDate = stakeholder.getCreationDate();
|
||||
updateDate = stakeholder.getUpdateDate();
|
||||
managers = stakeholder.getManagers();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -81,28 +96,28 @@ public class Stakeholder {
|
|||
this.alias = alias;
|
||||
}
|
||||
|
||||
public boolean isDefaultProfile() {
|
||||
public boolean getIsDefaultProfile() {
|
||||
return isDefaultProfile;
|
||||
}
|
||||
|
||||
public void setDefaultProfile(boolean defaultProfile) {
|
||||
isDefaultProfile = defaultProfile;
|
||||
public void setIsDefaultProfile(boolean isDefaultProfile) {
|
||||
this.isDefaultProfile = isDefaultProfile;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
public boolean getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setActive(boolean active) {
|
||||
isActive = active;
|
||||
public void setIsActive(boolean isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
public boolean getIsPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
public void setIsPublic(boolean isPublic) {
|
||||
this.isPublic = isPublic;
|
||||
}
|
||||
|
||||
public Date getCreationDate() {
|
||||
|
|
|
@ -2,14 +2,21 @@ package eu.dnetlib.uoamonitorservice.entities;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class SubCategory {
|
||||
public class SubCategory<StringOrIndicator> {
|
||||
private String name;
|
||||
private String alias;
|
||||
private String description;
|
||||
private boolean isActive;
|
||||
private boolean isPublic;
|
||||
private List<Indicator> charts;
|
||||
private List<Indicator> numbers;
|
||||
private List<StringOrIndicator> charts;
|
||||
private List<StringOrIndicator> numbers;
|
||||
|
||||
public SubCategory() {}
|
||||
public SubCategory(SubCategory subCategory) {
|
||||
name = subCategory.getName();
|
||||
alias = subCategory.getAlias();
|
||||
isActive = subCategory.getIsActive();
|
||||
isPublic = subCategory.getIsPublic();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
@ -27,43 +34,35 @@ public class SubCategory {
|
|||
this.alias = alias;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
public boolean getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setActive(boolean active) {
|
||||
isActive = active;
|
||||
public void setIsActive(boolean isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
public boolean getIsPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
public void setIsPublic(boolean isPublic) {
|
||||
this.isPublic = isPublic;
|
||||
}
|
||||
|
||||
public List<Indicator> getCharts() {
|
||||
public List<StringOrIndicator> getCharts() {
|
||||
return charts;
|
||||
}
|
||||
|
||||
public void setCharts(List<Indicator> charts) {
|
||||
public void setCharts(List<StringOrIndicator> charts) {
|
||||
this.charts = charts;
|
||||
}
|
||||
|
||||
public List<Indicator> getNumbers() {
|
||||
public List<StringOrIndicator> getNumbers() {
|
||||
return numbers;
|
||||
}
|
||||
|
||||
public void setNumbers(List<Indicator> numbers) {
|
||||
public void setNumbers(List<StringOrIndicator> numbers) {
|
||||
this.numbers = numbers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,15 @@ public class Topic {
|
|||
private boolean isPublic;
|
||||
private List<Category> categories;
|
||||
|
||||
public Topic() {}
|
||||
public Topic(Topic topic) {
|
||||
name = topic.getName();
|
||||
alias = topic.getAlias();
|
||||
description = topic.getDescription();
|
||||
isActive = topic.getIsActive();
|
||||
isPublic = topic.getIsPublic();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -34,20 +43,20 @@ public class Topic {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
public boolean getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setActive(boolean active) {
|
||||
isActive = active;
|
||||
public void setIsActive(boolean isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
public boolean getIsPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(boolean aPublic) {
|
||||
isPublic = aPublic;
|
||||
public void setIsPublic(boolean isPublic) {
|
||||
this.isPublic = isPublic;
|
||||
}
|
||||
|
||||
public List<Category> getCategories() {
|
||||
|
|
Loading…
Reference in New Issue