|
楼主 |
发表于 2017-5-26 15:58:12
|
显示全部楼层
我仿照写了一个,但是报错“ 编码: JUSTEP150084; 提示: "/OA/knowledge/process/publishKnowledge/queryKMKnowledgeAction"没有定义参数"dataModel" ”
我在下面是定义了 action.setParameter("dataModel", "/OA/knowledge/data");
代码如下:
Action action = new Action();
// 指定动作的process、activity和action,这里要注意登录的用户应该有执行这个功能中的这个动作的权限
action.setProcess("/OA/knowledge/process/publishKnowledge/publishKnowledgeProcess");
action.setActivity("applyActivity");
action.setName("queryKMKnowledgeAction"); //查询action名称
// 设置动作参数
List<String> range = new ArrayList<String>();
int limit = 20;
int offset = 1;
Map variables=new HashMap();
action.setParameter("concept", "OA_KM_Knowledge");
action.setParameter("select", "OA_KM_Knowledge.*");
action.setParameter("from", "OA_KM_Knowledge OA_KM_Knowledge");
action.setParameter("aggregate", "");
action.setParameter("dataModel", "/OA/knowledge/data");
action.setParameter("fnModel", "");
action.setParameter("condition", "");
action.setParameter("range", range);
action.setParameter("distinct", false);
action.setParameter("idColumn", "OA_KM_Knowledge");
action.setParameter("filter", "");
action.setParameter("limit", limit);
action.setParameter("offset", offset);
action.setParameter("columns", "");
action.setParameter("orderBy", "");
action.setParameter("aggregateColumns", "");
action.setParameter("variables", variables);
// action.setParameter("concept", new java.sql.Date(startDate.getTime()));
// action.setParameter("endDate", new java.sql.Date(endDate.getTime()));
// action.setParameter("borrower", borrower);
// 调用动作
ActionResult actionResult = ActionEngine.invokeAction(action, ActionUtils.JSON_CONTENT_TYPE, bsessionid, null, null);
// 判断是否调用成功
if (actionResult.isSuccess()) {
// 返回值
pw.write(actionResult.getDatas().toString());
} else {
throw new RuntimeException(actionResult.getMessage());
}
//----------
response.flushBuffer();
|
|