Examples of EOAdaptorOperation


Examples of com.webobjects.eoaccess.EOAdaptorOperation

    }

    public EOAdaptorOperation operation() {
        if (operation == null) {
            EOEntity entity = EOModelGroup.defaultGroup().entityNamed(entityName);
            operation = new EOAdaptorOperation(entity);
            operation.setAdaptorOperator(operator);
            operation.setAttributes(attributes);
            operation.setChangedValues(changedValues);
            operation.setQualifier(qualifier);
        }
View Full Code Here

Examples of com.webobjects.eoaccess.EOAdaptorOperation

        adaptorOperationsLock.lock();
        try {
            NSMutableArray ops = new NSMutableArray();
            if(adaptorOps.count() > 0) {
                for (int i = 0; i < adaptorOps.count(); i++) {
                    EOAdaptorOperation a = (EOAdaptorOperation) adaptorOps.objectAtIndex(i);
                    ERXAdaptorOperationWrapper wrapper = new ERXAdaptorOperationWrapper(a);
                    ops.addObject(wrapper);
                }
            }
            return ops;
View Full Code Here

Examples of com.webobjects.eoaccess.EOAdaptorOperation

        boolean wasHandled = false;
        NSDictionary userInfo = e.userInfo();
        if(userInfo != null) {
            String eType = (String)userInfo.objectForKey(EOAdaptorChannel.AdaptorFailureKey);
            if (EOAdaptorChannel.AdaptorOptimisticLockingFailure.equals(eType)) {
                EOAdaptorOperation adaptorOp = (EOAdaptorOperation) userInfo.objectForKey(EOAdaptorChannel.FailedAdaptorOperationKey);
                EODatabaseOperation databaseOp = (EODatabaseOperation) userInfo.objectForKey(EODatabaseContext.FailedDatabaseOperationKey);
                wasHandled = (adaptorOp != null && databaseOp != null);
            } else {
                log.error("Missing EOFailedAdaptorOperationKey or EOFailedDatabaseOperationKey in " + e + ": " + userInfo);
            }
View Full Code Here

Examples of com.webobjects.eoaccess.EOAdaptorOperation

   */
  public static boolean isUniqueFailure(EOGeneralAdaptorException e) {
    boolean wasHandled = false;
    NSDictionary userInfo = e.userInfo();
    if(userInfo != null) {
      EOAdaptorOperation adaptorOp = (EOAdaptorOperation) userInfo.objectForKey(EOAdaptorChannel.FailedAdaptorOperationKey);

      wasHandled = adaptorOp.toString().contains("UNIQUE");
      if (!wasHandled) {
        log.error("UNIQUE Integrity constraint violation  " + e + ": " + userInfo);
      }
    }
    return wasHandled;
View Full Code Here

Examples of com.webobjects.eoaccess.EOAdaptorOperation

    {
        return sourceAttributeForRelationship(relationship).columnName();
    }

    public static EOEnterpriseObject refetchFailedObject(EOEditingContext ec, EOGeneralAdaptorException e) {
        EOAdaptorOperation adaptorOp = (EOAdaptorOperation) e.userInfo().objectForKey(EOAdaptorChannel.FailedAdaptorOperationKey);
        EODatabaseOperation databaseOp = (EODatabaseOperation) e.userInfo().objectForKey(EODatabaseContext.FailedDatabaseOperationKey);
        NSDictionary dbSnapshot = databaseOp.dbSnapshot();
        EOEntity entity = adaptorOp.entity();
        String entityName = entity.name();
        EOGlobalID gid = entity.globalIDForRow(dbSnapshot);
        EOEnterpriseObject eo = ec.faultForGlobalID(gid, ec);
        // EOUtilities.databaseContextForModelNamed(ec, eo.entityName()).forgetSnapshotForGlobalID(gid);
        ec.refaultObject(eo);
View Full Code Here

Examples of com.webobjects.eoaccess.EOAdaptorOperation

     *
     * @param eo enterprise object to have the changes re-applied to.
     * @param e
     */
    public static void reapplyChanges(EOEnterpriseObject eo, EOGeneralAdaptorException e) {
        EOAdaptorOperation adaptorOp = (EOAdaptorOperation) e.userInfo().objectForKey(EOAdaptorChannel.FailedAdaptorOperationKey);
        NSDictionary changedValues = adaptorOp.changedValues();
        EOEntity entity = ERXEOAccessUtilities.entityForEo(eo);
        EOEditingContext ec = eo.editingContext();
        NSArray keys = changedValues.allKeys();
        NSMutableSet relationships = new NSMutableSet();
       
View Full Code Here

Examples of com.webobjects.eoaccess.EOAdaptorOperation

    @Override
    public boolean handleDatabaseException(EODatabaseContext databaseContext, Throwable throwable) {
      if (throwable instanceof EOGeneralAdaptorException) {
        EOGeneralAdaptorException gae = (EOGeneralAdaptorException) throwable;
        if (gae.userInfo() != null) {
          EOAdaptorOperation failedOperation = (EOAdaptorOperation) gae.userInfo().objectForKey(EOAdaptorChannel.FailedAdaptorOperationKey);
          if (failedOperation != null) {
            Throwable t = failedOperation.exception();
            if (t instanceof JDBCAdaptorException) {
              JDBCAdaptorException jdbcEx = (JDBCAdaptorException) t;
              SQLException sqlEx = jdbcEx.sqlException();
              if (sqlEx != null && UNIQUE_CONSTRAINT_EXCEPTION_STATE.equals(sqlEx.getSQLState())) {
                String message = sqlEx.getMessage();
View Full Code Here

Examples of com.webobjects.eoaccess.EOAdaptorOperation

      Integer deleteKey = ERXConstant.integerForInt(EODatabaseOperation.AdaptorDeleteOperator);
      NSArray deleteOps = (NSArray) groupedOps.objectForKey(deleteKey);
      if (insertOps!=null && deleteOps!=null) {
        NSMutableSet skippedOps = new NSMutableSet();
        for(Enumeration e = insertOps.objectEnumerator(); e.hasMoreElements();) {
          EOAdaptorOperation insertOp = (EOAdaptorOperation)e.nextElement();
          for(Enumeration e1 = deleteOps.objectEnumerator(); e1.hasMoreElements();) {
            EOAdaptorOperation deleteOp = (EOAdaptorOperation)e1.nextElement();
            if(!skippedOps.containsObject(deleteOp)) {
              if(insertOp.entity() == deleteOp.entity()) {
                if(deleteOp.qualifier().evaluateWithObject(insertOp.changedValues())) {
                  if(false) {
                    // here we remove both the delete and the
                    // insert. this might fail if we didn't lock on all rows
                    // FIXME: check the current snapshot in the database and
                    // see if it is the same as the new insert

                    skippedOps.addObject(deleteOp);
                    skippedOps.addObject(insertOp);
                  } else {
                    // here we put the delete up front, this might fail if
                    // we have cascading delete rules in the database
                    result.addObject(deleteOp);
                    skippedOps.addObject(deleteOp);
                  }
                  log.warn("Skipped: " + insertOp + "\n" + deleteOp);
                }
              }
            }
          }
        }
          for(Enumeration e = adaptorOps.objectEnumerator(); e.hasMoreElements();) {
            EOAdaptorOperation op = (EOAdaptorOperation)e.nextElement();
            if(!skippedOps.containsObject(op)) {
              result.addObject(op);
            }
          }
      } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.