summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2025-03-12 20:31:40 -0400
committerBenjamin Culkin <scorpress@gmail.com>2025-03-12 20:31:40 -0400
commit39dc3aa7db0341457c438693af5ba9bb1cfdf560 (patch)
treec3514435d82c34e0443a339dec2ae1ee91cb2215
parentbe03e4adfe97561553c9ed2c10561c49d35c06d9 (diff)
General updateworking
It's been a bit too long for me to recall what all I was doing here and what it should've been doing. Just looking at the files, I was attempting to figure out how the EO stuff works. Think I had some basic results, but just mostly added a tracing store to help w/ debugging
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/EOMapObjectStoreTest.java33
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/JDBCDBTest.java11
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/Person.java5
-rw-r--r--projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOVectorKeyGlobalID.java3
-rw-r--r--projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/TracingObjectStore.java87
-rw-r--r--wotonomy-web-test/src/main/java/Application.java5
-rw-r--r--wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html6
7 files changed, 132 insertions, 18 deletions
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/EOMapObjectStoreTest.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/EOMapObjectStoreTest.java
new file mode 100644
index 0000000..52cf6f2
--- /dev/null
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/EOMapObjectStoreTest.java
@@ -0,0 +1,33 @@
+package net.wotonomy.jdbcadaptor;
+
+import java.util.Map;
+
+import junit.framework.TestCase;
+import net.wotonomy.control.EOClassDescription;
+import net.wotonomy.control.EOEditingContext;
+import net.wotonomy.control.EOGlobalID;
+import net.wotonomy.control.EOKeyGlobalID;
+import net.wotonomy.control.EOVectorKeyGlobalID;
+
+public class EOMapObjectStoreTest extends TestCase {
+ public void testEOMapObjectStore() {
+ EOMapObjectStore store = new EOMapObjectStore();
+ EOEditingContext editCtx = new EOEditingContext(store);
+
+ EOClassDescription<Person> personDesc = EOClassDescription.classDescriptionForClass(Person.class);
+
+ EOKeyGlobalID personID = new EOVectorKeyGlobalID("John Doe", "John", "Doe");
+ //Person person = personDesc.createInstanceWithEditingContext(editCtx, personID);
+ Person person = new Person();
+
+ person.setFirstName("John");
+ person.setLastName("Doe");
+ person.setAge(25);
+
+ editCtx.insertObjectWithGlobalID(person, personID);
+ editCtx.saveChanges();
+
+ Map<EOGlobalID,Object> data = store.getData();
+ assertEquals(1, data.size());
+ }
+} \ No newline at end of file
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/JDBCDBTest.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/JDBCDBTest.java
index 90add1a..d572af0 100644
--- a/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/JDBCDBTest.java
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/JDBCDBTest.java
@@ -9,6 +9,7 @@ import net.wotonomy.control.EOClassDescription;
import net.wotonomy.control.EOEditingContext;
import net.wotonomy.control.EOKeyGlobalID;
import net.wotonomy.control.EOTemporaryGlobalID;
+import net.wotonomy.control.EOVectorKeyGlobalID;
import net.wotonomy.foundation.NSDictionary;
public class JDBCDBTest extends TestCase {
@@ -66,25 +67,27 @@ public class JDBCDBTest extends TestCase {
EODatabase db = new EODatabase(adaptor);
EODatabaseContext dbCtx = new EODatabaseContext(db);
((JDBCContext)dbCtx.adaptorContext()).connect();
+ ((JDBCContext)dbCtx.adaptorContext()).beginTransaction();
EOEditingContext editCtx = new EOEditingContext(dbCtx);
EOClassDescription<Person> personDesc = EOClassDescription.classDescriptionForClass(Person.class);
- EOTemporaryGlobalID tempGID = new EOTemporaryGlobalID();
- Person person = personDesc.createInstanceWithEditingContext(editCtx, tempGID);
-
+ EOKeyGlobalID personID = new EOVectorKeyGlobalID("John Doe", "John", "Doe");
+ //Person person = personDesc.createInstanceWithEditingContext(editCtx, personID);
+ Person person = new Person();
person.setFirstName("John");
person.setLastName("Doe");
person.setAge(25);
+ editCtx.insertObjectWithGlobalID(person, personID);
editCtx.saveChanges();
//editCtx.invalidateAllObjects();
((JDBCContext)dbCtx.adaptorContext()).commitTransaction();
//editCtx.reset();
- Person newPerson = (Person) editCtx.objectForGlobalID(tempGID);
+ Person newPerson = (Person) editCtx.objectForGlobalID(personID);
assertEquals(person, newPerson);
}
} \ No newline at end of file
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/Person.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/Person.java
index d42c77c..68b2eb9 100644
--- a/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/Person.java
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/test/java/net/wotonomy/jdbcadaptor/Person.java
@@ -1,8 +1,11 @@
package net.wotonomy.jdbcadaptor;
+import java.io.Serializable;
import java.util.Objects;
-public class Person {
+public class Person implements Serializable {
+ private static final long serialVersionUID = 6209495140898426987L;
+
private String firstName;
private String lastName;
diff --git a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOVectorKeyGlobalID.java b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOVectorKeyGlobalID.java
index 5fc500d..b5c14c3 100644
--- a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOVectorKeyGlobalID.java
+++ b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOVectorKeyGlobalID.java
@@ -27,14 +27,13 @@ public class EOVectorKeyGlobalID extends EOKeyGlobalID {
protected Object[] _keyValues;
- public EOVectorKeyGlobalID(String entityName, Object[] values) {
+ public EOVectorKeyGlobalID(String entityName, Object... values) {
super(entityName, 0);
_keyValues = new Object[values.length];
for (int i = 0; i < values.length; i++) {
_keyValues[i] = values[i];
}
}
-
/*
* (non-Javadoc)
*
diff --git a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/TracingObjectStore.java b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/TracingObjectStore.java
new file mode 100644
index 0000000..a047486
--- /dev/null
+++ b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/TracingObjectStore.java
@@ -0,0 +1,87 @@
+package net.wotonomy.control;
+
+import java.util.List;
+import java.util.Map;
+
+import net.wotonomy.foundation.NSArray;
+
+/**
+ * A implementation of EOObjectStore that just delegates to a child store.
+ *
+ * The reason for creating this is so that I can add tracing to see where the various calls are going;
+ * since I'm still unsure on what needs to be done to build a compliant and working implementation
+ * of EOObjectStore, and to what degree AbstractObjectStore helps with that.
+ *
+ * @author bjculkin
+ *
+ */
+public class TracingObjectStore extends EOObjectStore {
+ private EOObjectStore delegate;
+
+ public TracingObjectStore(EOObjectStore store) {
+ this.delegate = store;
+ }
+
+ @Override
+ public NSArray<?> arrayFaultWithSourceGlobalID(EOGlobalID aGlobalID, String aRelationship,
+ EOEditingContext aContext) {
+ return delegate.arrayFaultWithSourceGlobalID(aGlobalID, aRelationship, aContext);
+ }
+
+ @Override
+ public Object faultForGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext) {
+ return delegate.faultForGlobalID(aGlobalID, aContext);
+ }
+
+ @Override
+ public Object faultForRawRow(Map aDictionary, String anEntityName, EOEditingContext aContext) {
+ return delegate.faultForRawRow(aDictionary, anEntityName, aContext);
+ }
+
+ @Override
+ public void initializeObject(Object eo, EOGlobalID aGlobalID, EOEditingContext aContext) {
+ delegate.initializeObject(eo, aGlobalID, aContext);
+
+ }
+
+ @Override
+ public void invalidateAllObjects() {
+ delegate.invalidateAllObjects();
+ }
+
+ @Override
+ public void invalidateObjectsWithGlobalIDs(List aList) {
+ delegate.invalidateObjectsWithGlobalIDs(aList);
+ }
+
+ @Override
+ public boolean isObjectLockedWithGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext) {
+ return delegate.isObjectLockedWithGlobalID(aGlobalID, aContext);
+ }
+
+ @Override
+ public void lockObjectWithGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext) {
+ delegate.lockObjectWithGlobalID(aGlobalID, aContext);
+ }
+
+ @Override
+ public NSArray objectsForSourceGlobalID(EOGlobalID aGlobalID, String aRelationship, EOEditingContext aContext) {
+ return delegate.objectsForSourceGlobalID(aGlobalID, aRelationship, aContext);
+ }
+
+ @Override
+ public NSArray objectsWithFetchSpecification(EOFetchSpecification aFetchSpec, EOEditingContext aContext) {
+ return delegate.objectsWithFetchSpecification(aFetchSpec, aContext);
+ }
+
+ @Override
+ public void refaultObject(Object anObject, EOGlobalID aGlobalID, EOEditingContext aContext) {
+ delegate.refaultObject(anObject, aGlobalID, aContext);
+ }
+
+ @Override
+ public void saveChangesInEditingContext(EOEditingContext aContext) {
+ delegate.saveChangesInEditingContext(aContext);
+ }
+
+}
diff --git a/wotonomy-web-test/src/main/java/Application.java b/wotonomy-web-test/src/main/java/Application.java
index 5418913..2b59970 100644
--- a/wotonomy-web-test/src/main/java/Application.java
+++ b/wotonomy-web-test/src/main/java/Application.java
@@ -1,8 +1,3 @@
-// Decompiled by Jad v1.5.8c. Copyright 2001 Pavel Kouznetsov.
-// Jad home page: http://www.geocities.com/kpdus/jad.html
-// Decompiler options: packimports(3) fieldsfirst nonlb space
-// Source File Name: Application.java
-
import java.util.ArrayList;
import java.util.List;
diff --git a/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html b/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html
index 750a74f..0402ea2 100644
--- a/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html
+++ b/wotonomy-web-test/src/main/webapp/WEB-INF/classes/Main.wo/Main.html
@@ -17,12 +17,6 @@
<p>Some text..</p>
</div>
</webobject>
- <div class = "card">
- <h2>TITLE HEADING</h2>
- <h5>Title description, Sep 2, 2017</h5>
- <div class = "fakeimg" style = "height:200px;"> Image </div>
- <p>Some text..</p>
- </div>
</div>
<div class = "rightcolumn">
<div class = "card">