public static final StringWithId createItem(
      Configuration conf, SQLTable primaryTable, final SQLRowValues rs, List<SQLField> fields) {
    final String desc;
    if (rs.getID() == primaryTable.getUndefinedID()) desc = "?";
    else
      desc =
          CollectionUtils.join(
              getShowAs(conf).expandGroupBy(fields),
              " ◄ ",
              new ITransformer<Tuple2<Path, List<FieldPath>>, Object>() {
                public Object transformChecked(Tuple2<Path, List<FieldPath>> ancestorFields) {
                  final List<String> filtered =
                      CollectionUtils.transformAndFilter(
                          ancestorFields.get1(),
                          new ITransformer<FieldPath, String>() {
                            // no need to keep this Transformer in an attribute
                            // even when creating one per line it's the same speed
                            public String transformChecked(FieldPath input) {
                              return input.getString(rs);
                            }
                          },
                          IPredicate.notNullPredicate(),
                          new ArrayList<String>());
                  return CollectionUtils.join(filtered, " ");
                }
              });
    // don't store the whole SQLRowValues to save some memory
    final StringWithId res = new StringWithId(rs.getID(), desc);

    return res;
  }
Ejemplo n.º 2
0
  @Override
  public void select(final SQLRowAccessor r) {
    if (r != null) {
      this.numeroUniqueDevis.setIdSelected(r.getID());
    }

    if (r == null || r.getIDNumber() == null) super.select(r);
    else {
      System.err.println(r);
      final SQLRowValues rVals = r.asRowValues();
      final SQLRowValues vals = new SQLRowValues(r.getTable());
      vals.load(rVals, createSet("ID_CLIENT"));
      vals.setID(rVals.getID());
      System.err.println("Select CLIENT");

      super.select(vals);
      rVals.remove("ID_CLIENT");
      super.select(rVals);
    }

    // super.select(r);
    if (r != null) {
      this.table.insertFrom("ID_DEVIS", r.getID());
      // this.radioEtat.setVisible(r.getID() > getTable().getUndefinedID());
      if (getTable().contains("SITE_DIFF"))
        setSiteEnabled(r.getBoolean("SITE_DIFF"), Type_Diff.SITE);

      if (getTable().contains("DONNEUR_DIFF"))
        setSiteEnabled(r.getBoolean("DONNEUR_DIFF"), Type_Diff.DONNEUR_ORDRE);
    }
  }