Class FieldsMapping


  • public class FieldsMapping
    extends Object
    Matching of fields in queries and their aliases
    • Constructor Detail

      • FieldsMapping

        public FieldsMapping​(QueryWizardSource source)
        Parameters:
        source - QueryWizardSource
      • FieldsMapping

        public FieldsMapping​(QueryWizardSource source,
                             int fieldsCount)
        Parameters:
        source - QueryWizardSource
        fieldsCount - count of columns with fields
      • FieldsMapping

        public FieldsMapping​(FieldsMapping baseMapping)
        Parameters:
        baseMapping - base fields matching
    • Method Detail

      • eraseAliasesWithEmptyFields

        public static void eraseAliasesWithEmptyFields​(QueryWizardSource source)
        Remove aliases with empty fields matching
        Parameters:
        source - query wizard source
      • changeFieldsMapping

        public static void changeFieldsMapping​(QueryWizardSource source,
                                               FieldsMapping mapping,
                                               FieldsMapping newMapping)
        Change matching of fields
        Parameters:
        source - QueryWizardSource
        mapping - old fields matching
        newMapping - new fields matching
      • getFieldMappingForField

        public static FieldsMapping getFieldMappingForField​(QuerySchemaExpression field,
                                                            FieldsMapping parentMapping)
        Looking for fields matching for given field
        Parameters:
        field - - field in the same fields matching. Can't be null.
        parentMapping - - parent fields matching. Can't be null.
        Returns:
        fields matching if found, else null
      • createNestedFieldMapping

        public static void createNestedFieldMapping​(QueryWizardSource source,
                                                    int unionPos,
                                                    QuerySchemaExpression field,
                                                    FieldsMapping parentMapping)
        Create nested field mapping
        Parameters:
        source - QueryWizardSource
        unionPos -
        field -
        parentMapping -
      • findChildByAlias

        public FieldsMapping findChildByAlias​(String alias)
        Find child fields mapping by alias
        Parameters:
        alias - - alias. Can by like NestedTableAlias.NestedFieldAlias
        Returns:
        fields mapping or null
      • getImage

        public org.eclipse.swt.graphics.Image getImage()
        Get image for field mapping
        Returns:
        image
      • fieldsCount

        public int fieldsCount()
        Returns:
        fields (columns) count
      • getField

        public QuerySchemaExpression getField​(int column)
        Getting field from column
        Parameters:
        column - given column
        Returns:
        field in column
      • getParent

        public FieldsMapping getParent()
        Returns:
        parent fields matching
      • copyFields

        public void copyFields​(FieldsMapping fieldsMapping)
        Coping fields from given fields matching
        Parameters:
        fieldsMapping - base fields matching
      • removeChild

        public void removeChild​(FieldsMapping fieldMapping)
        Removing child fields matching
        Parameters:
        fieldMapping - fields matching which will be removed
      • isRoot

        public boolean isRoot()
        Is fields matching root
        Returns:
        true if true
      • isFieldsEmpty

        public boolean isFieldsEmpty()
        Is all columns have NULL expressions?
        Returns:
        true if true
      • getFirstNotNullField

        public QuerySchemaExpression getFirstNotNullField()
        Returns:
        first not null field
      • moveChild

        public void moveChild​(FieldsMapping fieldMapping,
                              int newIndex)
        Move fields mapping
        Parameters:
        fieldMapping - field mapping
        newIndex - new index
      • setChildAt

        public void setChildAt​(int index,
                               FieldsMapping newMapping)
        Setting new child fields matching
        Parameters:
        index -
        newMapping - new fields matching
      • eraseChildAt

        public void eraseChildAt​(int index)
        Remove child fields matching
        Parameters:
        index -
      • synchronizeColumnsFieldsCount

        public void synchronizeColumnsFieldsCount()
        Synchronizing fields counts in operators and nested tables
      • setAlias

        public void setAlias​(String alias)
        Setting new alias
        Parameters:
        alias - new alias