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");
}
}
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);
}
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);
}
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;
}
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);
}
Aggregations