Search in sources :

Example 1 with ConditionInvokingFailureException

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

the class AbstractConditionQuery method throwConditionInvokingGetReflectionFailureException.

protected void throwConditionInvokingGetReflectionFailureException(String columnFlexibleName, String methodName, ReflectionFailureException e) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Failed to invoke the method for getting value.");
    br.addItem("columnFlexibleName");
    br.addElement(columnFlexibleName);
    br.addItem("methodName");
    br.addElement(methodName);
    final String msg = br.buildExceptionMessage();
    throw new ConditionInvokingFailureException(msg, e);
}
Also used : ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder)

Example 2 with ConditionInvokingFailureException

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

the class AbstractConditionQuery method throwConditionInvokingGetMethodNotFoundException.

protected void throwConditionInvokingGetMethodNotFoundException(String columnFlexibleName, String methodName) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the method for getting the condition.");
    br.addItem("columnFlexibleName");
    br.addElement(columnFlexibleName);
    br.addItem("methodName");
    br.addElement(methodName);
    final String msg = br.buildExceptionMessage();
    throw new ConditionInvokingFailureException(msg);
}
Also used : ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder)

Example 3 with ConditionInvokingFailureException

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

the class AbstractConditionQuery method doInvokeHasForeignCQ.

protected boolean doInvokeHasForeignCQ(ConditionQuery cq, String foreignPropertyName) {
    assertStringNotNullAndNotTrimmedEmpty("foreignPropertyName", foreignPropertyName);
    final String methodName = "hasConditionQuery" + initCap(foreignPropertyName);
    final Method method = xhelpGettingCQMethod(cq, methodName, (Class<?>[]) null);
    if (method == null) {
        final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
        br.addNotice("Not found the method for determining a foreign condition query.");
        br.addItem("Table");
        br.addElement(cq.asTableDbName());
        br.addItem("foreignPropertyName");
        br.addElement(foreignPropertyName);
        br.addItem("methodName");
        br.addElement(methodName);
        br.addItem("ConditionQuery");
        br.addElement(DfTypeUtil.toClassTitle(cq));
        final String msg = br.buildExceptionMessage();
        throw new ConditionInvokingFailureException(msg);
    }
    try {
        return (Boolean) xhelpInvokingCQMethod(cq, method, (Object[]) null);
    } catch (ReflectionFailureException e) {
        String msg = "Failed to invoke the method for determining a condition(query):";
        msg = msg + " foreignPropertyName=" + foreignPropertyName;
        msg = msg + " methodName=" + methodName + " table=" + asTableDbName();
        throw new ConditionInvokingFailureException(msg, e);
    }
}
Also used : ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) Method(java.lang.reflect.Method) ReflectionFailureException(org.dbflute.util.DfReflectionUtil.ReflectionFailureException)

Example 4 with ConditionInvokingFailureException

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

the class AbstractConditionQuery method throwConditionInvokingForeignQueryMethodNotFoundException.

protected void throwConditionInvokingForeignQueryMethodNotFoundException(ConditionQuery cq, String foreignPropertyName, String methodName) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the method for getting a foreign condition query.");
    br.addItem("Table");
    br.addElement(asTableDbName());
    br.addItem("foreignPropertyName");
    br.addElement(foreignPropertyName);
    br.addItem("Method");
    br.addElement(methodName);
    final String msg = br.buildExceptionMessage();
    throw new ConditionInvokingFailureException(msg);
}
Also used : ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder)

Example 5 with ConditionInvokingFailureException

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

the class AbstractConditionQuery method doThrowConditionInvokingFailureException.

protected void doThrowConditionInvokingFailureException(String notice, String columnFlexibleName, String conditionKeyName, Object conditionValue, ConditionOption conditionOption, String methodName, Class<?>[] parameterTypes, RuntimeException cause) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice(notice);
    br.addItem("Table");
    br.addElement(asTableDbName());
    br.addItem("columnFlexibleName");
    br.addElement(columnFlexibleName);
    br.addItem("conditionKeyName");
    br.addElement(conditionKeyName);
    br.addItem("conditionValue");
    br.addElement(conditionValue);
    br.addElement(conditionValue != null ? conditionValue.getClass() : null);
    br.addItem("conditionOption");
    br.addElement(conditionOption);
    if (methodName != null) {
        final StringBuilder sb = new StringBuilder();
        if (parameterTypes != null) {
            int index = 0;
            for (Class<?> parameterType : parameterTypes) {
                if (index > 0) {
                    sb.append(", ");
                }
                sb.append(DfTypeUtil.toClassTitle(parameterType));
                ++index;
            }
        }
        br.addItem("Method");
        br.addElement(methodName + "(" + sb.toString() + ")");
    }
    final String msg = br.buildExceptionMessage();
    if (cause != null) {
        throw new ConditionInvokingFailureException(msg, cause);
    } else {
        throw new ConditionInvokingFailureException(msg);
    }
}
Also used : ConditionInvokingFailureException(org.dbflute.exception.ConditionInvokingFailureException) ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder)

Aggregations

ConditionInvokingFailureException (org.dbflute.exception.ConditionInvokingFailureException)10 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)8 Method (java.lang.reflect.Method)3 ReflectionFailureException (org.dbflute.util.DfReflectionUtil.ReflectionFailureException)3 SpecifiedColumn (org.dbflute.cbean.dream.SpecifiedColumn)1