Class ParentToChildConnection


  • public class ParentToChildConnection
    extends Object
    A parent-to-child connection joins the parent attribute of a hierarchical table with a corresponding child attribute via the designated operator. The designated attributes should be valid attributes of the corresponding table.
    Author:
    Ulrich Kreher
    • Constructor Detail

      • ParentToChildConnection

        public ParentToChildConnection​(String parentAttribute,
                                       String operator,
                                       String childAttribute)
        Creates a new parent-to-child-connection to use in a hierarchical query. It has to be ensured, that the designated attributes are legal. Take care if the column of both attributes can be NULL! In this case the join may fail since NULL = NULL is false so the corresponding tuple will not be in the join and therefore in the recursion step. In this case you will need to add two additional parent child connections using <parentAttribute>, "IS", "NULL", false and <childAttribute>, "IS", NULL, true
        Parameters:
        parentAttribute - The attribute of the parent-tuples to use in the join. If the columns of this attribute and the child attribute are nullable, you will need to add two additional parent to child connections for comparing each attribute with the constant NULL.
        operator - The operator used to join parent- and child-tuples.
        childAttribute - The attribute of the parent-tuples to use in the join. If the columns of this attribute and the child attribute are nullable, you will need to add two additional parent to child connections for comparing each attribute with the constant NULL.
      • ParentToChildConnection

        public ParentToChildConnection​(String attribute,
                                       String operator,
                                       String value,
                                       boolean childAttribute)
        Creates a new condition to compare a parent or child attribute with a constant.
        Parameters:
        attribute - The attribute of either the parent or the child tuples to compare with a constant.
        operator - The operator used to compare the attribute with a constant value.
        value - The (constant) value with which to compare the attribute.
        childAttribute - Whether the attribute is a child attribute (or a parent attribute). This is used to prefix the attribute appropriately so that it refers to the right table.
      • ParentToChildConnection

        protected ParentToChildConnection​(String parentAttribute,
                                          boolean parentConstant,
                                          String operator,
                                          String childAttribute,
                                          boolean childConstant)
        Creates a new parent-to-child-connection to use in a hierarchical query. Attributes may be constants which means, they select from the parent- or child-tuples. It has to be ensured, that the designated attributes are legal.
        Parameters:
        parentAttribute - The attribute of the parent-tuples to use in the join.
        parentConstant - Whether the attribute for the parent tuples is a constant and should therefore not be prefixed. In this case it selects from the child tuples.
        operator - The operator used to join parent- and child-tuples.
        childAttribute - The attribute of the parent-tuples to use in the join.
        childConstant - Whether the attribute for the child tuples is a constant and should therefore not be prefixed. In this case it selects from the parent tuples.
    • Method Detail

      • getParentAttribute

        public String getParentAttribute()
        Gets the attribute of the parent-tuples to use to join child-tuples with.
        Returns:
        The attribute of the parent-tuples to use to join child-tuples with.
      • isParentAttributeConstant

        public boolean isParentAttributeConstant()
        Gets whether the attribute for the parent tuples is a constant and should therefore not be prefixed. In this case it selects from the child tuples. A constant attribute is used on the right side of the operator.
        Returns:
        Whether the attribute for the parent tuples is a constant and should therefore not be prefixed. In this case it selects from the child tuples.
      • getOperator

        public String getOperator()
        Gets the operator used to join parent- and child-tuples.
        Returns:
        The operator used to join parent- and child-tuples.
      • getChildAttribute

        public String getChildAttribute()
        Gets the attribute of the child-tuples to use to join parent-tuples with.
        Returns:
        The attribute of the child-tuples to use to join parent-tuples with.
      • isChildAttributeConstant

        public boolean isChildAttributeConstant()
        Gets whether the attribute for the child tuples is a constant and should therefore not be prefixed. In this case it selects from the parent tuples. A constant attribute is used on the right side of the operator.
        Returns:
        Whether the attribute for the child tuples is a constant and should therefore not be prefixed. In this case it selects from the parent tuples.