public String convert(List<Map<String, String>> datas, String uid) { Action cmsaction = ControlFactory.getControl().getAction(CMSACTION); if (cmsaction != null) { Output cmsoutput = cmsaction.getOutput(uid); List<Parameter> parameters = cmsoutput.getParameters(); String convertor = cmsoutput.getConvertor(); String method = cmsoutput.getMethod(); if (StringUtil.isEmpty(convertor)) { convertor = "com.ai.eduportal.convertor.CmsResultConvert"; } if (StringUtil.isEmpty(method)) { log.error("{} convert to json has't config the convert method.", null, uid); return null; } Class<?>[] paramcls = new Class<?>[] {List.class, List.class}; Object[] paramvals = new Object[] {datas, parameters}; return ClassUtil.invokMethod(String.class, convertor, method, paramcls, paramvals); } else { log.error("{} convert to json has't get the action:{}", null, uid, CMSACTION); } return null; }
/** 清空所有缓存 */ public void clearAllCache() { SpringContextHelper.instance.getOscache().clear(); try { System.out.println("---clearAllCache-1--"); String baseDir = EDU_APP_BASEDIR; // ServletActionContext.getServletContext().getRealPath("/"); System.out.println("---clearAllCache-2--"); getHomeTops(baseDir, new ArrayList<Map<String, String>>()); System.out.println("---clearAllCache-3--"); } catch (Exception e) { log.error("clearAllCache", "{} called.加载应用信息失败:{}", e); } log.info("clearAllCache", "{} called.清空所有缓存完成。"); }
public void contextInitialized(ServletContextEvent event) { super.contextInitialized(event); final CmsServiceClient cmsService = SpringContextHelper.getBean("cmsClient", CmsServiceClient.class); final String baseDir = event.getServletContext().getRealPath("/"); CmsServiceClient.EDU_APP_BASEDIR = baseDir; logger.info("contextInitialized", "※---------{} init---> get cms homeTops start."); new Thread( new Runnable() { public void run() { try { cmsService.getHomeTops(baseDir, new ArrayList<Map<String, String>>()); logger.info( "contextInitialized", baseDir, "※---------{} init---> get cms homeTops End the base dir is {}."); } catch (Exception e) { logger.error("※---------{} init error:{}", e, "contextInitialized"); } } }) .start(); }