请选择发布的流程:
onclick="doploy()" />
@POST
@Path("/deploy/")
@Produces(MediaType.APPLICATION_JSON)
@LogAnnotation(operationName = "发布流程")
public String deployProcess(@RequestParam(required=false) MultipartFile processDef) {
ZipInputStream zis = null;
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder
.getRequestAttributes()).getRequest();
try {
request.setCharacterEncoding("UTF-8");
String deployFile = request.getParameter("processDef");
if (deployFile != null && !deployFile.isEmpty()) {
ProcessEngine processEngine = Configuration.getProcessEngine();
RepositoryService repositoryService = processEngine
.getRepositoryService();
zis = new ZipInputStream(processDef.getInputStream());
repositoryService.createDeployment()
.addResourcesFromZipInputStream(zis).deploy();
zis.close();
} else {
return GlobalConstant.FAILURE;
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return GlobalConstant.FAILURE;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return GlobalConstant.FAILURE;
} finally {
try {
if(zis != null){
zis.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return GlobalConstant.SUCCESS;
}