/** * Description: <br> * * @author 王伟<br> * @taskId <br> * @param class1 * @param id * @return * @throws DaoException <br> */ @Override public <T> T get(Class<T> entityClass, Serializable id) throws DaoException { Assert.notNull(id, ErrorCodeDef.ID_IS_NULL); return (T) getSession().get(entityClass, id); }
/** * Description: <br> * * @author 王伟<br> * @taskId <br> * @param entityName * @param id * @throws DaoException <br> */ @Override public <T> void deleteEntityById(Class<T> entityName, Serializable id) throws DaoException { Assert.notNull(id, ErrorCodeDef.ID_IS_NULL); delete(get(entityName, id)); }
public static <T> T proxy(Class<T> clazz, CacheProxy cacheProxy) { if (Modifier.isAbstract(clazz.getModifiers())) { T target = null; if (StringUtils.isNotEmpty(cacheProxy.name())) { target = ContextHolder.getContext().getBean(cacheProxy.name(), clazz); } else { target = ContextHolder.getContext().getBean(clazz); } Assert.notNull(target, ErrorCodeDef.PROXY_TARGET_NOT_FOUND, clazz); CachePorxyInvocationHandler invocationHandler = new CachePorxyInvocationHandler(target, cacheProxy, clazz); @SuppressWarnings("unchecked") T proxyObj = (T) Proxy.newProxyInstance(clazz.getClassLoader(), clazz.isInterface() ? new Class[] { clazz } : clazz.getInterfaces(), invocationHandler); LoggerUtil.info("Success cache proxy clazz[{0}].", clazz); return proxyObj; } return null; }
public static <T extends Serializable> int flowStart(T bean, String flowName, boolean throwable) { Assert.notNull(bean, ErrorCodeDef.NOT_NULL, "FlowBean"); int result = ErrorCodeDef.SUCCESS; // match flow config FlowConfig config = match(flowName); Assert.notNull(config, ErrorCodeDef.FLOW_NOT_MATCH, bean); try { execute(bean, new FlowContext(config)); } catch (Exception e) { LoggerUtil.error("flow process error.", e); FrameworkException fe = e instanceof FrameworkException ? (FrameworkException) e : new FrameworkException(e); if (throwable) { throw fe; } result = fe.getCode(); } return result; }
Assert.notNull(dataSource, ErrorCodeDef.DB_DATASOURCE_NOT_SET, dbCode);
if (StringUtils.isNotEmpty(component)) { FlowComponent flowComponent = ContextHolder.getContext().getBean(component, FlowComponent.class); Assert.notNull(flowComponent, ErrorCodeDef.FLOW_COMPONENT_NOT_FOUND, component); config.setComponent(flowComponent);
@SuppressWarnings("unchecked") public static <T extends Serializable> void execute(T flowBean, FlowContext flowContext) throws Exception { FlowConfig flowConfig = flowContext.getFlowConfig(); Assert.notNull(flowConfig, ErrorCodeDef.FLOW_COMPONENT_NOT_FOUND);