Пример #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
 public List<ReportColumn> getOrderedColumns() {
   return customColumnOrdering.getOrderedColumns();
 }
Пример #3
0
 public List<String> getOrderedLabels() {
   return customColumnOrdering.getOrderedLabels();
 }
Пример #4
0
 public List<Field> getOrderedFields() {
   return customColumnOrdering.getOrderedFields();
 }
Пример #5
0
 public EnumSet<Field> getFields() {
   return customColumnOrdering.getFields();
 }
Пример #6
0
 /**
  * Constructor for ordering based on aan array of Fields. This is the safest constructor as it
  * uses enums and therefore needs no checking.
  *
  * @param displayName
  * @param description
  * @param fieldOrder
  */
 PredefinedColumnOrdering(
     final String displayName, final String description, final Field[] fieldOrder) {
   this(displayName, description, CustomColumnOrdering.create(fieldOrder));
 }
Пример #7
0
 /**
  * Make a predefined ordering from a list of objects. This is a convenience method to make it
  * easier to specify predefined lists in this enum with mixed string/field columns.
  *
  * @param displayName the display name of the ordering
  * @param description a description for the ordering
  * @param columns a list of objects whose string representation will define the ordering
  * @throws
  *     org.lockss.exporter.kbart.KbartExportFilter.CustomColumnOrdering.CustomColumnOrderingException
  *     if there is a problem creating the internal ColumnOrdering
  */
 private PredefinedColumnOrdering(
     final String displayName, final String description, final Object... columns) {
   this(displayName, description, CustomColumnOrdering.createUnchecked(columns));
 }