Search in sources :

Example 1 with ControllerMethodAuthority

use of com.netsteadfast.greenstep.base.model.ControllerMethodAuthority in project bamboobsc by billchen198318.

the class BaseSupportAction method getActionMethodProgramId.

// ----------------------------------------------------------------------------
public String getActionMethodProgramId() {
    ((BaseSimpleActionInfo) this.baseActionInfoProvide).handlerActionAnnotations();
    Annotation[] annotations = ((BaseSimpleActionInfo) this.baseActionInfoProvide).getActionMethodAnnotations();
    if (annotations == null || annotations.length < 1) {
        return "";
    }
    String progId = "";
    for (Annotation annotation : annotations) {
        if (annotation instanceof ControllerMethodAuthority) {
            progId = this.defaultString(((ControllerMethodAuthority) annotation).programId());
        }
    }
    if (StringUtils.isBlank(progId)) {
        // 沒有ControllerMethodAuthority , 就找 url 的 prog_id 參數 , 主要是 COMMON FORM 會用到
        progId = this.defaultString(ActionContext.getContext().getValueStack().findString("prog_id"));
    }
    return progId;
}
Also used : ControllerMethodAuthority(com.netsteadfast.greenstep.base.model.ControllerMethodAuthority) BaseSimpleActionInfo(com.netsteadfast.greenstep.base.model.BaseSimpleActionInfo) Annotation(java.lang.annotation.Annotation)

Example 2 with ControllerMethodAuthority

use of com.netsteadfast.greenstep.base.model.ControllerMethodAuthority in project bamboobsc by billchen198318.

the class IndexAction method execute.

@ControllerMethodAuthority(programId = "CORE_INDEX")
public String execute() throws Exception {
    try {
        MenuResultObj menuData = MenuSupportUtils.getMenuData(super.getBasePath(), super.getHttpServletRequest().getSession().getId(), UserAccountHttpSessionSupport.getLang(ServletActionContext.getContext()));
        comboButtonMenuData = menuData.getHtmlData();
        dialogData = menuData.getDialogHtmlData();
        treeJsonData = MenuSupportUtils.getMenuTreeJsonDataStr(super.getBasePath(), UserAccountHttpSessionSupport.getLang(ServletActionContext.getContext()));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (!ApplicationSiteUtils.checkLoginUrlWithAllSysHostConfig(getHttpServletRequest())) {
            showConfigHost = YesNo.YES;
        }
    }
    return SUCCESS;
}
Also used : MenuResultObj(com.netsteadfast.greenstep.model.MenuResultObj) ControllerMethodAuthority(com.netsteadfast.greenstep.base.model.ControllerMethodAuthority)

Example 3 with ControllerMethodAuthority

use of com.netsteadfast.greenstep.base.model.ControllerMethodAuthority 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 4 with ControllerMethodAuthority

use of com.netsteadfast.greenstep.base.model.ControllerMethodAuthority 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 5 with ControllerMethodAuthority

use of com.netsteadfast.greenstep.base.model.ControllerMethodAuthority in project bamboobsc by billchen198318.

the class QueryParamInspectInterceptor method log.

private void log(ActionInvocation actionInvocation, Annotation[] annotations) throws ServiceException, Exception {
    String progId = "";
    for (Annotation anno : annotations) {
        if (anno instanceof ControllerMethodAuthority) {
            progId = ((ControllerMethodAuthority) anno).programId();
        }
    }
    if (StringUtils.isBlank(progId)) {
        return;
    }
    SysQueryParamInspectUtils.log(Constants.getSystem(), progId, actionInvocation.getProxy().getMethod(), ServletActionContext.getRequest());
}
Also used : ControllerMethodAuthority(com.netsteadfast.greenstep.base.model.ControllerMethodAuthority) Annotation(java.lang.annotation.Annotation)

Aggregations

ControllerMethodAuthority (com.netsteadfast.greenstep.base.model.ControllerMethodAuthority)6 AuthorityException (com.netsteadfast.greenstep.base.exception.AuthorityException)3 ControllerException (com.netsteadfast.greenstep.base.exception.ControllerException)3 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)3 File (java.io.File)3 JSON (org.apache.struts2.json.annotations.JSON)3 Annotation (java.lang.annotation.Annotation)2 BaseSimpleActionInfo (com.netsteadfast.greenstep.base.model.BaseSimpleActionInfo)1 MenuResultObj (com.netsteadfast.greenstep.model.MenuResultObj)1