Exemplo n.º 1
0
 private void emitGridTitle(JwCsvBuffer b) {
   String s = getState().getExportGridTitle();
   if (s != null) {
     b.addField(s);
     b.endRecord();
   }
 }
Exemplo n.º 2
0
 private void emitMainHeaders(JwCsvBuffer b, int rowIndex, boolean isLastRow) {
   for (ScGridColumn c : getColumns()) {
     if (!c.isExportable()) continue;
     if (rowIndex < c.getTitleCount()) b.addField(c.getExportTitleString(rowIndex).toUpperCase());
     else b.skipField();
   }
 }
Exemplo n.º 3
0
 private void emitCriteriaRow(JwCsvBuffer b, JwList<Object> v) {
   int len = b.getLength();
   for (Object e : v)
     if (e == null) b.addField("");
     else b.addField(e.toString());
   if (len != b.getLength()) b.endRecord();
 }
Exemplo n.º 4
0
  public void emitCriteria(JwCsvBuffer b) {
    if (!hasExportCriteria()) return;

    int len = b.getLength();
    for (JwList<Object> v : getExportCriteria()) emitCriteriaRow(b, v);
    if (len != b.getLength()) b.endRecord();
  }
Exemplo n.º 5
0
  public String exportCsv(JwList<T> v) {
    JwCsvBuffer b = new JwCsvBuffer();

    emitHeader(b);
    emitCriteria(b);
    emitGrid(b, v);

    return b.toString();
  }
Exemplo n.º 6
0
 public void emitGenerated(JwCsvBuffer b) {
   if (getState().getExportTimestamp()) {
     b.addField("Report Generated (UTC)");
     ScServletData data = ScServletData.getLocal();
     JwTimestampPolicy tp = data.getPreferredTimestampPolicy();
     b.addField(JwTimestamp.createNowUtc(), tp);
     b.endRecord();
     b.endRecord();
   }
 }
Exemplo n.º 7
0
  private void emitHeaders(ScServletData data, JwCsvBuffer b) {
    int rowIndex = 0;
    int rowCount = getTitleRowCount();
    int lastRow = rowCount - 1;

    while (rowIndex < rowCount) {
      boolean isLastRow = rowIndex == lastRow;
      int len = b.getLength();
      emitPreHeaders(data, b);
      emitMainHeaders(b, rowIndex, isLastRow);
      emitPostHeaders(data, b);
      if (len != b.getLength()) b.endRecord();
      rowIndex++;
    }
  }
Exemplo n.º 8
0
 private void emitColumn(
     ScServletData data, JwCsvBuffer buf, ScGridColumn<T> col, T e, int currentChamber) {
   Object o = col.getCellDivisionExportObject(e, currentChamber);
   Object m = col.getCellDivisionModel(e, currentChamber);
   if (m == null && o instanceof JwAdaptorIF) o = null;
   buf.addField(getExportStringForObject(data, o, m));
 }
Exemplo n.º 9
0
  protected void emitRow(
      ScServletData data, JwCsvBuffer buf, ScExportCsvState state, T e, int currentRow) {
    //        state.setCurrentRow(currentRow + 1);
    //        state.setCurrentRowIndex(currentRow);

    int maxChambers = getMaxChambersPerCell(e);

    for (int j = 0; j < maxChambers; j++) {
      int len = buf.getLength();

      emitPreColumns(data, buf, e, maxChambers, j);
      emitMainColumns(data, buf, e, maxChambers, j);
      emitPostColumns(data, buf, e, maxChambers, j);

      if (len != buf.getLength()) buf.endRecord();
    }
  }
Exemplo n.º 10
0
  public String getCsvExportFor(String airportCode, String roleOrRoleGroup) {
    JwSqlSelect st = getUserAirportAndRolesAndRoleGroupsSelect(airportCode, roleOrRoleGroup);

    JwCsvBuffer buffer = new JwCsvBuffer();
    buffer.addField("Login");
    buffer.addField("First Name");
    buffer.addField("Last Name");
    buffer.addField("Roles");
    buffer.addField("Role Groups");
    buffer.addField("Airports");
    buffer.endRecord();

    JwSqlResultSetProcessorIF p = getUserAirportAndRolesAndRoleGroupsResultSetProcessor(buffer);
    processResults(st, p);
    return buffer.toString();
  }