cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r399732 - in /incubator/cayenne/examples/trunk: 3t-example-client/ 3t-example-client/src/ 3t-example-client/src/cayenne3t/ 3t-example-client/src/cayenne3t/example/ 3t-example-client/src/cayenne3t/example/client/ 3t-example-client/src/cayenn...
Date Thu, 04 May 2006 15:23:59 GMT
Author: aadamchik
Date: Thu May  4 08:23:56 2006
New Revision: 399732

URL: http://svn.apache.org/viewcvs?rev=399732&view=rev
Log:
moving 3t-examples to Apache. I am the only author of this code, so there should be no IP
issues.

Added:
    incubator/cayenne/examples/trunk/3t-example-client/.classpath
    incubator/cayenne/examples/trunk/3t-example-client/.cvsignore
    incubator/cayenne/examples/trunk/3t-example-client/.project
    incubator/cayenne/examples/trunk/3t-example-client/src/
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/EventTrace.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/GraphChangeTrace.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/Main.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CDepartment.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CPerson.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CProject.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CustomClientObject.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CDepartment.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CPerson.java
    incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CProject.java
Modified:
    incubator/cayenne/examples/trunk/3t-example-client/   (props changed)
    incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/   (props changed)

Propchange: incubator/cayenne/examples/trunk/3t-example-client/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu May  4 08:23:56 2006
@@ -0,0 +1 @@
+classes

Added: incubator/cayenne/examples/trunk/3t-example-client/.classpath
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/.classpath?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/.classpath (added)
+++ incubator/cayenne/examples/trunk/3t-example-client/.classpath Thu May  4 08:23:56 2006
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/cayenne-java"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/cayenne-java-1.5"/>
+	<classpathentry kind="output" path="classes"/>
+</classpath>

Added: incubator/cayenne/examples/trunk/3t-example-client/.cvsignore
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/.cvsignore?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/.cvsignore (added)
+++ incubator/cayenne/examples/trunk/3t-example-client/.cvsignore Thu May  4 08:23:56 2006
@@ -0,0 +1,2 @@
+classes
+velocity.log

Added: incubator/cayenne/examples/trunk/3t-example-client/.project
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/.project?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/.project (added)
+++ incubator/cayenne/examples/trunk/3t-example-client/.project Thu May  4 08:23:56 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>3t-example-client</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/EventTrace.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/EventTrace.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/EventTrace.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/EventTrace.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,40 @@
+package cayenne3t.example.client;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.objectstyle.cayenne.DataChannelListener;
+import org.objectstyle.cayenne.graph.GraphEvent;
+
+public class EventTrace implements DataChannelListener {
+
+	Log logger;
+
+	GraphChangeTrace graphChangeTrace;
+
+	public EventTrace(String logLabel) {
+		this.logger = LogFactory.getLog(logLabel);
+		this.graphChangeTrace = new GraphChangeTrace(logLabel
+				+ " [graph change] ");
+	}
+
+	public void graphChanged(GraphEvent event) {
+		logger.info("*** Graph Changed");
+		processGraphDiff(event);
+	}
+
+	public void graphFlushed(GraphEvent event) {
+		logger.info("*** Graph Committed:" + event.getSource());
+		processGraphDiff(event);
+	}
+
+	public void graphRolledback(GraphEvent event) {
+		logger.info("*** Graph Rolledback");
+		processGraphDiff(event);
+	}
+
+	void processGraphDiff(GraphEvent e) {
+		if (e.getDiff() != null) {
+			e.getDiff().apply(graphChangeTrace);
+		}
+	}
+}

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/GraphChangeTrace.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/GraphChangeTrace.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/GraphChangeTrace.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/GraphChangeTrace.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,53 @@
+package cayenne3t.example.client;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.objectstyle.cayenne.graph.GraphChangeHandler;
+
+/**
+ * This is an example of a GraphEventListener that logs received events.
+ */
+public class GraphChangeTrace implements GraphChangeHandler {
+
+    Log logger;
+
+    public GraphChangeTrace(String logLabel) {
+        this.logger = LogFactory.getLog(logLabel);
+    }
+    
+    public void arcCreated(Object nodeId, Object targetNodeId, Object arcId) {
+        logger.info("Arc created: " + arcId);
+    }
+
+    public void arcDeleted(Object nodeId, Object targetNodeId, Object arcId) {
+        logger.info("Arc deleted: " + arcId);
+    }
+
+    public void graphCommitted() {
+        logger.info("Graph committed");
+    }
+
+    public void graphRolledback() {
+        logger.info("Graph rolled back");
+    }
+
+    public void nodeCreated(Object nodeId) {
+        logger.info("Node created: " + nodeId);
+    }
+
+    public void nodeIdChanged(Object nodeId, Object newId) {
+        logger.info("Node id changed from " + nodeId + " to " + newId);
+    }
+
+    public void nodePropertyChanged(
+            Object nodeId,
+            String property,
+            Object oldValue,
+            Object newValue) {
+        logger.info("Node property changed: " + property);
+    }
+
+    public void nodeRemoved(Object nodeId) {
+        logger.info("Node removed: " + nodeId);
+    }
+}

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/Main.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/Main.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/Main.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/client/Main.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,207 @@
+package cayenne3t.example.client;
+
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.BasicConfigurator;
+import org.objectstyle.cayenne.CayenneContext;
+import org.objectstyle.cayenne.DataChannel;
+import org.objectstyle.cayenne.ObjectContext;
+import org.objectstyle.cayenne.QueryResponse;
+import org.objectstyle.cayenne.exp.Expression;
+import org.objectstyle.cayenne.query.NamedQuery;
+import org.objectstyle.cayenne.query.Query;
+import org.objectstyle.cayenne.query.QueryChain;
+import org.objectstyle.cayenne.query.SelectQuery;
+import org.objectstyle.cayenne.remote.ClientChannel;
+import org.objectstyle.cayenne.remote.ClientConnection;
+import org.objectstyle.cayenne.remote.hessian.HessianConnection;
+import org.objectstyle.cayenne.util.EventUtil;
+
+import cayenne3t.example.hr.CDepartment;
+import cayenne3t.example.hr.CPerson;
+
+/**
+ * @author Andrus Adamchik
+ */
+public class Main {
+
+	EventTrace channelTrace;
+	ObjectContext context;
+
+	public static void main(String[] args) {
+		try {
+			new Main().execute();
+		} catch (Throwable th) {
+			th.printStackTrace();
+		}
+	}
+
+	Main() {
+		// init Log4J .. isn't strictly needed as Cayenne Client uses
+		// commons-logging, but
+		// helpful when run from Eclipse.
+		BasicConfigurator.configure();
+
+		// obtain object context
+		ClientConnection connection = new HessianConnection(
+				"http://localhost:8080/3t-example/cayenne", null, null,
+				"shared-session");
+
+		// enable channel events
+		DataChannel channel = new ClientChannel(connection, true);
+
+		// trace ALL context local and remote events ... must keep references to
+		// listeners
+		// to avoid deallocation
+		this.channelTrace = new EventTrace("channel-event");
+		EventUtil.listenForChannelEvents(channel.getEventManager(),
+				channelTrace);
+
+		// enable graph events
+		context = new CayenneContext(channel, true, true);
+	}
+
+	void execute() {
+		Log logger = LogFactory.getLog("3t-client-demo");
+		logger.info("*** 1. Setup data: ");
+
+		// batch a few queries in a single call...
+		Query[] deletes = new Query[2];
+		deletes[0] = new NamedQuery("DeletePerson");
+		deletes[1] = new NamedQuery("DeleteDepartment");
+
+		QueryResponse deleteResponse = context
+				.performGenericQuery(new QueryChain(deletes));
+
+		for (deleteResponse.reset(); deleteResponse.next();) {
+			if (!deleteResponse.isList()) {
+				int[] counts = deleteResponse.currentUpdateCount();
+				for (int i = 0; i < counts.length; i++) {
+					logger.info("   deleted = " + counts[i]);
+				}
+			}
+		}
+
+		// do a single named insert query...
+		Query insert = new NamedQuery("CreateData");
+		QueryResponse insertResponse = context.performGenericQuery(insert);
+		for (insertResponse.reset(); insertResponse.next();) {
+			if (!insertResponse.isList()) {
+				int[] counts = insertResponse.currentUpdateCount();
+				for (int i = 0; i < counts.length; i++) {
+					logger.info("   inserted = " + counts[i]);
+				}
+			}
+		}
+
+		logger.info("=======================================\n\n ");
+		logger.info("*** 2. Select: ");
+		List results = context
+				.performQuery(new NamedQuery("DepartmentWithName"));
+		logger.info("   select results: " + results);
+
+		CDepartment department = (CDepartment) results.get(0);
+		department.setDescription(department.getDescription() + "_");
+
+		logger.info("=======================================\n\n ");
+		logger.info("*** 3. Commit modified: ");
+		context.commitChanges();
+		logger.info("   department: " + department);
+
+		logger.info("=======================================\n\n ");
+		logger.info("*** 4. Commit New Object: ");
+		CPerson person = (CPerson) context.newObject(CPerson.class);
+		person.setBaseSalary(new Double(23000.00));
+		person.setDateHired(new Date());
+		person.setFullName("Test Person");
+
+		context.commitChanges();
+
+		logger.info("   person id: " + person.getObjectId());
+		logger.info("   person: " + person);
+
+		logger.info("=======================================\n\n ");
+		logger.info("*** 5. Setup relationship: ");
+
+		person.setDepartment(department);
+
+		CPerson anotherPerson = (CPerson) context.newObject(CPerson.class);
+		anotherPerson.setBaseSalary(new Double(88000.00));
+		anotherPerson.setDateHired(new Date());
+		anotherPerson.setFullName("Another Test Person");
+		department.addToEmployees(anotherPerson);
+
+		context.commitChanges();
+
+		CPerson yetAnotherPerson = (CPerson) context.newObject(CPerson.class);
+		yetAnotherPerson.setBaseSalary(new Double(1000000.00));
+		yetAnotherPerson.setDateHired(new Date());
+		yetAnotherPerson.setFullName("Yet Another Test Person");
+		department.addToEmployees(yetAnotherPerson);
+
+		context.commitChanges();
+
+		logger.info("=======================================\n\n ");
+		logger.info("*** 6. Delete relationship: ");
+
+		department.removeFromEmployees(anotherPerson);
+		yetAnotherPerson.setDepartment(null);
+		context.commitChanges();
+		logger.info(" employees: " + department.getEmployees());
+
+		logger.info("=======================================\n\n ");
+		logger.info("*** 7. Rollback: ");
+
+		department.setName("xyz");
+		CPerson rolledbackPerson = (CPerson) context.newObject(CPerson.class);
+		department.addToEmployees(rolledbackPerson);
+
+		context.rollbackChanges();
+		logger.info("***  " + department);
+		logger.info("***  " + rolledbackPerson);
+
+		logger.info("=======================================\n\n ");
+		logger.info("*** 8. Arbitrary Select: ");
+
+		// select using entity with qualifier
+		SelectQuery select1 = new SelectQuery("Person", Expression
+				.fromString("fullName like '%Another%'"));
+		List matches1 = context.performQuery(select1);
+		logger.info("results: " + matches1);
+
+		// same select using client class name
+		SelectQuery select2 = new SelectQuery(CPerson.class, Expression
+				.fromString("fullName like '%Another%'"));
+		List matches2 = context.performQuery(select2);
+		logger.info("results: " + matches2);
+
+		logger.info("=======================================\n\n ");
+		logger.info("*** 9. Select with Prefetches: ");
+		SelectQuery select3 = new SelectQuery(CPerson.class, Expression
+				.fromString("fullName like '%Tes%'"));
+		select3.addPrefetch("department");
+		List matches3 = context.performQuery(select3);
+		Iterator it3 = matches3.iterator();
+		while (it3.hasNext()) {
+			CPerson p = (CPerson) it3.next();
+			logger.info("*** result: " + p + ", prefetched: "
+					+ p.getDepartment());
+		}
+		
+		logger.info("=======================================\n\n ");
+		logger.info("*** 10. Paginated Select: ");
+		SelectQuery select4 = new SelectQuery(CPerson.class);
+		select4.setPageSize(2);
+		
+		List matches4 = context.performQuery(select4);
+		Iterator it4 = matches4.iterator();
+		while (it4.hasNext()) {
+			CPerson p = (CPerson) it4.next();
+			logger.info("*** result: " + p);
+		}
+	}
+}
\ No newline at end of file

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CDepartment.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CDepartment.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CDepartment.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CDepartment.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,7 @@
+package cayenne3t.example.hr;
+
+import cayenne3t.example.hr.auto._CDepartment;
+
+public class CDepartment extends _CDepartment {
+
+}

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CPerson.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CPerson.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CPerson.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CPerson.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,11 @@
+package cayenne3t.example.hr;
+
+import cayenne3t.example.hr.auto._CPerson;
+
+public class CPerson extends _CPerson {
+
+    public CPerson() {
+        // init defaults
+        this.baseSalary = new Double(0);
+    }
+}

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CProject.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CProject.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CProject.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CProject.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,7 @@
+package cayenne3t.example.hr;
+
+import cayenne3t.example.hr.auto._CProject;
+
+public class CProject extends _CProject {
+
+}

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CustomClientObject.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CustomClientObject.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CustomClientObject.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/CustomClientObject.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,12 @@
+package cayenne3t.example.hr;
+
+import org.objectstyle.cayenne.PersistentObject;
+
+/**
+ * This is a test "wedge" client-side superclass.
+ * 
+ * @author Andrus Adamchik
+ */
+public class CustomClientObject extends PersistentObject {
+
+}

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CDepartment.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CDepartment.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CDepartment.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CDepartment.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,115 @@
+package cayenne3t.example.hr.auto;
+
+import java.util.List;
+
+import org.objectstyle.cayenne.PersistentObject;
+
+import cayenne3t.example.hr.CPerson;
+import cayenne3t.example.hr.CProject;
+
+/**
+ * A generated persistent class mapped as "Department" Cayenne entity. It is a good idea
to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _CDepartment extends PersistentObject {
+
+    public static final String DESCRIPTION_PROPERTY = "description";
+    public static final String NAME_PROPERTY = "name";
+    public static final String EMPLOYEES_PROPERTY = "employees";
+    public static final String PROJECTS_PROPERTY = "projects";
+
+    protected String description;
+    protected String name;
+    protected List employees;
+    protected List projects;
+
+    public String getDescription() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "description");
+        }
+        
+        return description;
+    }
+    public void setDescription(String description) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "description");
+        }
+        
+        Object oldValue = this.description;
+        this.description = description;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "description", oldValue, description);
+        }
+    }
+    
+    
+    public String getName() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "name");
+        }
+        
+        return name;
+    }
+    public void setName(String name) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "name");
+        }
+        
+        Object oldValue = this.name;
+        this.name = name;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "name", oldValue, name);
+        }
+    }
+    
+    
+    public List getEmployees() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "employees");
+        }
+        
+        return employees;
+    }
+    public void addToEmployees(CPerson object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "employees");
+        }
+        
+        this.employees.add(object);
+    }
+    public void removeFromEmployees(CPerson object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "employees");
+        }
+        
+        this.employees.remove(object);
+    }
+    
+    public List getProjects() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "projects");
+        }
+        
+        return projects;
+    }
+    public void addToProjects(CProject object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "projects");
+        }
+        
+        this.projects.add(object);
+    }
+    public void removeFromProjects(CProject object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "projects");
+        }
+        
+        this.projects.remove(object);
+    }
+    
+}
\ No newline at end of file

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CPerson.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CPerson.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CPerson.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CPerson.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,158 @@
+package cayenne3t.example.hr.auto;
+
+import java.util.Date;
+import java.util.List;
+
+import org.objectstyle.cayenne.ValueHolder;
+
+import cayenne3t.example.hr.CDepartment;
+import cayenne3t.example.hr.CProject;
+import cayenne3t.example.hr.CustomClientObject;
+
+/**
+ * A generated persistent class mapped as "Person" Cayenne entity. It is a good idea to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _CPerson extends CustomClientObject {
+
+    public static final String BASE_SALARY_PROPERTY = "baseSalary";
+    public static final String DATE_HIRED_PROPERTY = "dateHired";
+    public static final String FULL_NAME_PROPERTY = "fullName";
+    public static final String DEPARTMENT_PROPERTY = "department";
+    public static final String MANAGED_PROJECTS_PROPERTY = "managedProjects";
+    public static final String PROJECTS_PROPERTY = "projects";
+
+    protected Double baseSalary;
+    protected Date dateHired;
+    protected String fullName;
+    protected ValueHolder department;
+    protected List managedProjects;
+    protected List projects;
+
+    public Double getBaseSalary() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "baseSalary");
+        }
+        
+        return baseSalary;
+    }
+    public void setBaseSalary(Double baseSalary) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "baseSalary");
+        }
+        
+        Object oldValue = this.baseSalary;
+        this.baseSalary = baseSalary;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "baseSalary", oldValue, baseSalary);
+        }
+    }
+    
+    
+    public Date getDateHired() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "dateHired");
+        }
+        
+        return dateHired;
+    }
+    public void setDateHired(Date dateHired) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "dateHired");
+        }
+        
+        Object oldValue = this.dateHired;
+        this.dateHired = dateHired;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "dateHired", oldValue, dateHired);
+        }
+    }
+    
+    
+    public String getFullName() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "fullName");
+        }
+        
+        return fullName;
+    }
+    public void setFullName(String fullName) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "fullName");
+        }
+        
+        Object oldValue = this.fullName;
+        this.fullName = fullName;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "fullName", oldValue, fullName);
+        }
+    }
+    
+    
+    public CDepartment getDepartment() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "department");
+        }
+        
+        return (CDepartment) department.getValue();
+    }
+    public void setDepartment(CDepartment department) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "department");
+        }
+        
+        this.department.setValue(department);
+    }
+    
+    public List getManagedProjects() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "managedProjects");
+        }
+        
+        return managedProjects;
+    }
+    public void addToManagedProjects(CProject object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "managedProjects");
+        }
+        
+        this.managedProjects.add(object);
+    }
+    public void removeFromManagedProjects(CProject object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "managedProjects");
+        }
+        
+        this.managedProjects.remove(object);
+    }
+    
+    public List getProjects() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "projects");
+        }
+        
+        return projects;
+    }
+    public void addToProjects(CProject object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "projects");
+        }
+        
+        this.projects.add(object);
+    }
+    public void removeFromProjects(CProject object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "projects");
+        }
+        
+        this.projects.remove(object);
+    }
+    
+}
\ No newline at end of file

Added: incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CProject.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CProject.java?rev=399732&view=auto
==============================================================================
--- incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CProject.java
(added)
+++ incubator/cayenne/examples/trunk/3t-example-client/src/cayenne3t/example/hr/auto/_CProject.java
Thu May  4 08:23:56 2006
@@ -0,0 +1,102 @@
+package cayenne3t.example.hr.auto;
+
+import java.util.List;
+
+import org.objectstyle.cayenne.PersistentObject;
+import org.objectstyle.cayenne.ValueHolder;
+
+import cayenne3t.example.hr.CDepartment;
+import cayenne3t.example.hr.CPerson;
+
+/**
+ * A generated persistent class mapped as "Project" Cayenne entity. It is a good idea to
+ * avoid changing this class manually, since it will be overwritten next time code is
+ * regenerated. If you need to make any customizations, put them in a subclass.
+ */
+public class _CProject extends PersistentObject {
+
+    public static final String NAME_PROPERTY = "name";
+    public static final String DEPARTMENT_PROPERTY = "department";
+    public static final String MANAGER_PROPERTY = "manager";
+    public static final String MEMBERS_PROPERTY = "members";
+
+    protected String name;
+    protected ValueHolder department;
+    protected ValueHolder manager;
+    protected List members;
+
+    public String getName() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "name");
+        }
+        
+        return name;
+    }
+    public void setName(String name) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "name");
+        }
+        
+        Object oldValue = this.name;
+        this.name = name;
+        
+        // notify objectContext about simple property change
+        if(objectContext != null) {
+            objectContext.propertyChanged(this, "name", oldValue, name);
+        }
+    }
+    
+    
+    public CDepartment getDepartment() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "department");
+        }
+        
+        return (CDepartment) department.getValue();
+    }
+    public void setDepartment(CDepartment department) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "department");
+        }
+        
+        this.department.setValue(department);
+    }
+    
+    public CPerson getManager() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "manager");
+        }
+        
+        return (CPerson) manager.getValue();
+    }
+    public void setManager(CPerson manager) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "manager");
+        }
+        
+        this.manager.setValue(manager);
+    }
+    
+    public List getMembers() {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "members");
+        }
+        
+        return members;
+    }
+    public void addToMembers(CPerson object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "members");
+        }
+        
+        this.members.add(object);
+    }
+    public void removeFromMembers(CPerson object) {
+        if(objectContext != null) {
+            objectContext.prepareForAccess(this, "members");
+        }
+        
+        this.members.remove(object);
+    }
+    
+}
\ No newline at end of file

Propchange: incubator/cayenne/examples/trunk/3t-example/webroot/WEB-INF/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu May  4 08:23:56 2006
@@ -0,0 +1 @@
+classes



Mime
View raw message