use of com.netsteadfast.greenstep.vo.SysBpmnResourceVO in project bamboobsc by billchen198318.
the class BusinessProcessManagementUtils method deployment.
public static String deployment(SysBpmnResourceVO sysBpmnResource) throws ServiceException, Exception {
DefaultResult<SysBpmnResourceVO> result = sysBpmnResourceService.findByUK(sysBpmnResource);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
ZipInputStream zip = new ZipInputStream(new ByteArrayInputStream(result.getValue().getContent()));
Deployment deployment = null;
try {
deployment = repositoryService.createDeployment().name(result.getValue().getName()).addZipInputStream(zip).deploy();
result.getValue().setDeploymentId(deployment.getId());
byte[] content = result.getValue().getContent();
// 先清掉content
result.getValue().setContent(null);
// 先清掉content
sysBpmnResourceService.updateObject(result.getValue());
// 填回content
result.getValue().setContent(content);
// 填回content
sysBpmnResourceService.updateObject(result.getValue());
logger.info("deployment Id: " + deployment.getId() + " , name: " + deployment.getName());
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage().toString());
throw e;
} finally {
zip.close();
zip = null;
}
return deployment.getId();
}
use of com.netsteadfast.greenstep.vo.SysBpmnResourceVO in project bamboobsc by billchen198318.
the class SystemBpmnResourceSaveOrUpdateAction method delete.
private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
SysBpmnResourceVO resource = new SysBpmnResourceVO();
resource.setOid(this.getFields().get("oid"));
DefaultResult<SysBpmnResourceVO> result = this.sysBpmnResourceService.findObjectByOid(resource);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
resource = result.getValue();
sysBpmnResourceService.hibernateSessionClear();
if (!StringUtils.isBlank(resource.getDeploymentId())) {
BusinessProcessManagementUtils.deleteDeployment(resource, false);
result = this.sysBpmnResourceService.findObjectByOid(resource);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
resource = result.getValue();
sysBpmnResourceService.hibernateSessionClear();
if (!StringUtils.isBlank(resource.getDeploymentId())) {
this.message = "Cannot delete deployment!";
return;
}
}
DefaultResult<Boolean> delResult = sysBpmnResourceService.deleteObject(resource);
this.message = delResult.getSystemMessage().getValue();
if (delResult.getValue() != null && delResult.getValue()) {
this.success = IS_YES;
}
}
Aggregations