Search in sources :

Example 51 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class SystemBpmnResourceSaveOrUpdateAction method deployment.

private void deployment(boolean overDeployment) 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 (!overDeployment && !StringUtils.isBlank(resource.getDeploymentId())) {
        this.message = "Already deployment!";
        return;
    }
    String id = BusinessProcessManagementUtils.deployment(resource);
    if (!StringUtils.isBlank(id)) {
        this.message = "Deployment success!";
        this.success = IS_YES;
    } else {
        this.message = "Deployment fail!";
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysBpmnResourceVO(com.netsteadfast.greenstep.vo.SysBpmnResourceVO)

Example 52 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException 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 53 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class SystemCalendarNoteManagementAction method loadSysCalendarNoteData.

/**
	 * 載入編輯mode需要的資料
	 * 
	 * @throws ServiceException
	 * @throws Exception
	 */
private void loadSysCalendarNoteData() throws ServiceException, Exception {
    this.transformFields2ValueObject(this.sysCalendarNote, new String[] { "oid" });
    DefaultResult<SysCalendarNoteVO> result = this.sysCalendarNoteService.findObjectByOid(sysCalendarNote);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    this.sysCalendarNote = result.getValue();
    AccountVO account = new AccountVO();
    account.setAccount(sysCalendarNote.getAccount());
    DefaultResult<AccountVO> aResult = this.accountService.findByUK(account);
    if (aResult.getValue() == null) {
        throw new ServiceException(aResult.getSystemMessage().getValue());
    }
    account = aResult.getValue();
    this.accountOid = account.getOid();
    this.calendarNoteDate = sysCalendarNote.getDate().substring(0, 4) + "-" + sysCalendarNote.getDate().substring(4, 6) + "-" + sysCalendarNote.getDate().substring(6, 8);
    String[] time = this.sysCalendarNote.getTime().split(Constants.DATETIME_DELIMITER);
    this.startHour = time[0].substring(0, 2);
    this.startMinutes = time[0].substring(2, 4);
    this.endHour = time[1].substring(0, 2);
    this.endMinutes = time[1].substring(2, 4);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysCalendarNoteVO(com.netsteadfast.greenstep.vo.SysCalendarNoteVO) AccountVO(com.netsteadfast.greenstep.vo.AccountVO)

Example 54 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class SystemExpressionSaveOrUpdateAction method copy2Upload.

private void copy2Upload() throws ControllerException, AuthorityException, ServiceException, Exception {
    SysExpressionVO expression = new SysExpressionVO();
    this.transformFields2ValueObject(expression, new String[] { "oid" });
    DefaultResult<SysExpressionVO> result = this.sysExpressionService.findObjectByOid(expression);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    expression = result.getValue();
    this.uploadOid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, expression.getContent().getBytes(), expression.getExprId() + "." + expression.getType());
    this.message = SysMessageUtil.get(GreenStepSysMsgConstants.INSERT_SUCCESS);
    this.success = IS_YES;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 55 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class SystemExpressionJobSaveOrUpdateAction method manualExecute.

private void manualExecute() throws ControllerException, AuthorityException, ServiceException, Exception {
    String exprJobOid = this.getFields().get("oid");
    String accountId = super.getAccountId();
    SysExprJobVO exprJob = new SysExprJobVO();
    exprJob.setOid(exprJobOid);
    DefaultResult<SysExprJobVO> result = this.sysExprJobService.findObjectByOid(exprJob);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    exprJob = result.getValue();
    if (Constants.getMainSystem().equals(exprJob.getSystem())) {
        // 是自己 CORE系統, 所以不用觸發遠端的服務
        SystemExpressionJobUtils.executeJobForManual(exprJobOid);
        return;
    }
    /*
		SysExprJobLogVO jobLog = SystemExpressionJobUtils.executeJobForManualFromRestServiceUrl(
				exprJob, accountId, this.getHttpServletRequest());
		*/
    SysExprJobLogVO jobLog = SystemExpressionJobUtils.executeJobForManualWebClient(exprJob, accountId, this.getHttpServletRequest());
    if (null != jobLog && !StringUtils.isBlank(jobLog.getFaultMsg())) {
        throw new ServiceException(jobLog.getFaultMsg());
    }
}
Also used : SysExprJobVO(com.netsteadfast.greenstep.vo.SysExprJobVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysExprJobLogVO(com.netsteadfast.greenstep.vo.SysExprJobLogVO)

Aggregations

ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)291 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)91 Transactional (org.springframework.transaction.annotation.Transactional)89 HashMap (java.util.HashMap)65 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)49 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)48 SysVO (com.netsteadfast.greenstep.vo.SysVO)30 IOException (java.io.IOException)24 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)20 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)19 List (java.util.List)19 Map (java.util.Map)19 ArrayList (java.util.ArrayList)17 LinkedHashMap (java.util.LinkedHashMap)17 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)16 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)15 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)15 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)14 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)13 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)12