Exemple #1
0
 public void cancel() {
   ec.revert();
   // NSDictionary snapshot = ec.committedSnapshotForObject(onEdit);
   if (ec.insertedObjects().contains(item)) {
     NSMutableArray fullList = (NSMutableArray) session().valueForKey("personList");
     fullList.removeObject(item);
   }
   //		onEdit = null;
 }
  /*------------------------------------------------------------------------------------------------*
   * Overridden by subclasses to perform additional initialization on the receiver upon its being
   * inserted into EOEditingContext. This is commonly used to assign default values or record the
   * time of insertion. EOCustomObject's implementation merely sends an awakeObjectFromInsertion
   * to the receiver's EOClassDescription.
   *
   * Subclasses should invoke super's implementation before performing their own initialization.
   *------------------------------------------------------------------------------------------------*/
  @Override
  public void awakeFromInsertion(EOEditingContext ec) {
    super.awakeFromInsertion(ec);

    LOG.info(
        "-----> awakeFromInsert: ({}) EOs: ({}), +({}), ~({}), -({})",
        ec,
        ec.registeredObjects().count(),
        ec.insertedObjects().count(),
        ec.updatedObjects().count(),
        ec.deletedObjects().count());
  }
  /*------------------------------------------------------------------------------------------------*
   *  Overridden by subclasses to perform additional initialization on the receiver upon its being
   *  fetched from the external repository into EOEditingContext. EOCustomObject's implementation
   *  merely sends an awakeObjectFromFetch to the receiver's EOClassDescription.
   *
   *  Subclasses should invoke super's implementation before performing their own initialization.
   *------------------------------------------------------------------------------------------------*/
  @Override
  public void awakeFromFetch(EOEditingContext ec) {
    super.awakeFromFetch(ec);

    if (logInAwake) {
      LOG.info(
          "----->  awakeFromFetch: ({}) EOs: ({}), +({}), ~({}), -({})",
          ec,
          ec.registeredObjects().count(),
          ec.insertedObjects().count(),
          ec.updatedObjects().count(),
          ec.deletedObjects().count());

      @SuppressWarnings("unchecked")
      NSArray<ERXGenericRecord> genericRecords = ec.registeredObjects();
      for (ERXGenericRecord genericRecord : genericRecords)
        LOG.info("        EOs: " + genericRecord);
    }
  }