protected Object doEvaluate(Object context, Map env) {
Query oclQuery = getQuery();
if (oclQuery == null) {
return null;
}
EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
// init environment
for (Iterator it = env.entrySet().iterator(); it.hasNext();) {
Map.Entry nextEntry = (Map.Entry) it.next();
evalEnv.replace((String) nextEntry.getKey(), nextEntry
.getValue());
}
try {
initExtentMap(context);
Object result = oclQuery.evaluate(context);
return (result != oclInstance.getEnvironment()
.getOCLStandardLibrary().getOclInvalid()) ? result
: null;
} finally {
evalEnv.clear();
oclQuery.getExtentMap().clear();
}
}