Class QueryWizardSource


  • public class QueryWizardSource
    extends Observable
    Contains query schema and hold current query and current operator. Also sync changes in query schema and notifies listeners about changes.
    • Field Detail

      • QUERY_SCHEMA_SOURCES_REMOVE

        public static final int QUERY_SCHEMA_SOURCES_REMOVE
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_SOURCES_REMOVE_ALL

        public static final int QUERY_SCHEMA_SOURCES_REMOVE_ALL
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_SOURCES_ADD

        public static final int QUERY_SCHEMA_SOURCES_ADD
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_SELECT_FIELD_SET

        public static final int QUERY_SCHEMA_SELECT_FIELD_SET
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_ALIAS_REMOVE

        public static final int QUERY_SCHEMA_ALIAS_REMOVE
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_SOURCES_CHANGE

        public static final int QUERY_SCHEMA_SOURCES_CHANGE
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_FIELD_ALIAS_CHANGED

        public static final int QUERY_SCHEMA_FIELD_ALIAS_CHANGED
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_VIRTUAL_TABLE_PARAMETERS_CHANGED

        public static final int QUERY_SCHEMA_VIRTUAL_TABLE_PARAMETERS_CHANGED
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_BEFORE_REMOVE_TEMPORARY_TABLE

        public static final int QUERY_SCHEMA_BEFORE_REMOVE_TEMPORARY_TABLE
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_TOTALS_CONTROLS_POINTS

        public static final int QUERY_SCHEMA_TOTALS_CONTROLS_POINTS
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_TOTALS_EXPRESSIONS

        public static final int QUERY_SCHEMA_TOTALS_EXPRESSIONS
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_DCS_SELECT_FIELDS

        public static final int QUERY_SCHEMA_DCS_SELECT_FIELDS
        See Also:
        Constant Field Values
      • QUERY_SCHEMA_DCS_CONDITIONS

        public static final int QUERY_SCHEMA_DCS_CONDITIONS
        See Also:
        Constant Field Values
      • QUERY_SOURCE_ALIAS_CHANGED

        public static final int QUERY_SOURCE_ALIAS_CHANGED
        See Also:
        Constant Field Values
      • SUM_EXPRESSION

        public static final Integer SUM_EXPRESSION
      • MIN_EXPRESSION

        public static final Integer MIN_EXPRESSION
      • MAX_EXPRESSION

        public static final Integer MAX_EXPRESSION
      • AVG_EXPRESSION

        public static final Integer AVG_EXPRESSION
      • COUNT_EXPRESSION

        public static final Integer COUNT_EXPRESSION
      • CONDITION_AND_EXPRESSION

        public static final Integer CONDITION_AND_EXPRESSION
    • Constructor Detail

      • QueryWizardSource

        public QueryWizardSource​(QuerySchema querySchema,
                                 org.eclipse.core.resources.IProject project)
        Parameters:
        querySchema - - querySchema query schema
        project - - context project
      • QueryWizardSource

        public QueryWizardSource​(QueryWizardSource qwSource)
        Parameters:
        qwSource - - base query wizard source. Call notifyBeforeChange before editing query schema.
    • Method Detail

      • setQuerySchema

        public void setQuerySchema​(QuerySchema querySchema)
        Set query schema
        Parameters:
        querySchema -
      • setQuerySchemaByCopy

        public void setQuerySchemaByCopy​(QuerySchema querySchema)
        Set query schema by copy
        Parameters:
        querySchema - - query schema
      • setQuerySchema

        public void setQuerySchema​(QuerySchema querySchema,
                                   boolean addEditAdapter)
        Set query schema
        Parameters:
        querySchema -
        addEditAdapter - - is need edit adapter. "false" can be if using query schema from another query wizard source, and also have edit adapter
      • isDcsMode

        public boolean isDcsMode()
        Is used query schema for dcs
        Returns:
        if query schema for dcs return true
      • getQuerySchema

        public QuerySchema getQuerySchema()
        Return query schema. Not use QuerySchema for getting queries. Use getQueries()
        Returns:
        query schema
      • getCurrentRootFieldsMapping

        public FieldsMapping getCurrentRootFieldsMapping()
        Get current fields mapping
        Returns:
        fields mapping
      • getCurrentOperator

        public QuerySchemaOperator getCurrentOperator()
        Return current operator
        Returns:
        current operator. Can be null if current query is not QuerySchemaSelectQuery or current operator index is not valid
      • getCurrentOperators

        public org.eclipse.emf.common.util.EList<QuerySchemaOperator> getCurrentOperators()
        Return current operators
        Returns:
        current operators. Can be null if current query is not QuerySchemaSelectQuery
      • setCurrentQueryIndex

        public void setCurrentQueryIndex​(int index)
        Set current query index
        Parameters:
        index - - current query index
      • setCurrentOperatorIndex

        public void setCurrentOperatorIndex​(int index)
        Set current operator index
        Parameters:
        index - - current operator index
      • getCurrentQueryIndex

        public int getCurrentQueryIndex()
        Return current query index
        Returns:
        current query index
      • getCurrentOperatorIndex

        public int getCurrentOperatorIndex()
        Return current operator index
        Returns:
        current operator index
      • getQlGeneratorMultiLangProposals

        public QlGeneratorMultiLangProposals getQlGeneratorMultiLangProposals()
        Get multiLang proposals
        Returns:
        multiLang proposals
      • setTempTableFields

        public void setTempTableFields​(QuerySchemaSource source,
                                       List<?> fields)
        Set available fields for temporary table
        Parameters:
        fields - - fields collection
      • notifyBeforeChange

        public void notifyBeforeChange()
        Use this method for notify that query schema will be modified. After call query schema will be replaced by copy, just one time for several calls. For copy-on-write support.
      • refreshModel

        public void refreshModel()
        Refresh query schema model
      • getScriptVariant

        public ScriptVariant getScriptVariant()
        Get current script variant (English or Russian)
        Returns:
        script variant
      • getExpressionPrototype

        public org.eclipse.emf.ecore.EObject getExpressionPrototype​(int prototype,
                                                                    boolean checkScriptVariant)
        Get prototype of expression
        Parameters:
        prototype - id
        checkScriptVariant - if need check current script variant
        project - current project
        Returns:
        expression prototype
      • getTempQuerySchema

        public QuerySchema getTempQuerySchema​(org.eclipse.core.resources.IProject project)
        Get temporary query schema
        Parameters:
        project - - project
        Returns:
        query schema
      • validateQuerySchema

        public String validateQuerySchema()
        Check query schema on errors
        Returns:
        null if no errors, or errors descriptions in query schema
      • notifyChange

        public void notifyChange​(int notifyType)
        Notify adapter about change
        Parameters:
        notifyType -
      • notifyChange

        public void notifyChange​(int notifyType,
                                 Object value)
        Notify adapter about change
        Parameters:
        notifyType -
        value - changed value
      • getDbViewVirtualFieldProcessor

        public DbViewVirtualFieldProcessor getDbViewVirtualFieldProcessor()
        Get DbViewVirtualFieldProcessor
        Returns:
        DbViewVirtualFieldProcessor
      • getDerivedTypeDbViewComputer

        public DerivedTypeComputerForDbViewQuery getDerivedTypeDbViewComputer()
        Get DerivedTypeComputerForDbViewQuery
        Returns:
        DerivedTypeComputerForDbViewQuery
      • getQlMapper

        public QlMapper getQlMapper()
        Get ql mapper
        Returns:
        ql mapper
      • getSerializer

        public org.eclipse.xtext.serializer.ISerializer getSerializer()
        Returns serializer
        Returns:
        serializer
      • getResourceValidator

        public org.eclipse.xtext.validation.IResourceValidator getResourceValidator()
        Get resource validator
        Returns:
        resource validator
      • getProject

        public org.eclipse.core.resources.IProject getProject()
        Get project
        Returns:
        current project
      • disableChangeNotifications

        public void disableChangeNotifications()
        Disable change notifications
      • enableChangeNotifications

        public void enableChangeNotifications()
        Enable change notifications
      • isEnabledChangeNotifications

        public boolean isEnabledChangeNotifications()
        Is enabled change notifications
        Returns:
      • getQueryParameters

        public List<String> getQueryParameters()
        Get all parameters used in query
        Returns:
        list of parameters
      • getQueryParameters

        public List<String> getQueryParameters​(boolean isAddAmpersand)
        Get all parameters used in query
        Parameters:
        isAddAmpersand - - add ampersand before parameter
        Returns:
        list of parameters
      • setAvailableTables

        public void setAvailableTables​(List<AvailableTable> availableTables)
        Set available tables for query schema
        Parameters:
        availableTables -
      • getAvailableTables

        public List<AvailableTable> getAvailableTables()
        Get available tables for query schema
        Parameters:
        availableTables -
      • setCurrentNestedQuery

        public void setCurrentNestedQuery​(QuerySchemaSource nestedQuerySource)
        Set current nested query from query schema for working
        Parameters:
        nestedQuerySource -
      • getCurrentNestedQuery

        public QuerySchemaSource getCurrentNestedQuery()
        Get current nested query, if was set
        Returns:
        nested query if was set, otherwise null
      • getAllAliases

        public Set<String> getAllAliases()
        Get all aliases used in query
        Returns:
        list of aliases
      • notifyUndoRedoAtions

        public void notifyUndoRedoAtions()
        Notify undo or redo ation
      • getEObjectText

        public String getEObjectText​(org.eclipse.emf.ecore.EObject object)
        Get EObject text
        Parameters:
        object - - object
        Returns:
        object text
      • getFuncByName

        public FunctionExpression getFuncByName​(String name)
        Get FunctionExpression by name
        Parameters:
        name - - function name
        Returns:
        FunctionExpression or null if not found
      • recalculateIssues

        public void recalculateIssues​(QuerySchemaBuilder builder)
        Recalculates schema issues.
        Parameters:
        builder - - builder to build query schema. Cannot be null.