Package com._1c.g5.v8.dt.ql
Class QlUtil
- java.lang.Object
-
- com._1c.g5.v8.dt.ql.QlUtil
-
public class QlUtil extends Object
Methods for this class is used in different area of ql and ql.dcs
-
-
Constructor Summary
Constructors Constructor Description QlUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static intcheckForNull(Object objF, Object objS)static voidcleanUpQueryCache(QuerySchema object)Clean up query cache than may holds reference to the query schema objects.static TypeDescriptioncloneTypeDescription(TypeDescription source)Create copy of type descriptionstatic intcompareValueDateLiteral(DateLiteralExpression dateFt, DateLiteralExpression dateSd)compare two date literalsstatic Map<String,String>createUserDataIntnl()Gets user data intnl for indexing valuesstatic Map<String,String>createUserDataRu()Gets user data ru for indexing valuesstatic TypeDescriptionexpandTypeSet(TypeDescription initialType, org.eclipse.emf.ecore.EObject context)static TypeDescriptionSourceexpandTypeSet(TypeDescriptionSource initialType, org.eclipse.emf.ecore.EObject context)static booleanfieldFromCompoundType(CommonExpression expr, IExpressionTypeChecker qlChecker)static DbViewElementgetDbView(org.eclipse.emf.ecore.EObject object, IDynamicDbViewFieldComputer dynamicDbViewComputer)Try found refer toDbViewElementinobjectstatic ACommonExpressiongetExpressionOfNestedTable(CommonExpression expression, IDynamicDbViewFieldComputer dbViewComputer)Gets expression corresponding to the field of nested tablestatic List<DbViewFieldDef>getFieldsFromOriginalDbView(DbViewElement dbViewDef, IDynamicDbViewFieldComputer dynamicDbViewComputer)Get fields fromdbViewDef, whendbViewDef.getMdObject() != nullanddbViewDef.getMdObject()was linked with another DbViewstatic List<String>getProposalsNameFor(org.eclipse.xtext.scoping.IScope scope, boolean isTable)Get string proposals from scope (only that instance ofTable)static CommonExpressiongetRefExpressionOfNestedTable(CommonExpression expression, IDynamicDbViewFieldComputer dbViewComputer)Gets expression corresponding to reference field of nested tablestatic StringgetTypeName(TypeDescription type, boolean isRussian)return name of the type, language sensetivestatic StringgetTypeName(TypeDescriptionSource type, boolean isRussian)Return name of the type, language sensetivestatic booleanisCompoundType(TypeDescription type, org.eclipse.emf.ecore.EObject context)Compound type is the type which has 2 or more TypeItem.static booleanisCompoundType(TypeDescriptionSource type, org.eclipse.emf.ecore.EObject context)Compound type is the type which has 2 or more TypeItem.static booleanisCurrentLangRussian(org.eclipse.emf.ecore.EObject eObject)Deprecated.Use the variant with provided services due to performance reasonsstatic booleanisCurrentLangRussian(org.eclipse.emf.ecore.EObject eObject, IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager)Check current language of configuration forScriptVariant.RUSSIANstatic booleanisCurrentLangRussian(org.eclipse.emf.ecore.resource.Resource resource)Deprecated.Use the variant with provided services due to performance reasonsstatic booleanisCurrentLangRussian(org.eclipse.emf.ecore.resource.Resource resource, IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager)Check current language of configuration forScriptVariant.RUSSIANstatic booleanisExternalDataSourceTable(AbstractQuerySchemaTable input)Checks thatAbstractQuerySchemaTablecorresponding to the table ofExternalDataSourceobjectDbViewElement.static booleanisExternalDataSourceTable(CommonExpression input)static booleanisExternaldataSourceTemporaryTable(AbstractQuerySchemaTable input)Checks thatAbstractQuerySchemaTablecorresponding to the temporary table ofExternalDataSourceChecks for full naming without using alias from query - segments count inAbstractQuerySchemaTableshould equals 4, it should be start fromEXTERNAL_DATA_SOURCE.static booleanisFloatNumber(NumberLiteralExpression number)static booleanisNestedTable(DbViewElement dbView)Checks thatdbViewis nested tablestatic booleanisPartOfBracketCommonExpression(CommonExpression expression)Checks thatexpressioncorresponding to the {@link QlPackage#Literals#BRACKET_COMMON_EXPRESSION__COMMON_EXPRESSION} partstatic booleanisPeriodKeyword(CommonExpression expr, QlTypeDescriptionContainer qlTypeDescr)Checks thatCommonExpressioncontent corresponding to period keywordstatic booleanisQSExprNestedTable(QuerySchemaExpression qsExpr, IDynamicDbViewFieldComputer dbViewComputer)Checks that expression contains link to nested tablestatic booleanisSpecialCompoundType(TypeDescription type, org.eclipse.emf.ecore.EObject context)Compound type is the type which has 2 or more TypeItem which have different base types and not is ref types.static booleanisSpecialCompoundType(TypeDescriptionSource type, org.eclipse.emf.ecore.EObject context)Compound type is the type which has 2 or more TypeItem which have different base types and not is ref types.static booleanisUnfixedType(TypeDescription type)Checks qualifiers of string and binary type for 'fix'static booleanisUnlimitedType(TypeDescription type)Checks qualifiers of string and binary type for 'unlimited'static booleanisUnlimitedType(TypeDescriptionSource type)Checks qualifiers of string and binary type for 'unlimited'static booleanisZeroNumber(NumberLiteralExpression number)ChecksNumberLiteralExpressionfor zerostatic intnumberOfFields(QuerySchemaExpression qsExpr, IDynamicDbViewFieldComputer dynamicDbViewComputer)determine number of fields forqsExpr
-
-
-
Method Detail
-
isFloatNumber
public static boolean isFloatNumber(NumberLiteralExpression number)
- Parameters:
number-- Returns:
- if number is float value then
true, else returnfalse
-
cleanUpQueryCache
public static void cleanUpQueryCache(QuerySchema object)
Clean up query cache than may holds reference to the query schema objects. This method also cleans any cache for nested query schemas.- Parameters:
object- the query schema object, cannot benull.
-
cloneTypeDescription
public static TypeDescription cloneTypeDescription(TypeDescription source)
Create copy of type description- Parameters:
source- sourceTypeDescription, cannot benull- Returns:
- created copy, cannot be
null
-
isZeroNumber
public static boolean isZeroNumber(NumberLiteralExpression number)
ChecksNumberLiteralExpressionfor zero- Parameters:
number-NumberLiteralExpressionchecking number, cannot benull- Returns:
- if integer and fractional part of number equal zero then
true, else returnfalse
-
getTypeName
public static String getTypeName(TypeDescription type, boolean isRussian)
return name of the type, language sensetive- Parameters:
type-isRussian-- Returns:
- name of the type
-
getTypeName
public static String getTypeName(TypeDescriptionSource type, boolean isRussian)
Return name of the type, language sensetive- Parameters:
type- theTypeDescriptionSource, may benullisRussian- Request russion variant of the name if true- Returns:
- The type name. Never
null
-
isQSExprNestedTable
public static boolean isQSExprNestedTable(QuerySchemaExpression qsExpr, IDynamicDbViewFieldComputer dbViewComputer)
Checks that expression contains link to nested table- Parameters:
qsExpr- checkingQuerySchemaExpression, cannot benulldbViewComputer- actualIDynamicDbViewFieldComputer, cannot benull- Returns:
- if
qsExprcorresponding to nested table expression in ql language thentrueelsefalse
-
isNestedTable
public static boolean isNestedTable(DbViewElement dbView)
Checks thatdbViewis nested table- Parameters:
dbView- checking dbView, can benull- Returns:
- if
dbViewcorresponding to nested table thentrueelsefalse
-
numberOfFields
public static int numberOfFields(QuerySchemaExpression qsExpr, IDynamicDbViewFieldComputer dynamicDbViewComputer)
determine number of fields forqsExpr- Parameters:
qsExpr-dynamicDbViewComputer- special computer ofDbViewElementfromCommonExpressionorAbstractQuerySchemaTable- Returns:
- number of fields
-
isUnfixedType
public static boolean isUnfixedType(TypeDescription type)
Checks qualifiers of string and binary type for 'fix'- Parameters:
type- checking type, cannot benull- Returns:
true, if string 'not fix',falseotherwise
-
isUnlimitedType
public static boolean isUnlimitedType(TypeDescription type)
Checks qualifiers of string and binary type for 'unlimited'- Parameters:
type- checking type, cannot benull- Returns:
true, if string 'unlimited'falseotherwise
-
isUnlimitedType
public static boolean isUnlimitedType(TypeDescriptionSource type)
Checks qualifiers of string and binary type for 'unlimited'- Parameters:
type- checking type, cannot benull- Returns:
true, if string 'unlimited'falseotherwise
-
isCompoundType
public static boolean isCompoundType(TypeDescription type, org.eclipse.emf.ecore.EObject context)
Compound type is the type which has 2 or more TypeItem.- Parameters:
type- cannot benull- Returns:
- true, if it's compound
-
isCompoundType
public static boolean isCompoundType(TypeDescriptionSource type, org.eclipse.emf.ecore.EObject context)
Compound type is the type which has 2 or more TypeItem.- Parameters:
type- cannot benull- Returns:
- true, if it's compound
-
isSpecialCompoundType
public static boolean isSpecialCompoundType(TypeDescription type, org.eclipse.emf.ecore.EObject context)
Compound type is the type which has 2 or more TypeItem which have different base types and not is ref types. This method not expandTypeSetfromTypeDescription- Parameters:
type- checkedTypeDescription, cannot benullcontext- context object for expandTypeSetinTypeDescription, cannot benull- Returns:
- true, if it's compound
-
isSpecialCompoundType
public static boolean isSpecialCompoundType(TypeDescriptionSource type, org.eclipse.emf.ecore.EObject context)
Compound type is the type which has 2 or more TypeItem which have different base types and not is ref types. This method not expandTypeSetfromTypeDescription- Parameters:
type- checkedTypeDescription, cannot benullcontext- context object for expandTypeSetinTypeDescription, cannot benull- Returns:
- true, if it's compound
-
compareValueDateLiteral
public static int compareValueDateLiteral(DateLiteralExpression dateFt, DateLiteralExpression dateSd)
compare two date literals- Parameters:
dateFt-dateSd-- Returns:
- 0 - if dateFt == dateSd, 1 - if dateFt > dateSd, -1 - if dateFt < dateSd, 2 - if dateFt not comparable with dateSd
-
getDbView
public static DbViewElement getDbView(org.eclipse.emf.ecore.EObject object, IDynamicDbViewFieldComputer dynamicDbViewComputer)
Try found refer toDbViewElementinobject- Parameters:
object-dynamicDbViewComputer- special computer ofDbViewElementfromCommonExpressionorAbstractQuerySchemaTable- Returns:
- actual dbView for this
objectornull
-
getFieldsFromOriginalDbView
public static List<DbViewFieldDef> getFieldsFromOriginalDbView(DbViewElement dbViewDef, IDynamicDbViewFieldComputer dynamicDbViewComputer)
Get fields fromdbViewDef, whendbViewDef.getMdObject() != nullanddbViewDef.getMdObject()was linked with another DbView- Parameters:
dbViewDef-dynamicDbViewComputer- special computer ofDbViewElementfromCommonExpressionorAbstractQuerySchemaTable- Returns:
- fields of original dbView for
dbViewDef
-
checkForNull
public static int checkForNull(Object objF, Object objS)
- Parameters:
objF-objS-- Returns:
- 0 - both != null; 1 - both == null; -1 - else
-
isCurrentLangRussian
@Deprecated public static boolean isCurrentLangRussian(org.eclipse.emf.ecore.EObject eObject)
Deprecated.Use the variant with provided services due to performance reasonsCheck current language of configuration forScriptVariant.RUSSIAN- Parameters:
eObject- actual object- Returns:
- true, if current language of configuration equal
ScriptVariant.RUSSIAN - See Also:
ScriptVariant
-
isCurrentLangRussian
public static boolean isCurrentLangRussian(org.eclipse.emf.ecore.EObject eObject, IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager)Check current language of configuration forScriptVariant.RUSSIAN- Parameters:
eObject- actual objectresourceLookup-IResourceLookupservice reference. May not benullv8ProjectManager-IV8ProjectManagerservice reference. May not benull- Returns:
- true, if current language of configuration equal
ScriptVariant.RUSSIAN - See Also:
ScriptVariant
-
isCurrentLangRussian
@Deprecated public static boolean isCurrentLangRussian(org.eclipse.emf.ecore.resource.Resource resource)
Deprecated.Use the variant with provided services due to performance reasonsCheck current language of configuration forScriptVariant.RUSSIAN- Parameters:
resource- actual resource- Returns:
- true, if current language of configuration equal
ScriptVariant.RUSSIAN - See Also:
ScriptVariant
-
isCurrentLangRussian
public static boolean isCurrentLangRussian(org.eclipse.emf.ecore.resource.Resource resource, IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager)Check current language of configuration forScriptVariant.RUSSIAN- Parameters:
resource- actual resourceresourceLookup-IResourceLookupservice reference. May not benullv8ProjectManager-IV8ProjectManagerservice reference. May not benull- Returns:
- true, if current language of configuration equal
ScriptVariant.RUSSIAN - See Also:
ScriptVariant
-
getProposalsNameFor
public static List<String> getProposalsNameFor(org.eclipse.xtext.scoping.IScope scope, boolean isTable)
Get string proposals from scope (only that instance ofTable)- Parameters:
scope-isTable- define what kind of type proposals we look up - table or field- Returns:
- list of proposals
-
createUserDataRu
public static Map<String,String> createUserDataRu()
Gets user data ru for indexing values- Returns:
- user data ru for indexing values, never
null
-
createUserDataIntnl
public static Map<String,String> createUserDataIntnl()
Gets user data intnl for indexing values- Returns:
- user data intnl for indexing values, never
null
-
isPeriodKeyword
public static boolean isPeriodKeyword(CommonExpression expr, QlTypeDescriptionContainer qlTypeDescr)
Checks thatCommonExpressioncontent corresponding to period keyword- Parameters:
expr- checkingCommonExpression, cannot benullqlTypeDescr- actualQlTypeDescriptionContainercannot benull- Returns:
trueifCommonExpressioncontent corresponding to period keyword,falseotherwise
-
getExpressionOfNestedTable
public static ACommonExpression getExpressionOfNestedTable(CommonExpression expression, IDynamicDbViewFieldComputer dbViewComputer)
Gets expression corresponding to the field of nested table- Parameters:
expression- checking expression, cannot benulldbViewComputer- actualIDynamicDbViewFieldComputer, cannot benull- Returns:
- expression corresponding to field of nested table or
nullif field wasn't found
-
getRefExpressionOfNestedTable
public static CommonExpression getRefExpressionOfNestedTable(CommonExpression expression, IDynamicDbViewFieldComputer dbViewComputer)
Gets expression corresponding to reference field of nested table- Parameters:
expression- checking expression, cannot benulldbViewComputer- actualIDynamicDbViewFieldComputer, cannot benull- Returns:
- expression corresponding to reference field of nested table or
nullif reference field wasn't found
-
isPartOfBracketCommonExpression
public static boolean isPartOfBracketCommonExpression(CommonExpression expression)
Checks thatexpressioncorresponding to the {@link QlPackage#Literals#BRACKET_COMMON_EXPRESSION__COMMON_EXPRESSION} part- Parameters:
expression- checking expression, cannot benull- Returns:
trueifexpressioncorresponding to the {@link QlPackage#Literals#BRACKET_COMMON_EXPRESSION__COMMON_EXPRESSION} part,falseotherwise
-
expandTypeSet
public static TypeDescription expandTypeSet(TypeDescription initialType, org.eclipse.emf.ecore.EObject context)
- Parameters:
initialType- initialTypeDescriptionchecking for containing ofTypeSetofDefinedTypeorChartOfCharacteristicTypes, cannot benullcontext- actualEObjectfor resolving, cannot benull- Returns:
TypeDescriptionwith types fromTypeSetofDefinedTypeorChartOfCharacteristicTypes, nevernull
-
expandTypeSet
public static TypeDescriptionSource expandTypeSet(TypeDescriptionSource initialType, org.eclipse.emf.ecore.EObject context)
- Parameters:
initialType- initialTypeDescriptionchecking for containing ofTypeSetofDefinedTypeorChartOfCharacteristicTypes, cannot benullcontext- actualEObjectfor resolving, cannot benull- Returns:
TypeDescriptionwith types fromTypeSetofDefinedTypeorChartOfCharacteristicTypes, nevernull
-
fieldFromCompoundType
public static boolean fieldFromCompoundType(CommonExpression expr, IExpressionTypeChecker qlChecker)
-
isExternalDataSourceTable
public static boolean isExternalDataSourceTable(CommonExpression input)
Checks thatCommonExpressioncorresponding to the field ofExternalDataSourceobjectDbViewElement. Checks for full naming without using alias from query - segments count inCommonExpressionshould be more than 4, it should be start fromEXTERNAL_DATA_SOURCE. SeeMdUtil.getFullyQualifiedName(com._1c.g5.v8.dt.metadata.mdclass.MdObject)forExternalDataSourceand its objects- Parameters:
input- checkingCommonExpression, cannot benull- Returns:
trueifCommonExpressionis table ofExternalDataSourceobjects,falseotherwise
-
isExternalDataSourceTable
public static boolean isExternalDataSourceTable(AbstractQuerySchemaTable input)
Checks thatAbstractQuerySchemaTablecorresponding to the table ofExternalDataSourceobjectDbViewElement. Checks for full naming without using alias from query - segments count inAbstractQuerySchemaTableshould be more than 4, it should be start fromEXTERNAL_DATA_SOURCE. SeeMdUtil.getFullyQualifiedName(com._1c.g5.v8.dt.metadata.mdclass.MdObject)forExternalDataSourceand its objects- Parameters:
input- checkingAbstractQuerySchemaTable, cannot benull- Returns:
trueifAbstractQuerySchemaTableis table ofExternalDataSourceobjects,falseotherwise
-
isExternaldataSourceTemporaryTable
public static boolean isExternaldataSourceTemporaryTable(AbstractQuerySchemaTable input)
Checks thatAbstractQuerySchemaTablecorresponding to the temporary table ofExternalDataSourceChecks for full naming without using alias from query - segments count inAbstractQuerySchemaTableshould equals 4, it should be start fromEXTERNAL_DATA_SOURCE.- Parameters:
input- checkingAbstractQuerySchemaTable, cannot benull- Returns:
trueifAbstractQuerySchemaTableis temporary table ofExternalDataSourceobjects,falseotherwise
-
-