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 classQueryWizardSource.NotificationWithValueNotification of change with valueclassQueryWizardSource.QuerySchemaEditAdapterEdit adapter for query schema sourcestatic classQueryWizardSource.QueryWizardSourceNotifyTypeType of source change
-
Field Summary
Fields Modifier and Type Field Description static IntegerAVG_EXPRESSIONstatic IntegerCONDITION_AND_EXPRESSIONstatic IntegerCOUNT_EXPRESSIONstatic IntegerMAX_EXPRESSIONstatic IntegerMIN_EXPRESSIONstatic intQUERY_SCHEMA_ALIAS_REMOVEstatic intQUERY_SCHEMA_BEFORE_REMOVE_TEMPORARY_TABLEstatic intQUERY_SCHEMA_DCS_CONDITIONSstatic intQUERY_SCHEMA_DCS_SELECT_FIELDSstatic intQUERY_SCHEMA_FIELD_ADDstatic intQUERY_SCHEMA_FIELD_ALIAS_CHANGEDstatic intQUERY_SCHEMA_FILTERstatic intQUERY_SCHEMA_ORDERstatic intQUERY_SCHEMA_SELECT_FIELD_SETstatic intQUERY_SCHEMA_SOURCES_ADDstatic intQUERY_SCHEMA_SOURCES_CHANGEstatic intQUERY_SCHEMA_SOURCES_REMOVEstatic intQUERY_SCHEMA_SOURCES_REMOVE_ALLstatic intQUERY_SCHEMA_TOTALS_CONTROLS_POINTSstatic intQUERY_SCHEMA_TOTALS_EXPRESSIONSstatic intQUERY_SCHEMA_VIRTUAL_TABLE_PARAMETERS_CHANGEDstatic intQUERY_SOURCE_ALIAS_CHANGEDstatic IntegerSUM_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 voiddisableChangeNotifications()Disable change notificationsvoidenableChangeNotifications()Enable change notificationsQueryWizardSource.QuerySchemaEditAdaptergetAdapter()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.QuerySchemaSourcegetCurrentNestedQuery()Get current nested query, if was setQuerySchemaOperatorgetCurrentOperator()Return current operatorintgetCurrentOperatorIndex()Return current operator indexorg.eclipse.emf.common.util.EList<QuerySchemaOperator>getCurrentOperators()Return current operatorsAbstractQuerySchemaQuerygetCurrentQuery()Return current queryintgetCurrentQueryIndex()Return current query indexFieldsMappinggetCurrentRootFieldsMapping()Get current fields mappingDbViewVirtualFieldProcessorgetDbViewVirtualFieldProcessor()Get DbViewVirtualFieldProcessorDerivedTypeComputerForDbViewQuerygetDerivedTypeDbViewComputer()Get DerivedTypeComputerForDbViewQueryStringgetEObjectText(org.eclipse.emf.ecore.EObject object)Get EObject textMap<AbstractExpression,String>getExpressinsTextCache()Get cached expressions textorg.eclipse.emf.ecore.EObjectgetExpressionPrototype(int prototype, boolean checkScriptVariant)Get prototype of expressionFunctionExpressiongetFuncByName(String name)Get FunctionExpression by nameorg.eclipse.core.resources.IProjectgetProject()Get projectQlDerivedFunctionProvidergetQlDerivedFunctionProvider()Gets actualQlDerivedFunctionProviderQlGeneratorMultiLangProposalsgetQlGeneratorMultiLangProposals()Get multiLang proposalsQlMappergetQlMapper()Get ql mapperList<AbstractQuerySchemaQuery>getQueries()Get queriesList<String>getQueryParameters()Get all parameters used in queryList<String>getQueryParameters(boolean isAddAmpersand)Get all parameters used in queryQuerySchemagetQuerySchema()Return query schema.org.eclipse.xtext.validation.IResourceValidatorgetResourceValidator()Get resource validatorScriptVariantgetScriptVariant()Get current script variant (English or Russian)org.eclipse.xtext.serializer.ISerializergetSerializer()Returns serializerQuerySchemagetTempQuerySchema(org.eclipse.core.resources.IProject project)Get temporary query schemaList<DbViewElement>getTempTableFields(QuerySchemaSource source)Get available fields for temporary tableIExpressionTypeCheckergetTypeChecker()Get type checkerbooleanisDcsMode()Is used query schema for dcsbooleanisEnabledChangeNotifications()Is enabled change notificationsvoidnotifyBeforeChange()Use this method for notify that query schema will be modified.voidnotifyChange(int notifyType)Notify adapter about changevoidnotifyChange(int notifyType, Object value)Notify adapter about changevoidnotifyUndoRedoAtions()Notify undo or redo ationvoidrecalculateIssues(QuerySchemaBuilder builder)Recalculates schema issues.voidrefreshModel()Refresh query schema modelvoidsetAvailableTables(List<AvailableTable> availableTables)Set available tables for query schemavoidsetCurrentNestedQuery(QuerySchemaSource nestedQuerySource)Set current nested query from query schema for workingvoidsetCurrentOperatorIndex(int index)Set current operator indexvoidsetCurrentQueryIndex(int index)Set current query indexvoidsetQuerySchema(QuerySchema querySchema)Set query schemavoidsetQuerySchema(QuerySchema querySchema, boolean addEditAdapter)Set query schemavoidsetQuerySchemaByCopy(QuerySchema querySchema)Set query schema by copyvoidsetTempTableFields(QuerySchemaSource source, List<?> fields)Set available fields for temporary tableStringvalidateQuerySchema()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.
-
-