Пример #1
0
 /**
  * An alternative constructor that allows one to specify whether or not to show columns which are
  * entirely empty. If <code>omitEmptyFields</code> is true, the <code>emptyFields</code> set is
  * filled with the names of the empty fields. This is an expensive operation which requires
  * iteration over potentially all of the titles, so is performed here at construction.
  *
  * <p>Due to this processing, it is not possible to accept an iterator instead of a list, which
  * would be less memory intensive.
  *
  * @param titles the titles to be exported
  * @param ordering an ordering to impose on the fields of each title
  * @param omitEmptyFields whether to omit empty field columns from the output
  */
 public KbartExportFilter(
     List<KbartTitle> titles,
     ColumnOrdering ordering,
     boolean omitEmptyFields,
     boolean omitHeader,
     boolean excludeNoIdTitles,
     boolean showHealthRatings) {
   this.titles = titles;
   this.columnOrdering = ordering;
   this.omitEmptyFields = omitEmptyFields;
   this.omitHeaderRow = omitHeader;
   this.excludeNoIdTitles = excludeNoIdTitles;
   this.showHealthRatings = showHealthRatings;
   // Work out the list of empty fields if necessary
   this.emptyFields = omitEmptyFields ? findEmptyFields() : EnumSet.noneOf(Field.class);
   // Create a list of the visible (non-omitted) fields out of the supplied ordering
   this.visibleColumnOrdering =
       CustomColumnOrdering.copy(columnOrdering).removeFields(emptyFields);
   this.rangeFieldsIncludedInDisplay =
       !CollectionUtil.isDisjoint(visibleColumnOrdering.getFields(), rangeFields);
   this.idFieldsIncludedInDisplay =
       !CollectionUtil.isDisjoint(visibleColumnOrdering.getFields(), idFields);
 }
Пример #2
0
 /**
  * Whether there are fields included in the given set which provide range information for a title.
  *
  * @param fields a set of fields to check
  * @return whether the list includes any range fields
  */
 public static boolean includesRangeFields(Set<Field> fields) {
   return !CollectionUtil.isDisjoint(fields, rangeFields);
 }