Package com._1c.g5.v8.dt.qw.ui.utils
Class QueryWizardSource
- java.lang.Object
-
- java.util.Observable
-
- com._1c.g5.v8.dt.qw.ui.utils.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QueryWizardSource.NotificationWithValue
Notification of change with valueclass
QueryWizardSource.QuerySchemaEditAdapter
Edit adapter for query schema sourcestatic class
QueryWizardSource.QueryWizardSourceNotifyType
Type of source change
-
Field Summary
Fields Modifier and Type Field Description static Integer
AVG_EXPRESSION
static Integer
CONDITION_AND_EXPRESSION
static Integer
COUNT_EXPRESSION
static Integer
MAX_EXPRESSION
static Integer
MIN_EXPRESSION
static int
QUERY_SCHEMA_ALIAS_REMOVE
static int
QUERY_SCHEMA_BEFORE_REMOVE_TEMPORARY_TABLE
static int
QUERY_SCHEMA_DCS_CONDITIONS
static int
QUERY_SCHEMA_DCS_SELECT_FIELDS
static int
QUERY_SCHEMA_FIELD_ADD
static int
QUERY_SCHEMA_FIELD_ALIAS_CHANGED
static int
QUERY_SCHEMA_FILTER
static int
QUERY_SCHEMA_ORDER
static int
QUERY_SCHEMA_SELECT_FIELD_SET
static int
QUERY_SCHEMA_SOURCES_ADD
static int
QUERY_SCHEMA_SOURCES_CHANGE
static int
QUERY_SCHEMA_SOURCES_REMOVE
static int
QUERY_SCHEMA_SOURCES_REMOVE_ALL
static int
QUERY_SCHEMA_TOTALS_CONTROLS_POINTS
static int
QUERY_SCHEMA_TOTALS_EXPRESSIONS
static int
QUERY_SCHEMA_VIRTUAL_TABLE_PARAMETERS_CHANGED
static int
QUERY_SOURCE_ALIAS_CHANGED
static Integer
SUM_EXPRESSION
-
Constructor Summary
Constructors Constructor Description QueryWizardSource(QuerySchema querySchema, org.eclipse.core.resources.IProject project)
QueryWizardSource(QueryWizardSource qwSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disableChangeNotifications()
Disable change notificationsvoid
enableChangeNotifications()
Enable change notificationsQueryWizardSource.QuerySchemaEditAdapter
getAdapter()
Return current adapterSet<String>
getAllAliases()
Get all aliases used in queryList<AvailableTable>
getAvailableTables()
Get available tables for query schemaCollection<org.eclipse.xtext.validation.Issue>
getCachedIssues()
Returns schema issues calculated on lastrecalculateIssues(QuerySchemaBuilder)
call.QuerySchemaSource
getCurrentNestedQuery()
Get current nested query, if was setQuerySchemaOperator
getCurrentOperator()
Return current operatorint
getCurrentOperatorIndex()
Return current operator indexorg.eclipse.emf.common.util.EList<QuerySchemaOperator>
getCurrentOperators()
Return current operatorsAbstractQuerySchemaQuery
getCurrentQuery()
Return current queryint
getCurrentQueryIndex()
Return current query indexFieldsMapping
getCurrentRootFieldsMapping()
Get current fields mappingDbViewVirtualFieldProcessor
getDbViewVirtualFieldProcessor()
Get DbViewVirtualFieldProcessorDerivedTypeComputerForDbViewQuery
getDerivedTypeDbViewComputer()
Get DerivedTypeComputerForDbViewQueryString
getEObjectText(org.eclipse.emf.ecore.EObject object)
Get EObject textMap<AbstractExpression,String>
getExpressinsTextCache()
Get cached expressions textorg.eclipse.emf.ecore.EObject
getExpressionPrototype(int prototype, boolean checkScriptVariant)
Get prototype of expressionFunctionExpression
getFuncByName(String name)
Get FunctionExpression by nameorg.eclipse.core.resources.IProject
getProject()
Get projectQlDerivedFunctionProvider
getQlDerivedFunctionProvider()
Gets actualQlDerivedFunctionProvider
QlGeneratorMultiLangProposals
getQlGeneratorMultiLangProposals()
Get multiLang proposalsQlMapper
getQlMapper()
Get ql mapperList<AbstractQuerySchemaQuery>
getQueries()
Get queriesList<String>
getQueryParameters()
Get all parameters used in queryList<String>
getQueryParameters(boolean isAddAmpersand)
Get all parameters used in queryQuerySchema
getQuerySchema()
Return query schema.org.eclipse.xtext.validation.IResourceValidator
getResourceValidator()
Get resource validatorScriptVariant
getScriptVariant()
Get current script variant (English or Russian)org.eclipse.xtext.serializer.ISerializer
getSerializer()
Returns serializerQuerySchema
getTempQuerySchema(org.eclipse.core.resources.IProject project)
Get temporary query schemaList<DbViewElement>
getTempTableFields(QuerySchemaSource source)
Get available fields for temporary tableIExpressionTypeChecker
getTypeChecker()
Get type checkerboolean
isDcsMode()
Is used query schema for dcsboolean
isEnabledChangeNotifications()
Is enabled change notificationsvoid
notifyBeforeChange()
Use this method for notify that query schema will be modified.void
notifyChange(int notifyType)
Notify adapter about changevoid
notifyChange(int notifyType, Object value)
Notify adapter about changevoid
notifyUndoRedoAtions()
Notify undo or redo ationvoid
recalculateIssues(QuerySchemaBuilder builder)
Recalculates schema issues.void
refreshModel()
Refresh query schema modelvoid
setAvailableTables(List<AvailableTable> availableTables)
Set available tables for query schemavoid
setCurrentNestedQuery(QuerySchemaSource nestedQuerySource)
Set current nested query from query schema for workingvoid
setCurrentOperatorIndex(int index)
Set current operator indexvoid
setCurrentQueryIndex(int index)
Set current query indexvoid
setQuerySchema(QuerySchema querySchema)
Set query schemavoid
setQuerySchema(QuerySchema querySchema, boolean addEditAdapter)
Set query schemavoid
setQuerySchemaByCopy(QuerySchema querySchema)
Set query schema by copyvoid
setTempTableFields(QuerySchemaSource source, List<?> fields)
Set available fields for temporary tableString
validateQuerySchema()
Check query schema on errors-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
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_FILTER
public static final int QUERY_SCHEMA_FILTER
- 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_ORDER
public static final int QUERY_SCHEMA_ORDER
- 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
-
QUERY_SCHEMA_FIELD_ADD
public static final int QUERY_SCHEMA_FIELD_ADD
- 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 schemaproject
- - 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
-
getAdapter
public QueryWizardSource.QuerySchemaEditAdapter getAdapter()
Return current adapter- Returns:
-
getQuerySchema
public QuerySchema getQuerySchema()
Return query schema. Not use QuerySchema for getting queries. Use getQueries()- Returns:
- query schema
-
getQueries
public List<AbstractQuerySchemaQuery> getQueries()
Get queries- Returns:
- queries collection
-
getCurrentQuery
public AbstractQuerySchemaQuery getCurrentQuery()
Return current query- Returns:
- current query
-
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
-
getTypeChecker
public IExpressionTypeChecker getTypeChecker()
Get type checker- Returns:
- type checker
-
getQlGeneratorMultiLangProposals
public QlGeneratorMultiLangProposals getQlGeneratorMultiLangProposals()
Get multiLang proposals- Returns:
- multiLang proposals
-
getQlDerivedFunctionProvider
public QlDerivedFunctionProvider getQlDerivedFunctionProvider()
Gets actualQlDerivedFunctionProvider
- Returns:
- actual
QlDerivedFunctionProvider
, nevernull
-
getTempTableFields
public List<DbViewElement> getTempTableFields(QuerySchemaSource source)
Get available fields for temporary table- Returns:
- fields collection
-
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
- idcheckScriptVariant
- if need check current script variantproject
- 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
-
getExpressinsTextCache
public Map<AbstractExpression,String> getExpressinsTextCache()
Get cached expressions text- Returns:
-
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 benull
.
-
getCachedIssues
public Collection<org.eclipse.xtext.validation.Issue> getCachedIssues()
Returns schema issues calculated on lastrecalculateIssues(QuerySchemaBuilder)
call.- Returns:
- cached schema issues. Cannot return
null
.
-
-