use of com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExprMap in project bamboobsc by billchen198318.
the class ServiceScriptExpressionUtils method getParameters.
private static Map<String, Object> getParameters(TbSysBeanHelpExpr beanHelpExpr, List<TbSysBeanHelpExprMap> beanHelpExprMaps, Object resultObj, ProceedingJoinPoint pjp) {
Object[] args = pjp.getArgs();
Map<String, Object> dataMap = new HashMap<String, Object>();
for (TbSysBeanHelpExprMap map : beanHelpExprMaps) {
Object value = null;
if (YesNo.YES.equals(map.getMethodResultFlag())) {
value = resultObj;
} else {
for (int i = 0; args != null && i < args.length; i++) {
if (args[i] != null && args[i].getClass() != null && args[i].getClass().getName().equals(map.getMethodParamClass()) && map.getMethodParamIndex() == i) {
value = args[i];
}
}
}
dataMap.put(map.getVarName(), value);
}
return dataMap;
}
use of com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExprMap in project bamboobsc by billchen198318.
the class ServiceScriptExpressionUtils method process.
private static void process(String runType, String beanId, Method method, String system, Object resultObj, ProceedingJoinPoint pjp) throws ServiceException, Exception {
SysBeanHelpVO beanHelp = loadSysBeanHelperData(beanId, method.getName(), system);
if (!YesNo.YES.equals(beanHelp.getEnableFlag())) {
return;
}
List<TbSysBeanHelpExpr> beanHelpExprs = loadSysBeanHelpExprsData(beanHelp);
if (beanHelpExprs == null || beanHelpExprs.size() < 1) {
return;
}
for (TbSysBeanHelpExpr helpExpr : beanHelpExprs) {
SysExpressionVO expression = new SysExpressionVO();
expression.setExprId(helpExpr.getExprId());
DefaultResult<SysExpressionVO> eResult = sysExpressionService.findByUK(expression);
if (eResult.getValue() == null) {
continue;
}
expression = eResult.getValue();
List<TbSysBeanHelpExprMap> exprMaps = loadSysBeanHelpExprMapsData(helpExpr);
/* 2015-04-14 rem
try {
ScriptExpressionUtils.execute(
expression.getType(),
expression.getContent(),
null,
getParameters(helpExpr, exprMaps, resultObj, pjp));
} catch (Exception e) {
e.printStackTrace();
}
*/
// 不要 try catch 包起來, 讓外面也能接到 Exception
ScriptExpressionUtils.execute(expression.getType(), expression.getContent(), null, getParameters(helpExpr, exprMaps, resultObj, pjp));
}
}
use of com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExprMap in project bamboobsc by billchen198318.
the class SystemBeanHelpLogicServiceImpl method delete.
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(SysBeanHelpVO beanHelp) throws ServiceException, Exception {
if (beanHelp == null || super.isBlank(beanHelp.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
// delete TB_SYS_BEAN_HELP_EXPR
Map<String, Object> params = new HashMap<String, Object>();
params.put("helpOid", beanHelp.getOid());
List<TbSysBeanHelpExpr> exprList = this.sysBeanHelpExprService.findListByParams(params);
for (int i = 0; exprList != null && i < exprList.size(); i++) {
// delete TB_SYS_BEAN_HELP_EXPR_MAP
TbSysBeanHelpExpr helpExpr = exprList.get(i);
params.clear();
params.put("helpExprOid", helpExpr.getOid());
List<TbSysBeanHelpExprMap> exprMapList = this.sysBeanHelpExprMapService.findListByParams(params);
for (int j = 0; exprMapList != null && j < exprMapList.size(); j++) {
TbSysBeanHelpExprMap helpExprMap = exprMapList.get(j);
this.sysBeanHelpExprMapService.delete(helpExprMap);
}
this.sysBeanHelpExprService.delete(helpExpr);
}
return sysBeanHelpService.deleteObject(beanHelp);
}
Aggregations