Project

General

Profile

« Previous | Next » 

Revision 60175

[Trunk | Monitor Service]:
1. StakeholderController.java:
a. Method "getMyRealStakeholders()" (/my-stakeholder) returns basic Stakeholder info (Topics are not full object anymore).
b. Method "saveStakeholder()" (/save) gets basic or full object for Stakeholder and returns whatever format it received.
2. IndicatorController.java: [Bug fix] In method "onUpdateDefaultIndicator()" improve checks (there were missing cases, e.g. chartObject of previous-saved indicatorPath was null).

View differences:

IndicatorController.java
135 135
        for(Indicator indicatorBasedOnDefault : indicators) {
136 136
            changed = false;
137 137

  
138
            if(indicator.getName() != null && !indicator.getName().equals(indicatorBasedOnDefault.getName())
139
                    && (oldIndicator.getName() == null || oldIndicator.getName().equals(indicatorBasedOnDefault.getName()))) {
140

  
138
//            if(indicator.getName() != null && !indicator.getName().equals(indicatorBasedOnDefault.getName())
139
//                    && (oldIndicator.getName() == null || oldIndicator.getName().equals(indicatorBasedOnDefault.getName()))) {
140
            if((
141
                    (indicator.getName() == null && oldIndicator.getName() != null)
142
                            ||
143
                            (indicator.getName() != null && !indicator.getName().equals(indicatorBasedOnDefault.getName()))
144
            ) && (
145
                    (oldIndicator.getName() == null && indicatorBasedOnDefault.getName() == null)
146
                            ||
147
                            (oldIndicator.getName() != null && oldIndicator.getName().equals(indicatorBasedOnDefault.getName()))
148
            )) {
141 149
                indicatorBasedOnDefault.setName(indicator.getName());
142 150
                changed = true;
143 151
            }
144 152

  
145
            if(indicator.getDescription() != null && !indicator.getDescription().equals(indicatorBasedOnDefault.getDescription())) {
153
            if(indicator.getDescription() != null && !indicator.getDescription().equals(indicatorBasedOnDefault.getDescription())
154
                || indicator.getDescription() == null && indicatorBasedOnDefault.getDescription() != null) {
146 155

  
147 156
                indicatorBasedOnDefault.setDescription(indicator.getDescription());
148 157
                changed = true;
149 158
            }
150 159

  
151
            if(indicator.getAdditionalDescription() != null && !indicator.getAdditionalDescription().equals(indicatorBasedOnDefault.getAdditionalDescription())
152
                    && (oldIndicator.getAdditionalDescription() == null || oldIndicator.getAdditionalDescription().equals(indicatorBasedOnDefault.getAdditionalDescription()))) {
153

  
160
//            if(indicator.getAdditionalDescription() != null && !indicator.getAdditionalDescription().equals(indicatorBasedOnDefault.getAdditionalDescription())
161
//                    && (oldIndicator.getAdditionalDescription() == null || oldIndicator.getAdditionalDescription().equals(indicatorBasedOnDefault.getAdditionalDescription()))) {
162
            if((
163
                    (indicator.getAdditionalDescription() == null && oldIndicator.getAdditionalDescription() != null)
164
                            ||
165
                            (indicator.getAdditionalDescription() != null && !indicator.getAdditionalDescription().equals(indicatorBasedOnDefault.getAdditionalDescription()))
166
            ) && (
167
                    (oldIndicator.getAdditionalDescription() == null && indicatorBasedOnDefault.getAdditionalDescription() == null)
168
                            ||
169
                            (oldIndicator.getAdditionalDescription() != null && oldIndicator.getAdditionalDescription().equals(indicatorBasedOnDefault.getAdditionalDescription()))
170
            )) {
154 171
                indicatorBasedOnDefault.setAdditionalDescription(indicator.getAdditionalDescription());
155 172
                changed = true;
156 173
            }
......
179 196
                    // Check if there are changes in indicator path and update existing indicators if needed
180 197
                    log.debug("update indicator path: "+i + " (indicator id: "+indicatorBasedOnDefault.getId()+")");
181 198

  
182
                    if(indicatorPath.getType() != null
183
                            && !indicatorPath.getType().equals(indicatorPathBasedOnDefault.getType())
184
                            && (oldIndicatorPath.getType().equals(indicatorPathBasedOnDefault.getType()))) {
185

  
199
//                    if(indicatorPath.getType() != null
200
//                            && !indicatorPath.getType().equals(indicatorPathBasedOnDefault.getType())
201
//                            && (oldIndicatorPath.getType().equals(indicatorPathBasedOnDefault.getType()))) {
202
                    if((
203
                            (indicatorPath.getType() == null && oldIndicatorPath.getType() != null)
204
                                    ||
205
                                    (indicatorPath.getType() != null && !indicatorPath.getType().equals(indicatorPathBasedOnDefault.getType()))
206
                    ) && (
207
                            (oldIndicatorPath.getType() == null && indicatorPathBasedOnDefault.getType() == null)
208
                                    ||
209
                                    (oldIndicatorPath.getType() != null && oldIndicatorPath.getType().equals(indicatorPathBasedOnDefault.getType()))
210
                    )) {
186 211
                        indicatorPathBasedOnDefault.setType(indicatorPath.getType());
187 212
                        changed = true; // parameter "type" needs to be changed as well
188 213
                    }
189 214
                    log.debug("After type check: "+changed);
190 215

  
191
                    if(indicatorPath.getSource() != null
192
                            && !indicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource())
193
                            && (oldIndicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource()))) {
194

  
216
//                    if(indicatorPath.getSource() != null
217
//                            && !indicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource())
218
//                            && (oldIndicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource()))) {
219
                    if((
220
                            (indicatorPath.getSource() == null && oldIndicatorPath.getSource() != null)
221
                                    ||
222
                                    (indicatorPath.getSource() != null && !indicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource()))
223
                    ) && (
224
                            (oldIndicatorPath.getSource() == null && indicatorPathBasedOnDefault.getSource() == null)
225
                                    ||
226
                                    (oldIndicatorPath.getSource() != null && oldIndicatorPath.getSource().equals(indicatorPathBasedOnDefault.getSource()))
227
                    )) {
195 228
                        indicatorPathBasedOnDefault.setSource(indicatorPath.getSource());
196 229
                        changed = true;
197 230
                    }
198 231
                    log.debug("After source check: "+changed);
199 232

  
200
                    if(indicatorPath.getUrl() != null
201
                            && !indicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl())
202
                            && (oldIndicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl()))) {
203

  
233
//                    if(indicatorPath.getUrl() != null
234
//                            && !indicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl())
235
//                            && (oldIndicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl()))) {
236
                    if((
237
                            (indicatorPath.getUrl() == null && oldIndicatorPath.getUrl() != null)
238
                                    ||
239
                                    (indicatorPath.getUrl() != null && !indicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl()))
240
                    ) && (
241
                            (oldIndicatorPath.getUrl() == null && indicatorPathBasedOnDefault.getUrl() == null)
242
                                    ||
243
                                    (oldIndicatorPath.getUrl() != null && oldIndicatorPath.getUrl().equals(indicatorPathBasedOnDefault.getUrl()))
244
                    )) {
204 245
                        indicatorPathBasedOnDefault.setUrl(indicatorPath.getUrl());
205 246
                        changed = true;
206 247
                    }
207 248
                    log.debug("After url check: "+changed);
208 249

  
209
                    if(indicatorPath.getChartObject() != null
210
                            && !indicatorPath.getChartObject().equals(indicatorPathBasedOnDefault.getChartObject())
211
                            && (oldIndicatorPath.getChartObject().equals(indicatorPathBasedOnDefault.getChartObject()))) {
250
                    if((
251
                            (indicatorPath.getChartObject() == null && oldIndicatorPath.getChartObject() != null)
252
                            ||
253
                            (indicatorPath.getChartObject() != null && !indicatorPath.getChartObject().equals(indicatorPathBasedOnDefault.getChartObject()))
254
                        ) && (
255
                            (oldIndicatorPath.getChartObject() == null && indicatorPathBasedOnDefault.getChartObject() == null)
256
                            ||
257
                            (oldIndicatorPath.getChartObject() != null && oldIndicatorPath.getChartObject().equals(indicatorPathBasedOnDefault.getChartObject()))
258
                    )) {
212 259

  
213 260
                        indicatorPathBasedOnDefault.setChartObject(indicatorPath.getChartObject());
214 261
                        changed = true;

Also available in: Unified diff