Compare commits

...

2 Commits

4 changed files with 52 additions and 12 deletions

12
scripts/2024-06-18.js Normal file
View File

@ -0,0 +1,12 @@
function addIndicatorPathGroups() {
var indicators = db.indicator.find({});
indicators.forEach(indicator => {
var paths = indicator.indicatorPaths;
delete indicator.indicatorPaths;
indicator.indicatorPathGroups = [];
indicator.indicatorPathGroups.push({title: '', indicatorPaths: paths});
db.indicator.save(indicator);
})
}
addIndicatorPathGroups();

View File

@ -2,6 +2,7 @@ package eu.dnetlib.uoamonitorservice.entities;
import eu.dnetlib.uoamonitorservice.generics.Common;
import eu.dnetlib.uoamonitorservice.primitives.IndicatorPath;
import eu.dnetlib.uoamonitorservice.primitives.IndicatorPathGroup;
import eu.dnetlib.uoamonitorservice.primitives.IndicatorSize;
import eu.dnetlib.uoamonitorservice.primitives.IndicatorType;
@ -13,7 +14,7 @@ public class Indicator extends Common {
private IndicatorSize width; //small,medium,large
private IndicatorSize height = IndicatorSize.MEDIUM; //small,medium,large
private List<String> tags; // this field is not used anywhere now
private List<IndicatorPath> indicatorPaths;
private List<IndicatorPathGroup> indicatorPathGroups;
public Indicator() {}
@ -26,7 +27,7 @@ public class Indicator extends Common {
creationDate = indicator.getCreationDate();
updateDate = indicator.getUpdateDate();
visibility = indicator.getVisibility();
indicatorPaths = indicator.getIndicatorPaths();
indicatorPathGroups = indicator.getIndicatorPathGroups();
tags = indicator.getTags();
setType(indicator.getType());
width = indicator.getWidth();
@ -54,7 +55,7 @@ public class Indicator extends Common {
(old.getHeight() == null || old.getHeight().equals(indicator.getHeight()))) {
indicator.setHeight(this.getHeight());
}
indicator.setIndicatorPaths(this.getIndicatorPaths());
indicator.setIndicatorPathGroups(this.getIndicatorPathGroups());
return indicator;
}
@ -105,11 +106,11 @@ public class Indicator extends Common {
this.tags = tags;
}
public List<IndicatorPath> getIndicatorPaths() {
return indicatorPaths;
public List<IndicatorPathGroup> getIndicatorPathGroups() {
return indicatorPathGroups;
}
public void setIndicatorPaths(List<IndicatorPath> indicatorPaths) {
this.indicatorPaths = indicatorPaths;
public void setIndicatorPathGroups(List<IndicatorPathGroup> indicatorPathGroups) {
this.indicatorPathGroups = indicatorPathGroups;
}
}

View File

@ -12,7 +12,6 @@ public class IndicatorPath {
private String chartObject;
private Map<String, String> parameters;
private Map<String, String> filters;
//private Map<String, Map<String, String>> filters;
public IndicatorPath() {}
@ -34,10 +33,6 @@ public class IndicatorPath {
return type.name();
}
// public IndicatorPathType getType() {
// return type;
// }
public void setType(String type) {
if(type == null) {
this.type = null;

View File

@ -0,0 +1,32 @@
package eu.dnetlib.uoamonitorservice.primitives;
import java.util.List;
public class IndicatorPathGroup {
String title;
List<IndicatorPath> indicatorPaths;
public IndicatorPathGroup() {
}
public IndicatorPathGroup(String title, List<IndicatorPath> indicatorPaths) {
this.title = title;
this.indicatorPaths = indicatorPaths;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<IndicatorPath> getIndicatorPaths() {
return indicatorPaths;
}
public void setIndicatorPaths(List<IndicatorPath> indicatorPaths) {
this.indicatorPaths = indicatorPaths;
}
}