@Override
  public WOActionResults performAction() {
    log.debug("The result of the task was " + _result);
    if (_nextPage != null && _nextPageResultKey != null) {
      if (_result instanceof EOGlobalID) {

        // Inflate it to a fault
        EOEditingContext ec = ERXEC.newEditingContext();
        // Let's ensure fresh ec since we are likely coming out of a background task
        ec.setFetchTimestamp(System.currentTimeMillis());

        _result = ec.faultForGlobalID((EOGlobalID) _result, ec);
      }
      _nextPage.takeValueForKey(_result, _nextPageResultKey);
    }

    if (_nextPage != null && _nextPageValues != null) {
      for (String key : nextPageValues().allKeys()) {
        Object value = nextPageValues().valueForKey(key);
        _nextPage.takeValueForKey(value, key);
      }
    }

    if (_nextPage != null && _nextPage instanceof IERXRefreshPage) {
      ((IERXRefreshPage) _nextPage).refresh();
    }

    return _nextPage;
  }
 /** retourne des faults d'objets à partir des globalIDs */
 public static NSArray faultsForGlobalIDs(EOEditingContext eContext, NSArray ids) {
   NSMutableArray objects = new NSMutableArray();
   for (int i = 0; i < ids.count(); i++) {
     objects.addObject(eContext.faultForGlobalID((EOGlobalID) ids.objectAtIndex(i), eContext));
   }
   return objects;
 }
 public static Object primaryKey(EOEditingContext eContext, EOGlobalID gid, String primKey) {
   EOEnterpriseObject record = eContext.faultForGlobalID(gid, eContext);
   if (record != null) {
     return primaryKey(eContext, record, primKey);
   } else {
     return null;
   }
 }
 /** retourne l'objet du globalID s'il existe, sinon son fault */
 public static EOGenericRecord safeObjectForGlobalID(EOEditingContext eContext, EOGlobalID gid) {
   EOGenericRecord objFault;
   objFault = (EOGenericRecord) eContext.objectForGlobalID(gid);
   if (objFault != null) {
     return objFault;
   } else {
     return (EOGenericRecord) eContext.faultForGlobalID(gid, eContext);
   }
 }
Beispiel #5
0
 private static EOTypeGroupe localInstanceOfObject(EOEditingContext ec, EOTypeGroupe object) {
   if (object != null && ec != null) {
     EOEditingContext otherEditingContext = object.editingContext();
     if (otherEditingContext == null) {
       throw new IllegalArgumentException(
           "The EOTypeGroupe " + object + " is not in an EOEditingContext.");
     } else {
       com.webobjects.eocontrol.EOGlobalID globalID =
           otherEditingContext.globalIDForObject(object);
       return (EOTypeGroupe) ec.faultForGlobalID(globalID, ec);
     }
   } else {
     return null;
   }
 }