Revision 58954
Added by Konstantina Galouni almost 4 years ago
modules/uoa-monitor-service/trunk/src/main/java/eu/dnetlib/uoamonitorservice/handlers/ExceptionsHandler.java | ||
---|---|---|
22 | 22 |
response.setErrorMessage("Invalid inputs"); |
23 | 23 |
response.setErrors(ex.getMessage()); |
24 | 24 |
response.setStatus(HttpStatus.BAD_REQUEST); |
25 |
log.debug("invalidInput exception : "+ ex.getMessage());
|
|
25 |
log.error("invalidInput exception : "+ ex.getMessage());
|
|
26 | 26 |
return new ResponseEntity<ExceptionResponse>(response, HttpStatus.BAD_REQUEST); |
27 | 27 |
} |
28 | 28 |
|
... | ... | |
33 | 33 |
response.setErrorMessage("Null pointer Exception"); |
34 | 34 |
response.setErrors(ex.getMessage()); |
35 | 35 |
response.setStatus(HttpStatus.BAD_REQUEST); |
36 |
log.debug("nullPointerException exception : "+ ex.getMessage());
|
|
36 |
log.error("nullPointerException exception : "+ ex.getMessage());
|
|
37 | 37 |
return new ResponseEntity<ExceptionResponse>(response, HttpStatus.BAD_REQUEST); |
38 | 38 |
} |
39 | 39 |
|
... | ... | |
44 | 44 |
response.setErrorMessage("Not found Exception"); |
45 | 45 |
response.setErrors(ex.getMessage()); |
46 | 46 |
response.setStatus(HttpStatus.NOT_FOUND); |
47 |
log.debug("notFoundException exception : "+ ex.getMessage());
|
|
47 |
log.error("notFoundException exception : "+ ex.getMessage());
|
|
48 | 48 |
return new ResponseEntity<ExceptionResponse>(response, HttpStatus.NOT_FOUND); |
49 | 49 |
} |
50 | 50 |
|
... | ... | |
55 | 55 |
response.setErrorMessage("Entity not found Exception"); |
56 | 56 |
response.setErrors(ex.getMessage()); |
57 | 57 |
response.setStatus(HttpStatus.NOT_FOUND); |
58 |
log.debug("entityNotFoundException exception : "+ ex.getMessage());
|
|
58 |
log.error("entityNotFoundException exception : "+ ex.getMessage());
|
|
59 | 59 |
return new ResponseEntity<ExceptionResponse>(response, HttpStatus.NOT_FOUND); |
60 | 60 |
} |
61 | 61 |
|
... | ... | |
66 | 66 |
response.setErrorMessage("Path not valid Exception"); |
67 | 67 |
response.setErrors(ex.getMessage()); |
68 | 68 |
response.setStatus(HttpStatus.NOT_FOUND); |
69 |
log.debug("pathNotValidException exception : "+ ex.getMessage());
|
|
69 |
log.error("pathNotValidException exception : "+ ex.getMessage());
|
|
70 | 70 |
return new ResponseEntity<ExceptionResponse>(response, HttpStatus.NOT_FOUND); |
71 | 71 |
} |
72 | 72 |
} |
modules/uoa-monitor-service/trunk/src/main/java/eu/dnetlib/uoamonitorservice/entities/Stakeholder.java | ||
---|---|---|
26 | 26 |
private String logoUrl; |
27 | 27 |
private String name; |
28 | 28 |
private String alias; |
29 |
private String description; |
|
29 | 30 |
private String defaultId = null; |
30 | 31 |
private boolean isActive; |
31 | 32 |
private boolean isPublic; |
... | ... | |
47 | 48 |
logoUrl = stakeholder.getLogoUrl(); |
48 | 49 |
name = stakeholder.getName(); |
49 | 50 |
alias = stakeholder.getAlias(); |
51 |
description = stakeholder.getDescription(); |
|
50 | 52 |
defaultId = stakeholder.getDefaultId(); |
51 | 53 |
isActive = stakeholder.getIsActive(); |
52 | 54 |
isPublic = stakeholder.getIsPublic(); |
... | ... | |
131 | 133 |
this.alias = alias; |
132 | 134 |
} |
133 | 135 |
|
136 |
public String getDescription() { |
|
137 |
return description; |
|
138 |
} |
|
139 |
|
|
140 |
public void setDescription(String description) { |
|
141 |
this.description = description; |
|
142 |
} |
|
143 |
|
|
134 | 144 |
public String getDefaultId() { |
135 | 145 |
return defaultId; |
136 | 146 |
} |
modules/uoa-monitor-service/trunk/src/main/java/eu/dnetlib/uoamonitorservice/entities/SubCategory.java | ||
---|---|---|
44 | 44 |
setName(defaultSubCategory.getName()); |
45 | 45 |
setAlias(defaultSubCategory.getAlias()); |
46 | 46 |
setDescription(defaultSubCategory.getDescription()); |
47 |
setIsActive(false);
|
|
48 |
setIsPublic(false);
|
|
47 |
setIsActive(defaultSubCategory.getIsActive());
|
|
48 |
setIsPublic(defaultSubCategory.getIsPublic());
|
|
49 | 49 |
setDefaultId(defaultSubCategory.getId()); |
50 | 50 |
setCharts(new ArrayList()); |
51 | 51 |
setNumbers(new ArrayList()); |
modules/uoa-monitor-service/trunk/src/main/java/eu/dnetlib/uoamonitorservice/entities/Indicator.java | ||
---|---|---|
37 | 37 |
setType(defaultIndicator.getType()); |
38 | 38 |
setWidth(defaultIndicator.getWidth()); |
39 | 39 |
setTags(defaultIndicator.getTags()); |
40 |
setIsActive(false);
|
|
41 |
setIsPublic(false);
|
|
42 |
setDefaultId(defaultIndicator.id);
|
|
40 |
setIsActive(defaultIndicator.getIsActive());
|
|
41 |
setIsPublic(defaultIndicator.getIsPublic());
|
|
42 |
setDefaultId(defaultIndicator.getId());
|
|
43 | 43 |
setIndicatorPaths(defaultIndicator.getIndicatorPaths()); |
44 | 44 |
} |
45 | 45 |
|
modules/uoa-monitor-service/trunk/src/main/java/eu/dnetlib/uoamonitorservice/entities/Category.java | ||
---|---|---|
36 | 36 |
setName(defaultCategory.getName()); |
37 | 37 |
setAlias(defaultCategory.getAlias()); |
38 | 38 |
setDescription(defaultCategory.getDescription()); |
39 |
setIsActive(false);
|
|
40 |
setIsPublic(false);
|
|
39 |
setIsActive(defaultCategory.getIsActive());
|
|
40 |
setIsPublic(defaultCategory.getIsPublic());
|
|
41 | 41 |
setIsOverview(defaultCategory.getIsOverview()); |
42 | 42 |
setDefaultId(defaultCategory.getId()); |
43 | 43 |
setSubCategories(new ArrayList()); |
modules/uoa-monitor-service/trunk/src/main/java/eu/dnetlib/uoamonitorservice/entities/Topic.java | ||
---|---|---|
14 | 14 |
private String name; |
15 | 15 |
private String alias; |
16 | 16 |
private String description; |
17 |
private String icon; |
|
17 | 18 |
private boolean isActive; |
18 | 19 |
private boolean isPublic; |
19 | 20 |
private String defaultId; |
... | ... | |
25 | 26 |
name = topic.getName(); |
26 | 27 |
alias = topic.getAlias(); |
27 | 28 |
description = topic.getDescription(); |
29 |
icon = topic.getIcon(); |
|
28 | 30 |
isActive = topic.getIsActive(); |
29 | 31 |
isPublic = topic.getIsPublic(); |
30 | 32 |
defaultId = topic.getDefaultId(); |
... | ... | |
34 | 36 |
setName(defaultTopic.getName()); |
35 | 37 |
setAlias(defaultTopic.getAlias()); |
36 | 38 |
setDescription(defaultTopic.getDescription()); |
37 |
setIsActive(false); |
|
38 |
setIsPublic(false); |
|
39 |
setIcon(defaultTopic.getIcon()); |
|
40 |
setIsActive(defaultTopic.getIsActive()); |
|
41 |
setIsPublic(defaultTopic.getIsPublic()); |
|
39 | 42 |
setDefaultId(defaultTopic.getId()); |
40 | 43 |
setCategories(new ArrayList()); |
41 | 44 |
} |
... | ... | |
72 | 75 |
this.description = description; |
73 | 76 |
} |
74 | 77 |
|
78 |
public String getIcon() { |
|
79 |
return icon; |
|
80 |
} |
|
81 |
|
|
82 |
public void setIcon(String icon) { |
|
83 |
this.icon = icon; |
|
84 |
} |
|
85 |
|
|
75 | 86 |
public boolean getIsActive() { |
76 | 87 |
return isActive; |
77 | 88 |
} |
modules/uoa-monitor-service/trunk/src/main/java/eu/dnetlib/uoamonitorservice/controllers/IndicatorController.java | ||
---|---|---|
146 | 146 |
|
147 | 147 |
// Check if there are changes in indicator path and update existing indicators if needed |
148 | 148 |
log.debug("update indicator path: "+i); |
149 |
if(!indicatorPath.getType().equals(indicatorPathBasedOnDefault.getType()) |
|
149 |
log.debug("indicatorPath.getType(): "+indicatorPath.getType()); |
|
150 |
log.debug("indicatorPathBasedOnDefault.getType(): "+indicatorPathBasedOnDefault.getType()); |
|
151 |
log.debug("oldIndicatorPath.getType(): "+oldIndicatorPath.getType()); |
|
152 |
|
|
153 |
if(indicatorPath.getType() != null |
|
154 |
&& !indicatorPath.getType().equals(indicatorPathBasedOnDefault.getType()) |
|
150 | 155 |
&& (oldIndicatorPath.getType().equals(indicatorPathBasedOnDefault.getType()))) { |
151 | 156 |
|
152 | 157 |
indicatorPathBasedOnDefault.setType(indicatorPath.getType()); |
... | ... | |
154 | 159 |
} |
155 | 160 |
log.debug("After type check: "+changed); |
156 | 161 |
|
157 |
if(!indicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource()) |
|
162 |
if(indicatorPath.getSource() != null |
|
163 |
&& !indicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource()) |
|
158 | 164 |
&& (oldIndicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource()))) { |
159 | 165 |
|
160 | 166 |
indicatorPathBasedOnDefault.setSource(indicatorPath.getSource()); |
... | ... | |
162 | 168 |
} |
163 | 169 |
log.debug("After source check: "+changed); |
164 | 170 |
|
165 |
if(!indicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl()) |
|
171 |
if(indicatorPath.getUrl() != null |
|
172 |
&& !indicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl()) |
|
166 | 173 |
&& (oldIndicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl()))) { |
167 | 174 |
|
168 | 175 |
indicatorPathBasedOnDefault.setUrl(indicatorPath.getUrl()); |
... | ... | |
170 | 177 |
} |
171 | 178 |
log.debug("After url check: "+changed); |
172 | 179 |
|
173 |
if(!indicatorPath.getChartObject().equals(indicatorPathBasedOnDefault.getChartObject()) |
|
180 |
if(indicatorPath.getChartObject() != null |
|
181 |
&& !indicatorPath.getChartObject().equals(indicatorPathBasedOnDefault.getChartObject()) |
|
174 | 182 |
&& (oldIndicatorPath.getChartObject().equals(indicatorPathBasedOnDefault.getChartObject()))) { |
175 | 183 |
|
176 | 184 |
indicatorPathBasedOnDefault.setChartObject(indicatorPath.getChartObject()); |
... | ... | |
243 | 251 |
} |
244 | 252 |
|
245 | 253 |
public void parameterMapping(IndicatorPath indicatorPath, Stakeholder stakeholder) throws UnsupportedEncodingException { |
246 |
if (indicatorPath.getParameters().containsKey("index_name")) { |
|
247 |
indicatorPath.getParameters().put("index_name", stakeholder.getIndex_name()); |
|
248 |
} else if (indicatorPath.getParameters().containsKey("index_shortName")) { |
|
249 |
indicatorPath.getParameters().put("index_shortName", stakeholder.getIndex_name().toLowerCase()); |
|
250 |
} else if (indicatorPath.getParameters().containsKey("index_id")) { |
|
251 |
indicatorPath.getParameters().put("index_id", stakeholder.getIndex_id()); |
|
254 |
if (indicatorPath.getParameters() != null) { |
|
255 |
if (indicatorPath.getParameters().containsKey("index_name")) { |
|
256 |
indicatorPath.getParameters().put("index_name", stakeholder.getIndex_name()); |
|
257 |
} else if (indicatorPath.getParameters().containsKey("index_shortName")) { |
|
258 |
indicatorPath.getParameters().put("index_shortName", stakeholder.getIndex_name().toLowerCase()); |
|
259 |
} else if (indicatorPath.getParameters().containsKey("index_id")) { |
|
260 |
indicatorPath.getParameters().put("index_id", stakeholder.getIndex_id()); |
|
261 |
} |
|
252 | 262 |
} |
253 | 263 |
|
254 |
|
|
255 |
String url = indicatorPath.getUrl(); |
|
256 |
String encoded_index_id = urlEncode(URLEncoder.encode(stakeholder.getIndex_id(), "UTF-8")); |
|
257 |
url = url.replace("index_id", encoded_index_id); |
|
258 |
String encoded_index_name = urlEncode(URLEncoder.encode(stakeholder.getIndex_name(), "UTF-8")); |
|
259 |
url = url.replace("index_name", encoded_index_name); |
|
260 |
String encoded_index_shortName = urlEncode(URLEncoder.encode(stakeholder.getIndex_shortName(), "UTF-8")); |
|
261 |
url = url.replace("index_shortName", encoded_index_shortName); |
|
262 |
indicatorPath.setUrl(url); |
|
264 |
// // url encoding for number indicators |
|
265 |
// String url = indicatorPath.getUrl();
|
|
266 |
// String encoded_index_id = urlEncode(URLEncoder.encode(stakeholder.getIndex_id(), "UTF-8"));
|
|
267 |
// url = url.replace("index_id", encoded_index_id);
|
|
268 |
// String encoded_index_name = urlEncode(URLEncoder.encode(stakeholder.getIndex_name(), "UTF-8"));
|
|
269 |
// url = url.replace("index_name", encoded_index_name);
|
|
270 |
// String encoded_index_shortName = urlEncode(URLEncoder.encode(stakeholder.getIndex_shortName(), "UTF-8"));
|
|
271 |
// url = url.replace("index_shortName", encoded_index_shortName);
|
|
272 |
// indicatorPath.setUrl(url);
|
|
263 | 273 |
} |
264 | 274 |
|
265 | 275 |
public String urlEncode(String encodedIndicatorPathField) { |
modules/uoa-monitor-service/trunk/src/main/java/eu/dnetlib/uoamonitorservice/controllers/TopicController.java | ||
---|---|---|
142 | 142 |
topicBasedOnDefault.setDescription(topic.getDescription()); |
143 | 143 |
changed = true; |
144 | 144 |
} |
145 |
if(topic.getIcon() != null && !topic.getIcon().equals(topicBasedOnDefault.getIcon()) |
|
146 |
&& (oldTopic.getIcon() == null || oldTopic.getIcon().equals(topicBasedOnDefault.getIcon()))) { |
|
145 | 147 |
|
148 |
topicBasedOnDefault.setIcon(topic.getIcon()); |
|
149 |
changed = true; |
|
150 |
} |
|
151 |
|
|
146 | 152 |
if(!changed) { |
147 | 153 |
// break; |
148 | 154 |
continue; |
Also available in: Unified diff
[Trunk | Monitor Service]:
1. trunk/src/test/java/eu/dnetlib/uoamonitorservice: New folders for tests.
2. ExceptionsHandler.java: Replace "log.debug" with "log.error".
3. Stakeholder.java: Field 'description' and getter/ setter methods added.
4. Topic.java: Field 'icon' and getter/ setter methods added | In method "copyFromDefault()", set "isActive" and "isPublic" fields of new Topic same as the values from default Topic.
5. TopicController.java: In method "onUpdateDefaultTopic()", add update for icon.
6. Category.java & SubCategory.java & Indicator.java:
In method "copyFromDefault()", set "isActive" and "isPublic" fields of new Category/ SubCategory/ Indicator same as the values from default Category/ SubCategory/ Indicator.
7. IndicatorController.java:
a. [Bug fix] Add some null checks when updating number indicators.
b. In method "parameterMapping()" comment replacement of "index_id", "index_name", "index_shortName" in indicatorPath.url (number indicators only).