Class BaseExportTemplate<ID extends Serializable,​T extends AbstractEntity<ID>>

    • Field Detail

      • FIXED_COLUMN_WIDTH

        protected static final int FIXED_COLUMN_WIDTH
        The width for a fixed with column
        See Also:
        Constant Field Values
      • TITLE_ROW_HEIGHT

        protected static final int TITLE_ROW_HEIGHT
        The height of the title row in pixels
        See Also:
        Constant Field Values
      • MAX_SIZE_BEFORE_STREAMING

        protected static final int MAX_SIZE_BEFORE_STREAMING
        The maximum number of rows that will be created normally. If the number is larger, then a streaming writer will be used. This is faster but it will mean we cannot auto size the columns
        See Also:
        Constant Field Values
    • Constructor Detail

      • BaseExportTemplate

        public BaseExportTemplate​(BaseService<ID,​T> service,
                                  EntityModel<T> entityModel,
                                  ExportMode exportMode,
                                  SortOrder[] sortOrders,
                                  Filter filter,
                                  String title,
                                  FetchJoinInformation... joins)
        Constructor
        Parameters:
        service - the service used to retrieve the data
        sortOrders - the sort order
        filter - the filter used to limit the data
        title - the title of the sheet
        customGenerator - custom generator used to apply extra styling
        joins -
    • Method Detail

      • generate

        protected abstract byte[] generate​(com.ocs.dynamo.domain.query.DataSetIterator<ID,​T> iterator)
                                    throws IOException
        Generates the file
        Parameters:
        iterator - data set iterator that contains the rows to include
        Returns:
        Throws:
        IOException
      • show

        protected boolean show​(AttributeModel am)
        Check whether a certain attribute model must be included in the export
        Parameters:
        am - the attribute model
        Returns:
        true if the attribute must be included, false otherwise
      • getFilter

        public Filter getFilter()
      • getSortOrders

        public SortOrder[] getSortOrders()
      • getTitle

        public String getTitle()
      • process

        public final byte[] process()
        Processes the input and creates a file
        Parameters:
        xls - whether to export to Excel (xlsx)
        Returns:
        Throws:
        IOException
      • processFixed

        public final byte[] processFixed​(List<T> items)
        Processes a fixed set of data
        Parameters:
        items - the set of data to process
        Returns: