[Trunk | Monitor Service]:

1. In all enums, add capitalized values too (maybe in the future, lowercased values will be removed - NOT NOW).
2. Visibility.java: New enumeration Visibility added with values: PUBLIC, RESTRICTED, PRIVATE (will replace isPublic and isActive fields).
3. Stakeholder.java: 
	a. Add field "isUpload" (default value: false) to define if "logoUrl" is a link, or a locally uploaded image.
	b. Remove fields "isActive" and "isPublic" and add field "visibility" (default value: Visibility.PRIVATE).
	c. Remove unused field "managers" (managers are defined from aai roles).
4. Topic.java & Category.java & SubCategory.java: 
	a. Remove fields "isActive" and "isPublic" and add field "visibility" (default value: Visibility.PRIVATE).
	b. Add fields "creationDate" and "updateDate".
5. Section.java: Add fields "creationDate" and "updateDate".
6. Indicator.java: 
	a. Rename enumeration "IndicatorWidth" to "IndicatorSize" (will be used for width and height).
	b. Add field "additionalDescription" (for default profiles, "description" can now be changed only by default profiles settings,
						while "additionalDescription" can also be changed by managers too).
	c. Add field "height" (default value:  IndicatorSize.MEDIUM).
	d. Remove fields "isActive" and "isPublic" and add field "visibility" (default value: Visibility.PRIVATE).
	e. Add fields "creationDate" and "updateDate".
This commit is contained in:
Konstantina Galouni 2020-11-11 11:20:10 +00:00
parent 3540b9ec6b
commit b7a4471385
8 changed files with 221 additions and 92 deletions

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.annotation.Id;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class Category<StringOrSubcategory> {
@ -14,8 +15,9 @@ public class Category<StringOrSubcategory> {
private String name;
private String alias;
private String description;
private boolean isActive;
private boolean isPublic;
private Visibility visibility = Visibility.PRIVATE;
private Date creationDate;
private Date updateDate;
private boolean isOverview;
private String defaultId;
private List<StringOrSubcategory> subCategories;
@ -26,8 +28,9 @@ public class Category<StringOrSubcategory> {
name = category.getName();
alias = category.getAlias();
description = category.getDescription();
isActive = category.getIsActive();
isPublic = category.getIsPublic();
setVisibility(category.getVisibility());
creationDate = category.getCreationDate();
updateDate = category.getUpdateDate();
isOverview = category.getIsOverview();
defaultId = category.getDefaultId();
}
@ -36,8 +39,9 @@ public class Category<StringOrSubcategory> {
setName(defaultCategory.getName());
setAlias(defaultCategory.getAlias());
setDescription(defaultCategory.getDescription());
setIsActive(defaultCategory.getIsActive());
setIsPublic(defaultCategory.getIsPublic());
setVisibility(defaultCategory.getVisibility());
setCreationDate(defaultCategory.getCreationDate());
setUpdateDate(defaultCategory.getUpdateDate());
setIsOverview(defaultCategory.getIsOverview());
setDefaultId(defaultCategory.getId());
setSubCategories(new ArrayList());
@ -75,20 +79,28 @@ public class Category<StringOrSubcategory> {
this.description = description;
}
public boolean getIsActive() {
return isActive;
public Visibility getVisibility() {
return visibility;
}
public void setIsActive(boolean isActive) {
this.isActive = isActive;
public void setVisibility(Visibility visibility) {
this.visibility = visibility;
}
public boolean getIsPublic() {
return isPublic;
public Date getCreationDate() {
return creationDate;
}
public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic;
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public boolean getIsOverview() {

View File

@ -3,17 +3,19 @@ package eu.dnetlib.uoamonitorservice.entities;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.annotation.Id;
import java.util.ArrayList;
import java.util.Date;
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;
number, chart,
NUMBER, CHART;
}
enum IndicatorWidth {
enum IndicatorSize {
// Do not rename or remove existring values. This may cause problems with already stored values in DB
small, medium, large;
small, medium, large,
SMALL, MEDIUM, LARGE;
}
public class Indicator {
@ -23,22 +25,28 @@ public class Indicator {
private String name;
private String description;
private String additionalDescription;
private IndicatorType type; //number,chart
private IndicatorWidth width; //small,medium,large
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 boolean isActive;
private boolean isPublic;
private Visibility visibility = Visibility.PRIVATE;
private Date creationDate;
private Date updateDate;
private String defaultId;
private List<IndicatorPath> indicatorPaths;
public void copyFromDefault(Indicator defaultIndicator) {
setName(defaultIndicator.getName());
setDescription(defaultIndicator.getDescription());
setAdditionalDescription(defaultIndicator.getAdditionalDescription());
setType(defaultIndicator.getType());
setWidth(defaultIndicator.getWidth());
setHeight(defaultIndicator.getHeight());
setTags(defaultIndicator.getTags());
setIsActive(defaultIndicator.getIsActive());
setIsPublic(defaultIndicator.getIsPublic());
setVisibility(defaultIndicator.getVisibility());
setCreationDate(defaultIndicator.getCreationDate());
setUpdateDate(defaultIndicator.getUpdateDate());
setDefaultId(defaultIndicator.getId());
setIndicatorPaths(defaultIndicator.getIndicatorPaths());
}
@ -67,6 +75,14 @@ public class Indicator {
this.description = description;
}
public String getAdditionalDescription() {
return additionalDescription;
}
public void setAdditionalDescription(String description) {
this.additionalDescription = description;
}
public String getType() {
if(type == null) {
return null;
@ -90,14 +106,22 @@ public class Indicator {
}
}
public IndicatorWidth getWidth() {
public IndicatorSize getWidth() {
return width;
}
public void setWidth(IndicatorWidth width) {
public void setWidth(IndicatorSize width) {
this.width = width;
}
public IndicatorSize getHeight() {
return height;
}
public void setHeight(IndicatorSize height) {
this.height = height;
}
public List<String> getTags() {
return tags;
}
@ -106,20 +130,28 @@ public class Indicator {
this.tags = tags;
}
public boolean getIsActive() {
return isActive;
public Visibility getVisibility() {
return visibility;
}
public void setIsActive(boolean isActive) {
this.isActive = isActive;
public void setVisibility(Visibility visibility) {
this.visibility = visibility;
}
public boolean getIsPublic() {
return isPublic;
public Date getCreationDate() {
return creationDate;
}
public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic;
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getDefaultId() {

View File

@ -5,9 +5,14 @@ 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, pie, line, other;
table, bar, column, pie, line, other,
TABLE, BAR, COLUMN, PIE, LINE, OTHER;
}
//enum SourceType {
// STATISTICS, SEARCH, METRICS, STATS_TOOL,OLD,IMAGE;
//}
public class IndicatorPath {
private IndicatorPathType type; // for charts is type of chart {table, bar, column, etc}
private String source; // for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, image}

View File

@ -4,11 +4,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.annotation.Id;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
enum SectionType {
// Do not rename or remove existring values. This may cause problems with already stored values in DB
number, chart;
number, chart,
NUMBER, CHART;
}
public class Section<StringOrIndicator> {
@ -20,6 +22,8 @@ public class Section<StringOrIndicator> {
private String defaultId;
private String stakeholderAlias;
private SectionType type;
private Date creationDate;
private Date updateDate;
private List<StringOrIndicator> indicators;
public Section() {}
@ -30,12 +34,16 @@ public class Section<StringOrIndicator> {
defaultId = section.getDefaultId();
stakeholderAlias = section.getStakeholderAlias();
setType(section.getType());
creationDate = section.getCreationDate();
updateDate = section.getUpdateDate();
}
public void copyFromDefault(Section defaultSection) {
setTitle(defaultSection.getTitle());
setType(defaultSection.getType());
setDefaultId(defaultSection.id);
setCreationDate(defaultSection.getCreationDate());
setUpdateDate(defaultSection.getUpdateDate());
setIndicators(new ArrayList<>());
}
@ -87,6 +95,22 @@ public class Section<StringOrIndicator> {
}
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public List<StringOrIndicator> getIndicators() {
return indicators;
}

View File

@ -10,7 +10,8 @@ import java.util.List;
enum StakeholderType
{
// Do not rename or remove existring values. This may cause problems with already stored values in DB
funder, ri, project, organization;
funder, ri, project, organization,
FUNDER, RI, PROJECT, ORGANIZATION;
}
@ -24,15 +25,14 @@ public class Stakeholder<StringOrTopic> {
private String index_name;
private String index_shortName;
private String logoUrl;
private boolean isUpload = false;
private String name;
private String alias;
private String description;
private String defaultId = null;
private boolean isActive;
private boolean isPublic;
private Visibility visibility = Visibility.PRIVATE;
private Date creationDate;
private Date updateDate;
private List<String> managers;
private List<StringOrTopic> topics;
@ -46,15 +46,14 @@ public class Stakeholder<StringOrTopic> {
index_name = stakeholder.getIndex_name();
index_shortName = stakeholder.getIndex_shortName();
logoUrl = stakeholder.getLogoUrl();
isUpload = stakeholder.getIsUpload();
name = stakeholder.getName();
alias = stakeholder.getAlias();
description = stakeholder.getDescription();
defaultId = stakeholder.getDefaultId();
isActive = stakeholder.getIsActive();
isPublic = stakeholder.getIsPublic();
setVisibility(stakeholder.getVisibility());
creationDate = stakeholder.getCreationDate();
updateDate = stakeholder.getUpdateDate();
managers = stakeholder.getManagers();
}
public String getId() {
@ -121,6 +120,14 @@ public class Stakeholder<StringOrTopic> {
this.logoUrl = logoUrl;
}
public boolean getIsUpload() {
return isUpload;
}
public void setIsUpload(boolean isUpload) {
this.isUpload = isUpload;
}
public String getName() { return name; }
public void setName(String name) { this.name = name; }
@ -149,20 +156,14 @@ public class Stakeholder<StringOrTopic> {
this.defaultId = defaultId;
}
public boolean getIsActive() {
return isActive;
public Visibility getVisibility() {
//return visibility.getLabel();
return visibility;
}
public void setIsActive(boolean isActive) {
this.isActive = isActive;
}
public boolean getIsPublic() {
return isPublic;
}
public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic;
public void setVisibility(Visibility visibility) {
//this.visibility = Visibility.get(visibility);
this.visibility = visibility;
}
public Date getCreationDate() {
@ -181,14 +182,6 @@ public class Stakeholder<StringOrTopic> {
this.updateDate = updateDate;
}
public List<String> getManagers() {
return managers;
}
public void setManagers(List<String> managers) {
this.managers = managers;
}
public List<StringOrTopic> getTopics() {
return topics;
}

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.annotation.Id;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SubCategory<StringOrSection> {
@ -14,8 +15,9 @@ public class SubCategory<StringOrSection> {
private String name;
private String alias;
private String description;
private boolean isActive;
private boolean isPublic;
private Visibility visibility = Visibility.PRIVATE;
private Date creationDate;
private Date updateDate;
private String defaultId;
private List<StringOrSection> charts;
private List<StringOrSection> numbers;
@ -26,16 +28,18 @@ public class SubCategory<StringOrSection> {
name = subCategory.getName();
alias = subCategory.getAlias();
description = subCategory.getDescription();
isActive = subCategory.getIsActive();
isPublic = subCategory.getIsPublic();
setVisibility(subCategory.getVisibility());
creationDate = subCategory.getCreationDate();
updateDate = subCategory.getUpdateDate();
defaultId = subCategory.getDefaultId();
}
public void createOverviewSubCategory(Category category) {
setName("Overview");
setAlias("overview");
setIsActive(category.getIsActive());
setIsPublic(category.getIsPublic());
setVisibility(category.getVisibility());
setCreationDate(category.getCreationDate());
setUpdateDate(category.getUpdateDate());
setCharts(new ArrayList<>());
setNumbers(new ArrayList<>());
}
@ -44,8 +48,9 @@ public class SubCategory<StringOrSection> {
setName(defaultSubCategory.getName());
setAlias(defaultSubCategory.getAlias());
setDescription(defaultSubCategory.getDescription());
setIsActive(defaultSubCategory.getIsActive());
setIsPublic(defaultSubCategory.getIsPublic());
setVisibility(defaultSubCategory.getVisibility());
setCreationDate(defaultSubCategory.getCreationDate());
setUpdateDate(defaultSubCategory.getUpdateDate());
setDefaultId(defaultSubCategory.getId());
setCharts(new ArrayList());
setNumbers(new ArrayList());
@ -83,20 +88,28 @@ public class SubCategory<StringOrSection> {
this.description = description;
}
public boolean getIsActive() {
return isActive;
public Visibility getVisibility() {
return visibility;
}
public void setIsActive(boolean isActive) {
this.isActive = isActive;
public void setVisibility(Visibility visibility) {
this.visibility = visibility;
}
public boolean getIsPublic() {
return isPublic;
public Date getCreationDate() {
return creationDate;
}
public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic;
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getDefaultId() {

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.data.annotation.Id;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class Topic<StringOrCategory> {
@ -15,8 +16,9 @@ public class Topic<StringOrCategory> {
private String alias;
private String description;
private String icon;
private boolean isActive;
private boolean isPublic;
private Visibility visibility = Visibility.PRIVATE;
private Date creationDate;
private Date updateDate;
private String defaultId;
private List<StringOrCategory> categories;
@ -27,8 +29,9 @@ public class Topic<StringOrCategory> {
alias = topic.getAlias();
description = topic.getDescription();
icon = topic.getIcon();
isActive = topic.getIsActive();
isPublic = topic.getIsPublic();
setVisibility(topic.getVisibility());
creationDate = topic.getCreationDate();
updateDate = topic.getUpdateDate();
defaultId = topic.getDefaultId();
}
@ -37,8 +40,9 @@ public class Topic<StringOrCategory> {
setAlias(defaultTopic.getAlias());
setDescription(defaultTopic.getDescription());
setIcon(defaultTopic.getIcon());
setIsActive(defaultTopic.getIsActive());
setIsPublic(defaultTopic.getIsPublic());
setVisibility(defaultTopic.getVisibility());
setCreationDate(defaultTopic.getCreationDate());
setUpdateDate(defaultTopic.getUpdateDate());
setDefaultId(defaultTopic.getId());
setCategories(new ArrayList());
}
@ -83,20 +87,28 @@ public class Topic<StringOrCategory> {
this.icon = icon;
}
public boolean getIsActive() {
return isActive;
public Visibility getVisibility() {
return visibility;
}
public void setIsActive(boolean isActive) {
this.isActive = isActive;
public void setVisibility(Visibility visibility) {
this.visibility = visibility;
}
public boolean getIsPublic() {
return isPublic;
public Date getCreationDate() {
return creationDate;
}
public void setIsPublic(boolean isPublic) {
this.isPublic = isPublic;
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getDefaultId() {

View File

@ -0,0 +1,38 @@
package eu.dnetlib.uoamonitorservice.entities;
import java.util.HashMap;
import java.util.Map;
public enum Visibility {
// Do not rename or remove existring values. This may cause problems with already stored values in DB
// PUBLIC("public"), RESTRICTED("restricted"), PRIVATE("private");
PUBLIC, RESTRICTED, PRIVATE
// private String label;
//
// private Visibility(String label) {
// this.label = label;
// }
//
// public String getLabel() {
// return this.label;
// }
//
// //Lookup table
// private static final Map<String, Visibility> lookup = new HashMap<>();
//
// //Populate the lookup table on loading time
// static
// {
// for(Visibility visibility : Visibility.values())
// {
// lookup.put(visibility.getLabel(), visibility);
// }
// }
//
// //This method can be used for reverse lookup purpose
// public static Visibility get(String visibility)
// {
// return lookup.get(visibility);
// }
}