Search in sources :

Example 6 with SysBpmnResourceVO

use of com.netsteadfast.greenstep.vo.SysBpmnResourceVO in project bamboobsc by billchen198318.

the class SystemBpmnResourceSaveOrUpdateAction method update.

private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields();
    String uploadOid = this.getFields().get("uploadOid");
    if (!StringUtils.isBlank(uploadOid)) {
        // 有更新上傳檔案
        this.selfTestUploadResourceData();
    }
    SysBpmnResourceVO resource = new SysBpmnResourceVO();
    resource.setOid(this.getFields().get("oid"));
    DefaultResult<SysBpmnResourceVO> oldResult = this.sysBpmnResourceService.findObjectByOid(resource);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    resource = oldResult.getValue();
    String beforeId = resource.getId();
    byte[] beforeContent = resource.getContent();
    resource.setContent(null);
    // 先清除原本的byte資料, 要不然每次update 資料越來越大
    sysBpmnResourceService.updateObject(resource);
    if (!StringUtils.isBlank(this.getFields().get("uploadOid"))) {
        this.fillContent(resource);
    } else {
        resource.setContent(beforeContent);
    }
    this.fillResource(resource);
    resource.setId(beforeId);
    DefaultResult<SysBpmnResourceVO> result = this.sysBpmnResourceService.updateObject(resource);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        String oldDeploymentIdId = result.getValue().getDeploymentId();
        if (!StringUtils.isBlank(oldDeploymentIdId) && !StringUtils.isBlank(uploadOid)) {
            // 更新上傳部屬
            BusinessProcessManagementUtils.deleteDeployment(result.getValue(), false);
            this.deployment(true);
        }
        this.success = IS_YES;
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysBpmnResourceVO(com.netsteadfast.greenstep.vo.SysBpmnResourceVO)

Example 7 with SysBpmnResourceVO

use of com.netsteadfast.greenstep.vo.SysBpmnResourceVO in project bamboobsc by billchen198318.

the class SystemBpmnResourceSaveOrUpdateAction method export.

private void export() 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();
    this.uploadOid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, resource.getContent(), resource.getId() + ".zip");
    this.message = SysMessageUtil.get(GreenStepSysMsgConstants.INSERT_SUCCESS);
    this.success = IS_YES;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysBpmnResourceVO(com.netsteadfast.greenstep.vo.SysBpmnResourceVO)

Example 8 with SysBpmnResourceVO

use of com.netsteadfast.greenstep.vo.SysBpmnResourceVO in project bamboobsc by billchen198318.

the class BusinessProcessManagementUtils method startProcess.

public static String startProcess(String resourceId, Map<String, Object> paramMap) throws ServiceException, Exception {
    if (StringUtils.isBlank(resourceId)) {
        throw new Exception(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysBpmnResourceVO sysBpmnResource = new SysBpmnResourceVO();
    sysBpmnResource.setId(resourceId);
    return startProcess(sysBpmnResource, paramMap);
}
Also used : SysBpmnResourceVO(com.netsteadfast.greenstep.vo.SysBpmnResourceVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 9 with SysBpmnResourceVO

use of com.netsteadfast.greenstep.vo.SysBpmnResourceVO in project bamboobsc by billchen198318.

the class BusinessProcessManagementUtils method loadResource.

public static SysBpmnResourceVO loadResource(String resourceId) throws ServiceException, Exception {
    if (StringUtils.isBlank(resourceId)) {
        throw new Exception(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysBpmnResourceVO sysBpmnResource = new SysBpmnResourceVO();
    sysBpmnResource.setId(resourceId);
    DefaultResult<SysBpmnResourceVO> result = sysBpmnResourceService.findByUK(sysBpmnResource);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    return result.getValue();
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysBpmnResourceVO(com.netsteadfast.greenstep.vo.SysBpmnResourceVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 10 with SysBpmnResourceVO

use of com.netsteadfast.greenstep.vo.SysBpmnResourceVO in project bamboobsc by billchen198318.

the class BusinessProcessManagementUtils method queryProcessDefinition.

public static List<ProcessDefinition> queryProcessDefinition(String resourceId) throws ServiceException, Exception {
    if (StringUtils.isBlank(resourceId)) {
        throw new Exception(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysBpmnResourceVO sysBpmnResource = new SysBpmnResourceVO();
    sysBpmnResource.setId(resourceId);
    return queryProcessDefinition(sysBpmnResource);
}
Also used : SysBpmnResourceVO(com.netsteadfast.greenstep.vo.SysBpmnResourceVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Aggregations

SysBpmnResourceVO (com.netsteadfast.greenstep.vo.SysBpmnResourceVO)12 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)10 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ZipInputStream (java.util.zip.ZipInputStream)1 Deployment (org.activiti.engine.repository.Deployment)1 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)1 ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)1 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)1 Task (org.activiti.engine.task.Task)1