List of usage examples for org.apache.commons.chain Context get
V get(Object key);
From source file:com.sf.ddao.chain.CtxHelper.java
public static <T> T get(Context ctx, Class<T> clazz) { //noinspection unchecked return (T) ctx.get(clazz.toString()); }
From source file:com.sf.ddao.conn.ConnectionHandlerHelper.java
public static Connection getConnection(Context context) throws SQLException { Connection conn = (Connection) context.get(CONNECTION_KEY); if (conn == null) { ConnectionHandlerHelper connectionHandlerHelper = CtxHelper.get(context, ConnectionHandlerHelper.class); conn = connectionHandlerHelper.connectionOnHold.get(); if (conn != null) { return conn; }/*from w w w.j ava 2 s . c om*/ conn = connectionHandlerHelper.createConnection(context); setConnection(context, conn); } return conn; }
From source file:com.sf.ddao.chain.CtxHelper.java
public static <T> T get(Context ctx, Class<T> clazz, Callable<T> callback) throws Exception { //noinspection unchecked T res = (T) ctx.get(clazz.toString()); if (res == null) { res = callback.call();/*from w w w .ja v a 2s .co m*/ put(ctx, clazz, res); } return res; }
From source file:com.azaptree.services.command.util.CommandUtils.java
public static <T> T get(final Context ctx, final TypeReferenceKey<T> key) { Assert.notNull(ctx, "ctx is required"); Assert.notNull(key, "key is required"); final T t = (T) ctx.get(key.getName()); return t != null ? t : key.getDefaultValue(); }
From source file:com.netsteadfast.greenstep.bsc.util.PerformanceScoreChainUtils.java
public static void createOrUpdateMonitorItemScore(String dateVal, Context context) throws ServiceException, Exception { ChainResultObj result = getResult(context); if (result.getValue() == null || ((BscStructTreeObj) result.getValue()).getVisions() == null || ((BscStructTreeObj) result.getValue()).getVisions().size() == 0) { logger.warn("No data!"); return;/*w w w. ja v a2s . c o m*/ } //String dateVal = SimpleUtils.getStrYMD(""); String frequency = (String) context.get("frequency"); String orgId = (String) context.get("orgId"); String empId = (String) context.get("empId"); List<VisionVO> visions = ((BscStructTreeObj) result.getValue()).getVisions(); for (VisionVO vision : visions) { List<PerspectiveVO> perspectives = vision.getPerspectives(); MonitorItemScoreVO visionMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.VISION, vision.getVisId()); //visionMonitorItemScore.setScore( BscReportSupportUtils.parse2(vision.getScore()) ); setScore(visionMonitorItemScore, vision.getScore()); saveOrUpdateMonitorItemScore(visionMonitorItemScore); for (PerspectiveVO perspective : perspectives) { List<ObjectiveVO> objectives = perspective.getObjectives(); MonitorItemScoreVO perspectiveMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.PERSPECTIVES, perspective.getPerId()); //perspectiveMonitorItemScore.setScore( BscReportSupportUtils.parse2(perspective.getScore()) ); setScore(perspectiveMonitorItemScore, perspective.getScore()); saveOrUpdateMonitorItemScore(perspectiveMonitorItemScore); for (ObjectiveVO objective : objectives) { List<KpiVO> kpis = objective.getKpis(); MonitorItemScoreVO objectiveMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.STRATEGY_OF_OBJECTIVES, objective.getObjId()); //objectiveMonitorItemScore.setScore( BscReportSupportUtils.parse2(objective.getScore()) ); setScore(objectiveMonitorItemScore, objective.getScore()); saveOrUpdateMonitorItemScore(objectiveMonitorItemScore); for (KpiVO kpi : kpis) { MonitorItemScoreVO kpiMonitorItemScore = getMonitorItemScore(dateVal, frequency, orgId, empId, MonitorItemType.KPI, kpi.getId()); //kpiMonitorItemScore.setScore( BscReportSupportUtils.parse2(kpi.getScore()) ); setScore(kpiMonitorItemScore, kpi.getScore()); saveOrUpdateMonitorItemScore(kpiMonitorItemScore); } } } } }
From source file:com.netsteadfast.greenstep.base.BaseChainCommandSupport.java
public Object getResult(Context context) { return context.get(ChainConstants.CHAIN_RESULT); }
From source file:com.sf.ddao.factory.param.ContextParameter.java
public Object extractParam(Context context) throws SQLException { return context.get(name); }
From source file:com.netsteadfast.greenstep.base.BaseChainCommandSupport.java
public String getMessage(Context context) { return (String) context.get(ChainConstants.CHAIN_MESSAGE); }
From source file:com.liulangf.pattern.gof.behavioral.chain.jakarta.simple.ForwardCommand.java
/** * Return the uri to forward to./*from ww w . ja va2 s . com*/ * * @param context The {@link Context} we are operating on * @return The uri to forward to */ protected String getForward(Context context) { String uri = (String) context.get("forward"); if (uri == null) { uri = getForward(); } return uri; }
From source file:com.netsteadfast.greenstep.base.chain.SimpleChain.java
private ChainResultObj getResult(Context context) throws Exception { ChainResultObj resultObj = new ChainResultObj(); resultObj.setValue(context.get(ChainConstants.CHAIN_RESULT)); resultObj.setMessage(StringUtils.defaultString((String) context.get(ChainConstants.CHAIN_MESSAGE))); return resultObj; }