use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class StrategyMapManagementAction method loadObjectiveItem.
private void loadObjectiveItem() throws ControllerException, ServiceException, Exception {
// 這裡的 fields.oid 放的是 BB_OBJECTIVE.OBJ_ID
String objId = super.defaultString(super.getFields().get("oid")).trim();
if (StringUtils.isBlank(objId)) {
throw new ControllerException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
this.objective = new ObjectiveVO();
this.objective.setObjId(objId);
DefaultResult<ObjectiveVO> result = this.objectiveService.findByUK(this.objective);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
this.objective = result.getValue();
PerspectiveVO perspective = new PerspectiveVO();
perspective.setPerId(this.objective.getPerId());
DefaultResult<PerspectiveVO> pResult = this.perspectiveService.findByUK(perspective);
if (pResult.getValue() == null) {
throw new ServiceException(pResult.getSystemMessage().getValue());
}
perspective = pResult.getValue();
DefaultResult<VisionVO> vResult = this.visionService.findForSimpleByVisId(perspective.getVisId());
if (vResult.getValue() == null) {
throw new ServiceException(vResult.getSystemMessage().getValue());
}
VisionVO vision = vResult.getValue();
this.visionOid = vision.getOid();
}
use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class AnalyticsProcessAction method doExcel.
/**
* qcharts.analyticsExcelAction.action
*
* @return
* @throws Exception
*/
@JSON(serialize = false)
@ControllerMethodAuthority(programId = "QCHARTS_PROG002D0002Q")
public String doExcel() throws Exception {
File catalogFile = null;
try {
if (!this.allowJob()) {
this.message = this.getNoAllowMessage();
return SUCCESS;
}
this.exportExcel(catalogFile);
} catch (AuthorityException | ControllerException | ServiceException e) {
this.message = e.getMessage().toString();
} catch (Exception e) {
this.message = this.logException(e);
this.success = IS_EXCEPTION;
}
catalogFile = null;
return SUCCESS;
}
use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class AnalyticsProcessAction method doHtml.
/**
* qcharts.analyticsHtmlAction.action
*
* @return
* @throws Exception
*/
@JSON(serialize = false)
@ControllerMethodAuthority(programId = "QCHARTS_PROG002D0002Q")
public String doHtml() throws Exception {
File catalogFile = null;
try {
if (!this.allowJob()) {
this.message = this.getNoAllowMessage();
return SUCCESS;
}
this.rendererHtml(catalogFile);
} catch (AuthorityException | ControllerException | ServiceException e) {
this.message = e.getMessage().toString();
} catch (Exception e) {
this.message = this.logException(e);
this.success = IS_EXCEPTION;
}
catalogFile = null;
return SUCCESS;
}
use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class CommonLoadFormAction method execute.
@JSON(serialize = false)
@SystemForm
public String execute() throws Exception {
String resultName = RESULT_SEARCH_NO_DATA;
if (StringUtils.isBlank(form_id) || StringUtils.isBlank(form_method)) {
this.message = "no settings data to init form!";
this.setErrorMessage(this.message);
return resultName;
}
try {
SysFormMethodVO formMethod = SystemFormUtils.findFormMethod(this.form_id, this.form_method);
resultName = formMethod.getResultType();
this.processExpression(formMethod);
} catch (ControllerException ce) {
this.message = ce.getMessage().toString();
this.setErrorMessage(this.message);
} catch (AuthorityException ae) {
this.message = ae.getMessage().toString();
this.setErrorMessage(this.message);
if (FormResultType.DEFAULT.equals(resultName)) {
resultName = RESULT_NO_AUTHORITH;
}
} catch (ServiceException se) {
this.message = se.getMessage().toString();
this.setErrorMessage(this.message);
} catch (Exception e) {
// 因為是 JSON 所以不用拋出 throw e 了
e.printStackTrace();
if (e.getMessage() == null) {
this.message = e.toString();
this.logger.error(e.toString());
} else {
this.message = e.getMessage().toString();
this.logger.error(e.getMessage());
}
this.setErrorMessage(this.message);
this.success = IS_EXCEPTION;
if (FormResultType.DEFAULT.equals(resultName)) {
resultName = ERROR;
}
}
return resultName;
}
use of com.netsteadfast.greenstep.base.exception.ControllerException in project bamboobsc by billchen198318.
the class CommonUploadFileAction method upload.
private void upload() throws ControllerException, AuthorityException, ServiceException, IOException, Exception {
if (this.getUpload() == null) {
throw new ControllerException(SysMessageUtil.get(GreenStepSysMsgConstants.UPLOAD_FILE_NO_SELECT));
}
if (StringUtils.isBlank(this.system) || StringUtils.isBlank(this.type) || !UploadTypes.check(this.type)) {
throw new ControllerException("System and type is required!");
}
String fileName = this.copy2UploadDir();
SysUploadVO uploadObj = new SysUploadVO();
uploadObj.setSystem(this.system);
uploadObj.setSubDir(UploadSupportUtils.getSubDir());
uploadObj.setType(this.type);
uploadObj.setFileName(fileName);
uploadObj.setShowName(this.uploadFileName);
if (uploadObj.getShowName().length() > 255) {
uploadObj.setShowName(uploadObj.getShowName().substring(0, 255));
}
uploadObj.setIsFile(this.isFile);
if (!YesNo.YES.equals(this.isFile)) {
uploadObj.setContent(FileUtils.readFileToByteArray(this.getUpload()));
}
DefaultResult<SysUploadVO> result = this.sysUploadService.saveObject(uploadObj);
this.message = result.getSystemMessage().getValue();
if (result.getValue() == null) {
return;
}
this.message = this.message + "upload file success!";
this.success = IS_YES;
this.uploadOid = result.getValue().getOid();
}
Aggregations