Class Join

java.lang.Object
com.inet.report.Join
All Implemented Interfaces:
NodeParser, com.inet.report.ReferenceHolder, Serializable

public class Join extends Object implements Serializable, com.inet.report.ReferenceHolder, NodeParser
A Join represents a connection between two tables. It is vectored and points from the source table to the target table. There are four kind of Joins: INNER, OUTER, LEFT OUTER and RIGHT OUTER. The connection will be created by one or more links between the table columns. There are six kinds of linktypes: A link between both tables will be called here as join condition. A join condition consists of two columns, a column from source table and a column from target table, and the link type.
See Also:
  • Method Details

    • getJoinType

      public int getJoinType()
      Returns the join type of this Join. The join type defines the data linking of the both tablesources of this join.
      Returns:
      the join type of this Join.
      Since:
      6.0
      See Also:
    • setJoinType

      public void setJoinType(int newJoinType)
      Sets the join type of this Join object.
      Parameters:
      newJoinType - the new join type for this Join object.
      Since:
      6.0
      See Also:
    • getSourceAlias

      public String getSourceAlias()
      Returns the source alias name for the source tables.
      Returns:
      the alias name of the source table.
      Since:
      6.0
    • getSourceTableSource

      public TableSource getSourceTableSource()
      Returns the TableSource Object of the source table.
      Returns:
      the TableSource Object of the source table.
      Since:
      6.1
    • getTargetAlias

      public String getTargetAlias()
      Returns the target alias name for the source tables.
      Returns:
      the alias name of the target table.
      Since:
      6.0
    • getTargetTableSource

      public TableSource getTargetTableSource()
      Returns the TableSource Object of the target table.
      Returns:
      the TableSource Object of the target table.
      Since:
      6.1
    • addCondition

      public void addCondition(String sourceColumn, String targetColumn, int linkType)
      Adds a join condition to this Join Object. A join condition consists of two columns, one column of source table and one column of target table, and the column link.
      example:
      join.addCondition("orderId","orderId",DatabaseTables.JOINLINK_GREATER_THAN);
      Parameters:
      sourceColumn - the column name of the source table that is used in this condition.
      targetColumn - the column name of the target table that is used in this condition.
      linkType - the link type with that both columns are linked together.
      Throws:
      IllegalArgumentException - If no database field could be found for sourceColumn or targetColumn.
      Since:
      6.0
      See Also:
    • addCondition

      public void addCondition(DatabaseField sourceColumn, DatabaseField targetColumn, int linkType)
      Adds a join condition to this Join Object. A join condition consists of two columns, one column of source table and one column of target table, and the column link.
      example:

      join.addCondition(sourceTableSource.getDatabaseField("orderId"),targetTableSource.getDatabaseField("orderId"),DatabaseTables.JOINLINK_GREATER_THAN);
      Parameters:
      sourceColumn - the column of the source table that is used in this condition.
      targetColumn - the column of the target table that is used in this condition.
      linkType - the link type with that both columns are linked together.
      Since:
      6.1
      See Also:
    • removeCondition

      public void removeCondition(int i)
      Removes a condition from the join.
      Parameters:
      i - condition index to remove. The index of the first condition is 0.
      Throws:
      ArrayIndexOutOfBoundsException - if the index is less than 0, greater than or equals the condition count.
      Since:
      6.0
      See Also:
    • getConditionCount

      public int getConditionCount()
      Returns the number of join conditions.
      Returns:
      the count of the join conditions.
      Since:
      6.0
      See Also:
    • getConditionSourceColumn

      public String getConditionSourceColumn(int i)
      Returns the column name from source table, used in the specified condition.
      Parameters:
      i - the index of the condition. The index of the first condition is 0.
      Returns:
      the column name of the source table for the respective condition.
      Throws:
      ArrayIndexOutOfBoundsException - if the index is less than 0, greater than or equals the condition count.
      Since:
      6.0
      See Also:
    • getConditionTargetColumn

      public String getConditionTargetColumn(int i)
      Returns the column name from target table, used in the specified condition.
      Parameters:
      i - the index of the condition. The index of the first condition is 0.
      Returns:
      the column name of the target table for the respective condition.
      Throws:
      ArrayIndexOutOfBoundsException - if the index is less than 0, greater than or equals the condition count.
      Since:
      6.0
      See Also:
    • getConditionLinkType

      public int getConditionLinkType(int i)
      Returns the link type of the specified condition.
      Parameters:
      i - the index of the condition. The index of the first condition is 0.
      Returns:
      the link type for the respective condition.
      Throws:
      ArrayIndexOutOfBoundsException - if the index is less than 0, greater than or equals the condition count.
      Since:
      6.0
      See Also:
    • getConditionSourceColumns

      public String[] getConditionSourceColumns()
      Returns all columns from source table, that are used for the join conditions.
      Returns:
      a String array containing all columns from source table, that are used for the join conditions.
      Since:
      6.0
      See Also:
    • getConditionSourceFields

      public DatabaseField[] getConditionSourceFields()
      Returns all fields from source table, that are used for the join conditions.
      Returns:
      a DatabaseField array containing all columns from source table, that are used for the join conditions.
      Since:
      6.1
      See Also:
    • getConditionTargetFields

      public DatabaseField[] getConditionTargetFields()
      Returns all fields from target table, that are used for the join conditions.
      Returns:
      a DatabaseField array containing all columns from target table, that are used for the join conditions.
      Since:
      6.1
      See Also:
    • getConditionTargetColumns

      public String[] getConditionTargetColumns()
      Returns all columns from target table, that are used for the join conditions.
      Returns:
      a String array containing all columns from target table, that are used for the join conditions.
      Since:
      6.0
      See Also:
    • getConditionLinkTypes

      public int[] getConditionLinkTypes()
      Returns the link types of all join conditions.
      Returns:
      an int array containing the link types of all join conditions.
      Since:
      6.0
      See Also:
    • paramString

      public String paramString()
      Returns a String representation of this Join.
      Returns:
      a String representation of this Join.
      Since:
      6.0
    • swapJoin

      public void swapJoin()
      Inverses the join by swapping the source and target table, and changes the join type and link to make the inverted join equivalent to the current join.

      For instance, an right join from A to B with link type '<' will become an left join from B to A with link type '>'.

      Since:
      15.0
    • isDOMParser

      public boolean isDOMParser()
      FOR INTERNAL USE ONLY Internal method for reading report XML

      Returns whether this node is to be read via a DOM parser.

      Specified by:
      isDOMParser in interface NodeParser
      Returns:
      true if this node is to be read via a DOM parser, false otherwise.
    • parseDOM

      public void parseDOM(Node node, Map<String,Object> parserMap) throws FatalParserException
      FOR INTERNAL USE ONLY Internal method for reading report XML

      Parses the node.

      Specified by:
      parseDOM in interface NodeParser
      Parameters:
      node - the node
      parserMap - The map of current Parser.
      Throws:
      FatalParserException - if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
    • parseElement

      public NodeParser parseElement(com.inet.report.parser.XMLTag group, String tag, Attributes atts, Map<String,Object> parserMap) throws FatalParserException
      FOR INTERNAL USE ONLY Internal method for reading report XML

      Parses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself. Note that the parsing is highly tolerant, i.e. exceptions are intercepted and suppressed if at all possible.

      Specified by:
      parseElement in interface NodeParser
      Parameters:
      group - XMLTag of the current node to be parsed, or null if there is no such current group. An XMLTag is a group of nodes bundled together, usually it is a Properties node such as CommonProperties, BorderProperties, etc.
      tag - The XMLTag to be parsed
      atts - The set of attributes in the current XMLTag
      parserMap - The map of current Parser.
      Returns:
      The NodeParser sub-element if one needed to be created, or null if none was created.
      Throws:
      FatalParserException - if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
    • parseEndElement

      public void parseEndElement(com.inet.report.parser.XMLTag group, String tag, Map<String,Object> parserMap) throws FatalParserException
      FOR INTERNAL USE ONLY Internal method for reading report XML

      Receive notification of the end of an XML tag.

      Specified by:
      parseEndElement in interface NodeParser
      Parameters:
      group - XMLTag of the current node to be parsed, or null if there is no such current group.
      tag - The XMLTag to be parsed
      parserMap - The map of current Parser.
      Throws:
      FatalParserException - if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
    • parseText

      public void parseText(String text, Map<String,Object> parserMap)
      FOR INTERNAL USE ONLY Internal method for reading report XML

      This method is called if text was encountered in the context of this node. (Examples would be a formula's text or a text element's text)

      Specified by:
      parseText in interface NodeParser
      Parameters:
      text - text encountered and to be stored
      parserMap - The map of current Parser.
    • addReferencedObject

      public final void addReferencedObject(com.inet.report.ReferencedObject reference)
      FOR INTERNAL USE ONLY Adds a ReferencedObject to the list of objects which this object is referencing.
      Specified by:
      addReferencedObject in interface com.inet.report.ReferenceHolder
      Parameters:
      reference - the referenced object
      Since:
      6.0
      See Also:
      • ReferenceHolder.addReferencedObject(com.inet.report.ReferencedObject)
    • removeReferencedObject

      public final void removeReferencedObject(com.inet.report.ReferencedObject reference)
      FOR INTERNAL USE ONLY Removes a ReferencedObject from the list of objects which this object is referencing.
      Specified by:
      removeReferencedObject in interface com.inet.report.ReferenceHolder
      Parameters:
      reference - the referenced object
      Since:
      6.0
      See Also:
      • ReferenceHolder.removeReferencedObject(com.inet.report.ReferencedObject)
    • getRealReferencedObjectCount

      public final int getRealReferencedObjectCount()
      FOR INTERNAL USE ONLY
      Specified by:
      getRealReferencedObjectCount in interface com.inet.report.ReferenceHolder
      Returns:
      the count of real referenced objects
      Since:
      6.0
      See Also:
      • ReferenceHolder.getRealReferencedObjectCount()
    • getReferencedObjectCount

      public final int getReferencedObjectCount()
      FOR INTERNAL USE ONLY Returns the number of ReferencedObjects which this object is referencing at the moment.
      Specified by:
      getReferencedObjectCount in interface com.inet.report.ReferenceHolder
      Returns:
      the count of referenced objects
      Since:
      6.0
      See Also:
      • ReferenceHolder.getReferencedObjectCount()
    • getReferencedObjects

      public final com.inet.report.ReferencedObject[] getReferencedObjects()
      FOR INTERNAL USE ONLY Returns the ReferencedObjects this object is referencing currently.
      Specified by:
      getReferencedObjects in interface com.inet.report.ReferenceHolder
      Returns:
      the referenced objects
      Since:
      6.0
      See Also:
      • ReferenceHolder.getReferencedObjects()
    • setReferences

      public final void setReferences()
      FOR INTERNAL USE ONLY
      Specified by:
      setReferences in interface com.inet.report.ReferenceHolder
      Since:
      6.0
    • resetReferences

      public final void resetReferences()
      FOR INTERNAL USE ONLY
      Specified by:
      resetReferences in interface com.inet.report.ReferenceHolder
      Since:
      6.0