1 | |
package org.kuali.student.lum.program.client; |
2 | |
|
3 | |
import java.util.ArrayList; |
4 | |
import java.util.HashMap; |
5 | |
import java.util.List; |
6 | |
import java.util.Map; |
7 | |
|
8 | |
import org.kuali.student.common.assembly.data.Data; |
9 | |
import org.kuali.student.common.assembly.data.Metadata; |
10 | |
import org.kuali.student.common.dto.DtoConstants; |
11 | |
import org.kuali.student.common.rice.StudentIdentityConstants; |
12 | |
import org.kuali.student.common.rice.authorization.PermissionType; |
13 | |
import org.kuali.student.common.ui.client.application.ViewContext; |
14 | |
import org.kuali.student.common.ui.client.configurable.mvc.layouts.MenuSectionController; |
15 | |
import org.kuali.student.common.ui.client.configurable.mvc.sections.Section; |
16 | |
import org.kuali.student.common.ui.client.configurable.mvc.views.SectionView; |
17 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
18 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
19 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
20 | |
import org.kuali.student.common.ui.client.mvc.ModelProvider; |
21 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
22 | |
import org.kuali.student.common.ui.client.mvc.View; |
23 | |
import org.kuali.student.common.ui.client.mvc.dto.ReferenceModel; |
24 | |
import org.kuali.student.common.ui.client.mvc.history.HistoryManager; |
25 | |
import org.kuali.student.common.ui.client.service.DataSaveResult; |
26 | |
import org.kuali.student.common.ui.client.util.ExportElement; |
27 | |
import org.kuali.student.common.ui.client.util.ExportUtils; |
28 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
29 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract; |
30 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations; |
31 | |
import org.kuali.student.common.ui.client.widgets.buttongroups.ButtonEnumerations.YesNoCancelEnum; |
32 | |
import org.kuali.student.common.ui.client.widgets.dialog.ButtonMessageDialog; |
33 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.ButtonGroup; |
34 | |
import org.kuali.student.common.ui.client.widgets.field.layout.button.YesNoCancelGroup; |
35 | |
import org.kuali.student.common.ui.shared.IdAttributes; |
36 | |
import org.kuali.student.common.ui.shared.IdAttributes.IdType; |
37 | |
import org.kuali.student.core.comments.ui.client.widgets.commenttool.CommentTool; |
38 | |
import org.kuali.student.lum.common.client.helpers.RecentlyViewedHelper; |
39 | |
import org.kuali.student.lum.common.client.widgets.AppLocations; |
40 | |
import org.kuali.student.lum.lu.LUConstants; |
41 | |
import org.kuali.student.lum.program.client.events.ModelLoadedEvent; |
42 | |
import org.kuali.student.lum.program.client.events.UpdateEvent; |
43 | |
import org.kuali.student.lum.program.client.properties.ProgramProperties; |
44 | |
import org.kuali.student.lum.program.client.rpc.AbstractCallback; |
45 | |
import org.kuali.student.lum.program.client.rpc.MajorDisciplineRpcService; |
46 | |
import org.kuali.student.lum.program.client.rpc.MajorDisciplineRpcServiceAsync; |
47 | |
import org.kuali.student.lum.program.client.widgets.ProgramSideBar; |
48 | |
|
49 | |
import com.google.gwt.core.client.GWT; |
50 | |
import com.google.gwt.event.dom.client.ClickEvent; |
51 | |
import com.google.gwt.event.dom.client.ClickHandler; |
52 | |
import com.google.gwt.event.logical.shared.CloseEvent; |
53 | |
import com.google.gwt.event.logical.shared.CloseHandler; |
54 | |
import com.google.gwt.event.shared.HandlerManager; |
55 | |
import com.google.gwt.user.client.ui.Label; |
56 | |
import com.google.gwt.user.client.ui.Widget; |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | 0 | public abstract class ProgramController extends MenuSectionController { |
62 | |
|
63 | |
protected MajorDisciplineRpcServiceAsync programRemoteService; |
64 | |
|
65 | 0 | protected boolean initialized = false; |
66 | |
|
67 | |
protected DataModel programModel; |
68 | |
|
69 | |
protected AbstractProgramConfigurer configurer; |
70 | |
|
71 | |
protected HandlerManager eventBus; |
72 | |
|
73 | 0 | protected Label statusLabel = new Label(); |
74 | |
|
75 | |
protected ProgramSideBar sideBar; |
76 | |
|
77 | 0 | private boolean needToLoadOldModel = false; |
78 | |
|
79 | |
protected ProgramStatus lastLoadedStatus; |
80 | |
|
81 | 0 | protected boolean reloadMetadata = false; |
82 | |
|
83 | 0 | protected boolean processBeforeShow = true; |
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
public ProgramController(String name, DataModel programModel, ViewContext viewContext, HandlerManager eventBus) { |
91 | 0 | super(); |
92 | 0 | programRemoteService = createProgramRemoteService(); |
93 | 0 | this.eventBus = eventBus; |
94 | 0 | this.programModel = programModel; |
95 | 0 | setViewContext(viewContext); |
96 | 0 | initializeModel(); |
97 | 0 | } |
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
protected MajorDisciplineRpcServiceAsync createProgramRemoteService() { |
104 | 0 | return GWT.create(MajorDisciplineRpcService.class); |
105 | |
} |
106 | |
|
107 | |
@Override |
108 | |
public void beforeViewChange(Enum<?> viewChangingTo, final Callback<Boolean> okToChange) { |
109 | 0 | if (processBeforeShow) { |
110 | 0 | super.beforeViewChange(viewChangingTo, new Callback<Boolean>() { |
111 | |
|
112 | |
@Override |
113 | |
public void exec(Boolean result) { |
114 | 0 | if (result) { |
115 | 0 | if (getCurrentView() instanceof SectionView && ((SectionView) getCurrentView()).isDirty()) { |
116 | 0 | ButtonGroup<ButtonEnumerations.YesNoCancelEnum> buttonGroup = new YesNoCancelGroup(); |
117 | 0 | final ButtonMessageDialog<ButtonEnumerations.YesNoCancelEnum> dialog = new ButtonMessageDialog<ButtonEnumerations.YesNoCancelEnum>("Warning", "You may have unsaved changes. Save changes?", buttonGroup); |
118 | 0 | buttonGroup.addCallback(new Callback<ButtonEnumerations.YesNoCancelEnum>() { |
119 | |
|
120 | |
@Override |
121 | |
public void exec(ButtonEnumerations.YesNoCancelEnum result) { |
122 | 0 | switch (result) { |
123 | |
case YES: |
124 | 0 | dialog.hide(); |
125 | 0 | fireUpdateEvent(okToChange); |
126 | 0 | break; |
127 | |
case NO: |
128 | 0 | dialog.hide(); |
129 | 0 | resetModel(); |
130 | 0 | needToLoadOldModel = true; |
131 | 0 | resetFieldInteractionFlag(); |
132 | 0 | okToChange.exec(true); |
133 | 0 | break; |
134 | |
case CANCEL: |
135 | 0 | okToChange.exec(false); |
136 | 0 | dialog.hide(); |
137 | |
|
138 | 0 | HistoryManager.logHistoryChange(); |
139 | |
break; |
140 | |
} |
141 | 0 | } |
142 | |
}); |
143 | 0 | dialog.addCloseLinkClickHandler(new ClickHandler() { |
144 | |
|
145 | |
@Override |
146 | |
public void onClick(ClickEvent event) { |
147 | 0 | okToChange.exec(false); |
148 | 0 | dialog.hide(); |
149 | |
|
150 | 0 | HistoryManager.logHistoryChange(); |
151 | 0 | } |
152 | |
}); |
153 | 0 | dialog.show(); |
154 | 0 | } else { |
155 | 0 | okToChange.exec(true); |
156 | |
} |
157 | |
} else { |
158 | 0 | okToChange.exec(false); |
159 | |
} |
160 | 0 | } |
161 | |
}); |
162 | |
} else { |
163 | 0 | processBeforeShow = true; |
164 | |
} |
165 | 0 | } |
166 | |
|
167 | |
protected void fireUpdateEvent(final Callback<Boolean> okToChange) { |
168 | 0 | eventBus.fireEvent(new UpdateEvent(okToChange)); |
169 | 0 | } |
170 | |
|
171 | |
protected void resetModel() { |
172 | 0 | programModel.resetRoot(); |
173 | 0 | } |
174 | |
|
175 | |
protected void resetFieldInteractionFlag() { |
176 | 0 | View currentView = getCurrentView(); |
177 | 0 | if (currentView instanceof Section) { |
178 | 0 | ((Section) currentView).resetFieldInteractionFlags(); |
179 | |
} |
180 | 0 | } |
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
private void initializeModel() { |
186 | 0 | setDefaultModelId(ProgramConstants.PROGRAM_MODEL_ID); |
187 | 0 | registerModel(ProgramConstants.PROGRAM_MODEL_ID, new ModelProvider<DataModel>() { |
188 | |
@Override |
189 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
190 | 0 | if (programModel.getRoot() == null || programModel.getRoot().size() == 0) { |
191 | 0 | loadModel(callback); |
192 | |
} else { |
193 | 0 | callback.onModelReady(programModel); |
194 | |
} |
195 | 0 | } |
196 | |
}); |
197 | 0 | } |
198 | |
|
199 | |
|
200 | |
@Override |
201 | |
public void requestModel(Class modelType, ModelRequestCallback callback) { |
202 | 0 | if (modelType == ReferenceModel.class) { |
203 | 0 | ReferenceModel referenceModel = new ReferenceModel(); |
204 | 0 | referenceModel.setReferenceId(ProgramUtils.getProgramId(programModel)); |
205 | 0 | referenceModel.setReferenceTypeKey(ProgramConstants.MAJOR_REFERENCE_TYPE_ID); |
206 | 0 | referenceModel.setReferenceType(ProgramConstants.MAJOR_LU_TYPE_ID); |
207 | 0 | Map<String, String> attributes = new HashMap<String, String>(); |
208 | 0 | attributes.put("name", getStringProperty("name")); |
209 | 0 | referenceModel.setReferenceAttributes(attributes); |
210 | 0 | callback.onModelReady(referenceModel); |
211 | 0 | } else { |
212 | 0 | super.requestModel(modelType, callback); |
213 | |
} |
214 | 0 | } |
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
protected void loadModel(final ModelRequestCallback<DataModel> callback) { |
223 | 0 | programRemoteService.getData(getViewContext().getId(), new AbstractCallback<Data>(ProgramProperties.get().common_retrievingData()) { |
224 | |
|
225 | |
@Override |
226 | |
public void onFailure(Throwable caught) { |
227 | 0 | super.onFailure(caught); |
228 | 0 | callback.onRequestFail(caught); |
229 | 0 | } |
230 | |
|
231 | |
@Override |
232 | |
public void onSuccess(Data result) { |
233 | 0 | super.onSuccess(result); |
234 | 0 | programModel.setRoot(result); |
235 | 0 | setHeaderTitle(); |
236 | 0 | callback.onModelReady(programModel); |
237 | 0 | } |
238 | |
}); |
239 | 0 | } |
240 | |
|
241 | |
private void setModelData() { |
242 | 0 | setHeaderTitle(); |
243 | 0 | setStatus(); |
244 | 0 | configurer.applyPermissions(); |
245 | |
|
246 | 0 | if (needToLoadOldModel) { |
247 | 0 | needToLoadOldModel = false; |
248 | |
} else { |
249 | 0 | String id = ProgramUtils.getProgramId(programModel); |
250 | 0 | if (null != id) { |
251 | |
|
252 | 0 | ViewContext docContext = new ViewContext(); |
253 | 0 | docContext.setId(id); |
254 | 0 | docContext.setIdType(IdType.OBJECT_ID); |
255 | 0 | String pgmType = getStringProperty(ProgramConstants.TYPE); |
256 | 0 | docContext.setAttribute(ProgramConstants.TYPE, pgmType + '/' + ProgramSections.PROGRAM_DETAILS_VIEW); |
257 | 0 | RecentlyViewedHelper.addDocument(getProgramName(), |
258 | |
HistoryManager.appendContext(getProgramViewLocation(pgmType), docContext)); |
259 | |
} |
260 | 0 | eventBus.fireEvent(new ModelLoadedEvent(programModel)); |
261 | 0 | onModelLoadedEvent(); |
262 | |
} |
263 | 0 | } |
264 | |
|
265 | |
private String getProgramViewLocation(String pgmType) { |
266 | 0 | if (ProgramClientConstants.MAJOR_PROGRAM.equals(pgmType)) { |
267 | 0 | return AppLocations.Locations.VIEW_PROGRAM.getLocation(); |
268 | 0 | } else if (ProgramClientConstants.CORE_PROGRAM.equals(pgmType)) { |
269 | 0 | return AppLocations.Locations.VIEW_CORE_PROGRAM.getLocation(); |
270 | 0 | } else if (ProgramClientConstants.CREDENTIAL_PROGRAM_TYPES.contains(pgmType)) { |
271 | 0 | return AppLocations.Locations.VIEW_BACC_PROGRAM.getLocation(); |
272 | |
} |
273 | 0 | return null; |
274 | |
} |
275 | |
|
276 | |
protected void setStatus() { |
277 | 0 | statusLabel.setText(ProgramProperties.get().common_status(getStringProperty(ProgramConstants.STATE))); |
278 | 0 | } |
279 | |
|
280 | |
public String getProgramName() { |
281 | 0 | String name = getStringProperty(ProgramConstants.LONG_TITLE); |
282 | 0 | if (name == null) { |
283 | 0 | name = ProgramProperties.get().common_newProgram(); |
284 | |
} |
285 | 0 | return name; |
286 | |
} |
287 | |
|
288 | |
|
289 | |
|
290 | |
|
291 | |
|
292 | |
|
293 | |
@Override |
294 | |
public void beforeShow(final Callback<Boolean> onReadyCallback) { |
295 | 0 | if (programModel.getRoot() == null) { |
296 | 0 | loadModel(new ModelRequestCallback<DataModel>() { |
297 | |
@Override |
298 | |
public void onModelReady(DataModel model) { |
299 | 0 | if (loadMetadataCondition()) { |
300 | 0 | loadMetadata(onReadyCallback); |
301 | |
} else { |
302 | |
|
303 | 0 | onReadyCallback.exec(true); |
304 | |
} |
305 | 0 | } |
306 | |
|
307 | |
@Override |
308 | |
public void onRequestFail(Throwable cause) { |
309 | 0 | GWT.log(cause.getMessage()); |
310 | 0 | } |
311 | |
}); |
312 | |
} else { |
313 | 0 | afterMetadataLoaded(onReadyCallback); |
314 | |
} |
315 | 0 | } |
316 | |
|
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
protected boolean loadMetadataCondition() { |
323 | 0 | return lastLoadedStatus == null || ProgramStatus.of(programModel) != lastLoadedStatus; |
324 | |
} |
325 | |
|
326 | |
|
327 | |
|
328 | |
|
329 | |
|
330 | |
|
331 | |
protected void loadMetadata(final Callback<Boolean> onReadyCallback) { |
332 | 0 | Map<String, String> idAttributes = new HashMap<String, String>(); |
333 | 0 | ViewContext viewContext = getViewContext(); |
334 | 0 | IdType idType = viewContext.getIdType(); |
335 | 0 | String viewContextId = null; |
336 | 0 | if (idType != null) { |
337 | 0 | idAttributes.put(IdAttributes.ID_TYPE, idType.toString()); |
338 | 0 | viewContextId = viewContext.getId(); |
339 | 0 | if (idType == IdType.COPY_OF_OBJECT_ID) { |
340 | 0 | viewContextId = null; |
341 | |
} |
342 | |
} |
343 | 0 | if (programModel.getRoot() != null) { |
344 | 0 | ProgramStatus programStatus = ProgramStatus.of(programModel); |
345 | 0 | idAttributes.put(DtoConstants.DTO_STATE, programStatus.getValue()); |
346 | 0 | if (programStatus.getNextStatus() != null) { |
347 | 0 | idAttributes.put(DtoConstants.DTO_NEXT_STATE, programStatus.getNextStatus().getValue()); |
348 | |
} |
349 | |
} |
350 | 0 | String currentDocType = programModel.get(configurer.getProposalPath()+"/type"); |
351 | 0 | idAttributes.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME, currentDocType); |
352 | 0 | if (LUConstants.PROPOSAL_TYPE_MAJOR_DISCIPLINE_MODIFY.equalsIgnoreCase(currentDocType)){ |
353 | 0 | String workflowNode = programModel.get(configurer.getProposalPath()+"/workflowNode"); |
354 | 0 | idAttributes.put(DtoConstants.DTO_WORKFLOW_NODE, workflowNode); |
355 | |
} |
356 | 0 | programRemoteService.getMetadata(viewContextId, idAttributes, new AbstractCallback<Metadata>() { |
357 | |
|
358 | |
@Override |
359 | |
public void onSuccess(Metadata result) { |
360 | 0 | super.onSuccess(result); |
361 | 0 | DataModelDefinition def = new DataModelDefinition(result); |
362 | 0 | programModel.setDefinition(def); |
363 | 0 | lastLoadedStatus = ProgramStatus.of(programModel); |
364 | 0 | afterMetadataLoaded(onReadyCallback); |
365 | 0 | } |
366 | |
|
367 | |
@Override |
368 | |
public void onFailure(Throwable caught) { |
369 | 0 | super.onFailure(caught); |
370 | 0 | onReadyCallback.exec(false); |
371 | 0 | } |
372 | |
}); |
373 | 0 | } |
374 | |
|
375 | |
protected void configureView() { |
376 | 0 | addStyleName("programController"); |
377 | 0 | configurer.setModelDefinition(programModel.getDefinition()); |
378 | 0 | configurer.configure(this); |
379 | 0 | addContentWidget(statusLabel); |
380 | 0 | setSideBarWidget(sideBar); |
381 | 0 | } |
382 | |
|
383 | |
@Override |
384 | |
public void setViewContext(ViewContext viewContext) { |
385 | 0 | super.setViewContext(viewContext); |
386 | 0 | if (viewContext.getId() != null && !viewContext.getId().isEmpty()) { |
387 | 0 | viewContext.setPermissionType(PermissionType.OPEN); |
388 | |
} else { |
389 | 0 | viewContext.setPermissionType(PermissionType.INITIATE); |
390 | |
} |
391 | 0 | } |
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
protected void afterMetadataLoaded(Callback<Boolean> onReadyCallback) { |
399 | 0 | if (!reloadMetadata) { |
400 | 0 | configureView(); |
401 | 0 | onReadyCallback.exec(true); |
402 | 0 | reloadMetadata = true; |
403 | |
} else { |
404 | 0 | onReadyCallback.exec(true); |
405 | 0 | ProgramUtils.syncMetadata(configurer, programModel.getDefinition()); |
406 | |
} |
407 | 0 | if (programModel.getRoot() != null) { |
408 | 0 | setModelData(); |
409 | |
} |
410 | 0 | } |
411 | |
|
412 | |
protected void setHeaderTitle() { |
413 | 0 | String title = getProgramName(); |
414 | 0 | this.setContentTitle(title); |
415 | 0 | this.setName(title); |
416 | 0 | } |
417 | |
|
418 | |
protected Widget createCommentPanel() { |
419 | 0 | final CommentTool commentTool = new CommentTool(ProgramSections.COMMENTS, "Comments", "kuali.comment.type.generalRemarks", "Program Comments"); |
420 | 0 | commentTool.setController(this); |
421 | 0 | KSButton commentsButton = new KSButton(ProgramProperties.get().comments_button(), KSButtonAbstract.ButtonStyle.DEFAULT_ANCHOR, new ClickHandler() { |
422 | |
|
423 | |
@Override |
424 | |
public void onClick(ClickEvent event) { |
425 | 0 | commentTool.show(); |
426 | 0 | } |
427 | |
}); |
428 | 0 | return commentsButton; |
429 | |
} |
430 | |
|
431 | |
protected void doSave() { |
432 | 0 | } |
433 | |
|
434 | |
|
435 | |
|
436 | |
|
437 | |
|
438 | |
|
439 | |
|
440 | |
|
441 | |
|
442 | |
|
443 | |
|
444 | |
|
445 | |
|
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
|
454 | |
|
455 | |
|
456 | |
|
457 | |
|
458 | |
protected void updateState(String state, final Callback<Boolean> okCallback) { |
459 | |
|
460 | 0 | programRemoteService.updateState(programModel.getRoot(), state, new AbstractCallback<DataSaveResult>(ProgramProperties.get().common_savingData()) { |
461 | |
@Override |
462 | |
public void onSuccess(DataSaveResult result) { |
463 | 0 | if(result.getValidationResults()==null || result.getValidationResults().isEmpty()){ |
464 | 0 | super.onSuccess(result); |
465 | 0 | okCallback.exec(true); |
466 | 0 | refreshModelAndView(result); |
467 | |
}else{ |
468 | |
|
469 | 0 | super.onSuccess(result); |
470 | |
|
471 | 0 | isValid(result.getValidationResults(), false, true); |
472 | 0 | ProgramUtils.handleValidationErrorsForSpecializations(result.getValidationResults(), programModel); |
473 | |
|
474 | 0 | okCallback.exec(false); |
475 | |
} |
476 | 0 | } |
477 | |
|
478 | |
}); |
479 | |
|
480 | 0 | } |
481 | |
|
482 | |
|
483 | |
|
484 | |
|
485 | |
|
486 | |
public void refreshModelAndView(DataSaveResult result){ |
487 | 0 | if (result != null) { |
488 | 0 | programModel.setRoot(result.getValue()); |
489 | |
} |
490 | 0 | setHeaderTitle(); |
491 | 0 | setStatus(); |
492 | 0 | } |
493 | |
|
494 | |
public DataModel getProgramModel() { |
495 | 0 | return programModel; |
496 | |
} |
497 | |
|
498 | |
public void onModelLoadedEvent() { |
499 | 0 | } |
500 | |
|
501 | |
protected String getStringProperty(String key) { |
502 | 0 | return programModel.get(key); |
503 | |
} |
504 | |
|
505 | |
protected Data getDataProperty(String key) { |
506 | 0 | return programModel.get(key); |
507 | |
} |
508 | |
|
509 | |
public boolean isExportButtonActive() { |
510 | 0 | if (this.getCurrentViewEnum() != null) { |
511 | 0 | if (this.getCurrentViewEnum().equals(ProgramSections.SUMMARY) |
512 | |
|| this.getCurrentViewEnum().equals(ProgramSections.VIEW_ALL)) { |
513 | 0 | return true; |
514 | |
} else { |
515 | 0 | return false; |
516 | |
} |
517 | |
|
518 | |
} else { |
519 | 0 | return false; |
520 | |
} |
521 | |
} |
522 | |
|
523 | |
@Override |
524 | |
public ArrayList<ExportElement> getExportElementsFromView() { |
525 | |
|
526 | 0 | String viewName = null; |
527 | 0 | String sectionTitle = null; |
528 | 0 | View currentView = this.getCurrentView(); |
529 | 0 | if (currentView != null) { |
530 | |
|
531 | 0 | ArrayList<ExportElement> exportElements = new ArrayList<ExportElement>(); |
532 | 0 | if (currentView != null && currentView instanceof Section) { |
533 | 0 | Section currentSection = (Section) currentView; |
534 | 0 | List<Section> nestedSections = currentSection.getSections(); |
535 | 0 | for (int i = 0; i < nestedSections.size(); i++) { |
536 | 0 | ExportElement sectionExportItem = new ExportElement(); |
537 | 0 | ArrayList<ExportElement> subList = null; |
538 | 0 | Section nestedSection = nestedSections.get(i); |
539 | 0 | if (nestedSection != null && nestedSection instanceof SectionView) { |
540 | 0 | SectionView nestedSectionView = (SectionView) nestedSection; |
541 | 0 | viewName = nestedSectionView.getName(); |
542 | 0 | sectionTitle = nestedSectionView.getTitle(); |
543 | 0 | sectionExportItem.setSectionName(sectionTitle + " " + i + " - " + viewName); |
544 | 0 | sectionExportItem.setViewName(sectionTitle + " " + i + " - " + viewName); |
545 | 0 | subList = ExportUtils.getExportElementsFromView(nestedSectionView, subList, viewName, sectionTitle); |
546 | 0 | if (subList != null && subList.size()> 0) { |
547 | 0 | sectionExportItem.setSubset(subList); |
548 | 0 | exportElements.add(sectionExportItem); |
549 | |
} |
550 | |
} |
551 | |
} |
552 | |
} |
553 | 0 | return exportElements; |
554 | |
|
555 | |
} else { |
556 | |
|
557 | |
} |
558 | 0 | return null; |
559 | |
|
560 | |
} |
561 | |
|
562 | |
} |