1 package com.calipso.reportgenerator.common; 2 3 import javax.swing.table.TableModel ; 4 5 import net.sf.jasperreports.engine.design.*; 6 import net.sf.jasperreports.engine.JRException; 7 import net.sf.jasperreports.engine.JRGroup; 8 import net.sf.jasperreports.engine.JRTextElement; 9 import net.sf.jasperreports.engine.JRQuery; 10 11 import java.util.*; 12 import java.text.NumberFormat ; 13 import java.text.DecimalFormat ; 14 15 22 public class StaticSQLJasperReportDefinition implements IJasperDefinition{ 23 private Map fields; 24 private Map variables; 25 private TableModel data; 26 private String tittle; 27 private Vector dimensions; 28 private Vector metrics; 29 private Vector accuMetrics; 30 private Vector nonGroupingDimensions; 31 private Vector dimensionsSizes; 32 private Vector metricsSizes; 33 private Vector accuMetricsSizes; 34 private Vector nonGroupingDimensionsSizes; 35 private int printAt; 36 private Vector metricsPosition = new Vector(); 37 private Vector nonGroupingDimensionPosition = new Vector(); 38 private Vector groupingDimensionPosition = new Vector(); 39 private ReportSpec reportSpec; 41 private String numberFormatPattern; 42 private Vector metricsWidth; 43 private Vector accMetricsPosition; 44 private Vector accMetricsWidht; 45 private JRQuery query = null; 46 private JasperDesign jasperDesign = null; 47 private Map reportParams; 48 49 public StaticSQLJasperReportDefinition(ReportSpec reportSpec,TableModel data, int dimensionsCount, int metricsCount, int nonGroupingDimensionsCount, int accuMetricsCount, String tittle, Map params){ 50 this.data = data; 51 this.tittle = tittle; 52 this.reportSpec = reportSpec; 54 metricsWidth = new Vector(); 55 accMetricsPosition = new Vector(); 56 accMetricsWidht = new Vector(); 57 initializeVectors(dimensionsCount, metricsCount, nonGroupingDimensionsCount, accuMetricsCount); 58 reportParams = params; 59 dimensionsSizes = calculateBestLenghts(dimensions); 60 metricsSizes = calculateBestLenghts(metrics); 61 accuMetricsSizes = calculateBestLenghts(this.accuMetrics); 62 nonGroupingDimensionsSizes = calculateBestLenghts(nonGroupingDimensions); 63 initializeNumberFormatPattern(); 64 } 65 66 public StaticSQLJasperReportDefinition(IJasperDefinition jasper, boolean isLandscape) throws InfoException{ 67 try{ 68 jasperDesign = jasper.getJasperDefinition(isLandscape); 69 }catch(Exception e){ 70 throw new InfoException(LanguageTraslator.traslate("221"),e); 71 } 72 } 73 74 private void initializeNumberFormatPattern() { 75 NumberFormat format = NumberFormat.getInstance(LanguageTraslator.getLocale()); 76 numberFormatPattern = ((DecimalFormat )format).toPattern(); 77 } 78 79 public JasperDesign getJasperDefinition(boolean isLandscape) throws JRException { 80 if(query==null){ 81 throw new JRException("La query es nula"); 82 } 83 if(jasperDesign!=null){ 84 jasperDesign.setQuery(query); 85 return jasperDesign; 86 } 87 JasperDesign jasperDesign = new JasperDesign(); 88 if(isLandscape) { 89 jasperDesign.setOrientation(JasperDesign.ORIENTATION_LANDSCAPE); 90 jasperDesign.setPrintOrder(JasperDesign.PRINT_ORDER_VERTICAL); 91 jasperDesign.setPageWidth(842); 92 jasperDesign.setPageHeight(595); 93 } else { 94 jasperDesign.setOrientation(JasperDesign.ORIENTATION_PORTRAIT); 95 jasperDesign.setPrintOrder(JasperDesign.PRINT_ORDER_HORIZONTAL); 96 jasperDesign.setPageWidth(595); 97 jasperDesign.setPageHeight(842); 98 } 99 jasperDesign.setName("BasicReport"); 100 addFields(jasperDesign); 101 addDetails(jasperDesign); 102 addGroups(jasperDesign); 103 addVariables(jasperDesign); 104 addTitle(jasperDesign); 105 addParams(jasperDesign); 106 if(query==null){ 108 throw new JRException("La query es nula"); 109 } 110 jasperDesign.setQuery(query); 111 return jasperDesign; 112 } 113 114 119 private void addParams(JasperDesign jasperDesign) throws JRException { 120 for (Iterator iterator = reportParams.entrySet().iterator(); iterator.hasNext();) { 121 Map.Entry param = (Map.Entry) iterator.next(); 122 JRDesignParameter parameter = new JRDesignParameter(); 123 parameter.setName(param.getKey().toString()); 124 parameter.setDescription(param.getKey().toString()); 125 Class paramClass = getClassFor(param); 126 parameter.setValueClass(paramClass); 127 jasperDesign.addParameter(parameter); 128 } 129 } 130 131 136 private Class getClassFor(Map.Entry param) { 137 Class result = java.lang.String .class; 138 Map map = new HashMap(); 139 map.put(param.getKey(), param.getValue()); 140 ReportMap.setParametersToSimpleType(map); 141 if(map.get(param.getKey())!=null){ 142 result = map.get(param.getKey()).getClass(); 143 } 144 return result; 145 } 146 147 148 public void setSQLText(String sqlText){ 149 String queryText = removeFilters(sqlText); 150 System.out.println(queryText); 151 query = new JRDesignQuery(); 152 ((JRDesignQuery)query).setText(queryText); 153 } 154 155 private String removeFilters(String sqlText) { 156 String result = ""; 157 StringTokenizer tokenizer = new StringTokenizer(sqlText, "%"); 158 String token; 159 int i=0; 160 while(tokenizer.hasMoreElements()){ 161 token = tokenizer.nextToken(); 162 result += token; 163 if(tokenizer.hasMoreElements()){ 164 tokenizer.nextToken(); 165 } 166 } 167 return result; 168 } 169 170 private void addFields(JasperDesign jasperDesign) throws JRException { 171 String name; 173 for(int i = 0 ; i < dimensions.size() ; i++) { 174 JRDesignField field = new JRDesignField(); 175 name = dimensions.elementAt(i).toString(); 176 field.setName(name); 177 field.setValueClass(String .class); 178 jasperDesign.addField(field); 179 } 180 for(int i = 0 ; i < nonGroupingDimensions.size() ; i++) { 181 JRDesignField field = new JRDesignField(); 182 name = nonGroupingDimensions.elementAt(i).toString(); 183 field.setName(name); 184 field.setValueClass(String .class); 185 jasperDesign.addField(field); 186 } 187 for(int i = 0 ; i < metrics.size() ; i++) { 188 JRDesignField field = new JRDesignField(); 189 name = metrics.elementAt(i).toString(); 190 field.setName(name); 191 field.setValueClass(Float .class); 192 jasperDesign.addField(field); 193 } 194 for(int i = 0 ; i < accuMetrics.size() ; i++) { 195 JRDesignField field = new JRDesignField(); 196 name = accuMetrics.elementAt(i).toString(); 197 field.setName(name); 198 field.setValueClass(Float .class); 199 jasperDesign.addField(field); 200 } 201 } 202 203 208 private void addGroups(JasperDesign jasperDesign) throws JRException { 209 JRDesignExpression expression; 211 JRDesignBand band; 212 JRDesignGroup group = null; 213 printAt = 0; 214 for(int j = 0 ; j < dimensions.size() ; j++) { 215 group = new JRDesignGroup(); 216 group.setName(dimensions.elementAt(j).toString()+"_GROUP"); 217 group.setReprintHeaderOnEachPage(true); 218 219 expression = new JRDesignExpression(); 220 expression.setValueClass(String .class); 221 expression.setText("$F{"+dimensions.elementAt(j)+"}"); 222 group.setExpression(expression); 223 224 if(j + 1 == dimensions.size()) { 225 band = new JRDesignBand(); 226 band.setHeight(40); 227 } else { 228 band = new JRDesignBand(); 229 band.setHeight(20); 230 } 231 232 233 JRDesignStaticText text = new JRDesignStaticText(); 234 String caption = reportSpec.getDimensionFromName(dimensions.elementAt(j).toString()).getCaption() + ":"; 235 text.setX(printAt); 236 text.setY(0); 237 text.setWidth(getLenghtForCaption((new Integer (caption.length())).intValue())); 238 text.setHeight(20); 239 text.setText(caption); 240 band.addElement(text); 241 242 JRDesignTextField textField = new JRDesignTextField(); 243 textField.setX(printAt + getLenghtForCaption((new Integer (caption.length())).intValue()) - 5); 244 textField.setY(0); 245 textField.setWidth(getLenghtForCaption(((Integer ) dimensionsSizes.elementAt(j)).intValue())); 246 textField.setHeight(20); 247 expression = new JRDesignExpression(); 248 expression.setValueClass(String .class); 249 expression.setText("$F{"+dimensions.elementAt(j)+"}"); 250 textField.setExpression(expression); 251 band.addElement(textField); 252 group.setGroupHeader(band); 253 254 if(j + 1 == dimensions.size()) { 255 for(int i = 0 ; i < nonGroupingDimensions.size() ; i++) { 256 int x = ((Integer ) nonGroupingDimensionPosition.elementAt(i)).intValue(); 257 text = new JRDesignStaticText(); 258 text.setX(x); 259 text.setY(20); 260 int first = getLenghtForCaption(((Integer ) nonGroupingDimensionsSizes.elementAt(i)).intValue()); 262 int second = getLenghtForCaption(nonGroupingDimensions.elementAt(i).toString().length()); 263 if(first >= second) { 264 text.setWidth(getLenghtForCaption(first)); 265 } else { 266 text.setWidth(getLenghtForCaption(second)); 267 } 268 text.setHeight(20); 269 text.setText(reportSpec.getDimensionFromName(nonGroupingDimensions.elementAt(i).toString()).getCaption()); 270 band.addElement(text); 271 } 272 273 for(int i = 0 ; i < metrics.size() ; i++) { 274 int x = ((Integer ) metricsPosition.elementAt(i)).intValue(); 275 text = new JRDesignStaticText(); 276 text.setX(x); 277 text.setY(20); 278 text.setWidth(((Integer ) metricsWidth.elementAt(i)).intValue()); 279 text.setHeight(20); 280 text.setText(reportSpec.getMetricFromName(metrics.elementAt(i).toString()).getCaption()); 281 band.addElement(text); 282 } 283 284 for(int i = 0 ; i < accMetricsPosition.size() ; i++) { 285 int x = ((Integer ) accMetricsPosition.elementAt(i)).intValue(); 286 text = new JRDesignStaticText(); 287 text.setX(x); 288 text.setY(20); 289 text.setWidth(((Integer ) accMetricsWidht.elementAt(i)).intValue()); 290 text.setHeight(20); 291 String metricName = getMetricName(accuMetrics.elementAt(i).toString()); 292 String metricCaption = reportSpec.getMetricFromName(metricName).getCaption(); 293 text.setText(metricCaption + " " + LanguageTraslator.traslate("315")); 294 band.addElement(text); 295 } 296 group.setGroupHeader(band); 297 } 298 299 300 band = new JRDesignBand(); 301 band.setHeight(30); 302 text = new JRDesignStaticText(); 303 text.setX(printAt); 304 text.setY(0); 305 text.setWidth(40); 306 text.setHeight(20); 307 text.setText(LanguageTraslator.traslate("358")); 308 band.addElement(text); 309 for(int i = 0 ; i < metrics.size() ; i++) { 310 band.setHeight(20); 311 textField = new JRDesignTextField(); 312 textField.setX(((Integer )metricsPosition.elementAt(i)).intValue()); 313 textField.setY(0); 314 textField.setWidth(getLenghtForCaption(((Integer ) dimensionsSizes.elementAt(j)).intValue()) + 20); 315 textField.setHeight(20); 316 expression = new JRDesignExpression(); 317 expression.setValueClass(Float .class); 318 expression.setText("$V{"+dimensions.elementAt(j).toString() + metrics.elementAt(i).toString()+"_SUM}"); 319 textField.setPattern(numberFormatPattern); 320 textField.setExpression(expression); 321 band.addElement(textField); 322 group.setGroupFooter(band); 323 } 324 groupingDimensionPosition.add(new Integer (printAt)); 325 printAt += 10; 327 jasperDesign.addGroup(group); 328 } 329 } 330 331 private String getMetricName(String s) { 332 StringTokenizer tokenizer = new StringTokenizer(s, "_"); 333 String returnVal = tokenizer.nextToken(); 334 return returnVal; 335 } 336 337 342 private void addVariables(JasperDesign jasperDesign) throws JRException { 343 JRDesignExpression expression; 345 for(int j = 0 ; j < dimensions.size() ; j++) { 346 for(int i = 0 ; i < metrics.size() ; i++) { 347 JRDesignVariable jrVariable = new JRDesignVariable(); 348 jrVariable.setName(dimensions.elementAt(j).toString()+ metrics.elementAt(i).toString()+"_SUM"); 349 jrVariable.setValueClass(Float .class); 350 jrVariable.setResetType(JRDesignVariable.RESET_TYPE_GROUP); 351 jrVariable.setCalculation(JRDesignVariable.CALCULATION_SUM); 352 jrVariable.setResetGroup((JRGroup)jasperDesign.getGroupsList().get(j)); 353 expression = new JRDesignExpression(); 354 expression.setValueClass(Float .class); 355 expression.setText("$F{"+metrics.elementAt(i).toString()+"}"); 356 jrVariable.setExpression(expression); 357 jasperDesign.addVariable(jrVariable); 358 } 359 } 360 } 361 362 366 private void addDetails(JasperDesign jasperDesign) { 367 int printAt = calculateStartForItem(); 369 JRDesignBand band = new JRDesignBand(); 370 band.setHeight(20); 371 JRDesignExpression expression; 372 for(int i = 0 ; i < nonGroupingDimensions.size() ; i++) { 373 JRDesignTextField textField = new JRDesignTextField(); 374 textField.setX(printAt); 375 textField.setY(0); 376 textField.setWidth(getLenghtForCaption(((Integer ) nonGroupingDimensionsSizes.elementAt(i)).intValue())); 377 textField.setHeight(20); 378 expression = new JRDesignExpression(); 379 expression.setValueClass(String .class); 380 expression.setText("$F{"+nonGroupingDimensions.elementAt(i)+"}"); 381 textField.setExpression(expression); 382 band.addElement(textField); 383 384 nonGroupingDimensionPosition.add(new Integer (printAt)); 385 386 int first = getLenghtForCaption(((Integer ) nonGroupingDimensionsSizes.elementAt(i)).intValue()); 387 int second = getLenghtForCaption(nonGroupingDimensions.elementAt(i).toString().length()); 388 if(first >= second) { 389 printAt += first; 390 } else { 391 printAt += second; 392 } 393 395 } 396 for(int i = 0 ; i < metrics.size() ; i++) { 397 JRDesignTextField textField = new JRDesignTextField(); 398 textField.setX(printAt + 25); 399 textField.setY(0); 400 402 metricsWidth.add(new Integer (getLenghtForCaption((new Integer (metrics.elementAt(i).toString().length())).intValue())+25)); 403 textField.setWidth(getLenghtForCaption((new Integer (metrics.elementAt(i).toString().length())).intValue())+25); 404 405 textField.setHeight(20); 406 textField.setPattern(numberFormatPattern); 407 expression = new JRDesignExpression(); 408 expression.setValueClass(Float .class); 409 expression.setText("$F{"+metrics.elementAt(i)+"}"); 410 textField.setExpression(expression); 411 band.addElement(textField); 412 metricsPosition.add(new Integer (printAt + 25)); 413 printAt += getLenghtForCaption(((Integer ) metricsSizes.elementAt(i)).intValue()) + 25 ; 414 } 415 416 for(int i = 0 ; i < accuMetrics.size() ; i++) { 417 JRDesignTextField textField = new JRDesignTextField(); 418 textField.setX(printAt + 25); 419 textField.setY(0); 420 421 423 accMetricsWidht.add(new Integer (getLenghtForCaption((new Integer (accuMetrics.elementAt(i).toString().length())).intValue())+25)); 424 textField.setWidth(getLenghtForCaption((new Integer (accuMetrics.elementAt(i).toString().length())).intValue())+25); 425 426 textField.setHeight(20); 427 textField.setPattern(numberFormatPattern); 428 expression = new JRDesignExpression(); 429 expression.setValueClass(Float .class); 430 expression.setText("$F{"+accuMetrics.elementAt(i)+"}"); 431 textField.setExpression(expression); 432 band.addElement(textField); 433 metricsPosition.add(new Integer (printAt + 25)); 434 accMetricsPosition.add(new Integer (printAt + 25)); 435 printAt += getLenghtForCaption(((Integer ) accuMetricsSizes.elementAt(i)).intValue()) + 25 ; 436 } 437 438 jasperDesign.setDetail(band); 439 } 440 441 445 572 573 private void addPageHeader(JasperDesign jasperDesign) { 574 575 JRDesignBand band = new JRDesignBand(); 576 577 String caption = getCaption(LanguageTraslator.traslate("308"), dimensions, new StringBuffer ()); 578 JRDesignStaticText text = new JRDesignStaticText(); 579 text = new JRDesignStaticText(); 580 text.setX(0); 581 text.setY(0); 582 text.setWidth(getLenghtForCaptionHeader(caption.length())); 583 text.setHeight(15); 584 text.setText(caption); 585 band.addElement(text); 586 587 caption = getCaption(LanguageTraslator.traslate("309"), nonGroupingDimensions, new StringBuffer ()); 588 text = new JRDesignStaticText(); 589 text.setX(0); 590 text.setY(15); 591 text.setWidth(getLenghtForCaptionHeader(caption.length())); 592 text.setHeight(15); 593 text.setText(caption); 594 band.addElement(text); 595 596 StringBuffer sb = new StringBuffer (); 597 StringBuffer buffer = new StringBuffer (); 598 sb.append(getCaption(LanguageTraslator.traslate("310"), metrics, buffer)); 599 sb.append(getCaption("", accuMetrics, buffer)); 600 text = new JRDesignStaticText(); 601 text.setX(0); 602 text.setY(30); 603 text.setWidth(getLenghtForCaptionHeader(sb.toString().length())); 604 text.setHeight(15); 605 text.setText(sb.toString()); 606 band.addElement(text); 607 608 jasperDesign.setPageHeader(band); 609 } 610 611 private String getCaption(String tittle, Vector vector, StringBuffer bufferString) { 612 StringBuffer buffer = new StringBuffer (); 613 buffer.append(tittle); 614 if(vector == dimensions || vector == nonGroupingDimensions) { 615 for(int i = 0 ; i < vector.size() ; i++){ 616 String caption = reportSpec.getDimensionFromName(vector.elementAt(i).toString()).getCaption(); 617 if(i == vector.size() - 1) { 618 buffer.append(caption); 619 } else { 620 buffer.append(caption + ", "); 621 } 622 } 623 } else if(vector == metrics) { 624 if(accuMetrics.size() == 0) { 625 for(int i = 0 ; i < vector.size() ; i++) { 626 String caption = reportSpec.getMetricFromName(metrics.elementAt(i).toString()).getCaption(); 627 if(i == vector.size() - 1) { 628 buffer.append(caption); 629 } else { 630 buffer.append(caption + ", "); 631 } 632 } 633 } else { 634 for(int i = 0 ; i < vector.size() ; i++) { 635 String caption = reportSpec.getMetricFromName(metrics.elementAt(i).toString()).getCaption(); 636 buffer.append(caption + ", "); 637 } 638 } 639 } else { 640 Object [] accMetrics = reportSpec.getAccumulableMetrics(); 641 for(int i = 0 ; i < accMetrics.length ; i++) { 642 ReportMetricSpec metric = (ReportMetricSpec) accMetrics[i]; 643 if(i == accMetrics.length - 1) { 644 buffer.append(metric.getCaption() + " " + LanguageTraslator.traslate("315")); 645 } else { 646 buffer.append(metric.getCaption() + " " + LanguageTraslator.traslate("315") + ", ") ; 647 } 648 649 } 650 } 651 return buffer.toString(); 652 } 653 654 658 private void addTitle(JasperDesign jasperDesign) throws JRException{ 659 JRDesignTextField textField = new JRDesignTextField(); 661 JRDesignBand band = new JRDesignBand(); 663 band.setHeight(50); 664 JRDesignStaticText staticText = new JRDesignStaticText(); 665 staticText.setX(0); 666 staticText.setY(10); 667 staticText.setWidth(515); 668 staticText.setHeight(30); 669 staticText.setTextAlignment(JRTextElement.TEXT_ALIGN_CENTER); 670 JRDesignReportFont bigFont = new JRDesignReportFont(); 671 bigFont.setName("Arial_Normal"); 672 bigFont.setDefault(true); 673 bigFont.setFontName("Arial"); 674 bigFont.setSize(16); 675 bigFont.setPdfFontName("Helvetica"); 676 bigFont.setPdfEncoding("Cp1252"); 677 bigFont.setPdfEmbedded(false); 678 jasperDesign.addFont(bigFont); 679 staticText.setFont(bigFont); 680 staticText.setText(tittle); 681 band.addElement(staticText); 682 688 jasperDesign.setTitle(band); 689 690 band = new JRDesignBand(); 691 band.setHeight(15); 692 staticText = new JRDesignStaticText(); 693 staticText.setX(0); 694 staticText.setY(0); 695 staticText.setWidth(40); 696 staticText.setHeight(15); 697 staticText.setText("Pagina: "); 698 band.addElement(staticText); 699 textField = new JRDesignTextField(); 700 textField.setX(40); 701 textField.setY(0); 702 textField.setWidth(100); 703 textField.setHeight(15); 704 JRDesignExpression expression = new JRDesignExpression(); 705 expression.setValueClass(Integer .class); 706 expression.setText("$V{PAGE_NUMBER}"); 707 textField.setExpression(expression); 708 band.addElement(textField); 709 jasperDesign.setPageFooter(band); 710 711 band = new JRDesignBand(); 712 band.setHeight(20); 713 jasperDesign.setSummary(band); 714 } 715 716 724 private void initializeVectors(int dimensionsCount, int metricsCount, int nonGroupingDimensionsCount, int accMetricsCount) { 725 dimensions = new Vector(); 726 nonGroupingDimensions = new Vector(); 727 metrics = new Vector(); 728 accuMetrics = new Vector(); 729 int i = 0; 730 for (; i < dimensionsCount; i++) { 731 dimensions.add(data.getColumnName(i)); 732 } 733 for (int z = 0; z < nonGroupingDimensionsCount; i++, z++) { 734 nonGroupingDimensions.add(data.getColumnName(i)); 735 } 736 for (int j = 0; j < metricsCount; i++, j++) { 737 metrics.add(data.getColumnName(i)); 738 } 739 for (int j = 0; j < accMetricsCount; i++, j++) { 740 accuMetrics.add(data.getColumnName(i)); 741 } 742 } 743 744 749 private Vector calculateBestLenghts(Vector vector) { 750 Vector bestSizes = new Vector(); 751 for(int i=0;i < vector.size();i++){ 752 bestSizes.add(new Integer (vector.elementAt(i).toString().length())); 753 } 754 return bestSizes; 755 } 756 757 762 private int getColumnIndexFromName(String columnName) { 763 int index = 0; 764 for (int i = 0; i < data.getColumnCount(); i++) { 765 if (data.getColumnName(i).equals(columnName)) { 766 index = i; 767 break; 768 } 769 } 770 return index; 771 } 772 773 779 private Integer getBestSize(Vector ColumnSizes) { 780 int compareTo = 0; 781 for (int i = 0; i < ColumnSizes.size(); i++) { 782 if (((Integer ) ColumnSizes.elementAt(i)).intValue() > compareTo) { 783 compareTo = ((Integer ) ColumnSizes.elementAt(i)).intValue(); 784 } 785 } 786 return new Integer (compareTo); 787 } 788 789 795 private int getLenghtForCaptionHeader(int chars){ 796 Integer integer = new Integer (chars); 798 Double qsrt = new Double (Math.sqrt(integer.doubleValue())); 799 return chars * 7 - ((chars / 2) - 3 * qsrt.intValue()); 800 } 801 802 807 private int calculateStartForItem() { 808 int width = 0 ; 809 for(int i = 0 ; i < dimensionsSizes.size() ; i++){ 810 width += (((Integer )dimensionsSizes.elementAt(i)).intValue()); 811 } 812 813 return 0; 815 } 816 817 823 private int getLenghtForCaption(int chars) { 824 if(chars == 2 ) { 825 return chars * 7; 826 } 827 Integer integer = new Integer (chars); 828 Double qsrt = new Double (Math.sqrt(integer.doubleValue())); 829 return chars * 8 - ((chars / 2) - 3 * qsrt.intValue()); 830 } 831 832 836 public Map getFields() { 837 if (fields == null){ 838 fields = new HashMap(); 839 } 840 return fields; 841 } 842 843 847 public Map getVariables() { 848 if (variables == null ){ 849 variables = new HashMap(); 850 } 851 return variables; 852 } 853 854 } 855 | Popular Tags |