Class GanttDataBuilder<R,B>

java.lang.Object
overit.geocallapp.utilities.ux.ui.container.gantt.data.GanttDataBuilder<R,B>
All Implemented Interfaces:
Serializable

public class GanttDataBuilder<R,B> extends Object implements Serializable
Given a DBView with the raw data of some Gantt blocks and rows, this class will build a tree of GanttRow. To do this, use a given GanttDataReader that have as assumption that the raw data must merge the definition of the row and the blocks. The result of the build process is a GanttRow that must be intended as a tree root. The children of this GanttRow are the actual rows generated with the given data.
See Also:
  • Constructor Details

    • GanttDataBuilder

      public GanttDataBuilder()
  • Method Details

    • setClustered

      public GanttDataBuilder<R,B> setClustered(boolean clustered)
      Parameters:
      clustered - say if the generated Gantt row should take track of the block overlapping
      Returns:
      an instance of this builder to chain the methods call
      See Also:
    • setReader

      public GanttDataBuilder<R,B> setReader(GanttDataReader<R,B> reader)
      Parameters:
      reader - the GanttDataReader to use to fill the GanttRows and GanttBlocks generated
      Returns:
      an instance of this builder to chain the methods call
      Throws:
      overit.geocall.asserts.AssertsException - if the given reader is null
    • setRawData

      public GanttDataBuilder<R,B> setRawData(DBView rawData)
      Parameters:
      rawData - the DBView that stores the data of rows and blocks. Assume that each record have the merged informations of both row and block.
      Returns:
      an instance of this builder to chain the methods call
      Throws:
      overit.geocall.asserts.AssertsException - if the given rawData is null
    • build

      public GanttRow<R,B> build()
      Returns:
      the GanttRow root of the generated tree
      Throws:
      overit.geocall.asserts.AssertsException - if called before to configure the reader and the rawData
    • buildRows

      protected Map<String,GanttRow<R,B>> buildRows()
      First step of the build process. Generate the GanttRow and puts them in a Map.
      Returns:
      a Map with the id string of the GanttRow as key, and the corresponding GanttRow as value.
    • buildHierarchy

      protected GanttRow<R,B> buildHierarchy(Map<String,GanttRow<R,B>> flatRows)
      Parameters:
      flatRows - a Map with the id string of the GanttRow as key, and the corresponding GanttRow as value.
      Returns:
      a GanttRow that is the root of a tree like hierarchy, builded using the GanttDataReader.getParentRowId(R) method to identity the parent/children relation
    • buildBlock

      protected GanttBlock<B> buildBlock(B rawData)
      Parameters:
      rawData - the block's rawData
      Returns:
      a well configured GanttBlock
    • buildRow

      protected GanttRow<R,B> buildRow(R rawData)
      Parameters:
      rawData - the row's rawData
      Returns:
      a well configured GanttRow. Note that if the builder is configured to generate a GanttRowClustered, this method will return this kind of GanttRow
      See Also: