Skip to content

Commit

Permalink
Revert "Merge pull request #342 from smarthealth/hotfix-erxec"
Browse files Browse the repository at this point in the history
This reverts commit 1ae0143, reversing
changes made to 0f9d473.
  • Loading branch information
darkv committed Jan 29, 2013
1 parent 1ae0143 commit ffa79f2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ public class ERXEC extends EOEditingContext {
private static final NSSelector EditingContextWillRevertObjectsDelegateSelector = new NSSelector("editingContextWillRevertObjects", new Class[] { EOEditingContext.class, NSArray.class, NSArray.class, NSArray.class });
private static final NSSelector EditingContextDidRevertObjectsDelegateSelector = new NSSelector("editingContextDidRevertObjects", new Class[] { EOEditingContext.class, NSArray.class, NSArray.class, NSArray.class });
private static final NSSelector EditingContextDidFailSaveChangesDelegateSelector = new NSSelector("editingContextDidFailSaveChanges", new Class[] { EOEditingContext.class, EOGeneralAdaptorException.class });

private static final String ERXECProcessQueuedNotificationsNotification = "processQueuedNotifications";
public static final NSSelector ERXECProcessQueuedNotificationsSelector = ERXSelectorUtilities.notificationSelector("processQueuedNotificationsNotification");

/**
* @return the value of the <code>er.extensions.ERXEC.editingContextClassName</code> property, which
Expand Down Expand Up @@ -1486,20 +1483,7 @@ public Object invokeRemoteMethod(EOEditingContext eoeditingcontext, EOGlobalID e
@Override
public void _objectsChangedInStore(NSNotification nsnotification) {
ERXEnterpriseObject.FlushCachesProcessor.perform(this, (NSArray) nsnotification.userInfo().objectForKey("objects"));

/*
* Check to see if this context, or any parent context, is saving changes.
* If so, queue up the notifications.
*/
boolean isSavingChanges = savingChanges;
EOObjectStore parent = parentObjectStore();
while(!isSavingChanges && parent instanceof ERXEC) {
ERXEC parentEc = (ERXEC) parent;
isSavingChanges = parentEc.savingChanges;
parent = parentEc.parentObjectStore();
}

if (isSavingChanges) {
if (savingChanges) {
synchronized (queuedNotifications) {
queuedNotifications.addObject(nsnotification);
}
Expand Down Expand Up @@ -1582,11 +1566,6 @@ private void processQueuedNotifications() {
for (NSNotification notification : queuedNotificationsClone) {
_objectsChangedInStore(notification);
}
NSNotificationCenter.defaultCenter().postNotification(ERXECProcessQueuedNotificationsNotification, this);
}

public void processQueuedNotificationsNotification(NSNotification n) {
processQueuedNotifications();
}

/**
Expand Down Expand Up @@ -1752,10 +1731,6 @@ public EOEditingContext _newEditingContext(EOObjectStore objectStore, boolean va
ec.unlock();
}
NSNotificationCenter.defaultCenter().postNotification(EditingContextDidCreateNotification, ec);
if(objectStore instanceof ERXEC) {
ERXEC parent = (ERXEC)objectStore;
NSNotificationCenter.defaultCenter().addObserver(ec, ERXECProcessQueuedNotificationsSelector, ERXECProcessQueuedNotificationsNotification, parent);
}
return ec;
}

Expand Down
25 changes: 0 additions & 25 deletions Tests/ERXTest/Sources/er/extensions/eof/ERXECTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import er.erxtest.ERXTestCase;
import er.erxtest.ERXTestUtilities;
import er.erxtest.model.Company;
import er.erxtest.model.Employee;

public class ERXECTest extends ERXTestCase {

Expand Down Expand Up @@ -53,30 +52,6 @@ public void testConstructorWithObjectStore() {
Assert.assertEquals(parentEC3, ec3.parentObjectStore());
}

public void testNestedECs() {
try {
EOEditingContext ec = ERXEC.newEditingContext();
Company c = (Company) EOUtilities.createAndInsertInstance(ec, Company.ENTITY_NAME);
c.setName("Name");
ec.saveChanges();
EOEditingContext nested = ERXEC.newEditingContext(ec);
Company nestC = c.localInstanceIn(nested);
Employee e = (Employee) EOUtilities.createAndInsertInstance(nested, Employee.ENTITY_NAME);
e.setFirstName("First");
e.setLastName("Last");
e.setManager(Boolean.FALSE);
e.addObjectToBothSidesOfRelationshipWithKey(nestC, Employee.COMPANY_KEY);
nested.saveChanges();
ec.saveChanges();
System.gc();
c.delete();
ec.saveChanges();
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}

public void testSerializablilty() throws IOException, ClassNotFoundException {
EOEditingContext ec = ERXEC.newEditingContext();
Company.createCompany(ec, "Some fruit company");
Expand Down

0 comments on commit ffa79f2

Please sign in to comment.