Ejemplo n.º 1
0
 /**
  * Adjusts the field list so that only the selected fields are read.
  *
  * @param readFunction
  */
 private void setFieldList(JCoFunction readFunction) {
   int length = 0;
   JCoTable fields = readFunction.getTableParameterList().getTable("FIELDS"); // $NON-NLS-1$
   fields.clear();
   if (selectedFields.isEmpty()) {
     for (final ITableField field : structure.getFieldList()) {
       length += field.getLength();
       fields.appendRow();
       fields.setValue("FIELDNAME", field.getFieldName()); // $NON-NLS-1$
     }
   } else {
     for (final String field : selectedFields) {
       try {
         length += structure.getField(field).getLength();
         fields.appendRow();
         fields.setValue("FIELDNAME", field); // $NON-NLS-1$
       } catch (FieldNotFoundException e) {
         throw new IllegalArgumentException(
             MessageFormat.format(Messages.TableReader_UnknownField, field), e);
       }
     }
   }
   if (length > 512) {
     throw new IllegalArgumentException(Messages.TableReader_ResultTooLong);
   }
 }
Ejemplo n.º 2
0
 /**
  * Adds a field to the list of fields to retrieve.
  *
  * @param field the descriptor of the field to add
  * @throws FieldNotFoundException
  */
 public void addField(ITableField field) throws FieldNotFoundException {
   structure.getField(field.getFieldName()); // to ensure that the field exists
   selectedFields.add(field.getFieldName());
 }