@Override
 public boolean onFlushDirty(
     Object entity,
     Serializable id,
     Object[] currentState,
     Object[] previousState,
     String[] propertyNames,
     Type[] types) {
   try {
     logger.info("onFlushDirty: Detected dirty object " + entity + " with id " + id);
     final int length = currentState.length;
     logger.info("onFlushDirty: Object Details are as below: ");
     for (int i = 0; i < length; i++) {
       logger.info(
           "onFlushDirty: propertyName : "
               + propertyNames[i]
               + " ,type :  "
               + types[i]
               + " , previous state : "
               + previousState[i]
               + " , current state : "
               + currentState[i]);
     }
     return tryToCastToCurrentObject(entity, cl, InterceptorOperations.UPDATE);
   } catch (CallbackException e) {
     logger.error(e.getMessage(), e);
   }
   return false; // as no change made to object here
 }
Beispiel #2
0
  /**
   * ==== IMPORTANT ====
   * This should never again be public because it does not honour the
   * chunks defined by actions+collect mode. It only honours chunks of
   * actions. This should not be made visible to the outside.
   *
   * <p>calls {@link #next} once and applies the returned {@link
   * FaAction}. This includes the special actions configured for non
   * matching input and EOF, if any.</p>
   *
   * <p>Due to the <code>FaAction<code> applied to <code>out</code>
   * after calling <code>next</code> anything can happen to
   * <code>out</code>. In particular it need not become longer.</p>
   *
   * @return <code>false</code> if <code>out</code> was not changed
   * and would not be changed &mdash; due to EOF &mdash; by any
   * subsequent calls to this method. If <code>true</code> is
   * returned, <code>out</code> is not necessarily changed, but there
   * is more input available to process.
   */
  private boolean crunch(StringBuilder out) throws java.io.IOException {
    int l = out.length();
    action = next(out);
    if (action == null) return true;

    if (action == EOF) {
      // there may have been some unmatched characters added to out
      // just before EOF was hit
      return l < out.length();
    }
    try {
      action.invoke(out, matchStart, this);
    } catch (CallbackException e) {
      String msg;
      if (matchStart <= out.length()) {
        msg =
            e.getMessage()
                + ". The match, possibly changed by the complaining "
                + "action, follows in "
                + "double brackets:\n[["
                + out.substring(matchStart)
                + "]]";
      } else {
        msg =
            e.getMessage()
                + ". Matched and filtered data just before the "
                + "match triggering the exception is: `"
                + out
                + "'";
      }

      CallbackException ee = new CallbackException(msg);
      ee.setStackTrace(e.getStackTrace());
      ee.initCause(e.getCause());
      throw ee;
    }
    return true;
  }