@@ -35,8 +35,8 @@ public void __internalSet(String property, Object value) {
3535 @ Override
3636 public Object __internalGet (String property ) {
3737 if ("name" .equals (property )) {
38- if (getEntityRoot () != null && getId () != null ) {
39- Object rootVal = getEntityRoot ().get (new EntityKey (typeName (), getId ()), property );
38+ if (getEntityMutationLedger () != null && getId () != null ) {
39+ Object rootVal = getEntityMutationLedger ().get (new EntityKey (typeName (), getId ()), property );
4040 if (rootVal != null ) return rootVal ;
4141 }
4242 return this .name ;
@@ -68,8 +68,8 @@ public void testRootBackedPropertyTracking() {
6868 entity .set$status (EntityStatus .PERSISTED ); // Persisted entity
6969 entity .clearUpdatedProperties ();
7070
71- EntityRoot root = new EntityRoot ();
72- entity .setEntityRoot (root );
71+ EntityMutationLedger root = new EntityMutationLedger ();
72+ entity .setEntityMutationLedger (root );
7373
7474 // 1. Updating a persisted entity records the new value under its EntityKey.
7575 entity .updateName ("Alice" );
@@ -102,8 +102,8 @@ public void testRootBackedPropertyTracking() {
102102 public void testTraceChainCopiedToRoot () {
103103 TestEntity entity = new TestEntity ();
104104 entity .updateId (101L );
105- EntityRoot root = new EntityRoot ();
106- entity .setEntityRoot (root );
105+ EntityMutationLedger root = new EntityMutationLedger ();
106+ entity .setEntityMutationLedger (root );
107107
108108 entity .setTraceChain ("trace-123" );
109109 entity .updateName ("Bob" );
@@ -115,8 +115,8 @@ public void testTraceChainCopiedToRoot() {
115115 @ Test
116116 public void testEntityWithoutIdFallsBackToLocalTracking () {
117117 TestEntity entity = new TestEntity ();
118- EntityRoot root = new EntityRoot ();
119- entity .setEntityRoot (root );
118+ EntityMutationLedger root = new EntityMutationLedger ();
119+ entity .setEntityMutationLedger (root );
120120
121121 // No ID set
122122 entity .updateName ("Charlie" );
@@ -365,7 +365,7 @@ public String toString() {
365365 }
366366
367367 @ Test
368- public void testEntityRootIntegrationExtras () {
368+ public void testEntityMutationLedgerIntegrationExtras () {
369369 TestEntity e = new TestEntity ();
370370 e .updateId (1L );
371371 e .updateVersion (2L );
@@ -374,8 +374,8 @@ public void testEntityRootIntegrationExtras() {
374374 assertFalse (e .isMarkedAsDelete ());
375375 assertNull (e .getOriginalVersion ());
376376
377- EntityRoot root = new EntityRoot ();
378- e .setEntityRoot (root );
377+ EntityMutationLedger root = new EntityMutationLedger ();
378+ e .setEntityMutationLedger (root );
379379
380380 // assertion removed
381381 assertEquals (Long .valueOf (2L ), e .getOriginalVersion ());
@@ -494,9 +494,9 @@ public void testBaseEntityBranches() {
494494 assertEquals (20L , e .__internalGet ("id" ));
495495 assertEquals (6L , e .__internalGet ("version" ));
496496
497- EntityRoot root = new EntityRoot ();
498- e .setEntityRoot (root ); // setEntityRoot branches
499- e .setEntityRoot (root ); // already set, branch hit
497+ EntityMutationLedger root = new EntityMutationLedger ();
498+ e .setEntityMutationLedger (root ); // setEntityMutationLedger branches
499+ e .setEntityMutationLedger (root ); // already set, branch hit
500500
501501 root .set (new EntityKey (e .typeName (), e .getId ()), "id" , 30L );
502502 assertEquals (30L , e .__internalGet ("id" )); // get from root branch
@@ -522,18 +522,18 @@ public void testBaseEntityBranches() {
522522 e .__internalSet ("name" , "test_name" );
523523 assertEquals ("test_name" , e .getDisplayName ());
524524
525- // update id before setting entityRoot to hit id != null branch
525+ // update id before setting entityMutationLedger to hit id != null branch
526526 TestEntity eRootTest = new TestEntity ();
527527 eRootTest .updateId (500L );
528- EntityRoot root2 = new EntityRoot ();
529- eRootTest .setEntityRoot (root2 );
528+ EntityMutationLedger root2 = new EntityMutationLedger ();
529+ eRootTest .setEntityMutationLedger (root2 );
530530
531- // getUpdatedProperties when entityRoot != null and id != null
531+ // getUpdatedProperties when entityMutationLedger != null and id != null
532532 assertNotNull (eRootTest .getUpdatedProperties ());
533533
534- // getUpdatedProperties when entityRoot != null and id == null
534+ // getUpdatedProperties when entityMutationLedger != null and id == null
535535 TestEntity eRootTest2 = new TestEntity ();
536- eRootTest2 .setEntityRoot (root2 );
536+ eRootTest2 .setEntityMutationLedger (root2 );
537537 assertNotNull (eRootTest2 .getUpdatedProperties ());
538538
539539 // isNew, isMarkedAsDelete, getOriginalVersion with id != null and root != null
@@ -579,8 +579,8 @@ public void testBaseEntityBranches() {
579579 public void testMoreBaseEntityBranches () {
580580 TestEntity e = new TestEntity ();
581581 e .updateId (100L );
582- EntityRoot root = new EntityRoot ();
583- e .setEntityRoot (root );
582+ EntityMutationLedger root = new EntityMutationLedger ();
583+ e .setEntityMutationLedger (root );
584584
585585 // setComment
586586 e .setComment ("comment" );
@@ -618,8 +618,8 @@ public void register(io.teaql.core.meta.EntityDescriptor type) {}
618618 io .teaql .core .meta .EntityMetaFactory .registerGlobal (null );
619619 }
620620
621- // setEntityRoot same
622- e .setEntityRoot (root );
621+ // setEntityMutationLedger same
622+ e .setEntityMutationLedger (root );
623623
624624 // dirtyFields
625625 assertTrue (e .dirtyFields ().contains ("id" )); // it has 'id' because we called root.set
@@ -677,7 +677,7 @@ public void testRemainingBranches() {
677677 e .setComment (null );
678678 e .setComment (null );
679679
680- // __internalGet, getUpdatedProperties, markAsDeleted, isMarkedAsDelete, isNew, getOriginalVersion, markToRemove, handleUpdate when id == null or entityRoot == null
680+ // __internalGet, getUpdatedProperties, markAsDeleted, isMarkedAsDelete, isNew, getOriginalVersion, markToRemove, handleUpdate when id == null or entityMutationLedger == null
681681 e .getUpdatedProperties ();
682682 e .set$status (io .teaql .core .EntityStatus .PERSISTED );
683683 e .markAsDeleted ();
@@ -694,8 +694,8 @@ public void testRemainingBranches() {
694694 e .__internalGet ("nonExistent" );
695695 } catch (Exception ignored ) {}
696696
697- EntityRoot root = new EntityRoot ();
698- e .setEntityRoot (root ); // id == null, root != null
697+ EntityMutationLedger root = new EntityMutationLedger ();
698+ e .setEntityMutationLedger (root ); // id == null, root != null
699699 e .getUpdatedProperties ();
700700 e .isMarkedAsDelete ();
701701 e .isNew ();
@@ -710,7 +710,7 @@ public void testRemainingBranches() {
710710 // getUpdatedProperties when id != null, root != null but changes empty
711711 TestEntity e2 = new TestEntity ();
712712 e2 .updateId (1L );
713- e2 .setEntityRoot (root );
713+ e2 .setEntityMutationLedger (root );
714714 e2 .getUpdatedProperties ();
715715
716716 // addRelation when descriptor == null
@@ -773,7 +773,7 @@ public void register(io.teaql.core.meta.EntityDescriptor type) {}
773773 }
774774
775775 @ Test
776- public void testEntityRootDelegates () {
776+ public void testEntityMutationLedgerDelegates () {
777777 BaseEntity entity = new BaseEntity () {
778778 @ Override public String typeName () { return "DummyEntity" ; }
779779 @ Override public boolean newItem () { return true ; }
@@ -782,17 +782,17 @@ public void testEntityRootDelegates() {
782782 entity .__internalSet ("id" , 1L );
783783 entity .__internalSet ("version" , 1L );
784784
785- // Test entityRoot == null branches
786- entity .setEntityRoot (null );
785+ // Test entityMutationLedger == null branches
786+ entity .setEntityMutationLedger (null );
787787 try { entity .__internalGet ("name" ); } catch (Exception ignored ) {}
788788 entity .getUpdatedProperties ();
789789 entity .dirtyFields ();
790790 try { entity .markAsDeleted (); } catch (Exception ignored ) {}
791791 entity .isMarkedAsDelete ();
792792 entity .isNew ();
793793
794- EntityRoot root = new EntityRoot ();
795- entity .setEntityRoot (root );
794+ EntityMutationLedger root = new EntityMutationLedger ();
795+ entity .setEntityMutationLedger (root );
796796
797797 entity .setComment ("test comment" );
798798 assertEquals ("test comment" , root .getComment ());
@@ -821,7 +821,7 @@ public void testEntityRootDelegates() {
821821 BaseEntity entityNoId = new BaseEntity () {
822822 @ Override public String typeName () { return "NoIdEntity" ; }
823823 };
824- entityNoId .setEntityRoot (root );
824+ entityNoId .setEntityMutationLedger (root );
825825 try {
826826 entityNoId .__internalGet ("name" );
827827 } catch (Exception ignored ) {}
0 commit comments