@SuppressWarnings("unchecked")
public Object invoke(MethodInvocation mi) throws Throwable {
Object result = null;
Method m = mi.getMethod();
Method superMethod = null;
Indexed indexedAnno = null;
Cached cachedAnno = null;
String cn = getClass().getSimpleName();
try {
superMethod = DAO.class.getMethod(m.getName(), m.getParameterTypes());
indexedAnno = Config.SEARCH_ENABLED ? superMethod.getAnnotation(Indexed.class) : null;
cachedAnno = Config.CACHE_ENABLED ? superMethod.getAnnotation(Cached.class) : null;
} catch (Exception e) {
logger.error(null, e);
}
// result = indexingAction(mi, indexedAnno);
Object[] args = mi.getArguments();
String appid = AOPUtils.getFirstArgOfString(args);
if (indexedAnno != null) {
switch (indexedAnno.action()) {
case ADD:
ParaObject addMe = AOPUtils.getArgOfParaObject(args);
if (Utils.isValidObject(addMe)) {
result = mi.proceed();
search.index(appid, addMe);