use of com.jfinal.aop.Before in project jfinal by jfinal.
the class ProxyGenerator method getMethodUpperInterceptors.
/**
* 获取 method 上层的拦截器,也即获取 global、class 这两层拦截器
* 注意:global 层拦截器已结合 class 层 @Clear 注解处理过
*/
protected List<Class<?>> getMethodUpperInterceptors(ProxyClass proxyClass) {
List<Class<?>> ret;
// 结合 class 级 @Clear,得到 global 级拦截器
Clear clearOnClass = proxyClass.getTarget().getAnnotation(Clear.class);
if (clearOnClass != null) {
Class<?>[] clearIntersOnClass = clearOnClass.value();
if (clearIntersOnClass.length != 0) {
// class 级 @clear 且带参
ret = InterceptorManager.me().getGlobalServiceInterceptorClasses();
removeInterceptor(ret, clearIntersOnClass);
} else {
ret = new ArrayList<>(3);
}
} else {
ret = InterceptorManager.me().getGlobalServiceInterceptorClasses();
}
// 追加 class 级拦截器
Before beforeOnClass = proxyClass.getTarget().getAnnotation(Before.class);
if (beforeOnClass != null) {
Class<?>[] classInters = beforeOnClass.value();
for (Class<?> c : classInters) {
ret.add(c);
}
}
return ret;
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class ProcessController method processInstanceDetail.
// 流程详情
@Before(IdRequired.class)
public void processInstanceDetail() {
// 流程实例 id
String processInstanceId = get("id");
HistoricProcessInstance instance = ActivitiUtils.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).includeProcessVariables().singleResult();
// 申请人
String initiator = (String) instance.getProcessVariables().get(ActConst.APPLY_USER);
// 发起表单数据
String applyFormData = (String) instance.getProcessVariables().get(ActConst.APPLY_FORM_DATA);
// 发起表单模板id
String formTplId = (String) instance.getProcessVariables().get(ActConst.APPLY_FORM_TPL_ID);
ActFormTpl formTpl = ActFormTpl.dao.findById(formTplId);
set("initiator", initiator);
set("instanceId", processInstanceId);
set("instanceName", instance.getName());
set("applyFormData", applyFormData);
// 表单模板
set("applyFormTpl", formTpl.getTemplate());
if (instance.getDeleteReason() != null) {
// 删除原因(用户取消任务才会存在)
set("delReason", instance.getDeleteReason());
}
if (instance.getEndTime() != null) {
// 流程结束时间
set("endTime", instance.getEndTime());
}
render("process/processInstance_detail.ftl");
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class ProcessDeployController method downloadZip.
/**
* 下载部署包
*/
@Before(IdRequired.class)
public void downloadZip() {
String deploymentId = get("id");
Deployment deployment = ActivitiUtils.getRepositoryService().createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (deployment == null) {
renderFail("部署包不存在");
return;
}
List<String> resourceNames = ActivitiUtils.getRepositoryService().getDeploymentResourceNames(deploymentId);
List<InputStream> resourceDatas = new ArrayList<>();
for (String resourceName : resourceNames) {
resourceDatas.add(ActivitiUtils.getRepositoryService().getResourceAsStream(deploymentId, resourceName));
}
render(ZipRender.me().filenames(resourceNames).dataIn(resourceDatas).fileName("部署包[id-" + deployment.getId() + "].zip"));
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class ProcessModelController method modelDeploy.
// 模型部署
@Before(IdRequired.class)
public void modelDeploy() throws IOException {
String modelId = get("id");
Model model = ActivitiUtils.getRepositoryService().getModel(modelId);
if (model == null) {
renderFail("参数错误");
return;
}
ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(ActivitiUtils.getRepositoryService().getModelEditorSource(model.getId()));
BpmnModel bpmnModel = new BpmnJsonConverter().convertToBpmnModel(modelNode);
// 这样是为了 流程定义转换为 模型是 ,模型能有 名称和 描述
if (StringUtils.isEmpty(bpmnModel.getMainProcess().getDocumentation())) {
bpmnModel.getMainProcess().setDocumentation((String) JSON.parseObject(model.getMetaInfo()).get("description"));
}
if (StringUtils.isEmpty(bpmnModel.getMainProcess().getName())) {
bpmnModel.getMainProcess().setName(model.getName());
}
byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(bpmnModel);
Deployment deployment = ActivitiUtils.getRepositoryService().createDeployment().name("通过model部署,modelId: " + model.getId()).addString(bpmnModel.getMainProcess().getId() + ".bpmn", new String(bpmnBytes, ActConst.DEFAULT_CHARSET)).deploy();
renderSuccess("部署成功,部署ID=" + deployment.getId());
}
use of com.jfinal.aop.Before in project my_curd by qinyou.
the class ProcessModelController method deleteAction.
// 删除模型
@Before(IdsRequired.class)
public void deleteAction() {
String ids = getPara("ids");
RepositoryService service = ActivitiUtils.getRepositoryService();
for (String id : ids.split(",")) {
service.deleteModel(id);
}
renderSuccess("删除成功");
}
Aggregations