Search in sources :

Example 1 with PagingStatusInvalidException

use of org.dbflute.exception.PagingStatusInvalidException in project dbflute-core by dbflute.

the class PagingInvoker method throwPagingStatusInvalidException.

protected void throwPagingStatusInvalidException(PagingBean pagingBean) {
    final boolean cbean = pagingBean instanceof ConditionBean;
    final String name = cbean ? "condition-bean" : "parameter-bean";
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("The status of paging was INVALID. (paging parameters was not found)");
    br.addItem("Advice");
    br.addElement("Confirm your logic for paging of " + name + ".");
    br.addElement("Paging execution needs paging parameters 'pageSize' and 'pageNumber'.");
    br.addElement("For example:");
    br.addElement("  (x):");
    if (cbean) {
        br.addElement("    MemberCB cb = new MemberCB();");
        br.addElement("    cb.query().set...;");
        br.addElement("    ... = memberBhv.selectPage(cb);");
    } else {
        br.addElement("    SimpleMemberPmb pmb = new SimpleMemberPmb();");
        br.addElement("    pmb.set...;");
        br.addElement("    ... = memberBhv.outsideSql().manualPaging().selectPage(...);");
    }
    br.addElement("  (o):");
    if (cbean) {
        br.addElement("    MemberCB cb = new MemberCB();");
        br.addElement("    cb.query().set...;");
        br.addElement("    cb.paging(20, 2); // *Point!");
        br.addElement("    ... = memberBhv.selectPage(cb);");
    } else {
        br.addElement("    SimpleMemberPmb pmb = new SimpleMemberPmb();");
        br.addElement("    pmb.set...;");
        br.addElement("    pmb.paging(20, 2); // *Point!");
        br.addElement("    ... = memberBhv.outsideSql().manualPaging().selectPage(...);");
    }
    br.addItem("PagingBean");
    br.addElement(pagingBean);
    final String msg = br.buildExceptionMessage();
    throw new PagingStatusInvalidException(msg);
}
Also used : PagingStatusInvalidException(org.dbflute.exception.PagingStatusInvalidException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) ConditionBean(org.dbflute.cbean.ConditionBean)

Aggregations

ConditionBean (org.dbflute.cbean.ConditionBean)1 PagingStatusInvalidException (org.dbflute.exception.PagingStatusInvalidException)1 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1