Search in sources :

Example 6 with ControllerException

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();
}
Also used : ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO)

Example 7 with ControllerException

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;
}
Also used : ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) File(java.io.File) AuthorityException(com.netsteadfast.greenstep.base.exception.AuthorityException) ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AuthorityException(com.netsteadfast.greenstep.base.exception.AuthorityException) ControllerMethodAuthority(com.netsteadfast.greenstep.base.model.ControllerMethodAuthority) JSON(org.apache.struts2.json.annotations.JSON)

Example 8 with ControllerException

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;
}
Also used : ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) File(java.io.File) AuthorityException(com.netsteadfast.greenstep.base.exception.AuthorityException) ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AuthorityException(com.netsteadfast.greenstep.base.exception.AuthorityException) ControllerMethodAuthority(com.netsteadfast.greenstep.base.model.ControllerMethodAuthority) JSON(org.apache.struts2.json.annotations.JSON)

Example 9 with ControllerException

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;
}
Also used : ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysFormMethodVO(com.netsteadfast.greenstep.vo.SysFormMethodVO) AuthorityException(com.netsteadfast.greenstep.base.exception.AuthorityException) ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) AuthorityException(com.netsteadfast.greenstep.base.exception.AuthorityException) JSON(org.apache.struts2.json.annotations.JSON) SystemForm(com.netsteadfast.greenstep.base.model.SystemForm)

Example 10 with ControllerException

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();
}
Also used : ControllerException(com.netsteadfast.greenstep.base.exception.ControllerException) SysUploadVO(com.netsteadfast.greenstep.vo.SysUploadVO)

Aggregations

ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)17 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)10 AuthorityException (com.netsteadfast.greenstep.base.exception.AuthorityException)8 File (java.io.File)6 JSON (org.apache.struts2.json.annotations.JSON)4 ChainResultObj (com.netsteadfast.greenstep.base.model.ChainResultObj)3 ControllerMethodAuthority (com.netsteadfast.greenstep.base.model.ControllerMethodAuthority)3 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 SimpleChain (com.netsteadfast.greenstep.base.chain.SimpleChain)2 StrategyMapItemsVO (com.netsteadfast.greenstep.bsc.vo.StrategyMapItemsVO)2 HashMap (java.util.HashMap)2 Context (org.apache.commons.chain.Context)2 IActionFieldsCheckUtils (com.netsteadfast.greenstep.base.model.IActionFieldsCheckUtils)1 SystemForm (com.netsteadfast.greenstep.base.model.SystemForm)1 BscStructTreeObj (com.netsteadfast.greenstep.bsc.model.BscStructTreeObj)1 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)1 OlapCatalogVO (com.netsteadfast.greenstep.vo.OlapCatalogVO)1 OlapConfVO (com.netsteadfast.greenstep.vo.OlapConfVO)1 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)1