Search in sources :

Example 1 with HpInvalidQueryInfo

use of org.dbflute.cbean.chelper.HpInvalidQueryInfo in project dbflute-core by dbflute.

the class BehaviorExceptionThrower method setupInvalidQueryElement.

protected void setupInvalidQueryElement(ExceptionMessageBuilder br, ConditionBean cb) {
    br.addItem("Invalid Query");
    final List<HpInvalidQueryInfo> invalidQueryList = cb.getSqlClause().getInvalidQueryList();
    if (invalidQueryList != null && !invalidQueryList.isEmpty()) {
        for (HpInvalidQueryInfo invalidQueryInfo : invalidQueryList) {
            br.addElement(invalidQueryInfo.buildDisplay());
        }
    } else {
        br.addElement("*no invalid");
    }
}
Also used : HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo)

Example 2 with HpInvalidQueryInfo

use of org.dbflute.cbean.chelper.HpInvalidQueryInfo in project dbflute-core by dbflute.

the class ConditionBeanExceptionThrower method throwInvalidQueryRegisteredException.

public void throwInvalidQueryRegisteredException(HpInvalidQueryInfo... invalidQueryInfoAry) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Registered the invalid query. (null or empty)");
    br.addItem("Advice");
    br.addElement("The value of null or empty is not allowed to query as default.");
    br.addElement("For example: (when checked by default)");
    br.addElement("  (x):");
    br.addElement("    cb.query().setMemberName_Equal(null); // exception");
    br.addElement("    cb.query().setMemberName_Equal(\"\"); // exception");
    br.addElement("  (o):");
    br.addElement("    cb.query().setMemberName_Equal(\"Pixy\"); // normal query");
    br.addElement("  (o):");
    br.addElement("    cb.ignoreNullOrEmptyQuery();");
    br.addElement("    cb.query().setMemberName_Equal(null); // no condition");
    br.addElement("    cb.query().setMemberName_Equal(\"\"); // no condition");
    br.addItem("Invalid Query");
    for (HpInvalidQueryInfo invalidQueryInfo : invalidQueryInfoAry) {
        br.addElement(invalidQueryInfo.buildDisplay());
    }
    final String msg = br.buildExceptionMessage();
    throw new InvalidQueryRegisteredException(msg);
}
Also used : InvalidQueryRegisteredException(org.dbflute.exception.InvalidQueryRegisteredException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo)

Example 3 with HpInvalidQueryInfo

use of org.dbflute.cbean.chelper.HpInvalidQueryInfo in project dbflute-core by dbflute.

the class AbstractConditionQuery method handleInvalidQuery.

// ===================================================================================
// Invalid Query
// =============
protected void handleInvalidQuery(ConditionKey key, Object value, ConditionValue cvalue, String columnDbName) {
    final HpInvalidQueryInfo invalidQueryInfo = xcreateInvalidQueryInfo(key, value, columnDbName);
    xdoHandleInvalidQuery(columnDbName, invalidQueryInfo);
}
Also used : HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo)

Example 4 with HpInvalidQueryInfo

use of org.dbflute.cbean.chelper.HpInvalidQueryInfo in project dbflute-core by dbflute.

the class AbstractConditionQuery method xcreateInvalidQueryInfo.

protected HpInvalidQueryInfo xcreateInvalidQueryInfo(ConditionKey key, Object value, String columnDbName) {
    final String locationBase = xgetLocationBase();
    final ColumnInfo targetColumn = xgetLocalDBMeta().findColumnInfo(columnDbName);
    final HpInvalidQueryInfo invalidQueryInfo = new HpInvalidQueryInfo(locationBase, targetColumn, key, value);
    if (_inline) {
        invalidQueryInfo.inlineView();
    } else if (_onClause) {
        invalidQueryInfo.onClause();
    }
    return invalidQueryInfo;
}
Also used : HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo) ColumnInfo(org.dbflute.dbmeta.info.ColumnInfo)

Example 5 with HpInvalidQueryInfo

use of org.dbflute.cbean.chelper.HpInvalidQueryInfo in project dbflute-core by dbflute.

the class AbstractConditionQuery method handleInvalidQueryList.

protected void handleInvalidQueryList(List<ConditionKey> keyList, List<? extends Object> valueList, String columnDbName) {
    if (keyList.size() != valueList.size()) {
        String msg = "The argument 'keyList' should have the same size as 'valueList':";
        msg = msg + " keyList=" + keyList + ", valueList=" + valueList;
        throw new IllegalArgumentException(msg);
    }
    final HpInvalidQueryInfo[] invalidQueryInfoAry = new HpInvalidQueryInfo[keyList.size()];
    int index = 0;
    for (ConditionKey key : keyList) {
        final Object value = valueList.get(index);
        invalidQueryInfoAry[index] = xcreateInvalidQueryInfo(key, value, columnDbName);
        ++index;
    }
    xdoHandleInvalidQuery(columnDbName, invalidQueryInfoAry);
}
Also used : HpInvalidQueryInfo(org.dbflute.cbean.chelper.HpInvalidQueryInfo) ConditionKey(org.dbflute.cbean.ckey.ConditionKey)

Aggregations

HpInvalidQueryInfo (org.dbflute.cbean.chelper.HpInvalidQueryInfo)5 ConditionKey (org.dbflute.cbean.ckey.ConditionKey)1 ColumnInfo (org.dbflute.dbmeta.info.ColumnInfo)1 InvalidQueryRegisteredException (org.dbflute.exception.InvalidQueryRegisteredException)1 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1