wt.epm.query
Class Query
java.lang.Object
wt.epm.query.Query
- public class Query
- extends Object
Method Summary |
protected static void |
addIterationFilter(QuerySpec querySpec,
int classIndex,
long[] iterationIds)
|
protected static void |
addMasterFilter(QuerySpec querySpec,
int classIndex,
long[] masterIds)
|
void |
addPackage(String pkg)
|
void |
addPackages(Collection pkgs)
|
protected static void |
appendOpionalAnd(QuerySpec querySpec)
|
private int |
checkChunk()
|
(package private) void |
checkParamName(String name)
|
void |
clearPackages()
|
protected static void |
clearSelectList(QuerySpec querySpec)
|
static Collection |
convertArrayToCollection(Object value)
|
protected static Collection |
convertToLongIdIfPersistable(Collection value)
|
protected static Object |
convertToLongIdIfPersistable(Object value)
|
void |
dumpParserTree(PrintStream out)
|
QueryResult |
execute()
|
private QueryResult |
execute(boolean normalize)
|
protected QueryResult |
execute(QuerySpec querySpec)
|
Map |
execute(String keySelectItom)
|
Map |
execute(String keySelectItom,
boolean distinct)
|
Map |
execute(String keySelectItom,
String valueSelectItom)
|
Map |
execute(String keySelectItom,
String valueSelectItom,
boolean distinct)
|
private QueryResult |
executeChunk(QueryNodes.QueryContext context,
boolean forcePreparation)
|
List |
executeList()
|
List |
executeList(String selectItom)
|
Object |
findFirstObject()
|
Object[] |
findFirstRow()
|
Class |
findJavaClass(String className)
|
int |
getChunkSize()
|
(package private) static ConfigSpecHandler |
getConfigSpecHandler(String name)
|
protected QueryNodes.Node |
getFromCache(String key)
|
protected Set |
getMasters(QuerySpec querySpec,
int classIndex)
|
Object |
getParam(String name)
|
(package private) QueryNodes.QueryRootNode |
getRootNode()
|
(package private) String |
getSql(QuerySpec querySpec)
|
static boolean |
getUseInClauseBindOptimizationProperty()
|
static Map |
indexByLongId(Collection objects)
|
(package private) static void |
internalError(String s)
|
(package private) static void |
invalidConfigSpecName(String name)
|
(package private) static void |
invalidParameterName(String name)
|
(package private) static void |
invalidParameterType(String name,
String assignedType,
String expectedType)
|
private boolean |
isChunkingAvialable()
|
boolean |
isUseAuthorization()
|
boolean |
isUseCache()
|
boolean |
isUseInClauseBindOptimization()
|
(package private) static void |
log(String s)
|
protected static void |
login(String username,
String password)
|
(package private) static void |
logSql(String s)
|
static void |
main(String[] args)
|
Name |
mapAttribute(Name name)
|
void |
mapResultOnParam(String paramName,
String selectItom)
|
protected static Long |
number2Long(Number number)
|
protected static long[] |
numbers2longs(Collection numbers)
|
(package private) static void |
parameterIsNotAssigned(String name)
|
protected void |
parse(String query,
boolean parserDebug)
|
QuerySpec |
prepareQuerySpec()
|
private QueryNodes.QueryScope |
prepareSqueryScope(QueryNodes.QueryContext context)
|
protected static void |
print(QueryResult qr)
|
protected QueryResult |
processConfigSpec(QueryNodes.QueryScope scope,
QueryNodes.ConfigSpecNode configSpecNode)
|
protected QueryResult |
processConfigSpecLine(QuerySpec querySpec,
int iteratedSelectIndex,
ConfigSpec configSpec)
|
protected QueryResult |
processMultiLineConfigSpec1(QueryNodes.QueryScope scope,
int iteratedSelectIndex,
List lines)
|
protected QueryResult |
processMultiLineConfigSpec2(QueryNodes.QueryScope scope,
int iteratedSelectIndex,
List lines)
|
protected QueryResult |
processResultMapping(QueryResult queryResult)
|
protected void |
putToCach(String key,
QueryNodes.Node node)
|
static void |
regirterAttributeMapping(Name virtualName,
Name attrName)
|
static void |
regirterAttributeMapping(String virtualName,
String attrName)
|
static void |
regirterConfigSpecHandler(String name,
ConfigSpecHandler handler)
|
void |
removePackage(String pkg)
|
void |
setChunkSize(int chunkSize)
|
void |
setParam(String name,
Collection value,
String selectItom)
Deprecated. |
void |
setParam(String name,
double value)
|
void |
setParam(String name,
long value)
|
void |
setParam(String name,
Object value)
|
void |
setUseAuthorization(boolean useAuthorization)
|
void |
setUseCache(boolean value)
|
void |
setUseInClauseBindOptimization(boolean value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ATTR_MASTER_ID
public static final String ATTR_MASTER_ID
- See Also:
- Constant Field Values
ATTR_ID
public static final String ATTR_ID
- See Also:
- Constant Field Values
USE_CACHE
static boolean USE_CACHE
USE_IN_CLAUSE_BIND_OPTIMIZATION
static boolean USE_IN_CLAUSE_BIND_OPTIMIZATION
log
public static boolean log
logSql
public static boolean logSql
logTime
public static boolean logTime
queryString
private String queryString
rootNode
private QueryNodes.QueryRootNode rootNode
useCache
private boolean useCache
useInClauseBindOptimization
private boolean useInClauseBindOptimization
useAuthorization
private boolean useAuthorization
packages
private List packages
paramValues
private Map paramValues
selectParamMap
private Map selectParamMap
defaultChunkSize
private static int defaultChunkSize
chunkSize
private int chunkSize
configSpecHandlers
private static Map configSpecHandlers
attrNameMap
private static Map attrNameMap
MAX_ENTRIES
private static final int MAX_ENTRIES
- See Also:
- Constant Field Values
queryCache
private static Map queryCache
Query
public Query(String query)
throws QueryException
Query
public Query(String query,
boolean parserDebug)
throws QueryException
getUseInClauseBindOptimizationProperty
public static boolean getUseInClauseBindOptimizationProperty()
getRootNode
QueryNodes.QueryRootNode getRootNode()
isUseCache
public boolean isUseCache()
setUseCache
public void setUseCache(boolean value)
isUseInClauseBindOptimization
public boolean isUseInClauseBindOptimization()
setUseInClauseBindOptimization
public void setUseInClauseBindOptimization(boolean value)
isUseAuthorization
public boolean isUseAuthorization()
setUseAuthorization
public void setUseAuthorization(boolean useAuthorization)
addPackage
public void addPackage(String pkg)
addPackages
public void addPackages(Collection pkgs)
removePackage
public void removePackage(String pkg)
clearPackages
public void clearPackages()
findJavaClass
public Class findJavaClass(String className)
mapResultOnParam
public void mapResultOnParam(String paramName,
String selectItom)
throws QueryException
- Throws:
QueryException
setParam
public void setParam(String name,
Collection value,
String selectItom)
throws QueryException
- Deprecated.
- Please use setParam(name, value) and mapResultOnParam(paramName, selectItom) instead
- Parameters:
name
- Stringvalue
- CollectionselectItom
- String
- Throws:
QueryException
processResultMapping
protected QueryResult processResultMapping(QueryResult queryResult)
throws QueryException
- Throws:
QueryException
setParam
public void setParam(String name,
Object value)
throws QueryException
- Throws:
QueryException
setParam
public void setParam(String name,
long value)
throws QueryException
- Throws:
QueryException
setParam
public void setParam(String name,
double value)
throws QueryException
- Throws:
QueryException
getParam
public Object getParam(String name)
throws QueryException
- Throws:
QueryException
checkParamName
void checkParamName(String name)
throws QueryException
- Throws:
QueryException
invalidParameterName
static void invalidParameterName(String name)
throws QueryException
- Throws:
QueryException
invalidParameterType
static void invalidParameterType(String name,
String assignedType,
String expectedType)
throws QueryException
- Throws:
QueryException
parameterIsNotAssigned
static void parameterIsNotAssigned(String name)
throws QueryException
- Throws:
QueryException
prepareQuerySpec
public QuerySpec prepareQuerySpec()
throws QueryException
- Throws:
QueryException
prepareSqueryScope
private QueryNodes.QueryScope prepareSqueryScope(QueryNodes.QueryContext context)
throws QueryException
- Throws:
QueryException
findFirstObject
public Object findFirstObject()
throws QueryException
- Throws:
QueryException
findFirstRow
public Object[] findFirstRow()
throws QueryException
- Throws:
QueryException
execute
public Map execute(String keySelectItom)
throws QueryException
- Throws:
QueryException
execute
public Map execute(String keySelectItom,
boolean distinct)
throws QueryException
- Throws:
QueryException
execute
public Map execute(String keySelectItom,
String valueSelectItom)
throws QueryException
- Throws:
QueryException
execute
public Map execute(String keySelectItom,
String valueSelectItom,
boolean distinct)
throws QueryException
- Throws:
QueryException
executeList
public List executeList()
throws QueryException
- Throws:
QueryException
executeList
public List executeList(String selectItom)
throws QueryException
- Throws:
QueryException
execute
public QueryResult execute()
throws QueryException
- Throws:
QueryException
execute
private QueryResult execute(boolean normalize)
throws QueryException
- Throws:
QueryException
executeChunk
private QueryResult executeChunk(QueryNodes.QueryContext context,
boolean forcePreparation)
throws QueryException
- Throws:
QueryException
execute
protected QueryResult execute(QuerySpec querySpec)
throws QueryException
- Throws:
QueryException
setChunkSize
public void setChunkSize(int chunkSize)
getChunkSize
public int getChunkSize()
isChunkingAvialable
private boolean isChunkingAvialable()
checkChunk
private int checkChunk()
throws QueryException
- Throws:
QueryException
dumpParserTree
public void dumpParserTree(PrintStream out)
parse
protected void parse(String query,
boolean parserDebug)
throws QueryException
- Throws:
QueryException
regirterConfigSpecHandler
public static void regirterConfigSpecHandler(String name,
ConfigSpecHandler handler)
throws QueryException
- Throws:
QueryException
getConfigSpecHandler
static ConfigSpecHandler getConfigSpecHandler(String name)
invalidConfigSpecName
static void invalidConfigSpecName(String name)
throws QueryException
- Throws:
QueryException
processConfigSpec
protected QueryResult processConfigSpec(QueryNodes.QueryScope scope,
QueryNodes.ConfigSpecNode configSpecNode)
throws QueryException
- Throws:
QueryException
processMultiLineConfigSpec1
protected QueryResult processMultiLineConfigSpec1(QueryNodes.QueryScope scope,
int iteratedSelectIndex,
List lines)
throws WTException
- Throws:
WTException
processMultiLineConfigSpec2
protected QueryResult processMultiLineConfigSpec2(QueryNodes.QueryScope scope,
int iteratedSelectIndex,
List lines)
throws WTException
- Throws:
WTException
processConfigSpecLine
protected QueryResult processConfigSpecLine(QuerySpec querySpec,
int iteratedSelectIndex,
ConfigSpec configSpec)
throws WTException
- Throws:
WTException
getMasters
protected Set getMasters(QuerySpec querySpec,
int classIndex)
throws WTException
- Throws:
WTException
regirterAttributeMapping
public static void regirterAttributeMapping(String virtualName,
String attrName)
throws QueryException
- Throws:
QueryException
regirterAttributeMapping
public static void regirterAttributeMapping(Name virtualName,
Name attrName)
throws QueryException
- Throws:
QueryException
mapAttribute
public Name mapAttribute(Name name)
throws QueryException
- Throws:
QueryException
putToCach
protected void putToCach(String key,
QueryNodes.Node node)
getFromCache
protected QueryNodes.Node getFromCache(String key)
getSql
String getSql(QuerySpec querySpec)
throws QueryException
- Throws:
QueryException
logSql
static void logSql(String s)
log
static void log(String s)
internalError
static void internalError(String s)
throws QueryException
- Throws:
QueryException
addMasterFilter
protected static void addMasterFilter(QuerySpec querySpec,
int classIndex,
long[] masterIds)
throws WTException
- Throws:
WTException
addIterationFilter
protected static void addIterationFilter(QuerySpec querySpec,
int classIndex,
long[] iterationIds)
throws WTException
- Throws:
WTException
clearSelectList
protected static void clearSelectList(QuerySpec querySpec)
throws WTException
- Throws:
WTException
appendOpionalAnd
protected static void appendOpionalAnd(QuerySpec querySpec)
numbers2longs
protected static long[] numbers2longs(Collection numbers)
number2Long
protected static Long number2Long(Number number)
convertToLongIdIfPersistable
protected static Collection convertToLongIdIfPersistable(Collection value)
throws QueryException
- Throws:
QueryException
convertToLongIdIfPersistable
protected static Object convertToLongIdIfPersistable(Object value)
throws QueryException
- Throws:
QueryException
indexByLongId
public static Map indexByLongId(Collection objects)
throws QueryException
- Throws:
QueryException
convertArrayToCollection
public static Collection convertArrayToCollection(Object value)
throws QueryException
- Throws:
QueryException
login
protected static void login(String username,
String password)
print
protected static void print(QueryResult qr)
main
public static void main(String[] args)