Package com.inet.report
Class Join
- java.lang.Object
-
- com.inet.report.Join
-
- All Implemented Interfaces:
NodeParser
,com.inet.report.ReferenceHolder
,java.io.Serializable
public class Join extends java.lang.Object implements java.io.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:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCondition(DatabaseField sourceColumn, DatabaseField targetColumn, int linkType)
Adds a join condition to this Join Object.void
addCondition(java.lang.String sourceColumn, java.lang.String targetColumn, int linkType)
Adds a join condition to this Join Object.void
addReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLY Adds aReferencedObject
to the list of objects which this object is referencing.int
getConditionCount()
Returns the number of join conditions.int
getConditionLinkType(int i)
Returns the link type of the specified condition.int[]
getConditionLinkTypes()
Returns the link types of all join conditions.java.lang.String
getConditionSourceColumn(int i)
Returns the column name from source table, used in the specified condition.java.lang.String[]
getConditionSourceColumns()
Returns all columns from source table, that are used for the join conditions.DatabaseField[]
getConditionSourceFields()
Returns all fields from source table, that are used for the join conditions.java.lang.String
getConditionTargetColumn(int i)
Returns the column name from target table, used in the specified condition.java.lang.String[]
getConditionTargetColumns()
Returns all columns from target table, that are used for the join conditions.DatabaseField[]
getConditionTargetFields()
Returns all fields from target table, that are used for the join conditions.int
getJoinType()
Returns the join type of this Join.int
getRealReferencedObjectCount()
FOR INTERNAL USE ONLYint
getReferencedObjectCount()
FOR INTERNAL USE ONLY Returns the number ofReferencedObject
s which this object is referencing at the moment.com.inet.report.ReferencedObject[]
getReferencedObjects()
FOR INTERNAL USE ONLY Returns theReferencedObject
s this object is referencing currently.java.lang.String
getSourceAlias()
Returns the source alias name for the source tables.TableSource
getSourceTableSource()
Returns the TableSource Object of the source table.java.lang.String
getTargetAlias()
Returns the target alias name for the source tables.TableSource
getTargetTableSource()
Returns the TableSource Object of the target table.boolean
isDOMParser()
FOR INTERNAL USE ONLY Internal method for reading report XMLjava.lang.String
paramString()
Returns a String representation of this Join.void
parseDOM(org.w3c.dom.Node node, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY Internal method for reading report XMLNodeParser
parseElement(com.inet.report.parser.XMLTag group, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
parseEndElement(com.inet.report.parser.XMLTag group, java.lang.String tag, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
parseText(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
removeCondition(int i)
Removes a condition from the join.void
removeReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLY Removes aReferencedObject
from the list of objects which this object is referencing.void
resetReferences()
FOR INTERNAL USE ONLYvoid
setJoinType(int newJoinType)
Sets the join type of this Join object.void
setReferences()
FOR INTERNAL USE ONLYvoid
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.
-
-
-
Method Detail
-
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(int)
,DatabaseTables.JOINTYPE_INNER
,DatabaseTables.JOINTYPE_LEFT_OUTER
,DatabaseTables.JOINTYPE_RIGHT_OUTER
,DatabaseTables.JOINTYPE_FULL_OUTER
-
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:
getJoinType()
,DatabaseTables.JOINTYPE_INNER
,DatabaseTables.JOINTYPE_LEFT_OUTER
,DatabaseTables.JOINTYPE_RIGHT_OUTER
,DatabaseTables.JOINTYPE_FULL_OUTER
-
getSourceAlias
public java.lang.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 java.lang.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(java.lang.String sourceColumn, java.lang.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:
java.lang.IllegalArgumentException
- If no database field could be found for sourceColumn or targetColumn.- Since:
- 6.0
- See Also:
removeCondition(int)
-
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(int)
-
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:
java.lang.ArrayIndexOutOfBoundsException
- if the index is less than 0, greater than or equals the condition count.- Since:
- 6.0
- See Also:
addCondition(String, String, int)
,getConditionCount()
-
getConditionCount
public int getConditionCount()
Returns the number of join conditions.- Returns:
- the count of the join conditions.
- Since:
- 6.0
- See Also:
getConditionSourceColumn(int)
,getConditionTargetColumn(int)
,getConditionLinkType(int)
-
getConditionSourceColumn
public java.lang.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:
java.lang.ArrayIndexOutOfBoundsException
- if the index is less than 0, greater than or equals the condition count.- Since:
- 6.0
- See Also:
getConditionCount()
,getConditionTargetColumn(int)
,getConditionLinkType(int)
-
getConditionTargetColumn
public java.lang.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:
java.lang.ArrayIndexOutOfBoundsException
- if the index is less than 0, greater than or equals the condition count.- Since:
- 6.0
- See Also:
getConditionCount()
,getConditionSourceColumn(int)
,getConditionLinkType(int)
-
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:
java.lang.ArrayIndexOutOfBoundsException
- if the index is less than 0, greater than or equals the condition count.- Since:
- 6.0
- See Also:
getConditionCount()
,getConditionTargetColumn(int)
,getConditionSourceColumn(int)
-
getConditionSourceColumns
public java.lang.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:
getConditionTargetColumns()
,getConditionLinkTypes()
-
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:
getConditionTargetColumns()
,getConditionLinkTypes()
-
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:
getConditionSourceColumns()
,getConditionLinkTypes()
-
getConditionTargetColumns
public java.lang.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:
getConditionSourceColumns()
,getConditionLinkTypes()
-
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:
getConditionSourceColumns()
,getConditionTargetColumns()
-
paramString
public java.lang.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 XMLReturns whether this node is to be read via a DOM parser.
- Specified by:
isDOMParser
in interfaceNodeParser
- Returns:
- true if this node is to be read via a DOM parser, false otherwise.
-
parseDOM
public void parseDOM(org.w3c.dom.Node node, java.util.Map<java.lang.String,java.lang.Object> parserMap) throws FatalParserException
FOR INTERNAL USE ONLY Internal method for reading report XMLParses the node.
- Specified by:
parseDOM
in interfaceNodeParser
- Parameters:
node
- the nodeparserMap
- 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, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map<java.lang.String,java.lang.Object> parserMap) throws FatalParserException
FOR INTERNAL USE ONLY Internal method for reading report XMLParses 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 interfaceNodeParser
- 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 parsedatts
- The set of attributes in the current XMLTagparserMap
- 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, java.lang.String tag, java.util.Map<java.lang.String,java.lang.Object> parserMap) throws FatalParserException
FOR INTERNAL USE ONLY Internal method for reading report XMLReceive notification of the end of an XML tag.
- Specified by:
parseEndElement
in interfaceNodeParser
- Parameters:
group
- XMLTag of the current node to be parsed, or null if there is no such current group.tag
- The XMLTag to be parsedparserMap
- 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(java.lang.String text, java.util.Map<java.lang.String,java.lang.Object> parserMap)
FOR INTERNAL USE ONLY Internal method for reading report XMLThis 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 interfaceNodeParser
- Parameters:
text
- text encountered and to be storedparserMap
- The map of current Parser.
-
addReferencedObject
public final void addReferencedObject(com.inet.report.ReferencedObject reference)
FOR INTERNAL USE ONLY Adds aReferencedObject
to the list of objects which this object is referencing.- Specified by:
addReferencedObject
in interfacecom.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 aReferencedObject
from the list of objects which this object is referencing.- Specified by:
removeReferencedObject
in interfacecom.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 interfacecom.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 ofReferencedObject
s which this object is referencing at the moment.- Specified by:
getReferencedObjectCount
in interfacecom.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 theReferencedObject
s this object is referencing currently.- Specified by:
getReferencedObjects
in interfacecom.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 interfacecom.inet.report.ReferenceHolder
- Since:
- 6.0
-
resetReferences
public final void resetReferences()
FOR INTERNAL USE ONLY- Specified by:
resetReferences
in interfacecom.inet.report.ReferenceHolder
- Since:
- 6.0
-
-