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!";
}
}
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;
}
}
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);
}
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;
}
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());
}
}
Aggregations