Coverage Report - org.kuali.student.common.ui.client.util.ExportUtils
 
Classes in this File Line Coverage Branch Coverage Complexity
ExportUtils
0%
0/215
0%
0/182
8.231
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may
 3  
  * not use this file except in compliance with the License. You may obtain a copy of the License at
 4  
  * http://www.osedu.org/licenses/ECL-2.0 Unless required by applicable law or agreed to in writing, software distributed
 5  
  * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 6  
  * implied. See the License for the specific language governing permissions and limitations under the License.
 7  
  */
 8  
 
 9  
 package org.kuali.student.common.ui.client.util;
 10  
 
 11  
 import java.util.ArrayList;
 12  
 import java.util.List;
 13  
 
 14  
 import org.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor;
 15  
 import org.kuali.student.common.ui.client.configurable.mvc.SectionTitle;
 16  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.BaseSection;
 17  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.Section;
 18  
 import org.kuali.student.common.ui.client.configurable.mvc.sections.WarnContainer;
 19  
 import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
 20  
 import org.kuali.student.common.ui.client.mvc.Controller;
 21  
 import org.kuali.student.common.ui.client.reporting.ReportExportWidget;
 22  
 import org.kuali.student.common.ui.client.widgets.KSButton;
 23  
 import org.kuali.student.common.ui.client.widgets.KSItemLabel;
 24  
 import org.kuali.student.common.ui.client.widgets.ULPanel;
 25  
 import org.kuali.student.common.ui.client.widgets.field.layout.element.FieldElement;
 26  
 import org.kuali.student.common.ui.client.widgets.list.KSLabelList;
 27  
 import org.kuali.student.common.ui.client.widgets.list.KSSelectedList;
 28  
 import org.kuali.student.common.ui.client.widgets.menus.KSListPanel;
 29  
 import org.kuali.student.common.ui.client.widgets.search.KSPicker;
 30  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTable;
 31  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableBlock;
 32  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableModel;
 33  
 import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableRow;
 34  
 
 35  
 import com.google.gwt.user.client.ui.ComplexPanel;
 36  
 import com.google.gwt.user.client.ui.FlowPanel;
 37  
 import com.google.gwt.user.client.ui.HasHTML;
 38  
 import com.google.gwt.user.client.ui.HasText;
 39  
 import com.google.gwt.user.client.ui.ListBox;
 40  
 import com.google.gwt.user.client.ui.Widget;
 41  
 import com.google.gwt.user.client.ui.WidgetCollection;
 42  
 
 43  
 /**
 44  
  * 
 45  
  * This is a description of what this class does - pctsw don't forget to fill this in. 
 46  
  * 
 47  
  * @author Kuali Rice Team (kuali-rice@googlegroups.com)
 48  
  *
 49  
  */
 50  0
 public class ExportUtils {
 51  
     public static final String PDF = "PDF";
 52  
     public static final String DOC = "DOC";
 53  
     public static final String XLS = "XLS";
 54  
 
 55  
     /**
 56  
      * 
 57  
      * Inspect the given widget for the value and add it to the export element object.
 58  
      * 
 59  
      * @param exportItem
 60  
      * @param fieldWidget
 61  
      * @param setFirstFieldValue
 62  
      * @param viewName
 63  
      * @param sectionName
 64  
      * @return
 65  
      */
 66  
     public static ExportElement getExportItemDetails(ExportElement exportItem, Widget fieldWidget, boolean setFirstFieldValue, String viewName, String sectionName) {
 67  
         
 68  
         // Do not display the widget data if it is not visible on the screen.
 69  0
         if (!fieldWidget.getParent().getElement().getStyle().getDisplay().equals("none")){
 70  
             
 71  0
             if (fieldWidget instanceof HasHTML) {
 72  
                 // HasHTML...
 73  0
                 HasHTML itemHasHTML = (HasHTML) fieldWidget;
 74  0
                 setFieldValue(exportItem, setFirstFieldValue, itemHasHTML.getHTML());
 75  
                 
 76  0
             } else if (fieldWidget instanceof HasText) {
 77  
                 // Hastext...
 78  0
                 HasText itemHasTextValue = (HasText) fieldWidget;
 79  0
                 setFieldValue(exportItem, setFirstFieldValue, itemHasTextValue.getText());
 80  
 
 81  0
             } else if (fieldWidget instanceof KSSelectedList) {
 82  0
                 KSSelectedList selectedList = (KSSelectedList) fieldWidget;
 83  0
                 List<KSItemLabel> selectedItems = selectedList.getSelectedItems();
 84  0
                 String values = new String();
 85  0
                 for (int j = 0; j < selectedItems.size(); j++) {
 86  0
                     values = selectedItems.get(j).getDisplayText();
 87  
                 }
 88  0
                 setFieldValue(exportItem, setFirstFieldValue, values);
 89  
                 
 90  0
             } else if (fieldWidget instanceof KSPicker) {
 91  0
                 KSPicker picker = (KSPicker) fieldWidget;
 92  0
                 if (picker.getInputWidget() instanceof HasText) {
 93  0
                     HasText item = (HasText) picker.getInputWidget();
 94  0
                     setFieldValue(exportItem, setFirstFieldValue, item.getText());
 95  0
                 } else if (picker.getInputWidget() instanceof KSLabelList) {
 96  0
                     String fieldValue = null;
 97  0
                     KSLabelList widget = (KSLabelList) picker.getInputWidget();
 98  0
                     List<String> selected = widget.getSelectedItemsForExport();
 99  0
                     for (int j = 0; j < selected.size(); j++) {
 100  0
                         if (fieldValue == null) {
 101  0
                             fieldValue = new String(selected.get(j));
 102  
                         } else {
 103  0
                             fieldValue = fieldValue + ", " + selected.get(j);
 104  
                         }
 105  
                     }
 106  0
                     setFieldValue(exportItem, setFirstFieldValue, fieldValue);
 107  
                 }
 108  
                 
 109  0
             } else if (fieldWidget instanceof ListBox) {
 110  
                 // Get the selected element from a list box.
 111  0
                 ListBox listBox = (ListBox) fieldWidget;
 112  0
                 setFieldValue(exportItem, setFirstFieldValue, listBox.getItemText(listBox.getSelectedIndex()));
 113  
             
 114  0
             } else if (fieldWidget instanceof SectionTitle) {
 115  
                 try {
 116  
                     // Retrieve the title from sections.
 117  0
                     SectionTitle sectionTitle = (SectionTitle) fieldWidget;
 118  0
                     setFieldValue(exportItem, setFirstFieldValue, sectionTitle.getExportFieldValue());
 119  
                     // If the value does not already contain the bold html tags, set the print type to bold.
 120  0
                     if (!exportItem.getValue().contains("<b>")){
 121  0
                         exportItem.setPrintType(ExportElement.BOLD);
 122  
                     }
 123  0
                 } catch (Exception e) {
 124  
                     // ignore, section tile interface problem - only in debugging.");
 125  0
                 }
 126  
                 
 127  0
             } else if (fieldWidget instanceof SummaryTable) {
 128  
                 // Call custom details for widget method for summary tables.
 129  0
                 if (fieldWidget.isVisible()){
 130  0
                     exportItem.setSubset(ExportUtils.getDetailsForWidget((SummaryTable)fieldWidget));
 131  
                 }
 132  
         
 133  0
             } else if (fieldWidget instanceof ReportExportWidget) {
 134  
                 // Retrieve custom implementation data of report export widget.
 135  0
                     if (fieldWidget.isVisible()){
 136  0
                     ReportExportWidget widget = (ReportExportWidget) fieldWidget;
 137  0
                     if (widget.isExportElement() ) {
 138  0
                         exportItem.setSubset(widget.getExportElementSubset(exportItem));
 139  0
                         setFieldValue(exportItem, setFirstFieldValue, widget.getExportFieldValue());
 140  
                     }
 141  0
                 }
 142  
         
 143  0
             } else if (fieldWidget instanceof ComplexPanel) {
 144  
                 // Retrieve child elements from complex panel.
 145  0
                 if(fieldWidget.isVisible()) {
 146  0
                     exportItem.setSubset(ExportUtils.getDetailsForWidget(fieldWidget, viewName, sectionName));
 147  
                 }
 148  
 
 149  0
             } else if (fieldWidget instanceof FieldElement) {
 150  
                 // Retrieve subset from the widget on the field element.
 151  0
                 if(fieldWidget.isVisible()) {
 152  0
                     Widget widget = ((FieldElement)fieldWidget).getFieldWidget();
 153  0
                     exportItem = getExportItemDetails(exportItem, widget, true, viewName, sectionName);
 154  0
                     exportItem.setPrintType(ExportElement.PARAGRAPH);
 155  
                 }
 156  
 
 157  
             } else {
 158  
                 // don't set anything
 159  
             }
 160  
         
 161  
             
 162  
         }
 163  0
         return exportItem;
 164  
     }
 165  
 
 166  
 
 167  
     /**
 168  
      * 
 169  
      * This method sets the extracted string value.
 170  
      * 
 171  
      * @param exportItem
 172  
      * @param setFirstFieldValue
 173  
      * @param fieldValue
 174  
      */
 175  
     private static void setFieldValue(ExportElement exportItem, boolean setFirstFieldValue, String fieldValue) {
 176  0
         if (setFirstFieldValue) {
 177  0
             exportItem.setFieldValue(fieldValue);
 178  
         } else {
 179  0
             exportItem.setFieldValue2(fieldValue);
 180  
         }
 181  0
     }
 182  
     
 183  
     
 184  
 
 185  
     /**
 186  
      * This method gets the current controller based on the widget that was passed to it.
 187  
      * 
 188  
      * @param theWidget
 189  
      * @return currentController
 190  
      */
 191  
     public static Controller getController(Widget theWidget) {
 192  
         // TODO Nina - This can't be the correct way of getting handle to
 193  
         // Controller, isn't there a better way??
 194  0
         if (theWidget != null) {
 195  
 
 196  0
             if (theWidget instanceof Controller) {
 197  0
                 Controller controller = (Controller) theWidget;
 198  0
                 return controller;
 199  
             } else {
 200  0
                 return getController(theWidget.getParent());
 201  
             }
 202  
         } else {
 203  0
             return null;
 204  
         }
 205  
     }
 206  
 
 207  
     /**
 208  
      * Handles the export click event.
 209  
      * 
 210  
      * @param currentController
 211  
      * @param format
 212  
      * @param reportTitle
 213  
      */
 214  
     public static void handleExportClickEvent(Controller currentController, String format, String reportTitle) {
 215  0
         List<ExportElement> exportElements = new ArrayList<ExportElement>();
 216  0
         exportElements = currentController.getExportElementsFromView();
 217  0
         if (exportElements != null && exportElements.size() > 0) {
 218  0
             currentController.doReportExport(exportElements, format, reportTitle);
 219  
         }
 220  0
     }
 221  
 
 222  
     /**
 223  
      * 
 224  
      * Retrieve the sub elements from the summary table on a table section.
 225  
      * 
 226  
      * @param tableSection
 227  
      * @param exportElements
 228  
      * @return
 229  
      */
 230  
     public static List<ExportElement> getDetailsForWidget(SummaryTable sumTable) {
 231  0
         List<ExportElement> exportElements = new ArrayList<ExportElement>();
 232  0
         SummaryTableModel model = sumTable.getModel();
 233  
         
 234  
         // Loop through the different sections. 
 235  0
         for (SummaryTableBlock block : model.getSectionList()) {
 236  0
             String blockName = block.getTitle();
 237  
             
 238  
             // Loop through all the rows.
 239  0
             for (SummaryTableRow row : block.getSectionRowList()) {
 240  0
                 ExportElement element = new ExportElement();
 241  0
                                 element.setSectionName(blockName);
 242  0
                                 element.setViewName(blockName);
 243  0
                                 element.setFieldLabel(row.getTitle());
 244  0
                                 element.setMandatory(row.isRequired());
 245  
                 
 246  
                                 // Only add elements if row is visible.
 247  0
                 if (row.isShown()) {
 248  
                     // Add the first element of the row.
 249  0
                     element = setSummaryElement(blockName, row, element, row.getCell1(), true);
 250  
                     // Add the second element of the row.
 251  0
                     element = setSummaryElement(blockName, row, element, row.getCell2(), false);
 252  
                     // All element to list.
 253  0
                     if (element != null && element.getViewName() != null) {
 254  0
                         exportElements.add(element);
 255  
                     }
 256  
                 }
 257  
                 
 258  0
             }
 259  0
         }
 260  0
         return exportElements;
 261  
     }
 262  
 
 263  
     /**
 264  
      * Set the details for the summary element.
 265  
      * 
 266  
      * @param blockName
 267  
      * @param row
 268  
      * @param element
 269  
      * @param fdWidget
 270  
      * @param setFirstFieldValue
 271  
      * @return
 272  
      */
 273  
     private static ExportElement setSummaryElement(String blockName, SummaryTableRow row, ExportElement element, Widget fdWidget, boolean setFirstFieldValue) {
 274  0
         if (fdWidget != null) {
 275  0
             if (fdWidget instanceof KSListPanel) {
 276  0
                 element.setSubset(ExportUtils.getDetailsForWidget(fdWidget, blockName, blockName));
 277  
             } else {
 278  0
                 element = ExportUtils.getExportItemDetails(element, fdWidget, setFirstFieldValue, blockName, blockName);
 279  
             }
 280  
         } else {
 281  0
             if (row.getTitle() != null) {
 282  0
                 element.setFieldLabel(row.getTitle());
 283  
             }
 284  
         }
 285  0
         return element;
 286  
     }
 287  
 
 288  
     /**
 289  
      * 
 290  
      * Retrieves the sub elements from a container widget.
 291  
      * 
 292  
      * @param currentViewWidget
 293  
      * @param viewName
 294  
      * @param sectionName
 295  
      * @return
 296  
      */
 297  
     public static List<ExportElement> getDetailsForWidget(Widget currentViewWidget, String viewName, String sectionName) {
 298  0
         List<ExportElement> childElements = new ArrayList<ExportElement>();
 299  0
         if (!currentViewWidget.getParent().getElement().getStyle().getDisplay().equals("none")){
 300  0
             if (currentViewWidget instanceof Section) {
 301  0
                 Section widgetHasFields = (Section) currentViewWidget;
 302  0
                 List<FieldDescriptor> widgetFields = widgetHasFields.getFields();
 303  0
                 for (FieldDescriptor field : widgetFields) {
 304  0
                     ExportElement exportItem = createExportElement(viewName, sectionName, childElements, field.getFieldElement().getFieldWidget());
 305  0
                     exportItem.setFieldLabel(field.getFieldLabel());
 306  0
                 }
 307  0
             } else if (currentViewWidget instanceof KSListPanel) {
 308  0
                 KSListPanel ksListPanelWidget = (KSListPanel) currentViewWidget;
 309  0
                 WidgetCollection children = ksListPanelWidget.getChildren();
 310  0
                 for (int i = 0; i < children.size(); i++) {
 311  0
                     createExportElement(viewName, sectionName, childElements, children.get(i));
 312  
                 }
 313  
 
 314  0
             } else if (currentViewWidget instanceof ULPanel) {
 315  0
                 ComplexPanel complexPanel = (ComplexPanel) currentViewWidget;
 316  0
                 if (complexPanel.isVisible()){
 317  0
                     for (int i = 0; i < complexPanel.getWidgetCount(); i++) {
 318  0
                         Widget child = complexPanel.getWidget(i);
 319  0
                         if (child instanceof FlowPanel){
 320  0
                             List<ExportElement> subset = ExportUtils.getDetailsForWidget(child, viewName, sectionName);
 321  0
                             if (subset != null && subset.size() > 0){
 322  0
                                 subset.get(0).setPrintType(ExportElement.LIST);
 323  0
                                 childElements.addAll(subset);
 324  
                             }
 325  
                             
 326  0
                         } else if (!(child instanceof KSButton)
 327  
                                 && !(child instanceof WarnContainer)) {
 328  0
                             ExportElement exportItem = createExportElement(viewName, sectionName, childElements, child);
 329  0
                             exportItem.setPrintType(ExportElement.LIST);
 330  
                         }
 331  
                     }
 332  
                 }
 333  
                 
 334  0
             } else if (currentViewWidget instanceof ComplexPanel) {
 335  0
                 ComplexPanel complexPanel = (ComplexPanel) currentViewWidget;
 336  0
                 if (complexPanel.isVisible()){
 337  0
                     for (int i = 0; i < complexPanel.getWidgetCount(); i++) {
 338  0
                         Widget child = complexPanel.getWidget(i);
 339  0
                         if (child instanceof FlowPanel){
 340  0
                             List<ExportElement> subset = ExportUtils.getDetailsForWidget(child, viewName, sectionName);
 341  0
                             if (subset != null && subset.size() > 0){
 342  0
                                 childElements.addAll(subset);
 343  
                             }
 344  
                             
 345  0
                         } else if (!(child instanceof KSButton)
 346  
                                 && !(child instanceof WarnContainer)) {
 347  0
                             createExportElement(viewName, sectionName, childElements, child);
 348  
                         }
 349  
                     }
 350  
                 }
 351  0
             } else {
 352  
 
 353  0
                 System.out.println("ExportUtils does not cater for this type..." + currentViewWidget.getClass().getName());
 354  
 
 355  
             }
 356  
         }
 357  0
         return childElements;
 358  
     }
 359  
 
 360  
     // Added for 2nd widget (side-by-side comparison)
 361  
     public static List<ExportElement> getDetailsForWidget(ExportElement element, Widget currentViewWidget, boolean setFirstFieldValue, String viewName, String sectionName) {
 362  0
         List<ExportElement> childElements = new ArrayList<ExportElement>();
 363  0
         if (!currentViewWidget.getParent().getElement().getStyle().getDisplay().equals("none")){
 364  0
             if (currentViewWidget instanceof Section) {
 365  0
                 Section widgetHasFields = (Section) currentViewWidget;
 366  0
                 List<FieldDescriptor> widgetFields = widgetHasFields.getFields();
 367  0
                  for (FieldDescriptor field : widgetFields) {
 368  0
                      ExportElement exportItem = createExportElement(viewName, sectionName, childElements, field.getFieldElement().getFieldWidget());
 369  0
                      exportItem.setFieldLabel(field.getFieldLabel());
 370  0
                 }
 371  0
             } else if (currentViewWidget instanceof KSListPanel) {
 372  0
                 KSListPanel ksListPanelWidget = (KSListPanel) currentViewWidget;
 373  0
                 WidgetCollection children = ksListPanelWidget.getChildren();
 374  0
                 for (int i = 0; i < children.size(); i++) {
 375  0
                         if (!element.getSubset().isEmpty() && i < element.getSubset().size()) 
 376  0
                                 createExportElementOld(element.getSubset().get(i), viewName, sectionName, childElements, children.get(i)); 
 377  
                         else        
 378  0
                                 createExportElement2(viewName, sectionName, childElements, children.get(i));
 379  
                 }
 380  0
             } else if (currentViewWidget instanceof ULPanel) {
 381  0
                 ComplexPanel complexPanel = (ComplexPanel) currentViewWidget;
 382  0
                 if (complexPanel.isVisible()){
 383  0
                     for (int i = 0; i < complexPanel.getWidgetCount(); i++) {
 384  0
                         Widget child = complexPanel.getWidget(i);
 385  0
                         if (child instanceof FlowPanel){
 386  0
                             List<ExportElement> subset = ExportUtils.getDetailsForWidget(child, viewName, sectionName);
 387  0
                             if (subset != null && subset.size() > 0){
 388  0
                                 subset.get(0).setPrintType(ExportElement.LIST);
 389  0
                                 childElements.addAll(subset);
 390  
                             }
 391  
                             
 392  0
                         } else if (!(child instanceof KSButton)
 393  
                                 && !(child instanceof WarnContainer)) {
 394  0
                             ExportElement exportItem = createExportElement(viewName, sectionName, childElements, child);
 395  0
                             exportItem.setPrintType(ExportElement.LIST);
 396  
                         }
 397  
                     }
 398  
                 }
 399  
                 
 400  0
             } else if (currentViewWidget instanceof ComplexPanel) {
 401  0
                 ComplexPanel complexPanel = (ComplexPanel) currentViewWidget;
 402  0
                 if (complexPanel.isVisible()){
 403  0
                     for (int i = 0; i < complexPanel.getWidgetCount(); i++) {
 404  0
                         Widget child = complexPanel.getWidget(i);
 405  0
                         if (child instanceof FlowPanel){
 406  0
                             List<ExportElement> subset = ExportUtils.getDetailsForWidget(child, viewName, sectionName);
 407  0
                             if (subset != null && subset.size() > 0){
 408  0
                                 childElements.addAll(subset);
 409  
                             }
 410  
                             
 411  0
                         } else if (!(child instanceof KSButton)
 412  
                                 && !(child instanceof WarnContainer)) {
 413  0
                             createExportElement(viewName, sectionName, childElements, child);
 414  
                         }
 415  
                     }
 416  
                 }
 417  0
             } else {
 418  
 
 419  0
                 System.out.println("ExportUtils does not cater for this type..." + currentViewWidget.getClass().getName());
 420  
 
 421  
             }
 422  
         }
 423  0
         return childElements;
 424  
     }
 425  
 
 426  
     public static ArrayList<ExportElement> getExportElementsFromView(Widget currentViewWidget, ArrayList<ExportElement> exportElements, String viewName, String sectionName) {
 427  0
         if (exportElements == null) {
 428  0
             exportElements = new ArrayList<ExportElement>();
 429  
         }
 430  0
         if (currentViewWidget.getParent() == null || !currentViewWidget.getParent().getElement().getStyle().getDisplay().equals("none")) {
 431  0
             if (currentViewWidget instanceof VerticalSectionView) {
 432  0
                 Section widgetHasFields = (Section) currentViewWidget;
 433  0
                 List<FieldDescriptor> widgetFields = widgetHasFields.getFields();
 434  0
                 for (FieldDescriptor field : widgetFields) {
 435  0
                     Widget child = field.getFieldElement().getFieldWidget();
 436  0
                     ExportElement exportItem = createExportElement(viewName, sectionName, exportElements, child);
 437  0
                     exportItem.setFieldLabel(field.getFieldLabel());
 438  0
                 }
 439  0
                 if ((currentViewWidget instanceof BaseSection) && (widgetHasFields.getFields().size() == 0)) {
 440  0
                     BaseSection bSection = (BaseSection) currentViewWidget;
 441  0
                     createExportElement(viewName, sectionName, exportElements, bSection.getLayout());
 442  
                 }
 443  
             }
 444  
         }
 445  0
         return exportElements;
 446  
     }
 447  
     
 448  
     /**
 449  
      * 
 450  
      * Creates a new export element with its sub elements.
 451  
      * 
 452  
      * @param viewName
 453  
      * @param sectionName
 454  
      * @param childElements
 455  
      * @param child
 456  
      * @return
 457  
      */
 458  
     private static ExportElement createExportElement(String viewName, String sectionName, List<ExportElement> childElements, Widget child) {
 459  0
         ExportElement exportItem = new ExportElement();
 460  0
         exportItem.setSectionName(sectionName);
 461  0
         exportItem.setViewName(viewName);
 462  
                             
 463  0
         exportItem = getExportItemDetails(exportItem, child, true, viewName, sectionName);
 464  0
         ExportUtils.addElementToElementArray(childElements, exportItem);
 465  0
         return exportItem;
 466  
     }
 467  
 
 468  
     private static ExportElement createExportElement2(String viewName, String sectionName, List<ExportElement> childElements, Widget child) {
 469  0
         ExportElement exportItem = new ExportElement();
 470  0
         exportItem.setSectionName(sectionName);
 471  0
         exportItem.setViewName(viewName);
 472  
                             
 473  0
         exportItem = getExportItemDetails(exportItem, child, false, viewName, sectionName);
 474  0
         ExportUtils.addElementToElementArray(childElements, exportItem);
 475  0
         return exportItem;
 476  
     }
 477  
 
 478  
     private static ExportElement createExportElementOld(ExportElement exportItem, String viewName, String sectionName, List<ExportElement> childElements, Widget child) {
 479  0
         exportItem = getExportItemDetails(exportItem, child, false, viewName, sectionName);
 480  0
         ExportUtils.addElementToElementArray(childElements, exportItem);
 481  0
         return exportItem;
 482  
     }
 483  
 
 484  
     // Only add element if it is not null
 485  
     public static List<ExportElement> addElementToElementArray(List<ExportElement> elementArray, ExportElement element) {
 486  0
         if (element.getFieldLabel() != null || element.getFieldValue() != null || element.getFieldValue2() != null || (element.getSubset() != null && element.getSubset().size() > 0)) {
 487  0
             elementArray.add(element);
 488  
         }
 489  0
         return elementArray;
 490  
     }
 491  
 
 492  
 }