Search in sources :

Example 1 with SystemForm

use of com.netsteadfast.greenstep.base.model.SystemForm 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)

Aggregations

AuthorityException (com.netsteadfast.greenstep.base.exception.AuthorityException)1 ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)1 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 SystemForm (com.netsteadfast.greenstep.base.model.SystemForm)1 SysFormMethodVO (com.netsteadfast.greenstep.vo.SysFormMethodVO)1 JSON (org.apache.struts2.json.annotations.JSON)1