Revision 51273
Added by Argiro Kokogiannaki over 6 years ago
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/StatisticsStatus.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities; |
|
2 |
|
|
3 |
/** |
|
4 |
* Created by argirok on 5/3/2018. |
|
5 |
*/ |
|
6 |
public class StatisticsStatus { |
|
7 |
Boolean show = true; |
|
8 |
Boolean showInDashboard = false; |
|
9 |
|
|
10 |
public Boolean getShow() { |
|
11 |
return show; |
|
12 |
} |
|
13 |
|
|
14 |
public void setShow(Boolean show) { |
|
15 |
this.show = show; |
|
16 |
} |
|
17 |
|
|
18 |
public Boolean getShowInDashboard() { |
|
19 |
return showInDashboard; |
|
20 |
} |
|
21 |
|
|
22 |
public void setShowInDashboard(Boolean showInDashboard) { |
|
23 |
this.showInDashboard = showInDashboard; |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public String toString() { |
|
28 |
return "StatisticsStatus{" + |
|
29 |
"show=" + show + |
|
30 |
", showInDashboard=" + showInDashboard + |
|
31 |
'}'; |
|
32 |
} |
|
33 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/Statistics.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities; |
|
2 |
|
|
3 |
import com.fasterxml.jackson.annotation.JsonProperty; |
|
4 |
import org.springframework.data.annotation.Id; |
|
5 |
|
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.Map; |
|
8 |
|
|
9 |
/** |
|
10 |
* Created by argirok on 5/3/2018. |
|
11 |
*/ |
|
12 |
public class Statistics { |
|
13 |
@Id |
|
14 |
@JsonProperty("_id") |
|
15 |
private String id; |
|
16 |
private String pid; |
|
17 |
private Map<String, StatisticsStatus> statistics; |
|
18 |
|
|
19 |
public Statistics(String pid){ |
|
20 |
this.setPid(pid); |
|
21 |
this.statistics = new HashMap<String, StatisticsStatus>(); |
|
22 |
|
|
23 |
this.statistics.put("publicationsNumber", new StatisticsStatus()); |
|
24 |
this.statistics.put("publicationsProjectNumber", new StatisticsStatus()); |
|
25 |
this.statistics.put("publicationsOpenNumber", new StatisticsStatus()); |
|
26 |
this.statistics.put("publicationsClosedNumber", new StatisticsStatus()); |
|
27 |
this.statistics.put("publicationsEmbargoNumber", new StatisticsStatus()); |
|
28 |
|
|
29 |
this.statistics.put("datasetsNumber", new StatisticsStatus()); |
|
30 |
this.statistics.put("datasetsProjectNumber", new StatisticsStatus()); |
|
31 |
this.statistics.put("datasetsOpenNumber", new StatisticsStatus()); |
|
32 |
this.statistics.put("datasetsClosedNumber", new StatisticsStatus()); |
|
33 |
this.statistics.put("datasetsEmbargoNumber", new StatisticsStatus()); |
|
34 |
|
|
35 |
this.statistics.put("softwareNumber", new StatisticsStatus()); |
|
36 |
this.statistics.put("softwareProjectNumber", new StatisticsStatus()); |
|
37 |
this.statistics.put("softwareOpenNumber", new StatisticsStatus()); |
|
38 |
this.statistics.put("softwareClosedNumber", new StatisticsStatus()); |
|
39 |
this.statistics.put("softwareEmbargoNumber", new StatisticsStatus()); |
|
40 |
|
|
41 |
this.statistics.put("publicationsTimeline", new StatisticsStatus()); |
|
42 |
this.statistics.put("datasetsTimeline", new StatisticsStatus()); |
|
43 |
this.statistics.put("softwareTimeline", new StatisticsStatus()); |
|
44 |
|
|
45 |
|
|
46 |
this.statistics.put("publicationsProjectColumn", new StatisticsStatus()); |
|
47 |
this.statistics.put("publicationsProjectPie", new StatisticsStatus()); |
|
48 |
this.statistics.put("publicationsProjectTable", new StatisticsStatus()); |
|
49 |
|
|
50 |
this.statistics.put("datasetsProjectColumn", new StatisticsStatus()); |
|
51 |
this.statistics.put("datasetsProjectPie", new StatisticsStatus()); |
|
52 |
this.statistics.put("datasetsProjectTable", new StatisticsStatus()); |
|
53 |
|
|
54 |
this.statistics.put("softwareProjectColumn", new StatisticsStatus()); |
|
55 |
this.statistics.put("softwareProjectPie", new StatisticsStatus()); |
|
56 |
this.statistics.put("softwareProjectTable", new StatisticsStatus()); |
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
public String getId() { |
|
61 |
return id; |
|
62 |
} |
|
63 |
|
|
64 |
public void setId(String id) { |
|
65 |
this.id = id; |
|
66 |
} |
|
67 |
|
|
68 |
public String getPid() { |
|
69 |
return pid; |
|
70 |
} |
|
71 |
|
|
72 |
public void setPid(String pid) { |
|
73 |
this.pid = pid; |
|
74 |
} |
|
75 |
|
|
76 |
public Map<String, StatisticsStatus> getStatistics() { |
|
77 |
return statistics; |
|
78 |
} |
|
79 |
|
|
80 |
public void setStatistics(Map<String, StatisticsStatus> statistics) { |
|
81 |
this.statistics = statistics; |
|
82 |
} |
|
83 |
|
|
84 |
@Override |
|
85 |
public String toString() { |
|
86 |
return "Statistics{" + |
|
87 |
"id='" + id + '\'' + |
|
88 |
", pid='" + pid + '\'' + |
|
89 |
", statistics=" + statistics + |
|
90 |
'}'; |
|
91 |
} |
|
92 |
} |
modules/uoa-admin-tools/update_db.js | ||
---|---|---|
1 |
use openaire_admin; |
|
2 |
|
|
3 |
var communities = db.community.find().map( function(entity) { return entity._id.str; } ); |
|
4 |
print(communities); |
|
5 |
for(var i =0; i < communities.length; i++){ |
|
6 |
print(communities[i]); |
|
7 |
var communityPid = communities[i]; |
|
8 |
var charts_map = {}; |
|
9 |
charts_map["total"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
10 |
charts_map["project"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
11 |
charts_map["open"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
12 |
charts_map["closed"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
13 |
charts_map["embargo"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
14 |
|
|
15 |
var charts = {"map":charts_map}; |
|
16 |
var numbers_map = {}; |
|
17 |
numbers_map["timeline"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
18 |
numbers_map["graph"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
19 |
numbers_map["projectTable"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
20 |
numbers_map["projectColumn"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
21 |
numbers_map["projectPie"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
22 |
|
|
23 |
var numbers = {"map":numbers_map}; |
|
24 |
var statistics_entities = {"charts":charts,"numbers":numbers} |
|
25 |
var entities = {}; |
|
26 |
entities["publication"]=statistics_entities; |
|
27 |
entities["dataset"]=statistics_entities; |
|
28 |
entities["sofware"]=statistics_entities; |
|
29 |
var statistics = {"pid" : communityPid, "entities" : entities}; |
|
30 |
|
|
31 |
db.statistics.save(statistics); |
|
32 |
print("Update stats for " + communityPid) |
|
33 |
} |
modules/uoa-admin-tools/init_db.js | ||
---|---|---|
2 | 2 |
|
3 | 3 |
use openaire_admin |
4 | 4 |
|
5 |
drop = false; |
|
5 |
var drop = false;
|
|
6 | 6 |
if(drop) { |
7 | 7 |
db.dropDatabase() |
8 | 8 |
} |
... | ... | |
24 | 24 |
db.entity.save({"pid" : "organization", "name" : "Organization"}) |
25 | 25 |
db.entity.save({"pid" : "datasource", "name" : "Content Provider"}) |
26 | 26 |
|
27 |
|
|
27 | 28 |
publicationId = db.entity.find( { pid: "publication" }).map( function(entity) { return entity._id.str; } ).toString() |
28 | 29 |
datasetId = db.entity.find( { pid: "dataset" }).map( function(entity) { return entity._id.str; } ).toString() |
29 | 30 |
softwareId = db.entity.find( { pid: "software" }).map( function(entity) { return entity._id.str; } ).toString() |
... | ... | |
162 | 163 |
community_entities[projectId] = true; |
163 | 164 |
community_entities[organizationId] = true; |
164 | 165 |
community_entities[datasourceId] = true; |
165 |
var communityPid="openaire";
|
|
166 |
db.community.save({ "name" : "OpenAIRE", "pid" : "openaire", "pages" : community_pages, "entities" : community_entities})
|
|
166 |
var communityPid="test";
|
|
167 |
db.community.save({ "name" : "OpenAIRE", "pid" : communityPid, "pages" : community_pages, "entities" : community_entities})
|
|
167 | 168 |
|
168 |
openaireCommunity = db.community.find( { pid: "openaire" }).map( function(community) { return community._id.str; } ).toString()
|
|
169 |
openaireCommunity = db.community.find( { pid: communityPid }).map( function(community) { return community._id.str; } ).toString()
|
|
169 | 170 |
|
170 | 171 |
db.divId.save({ "name" : "link-context-form", "pages" : [link, directLink], "community" : openaireCommunity}) |
171 | 172 |
db.divId.save({ "name" : "link-project-form", "pages" : [link, directLink], "community" : openaireCommunity}) |
... | ... | |
173 | 174 |
db.divId.save({ "name" : "link-result-bulk", "pages" : [link], "community" : openaireCommunity}) |
174 | 175 |
db.divId.save({ "name" : "link-metadata", "pages" : [link, directLink], "community" : openaireCommunity}) |
175 | 176 |
|
176 |
var community_statistics = {} |
|
177 |
var charts_map = {}; |
|
178 |
charts_map["total"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
179 |
charts_map["project"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
180 |
charts_map["open"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
181 |
charts_map["closed"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
182 |
charts_map["embargo"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
177 | 183 |
|
178 |
community_statistics["publicationsNumber"] = { "show" : true, "showInDashboard" : false }; |
|
179 |
community_statistics["publicationsProjectNumber"] = { "show" : true, "showInDashboard" : false }; |
|
180 |
community_statistics["publicationsOpenNumber"] = { "show" : true, "showInDashboard" : false }; |
|
181 |
community_statistics["publicationsClosedNumber"] = { "show" : true, "showInDashboard" : false }; |
|
182 |
community_statistics["publicationsEmbargoNumber"] = { "show" : true, "showInDashboard" : false }; |
|
184 |
var charts = {"map":charts_map}; |
|
185 |
var numbers_map = {}; |
|
186 |
numbers_map["timeline"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
187 |
numbers_map["graph"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
188 |
numbers_map["projectTable"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
189 |
numbers_map["projectColumn"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
190 |
numbers_map["projectPie"] = { "showInDashboard" : true, "showInDashboard" : false }; |
|
183 | 191 |
|
184 |
community_statistics["datasetsNumber"] = { "show" : true, "showInDashboard" : false }; |
|
185 |
community_statistics["datasetsProjectNumber"] = { "show" : true, "showInDashboard" : false }; |
|
186 |
community_statistics["datasetsOpenNumber"] = { "show" : true, "showInDashboard" : false }; |
|
187 |
community_statistics["datasetsClosedNumber"] = { "show" : true, "showInDashboard" : false }; |
|
188 |
community_statistics["datasetsEmbargoNumber"] = { "show" : true, "showInDashboard" : false }; |
|
192 |
var numbers = {"map":numbers_map}; |
|
193 |
var statistics_entities = {"charts":charts,"numbers":numbers} |
|
194 |
var entities = {}; |
|
195 |
entities["publication"]=statistics_entities; |
|
196 |
entities["dataset"]=statistics_entities; |
|
197 |
entities["sofware"]=statistics_entities; |
|
198 |
var statistics = {"pid" : communityPid, "entities" : entities}; |
|
189 | 199 |
|
190 |
community_statistics["softwareNumber"] = { "show" : true, "showInDashboard" : false }; |
|
191 |
community_statistics["softwareProjectNumber"] = { "show" : true, "showInDashboard" : false }; |
|
192 |
community_statistics["softwareOpenNumber"] = { "show" : true, "showInDashboard" : false }; |
|
193 |
community_statistics["softwareClosedNumber"] = { "show" : true, "showInDashboard" : false }; |
|
194 |
community_statistics["softwareEmbargoNumber"] = { "show" : true, "showInDashboard" : false }; |
|
200 |
db.statistics.save(statistics); |
|
195 | 201 |
|
196 |
community_statistics["publicationsTimeline"] = { "show" : true, "showInDashboard" : false }; |
|
197 |
community_statistics["datasetsTimeline"] = { "show" : true, "showInDashboard" : false }; |
|
198 |
community_statistics["softwareTimeline"] = { "show" : true, "showInDashboard" : false }; |
|
199 |
|
|
200 |
community_statistics["publicationsProjectColumn"] = { "show" : true, "showInDashboard" : false }; |
|
201 |
community_statistics["publicationsProjectPie"] = { "show" : true, "showInDashboard" : false }; |
|
202 |
community_statistics["publicationsProjectTable"] = { "show" : true, "showInDashboard" : false }; |
|
203 |
|
|
204 |
community_statistics["datasetsProjectColumn"] = { "show" : true, "showInDashboard" : false }; |
|
205 |
community_statistics["datasetsProjectPie"] = { "show" : true, "showInDashboard" : false }; |
|
206 |
community_statistics["datasetsProjectTable"] = { "show" : true, "showInDashboard" : false }; |
|
207 |
|
|
208 |
community_statistics["softwareProjectColumn"] = { "show" : true, "showInDashboard" : false }; |
|
209 |
community_statistics["softwareProjectPie"] = { "show" : true, "showInDashboard" : false }; |
|
210 |
community_statistics["softwareProjectTable"] = { "show" : true, "showInDashboard" : false }; |
|
211 |
|
|
212 |
db.statistics.save({ "pid" : communityPid, "statistics" : community_statistics}) |
|
213 |
|
|
214 | 202 |
var subscribers = []; |
215 | 203 |
db.communitySubscribers.save({ "pid" : communityPid, "subscribers" : subscribers}) |
216 | 204 |
|
modules/uoa-admin-tools/src/test/java/eu/dnetlib/uoaadmintools/UoaAdminToolsApplicationTests.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import eu.dnetlib.uoaadmintools.dao.*; |
4 | 4 |
import eu.dnetlib.uoaadmintools.entities.*; |
5 |
import eu.dnetlib.uoaadmintools.entities.statistics.Statistics; |
|
5 | 6 |
import org.junit.Test; |
6 | 7 |
import org.junit.runner.RunWith; |
7 | 8 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
174 | 175 |
|
175 | 176 |
// @Test |
176 | 177 |
// public void createStatistics() { |
178 |
// statisticsDAO.deleteAll(); |
|
177 | 179 |
// List<Community> communities = communityDAO.findAll(); |
178 | 180 |
// for(Community c:communities){ |
179 | 181 |
// |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/dao/StatisticsDAO.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.uoaadmintools.dao; |
2 | 2 |
|
3 | 3 |
|
4 |
import eu.dnetlib.uoaadmintools.entities.Statistics; |
|
4 |
import eu.dnetlib.uoaadmintools.entities.statistics.Statistics;
|
|
5 | 5 |
|
6 | 6 |
import java.util.List; |
7 | 7 |
|
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/dao/MongoDBStatisticsDAO.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.uoaadmintools.dao; |
2 | 2 |
|
3 |
import eu.dnetlib.uoaadmintools.entities.Statistics; |
|
3 |
import eu.dnetlib.uoaadmintools.entities.statistics.Statistics;
|
|
4 | 4 |
import org.springframework.data.mongodb.repository.MongoRepository; |
5 | 5 |
|
6 | 6 |
import java.util.List; |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/statistics/ChartsMap.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.statistics; |
|
2 |
|
|
3 |
import java.util.HashMap; |
|
4 |
import java.util.Map; |
|
5 |
|
|
6 |
/** |
|
7 |
* Created by argirok on 15/3/2018. |
|
8 |
*/ |
|
9 |
public class ChartsMap { |
|
10 |
Map<String,StatisticsStatus> map = new HashMap<String, StatisticsStatus>(); |
|
11 |
public ChartsMap(){ |
|
12 |
map.put("timeline",new StatisticsStatus()); |
|
13 |
map.put("graph",new StatisticsStatus()); |
|
14 |
map.put("projectTable",new StatisticsStatus()); |
|
15 |
map.put("projectColumn",new StatisticsStatus()); |
|
16 |
map.put("projectPie",new StatisticsStatus()); |
|
17 |
} |
|
18 |
|
|
19 |
public Map<String, StatisticsStatus> getMap() { |
|
20 |
return map; |
|
21 |
} |
|
22 |
|
|
23 |
public void setMap(Map<String, StatisticsStatus> map) { |
|
24 |
this.map = map; |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public String toString() { |
|
29 |
return "ChartsMap{" + |
|
30 |
"entities=" + map + |
|
31 |
'}'; |
|
32 |
} |
|
33 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/statistics/StatisticsEntity.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.statistics; |
|
2 |
|
|
3 |
/** |
|
4 |
* Created by argirok on 15/3/2018. |
|
5 |
*/ |
|
6 |
public class StatisticsEntity { |
|
7 |
private ChartsMap charts = new ChartsMap(); |
|
8 |
private NumbersMap numbers = new NumbersMap(); |
|
9 |
|
|
10 |
public ChartsMap getCharts() { |
|
11 |
return charts; |
|
12 |
} |
|
13 |
|
|
14 |
public void setCharts(ChartsMap charts) { |
|
15 |
this.charts = charts; |
|
16 |
} |
|
17 |
|
|
18 |
public NumbersMap getNumbers() { |
|
19 |
return numbers; |
|
20 |
} |
|
21 |
|
|
22 |
public void setNumbers(NumbersMap numbers) { |
|
23 |
this.numbers = numbers; |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public String toString() { |
|
28 |
return "StatisticsEntity{" + |
|
29 |
"charts=" + charts + |
|
30 |
", numbers=" + numbers + |
|
31 |
'}'; |
|
32 |
} |
|
33 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/statistics/NumbersMap.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.statistics; |
|
2 |
|
|
3 |
import java.util.HashMap; |
|
4 |
import java.util.Map; |
|
5 |
|
|
6 |
/** |
|
7 |
* Created by argirok on 15/3/2018. |
|
8 |
*/ |
|
9 |
public class NumbersMap { |
|
10 |
Map<String,StatisticsStatus> map = new HashMap<String, StatisticsStatus>(); |
|
11 |
public NumbersMap(){ |
|
12 |
map.put("total",new StatisticsStatus()); |
|
13 |
map.put("project",new StatisticsStatus()); |
|
14 |
map.put("open",new StatisticsStatus()); |
|
15 |
map.put("closed",new StatisticsStatus()); |
|
16 |
map.put("embargo",new StatisticsStatus()); |
|
17 |
} |
|
18 |
|
|
19 |
public Map<String, StatisticsStatus> getMap() { |
|
20 |
return map; |
|
21 |
} |
|
22 |
|
|
23 |
public void setMap(Map<String, StatisticsStatus> map) { |
|
24 |
this.map = map; |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public String toString() { |
|
29 |
return "ChartsMap{" + |
|
30 |
"entities=" + map + |
|
31 |
'}'; |
|
32 |
} |
|
33 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/statistics/Statistics.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.statistics; |
|
2 |
|
|
3 |
import com.fasterxml.jackson.annotation.JsonProperty; |
|
4 |
import org.springframework.data.annotation.Id; |
|
5 |
|
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.Map; |
|
8 |
|
|
9 |
/** |
|
10 |
* Created by argirok on 5/3/2018. |
|
11 |
*/ |
|
12 |
public class Statistics { |
|
13 |
@Id |
|
14 |
@JsonProperty("_id") |
|
15 |
private String id; |
|
16 |
private String pid; |
|
17 |
Map<String,StatisticsEntity> entities = new HashMap<String, StatisticsEntity>(); |
|
18 |
public Statistics(String pid){ |
|
19 |
this.pid = pid; |
|
20 |
entities.put("publication",new StatisticsEntity()); |
|
21 |
entities.put("dataset",new StatisticsEntity()); |
|
22 |
entities.put("software",new StatisticsEntity()); |
|
23 |
} |
|
24 |
public String getId() { |
|
25 |
return id; |
|
26 |
} |
|
27 |
|
|
28 |
public void setId(String id) { |
|
29 |
this.id = id; |
|
30 |
} |
|
31 |
|
|
32 |
public String getPid() { |
|
33 |
return pid; |
|
34 |
} |
|
35 |
|
|
36 |
public void setPid(String pid) { |
|
37 |
this.pid = pid; |
|
38 |
} |
|
39 |
|
|
40 |
public Map<String, StatisticsEntity> getEntities() { |
|
41 |
return entities; |
|
42 |
} |
|
43 |
|
|
44 |
public void setEntities(Map<String, StatisticsEntity> entities) { |
|
45 |
this.entities = entities; |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public String toString() { |
|
50 |
return "Statistics{" + |
|
51 |
"id='" + id + '\'' + |
|
52 |
", pid='" + pid + '\'' + |
|
53 |
", entities=" + entities + |
|
54 |
'}'; |
|
55 |
} |
|
56 |
|
|
57 |
// private Map<String, StatisticsStatus> statistics; |
|
58 |
// |
|
59 |
// public Statistics(String pid){ |
|
60 |
// this.setPid(pid); |
|
61 |
// this.statistics = new HashMap<String, StatisticsStatus>(); |
|
62 |
// |
|
63 |
// this.statistics.put("publicationsNumber", new StatisticsStatus()); |
|
64 |
// this.statistics.put("publicationsProjectNumber", new StatisticsStatus()); |
|
65 |
// this.statistics.put("publicationsOpenNumber", new StatisticsStatus()); |
|
66 |
// this.statistics.put("publicationsClosedNumber", new StatisticsStatus()); |
|
67 |
// this.statistics.put("publicationsEmbargoNumber", new StatisticsStatus()); |
|
68 |
// |
|
69 |
// this.statistics.put("datasetsNumber", new StatisticsStatus()); |
|
70 |
// this.statistics.put("datasetsProjectNumber", new StatisticsStatus()); |
|
71 |
// this.statistics.put("datasetsOpenNumber", new StatisticsStatus()); |
|
72 |
// this.statistics.put("datasetsClosedNumber", new StatisticsStatus()); |
|
73 |
// this.statistics.put("datasetsEmbargoNumber", new StatisticsStatus()); |
|
74 |
// |
|
75 |
// this.statistics.put("softwareNumber", new StatisticsStatus()); |
|
76 |
// this.statistics.put("softwareProjectNumber", new StatisticsStatus()); |
|
77 |
// this.statistics.put("softwareOpenNumber", new StatisticsStatus()); |
|
78 |
// this.statistics.put("softwareClosedNumber", new StatisticsStatus()); |
|
79 |
// this.statistics.put("softwareEmbargoNumber", new StatisticsStatus()); |
|
80 |
// |
|
81 |
// this.statistics.put("publicationsTimeline", new StatisticsStatus()); |
|
82 |
// this.statistics.put("datasetsTimeline", new StatisticsStatus()); |
|
83 |
// this.statistics.put("softwareTimeline", new StatisticsStatus()); |
|
84 |
// |
|
85 |
// |
|
86 |
// this.statistics.put("publicationsProjectColumn", new StatisticsStatus()); |
|
87 |
// this.statistics.put("publicationsProjectPie", new StatisticsStatus()); |
|
88 |
// this.statistics.put("publicationsProjectTable", new StatisticsStatus()); |
|
89 |
// |
|
90 |
// this.statistics.put("datasetsProjectColumn", new StatisticsStatus()); |
|
91 |
// this.statistics.put("datasetsProjectPie", new StatisticsStatus()); |
|
92 |
// this.statistics.put("datasetsProjectTable", new StatisticsStatus()); |
|
93 |
// |
|
94 |
// this.statistics.put("softwareProjectColumn", new StatisticsStatus()); |
|
95 |
// this.statistics.put("softwareProjectPie", new StatisticsStatus()); |
|
96 |
// this.statistics.put("softwareProjectTable", new StatisticsStatus()); |
|
97 |
// |
|
98 |
// } |
|
99 |
// |
|
100 |
// public String getId() { |
|
101 |
// return id; |
|
102 |
// } |
|
103 |
// |
|
104 |
// public void setId(String id) { |
|
105 |
// this.id = id; |
|
106 |
// } |
|
107 |
// |
|
108 |
// public String getPid() { |
|
109 |
// return pid; |
|
110 |
// } |
|
111 |
// |
|
112 |
// public void setPid(String pid) { |
|
113 |
// this.pid = pid; |
|
114 |
// } |
|
115 |
// |
|
116 |
// public Map<String, StatisticsStatus> getStatistics() { |
|
117 |
// return statistics; |
|
118 |
// } |
|
119 |
// |
|
120 |
// public void setStatistics(Map<String, StatisticsStatus> statistics) { |
|
121 |
// this.statistics = statistics; |
|
122 |
// } |
|
123 |
// |
|
124 |
// @Override |
|
125 |
// public String toString() { |
|
126 |
// return "Statistics{" + |
|
127 |
// "id='" + id + '\'' + |
|
128 |
// ", pid='" + pid + '\'' + |
|
129 |
// ", statistics=" + statistics + |
|
130 |
// '}'; |
|
131 |
// } |
|
132 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/entities/statistics/StatisticsStatus.java | ||
---|---|---|
1 |
package eu.dnetlib.uoaadmintools.entities.statistics; |
|
2 |
|
|
3 |
/** |
|
4 |
* Created by argirok on 5/3/2018. |
|
5 |
*/ |
|
6 |
public class StatisticsStatus { |
|
7 |
Boolean showInMonitor = true; |
|
8 |
Boolean showInDashboard = false; |
|
9 |
|
|
10 |
public Boolean getShowInMonitor() { |
|
11 |
return showInMonitor; |
|
12 |
} |
|
13 |
|
|
14 |
public void setShowInMonitor(Boolean showInMonitor) { |
|
15 |
this.showInMonitor = showInMonitor; |
|
16 |
} |
|
17 |
|
|
18 |
public Boolean getShowInDashboard() { |
|
19 |
return showInDashboard; |
|
20 |
} |
|
21 |
|
|
22 |
public void setShowInDashboard(Boolean showInDashboard) { |
|
23 |
this.showInDashboard = showInDashboard; |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public String toString() { |
|
28 |
return "StatisticsStatus{" + |
|
29 |
"showInMonitor=" + showInMonitor + |
|
30 |
", showInDashboard=" + showInDashboard + |
|
31 |
'}'; |
|
32 |
} |
|
33 |
} |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/CommunityController.java | ||
---|---|---|
3 | 3 |
import eu.dnetlib.uoaadmintools.dao.*; |
4 | 4 |
import eu.dnetlib.uoaadmintools.entities.*; |
5 | 5 |
|
6 |
import eu.dnetlib.uoaadmintools.entities.statistics.Statistics; |
|
6 | 7 |
import org.apache.log4j.Logger; |
7 | 8 |
import org.springframework.web.bind.annotation.*; |
8 | 9 |
import org.springframework.beans.factory.annotation.Autowired; |
modules/uoa-admin-tools/src/main/java/eu/dnetlib/uoaadmintools/controllers/StatisticsController.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.uoaadmintools.controllers; |
2 | 2 |
|
3 | 3 |
import eu.dnetlib.uoaadmintools.dao.*; |
4 |
import eu.dnetlib.uoaadmintools.entities.*; |
|
4 |
import eu.dnetlib.uoaadmintools.entities.statistics.*;
|
|
5 | 5 |
import eu.dnetlib.uoaadmintools.handlers.NotFoundException; |
6 | 6 |
import org.apache.log4j.Logger; |
7 | 7 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
56 | 56 |
|
57 | 57 |
|
58 | 58 |
|
59 |
@RequestMapping(value = "statistics/{pid}/toggle", method = RequestMethod.POST) |
|
60 |
public Statistics togglePage(@PathVariable(value = "pid") String pid, @RequestBody String key, @RequestParam String status, @RequestParam String statsPage) throws NotFoundException { |
|
59 |
|
|
60 |
@RequestMapping(value = "statistics/{pid}/{entity}/charts", method = RequestMethod.POST) |
|
61 |
public Statistics toggleCharts(@PathVariable(value = "pid") String pid, @PathVariable(value = "entity") String entity, @RequestBody String key, @RequestParam String status, @RequestParam String monitor) throws NotFoundException { |
|
61 | 62 |
Statistics statistics = statisticsDAO.findByPid(pid); |
62 | 63 |
if(statistics == null){ |
63 |
throw new NotFoundException("Statistics not found"); |
|
64 |
throw new NotFoundException("Statistics not found for community");
|
|
64 | 65 |
} |
65 |
Map<String, StatisticsStatus> stats = statistics.getStatistics(); |
|
66 |
|
|
67 |
StatisticsStatus statisticsStatus= stats.get(key); |
|
66 |
StatisticsEntity statisticsEntity = statistics.getEntities().get(entity); |
|
67 |
if(statisticsEntity == null ){ |
|
68 |
throw new NotFoundException("Statistics not found for entity"); |
|
69 |
} |
|
70 |
ChartsMap charts = statisticsEntity.getCharts(); |
|
71 |
if(charts == null){ |
|
72 |
throw new NotFoundException("Statistics not found - no charts"); |
|
73 |
} |
|
74 |
StatisticsStatus statisticsStatus= charts.getMap().get(key); |
|
68 | 75 |
if(statisticsStatus == null){ |
69 | 76 |
throw new NotFoundException("Statistics not found for key"); |
70 | 77 |
} |
71 |
if(Boolean.parseBoolean(statsPage)){
|
|
72 |
statisticsStatus.setShow(Boolean.parseBoolean(status)); |
|
78 |
if(Boolean.parseBoolean(monitor)){
|
|
79 |
statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status));
|
|
73 | 80 |
}else{ |
74 | 81 |
statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status)); |
75 | 82 |
} |
76 |
stats.put(key,statisticsStatus); |
|
83 |
// stats.put(key,statisticsStatus);
|
|
77 | 84 |
return statisticsDAO.save(statistics); |
78 | 85 |
} |
86 |
@RequestMapping(value = "statistics/{pid}/{entity}/numbers", method = RequestMethod.POST) |
|
87 |
public Statistics toggleNumber(@PathVariable(value = "pid") String pid, @PathVariable(value = "entity") String entity, @RequestBody String key, @RequestParam String status, @RequestParam String monitor) throws NotFoundException { |
|
88 |
Statistics statistics = statisticsDAO.findByPid(pid); |
|
89 |
if(statistics == null){ |
|
90 |
throw new NotFoundException("Statistics not found for community"); |
|
91 |
} |
|
92 |
StatisticsEntity statisticsEntity = statistics.getEntities().get(entity); |
|
93 |
if(statisticsEntity == null ){ |
|
94 |
throw new NotFoundException("Statistics not found for entity"); |
|
95 |
} |
|
96 |
NumbersMap numbers = statisticsEntity.getNumbers(); |
|
97 |
if(numbers == null){ |
|
98 |
throw new NotFoundException("Statistics not found - no numbers"); |
|
99 |
} |
|
100 |
StatisticsStatus statisticsStatus= numbers.getMap().get(key); |
|
101 |
if(statisticsStatus == null){ |
|
102 |
throw new NotFoundException("Statistics not found for key"); |
|
103 |
} |
|
104 |
if(Boolean.parseBoolean(monitor)){ |
|
105 |
statisticsStatus.setShowInMonitor(Boolean.parseBoolean(status)); |
|
106 |
}else{ |
|
107 |
statisticsStatus.setShowInDashboard(Boolean.parseBoolean(status)); |
|
108 |
} |
|
109 |
// stats.put(key,statisticsStatus); |
|
110 |
return statisticsDAO.save(statistics); |
|
111 |
} |
|
79 | 112 |
|
80 | 113 |
|
81 | 114 |
} |
Also available in: Unified diff
Change Statistics structure - add new classes | create add update script for statistics