<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>src/com/norex/gtrax/client/contact/tasks/TaskWidget.java</filename>
    </added>
    <added>
      <filename>src/com/norex/gtrax/client/contact/tasks/taskwidget.css</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -8,6 +8,7 @@ import com.google.gwt.user.client.rpc.RemoteService;
 import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
 import com.norex.gtrax.client.authentication.auth.ClientAuth;
 import com.norex.gtrax.client.authentication.group.ClientGroup;
+import com.norex.gtrax.client.contact.tasks.ClientTask;
 
 @RemoteServiceRelativePath(&quot;auth&quot;)
 public interface AuthService extends RemoteService {
@@ -20,11 +21,17 @@ public interface AuthService extends RemoteService {
 	public ClientAuth login(String url) throws NotLoggedInException;
 	public ArrayList&lt;ClientGroup&gt; getAuthGroups(ClientAuth auth);
 	
+	// groups
 	public ClientGroup saveGroup(ClientGroup group);
 	public ArrayList&lt;ClientGroup&gt; getGroups();
 	public ClientAuth addAuthToGroup(ClientAuth auth, ClientGroup group);
 	public ArrayList&lt;ClientAuth&gt; getGroupMembers(ClientGroup group);
 	public void deleteGroup(ClientGroup group);
-	
+
+	// permissions
 	public ArrayList&lt;String&gt; getAllPermissions();
+	
+	// tasks
+	public ArrayList&lt;ClientTask&gt; getTasks(ClientAuth auth);
+	public ClientTask saveTask(ClientTask task);
 }</diff>
      <filename>src/com/norex/gtrax/client/authentication/AuthService.java</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,7 @@ import java.lang.String;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.norex.gtrax.client.authentication.auth.ClientAuth;
 import com.norex.gtrax.client.authentication.group.ClientGroup;
+import com.norex.gtrax.client.contact.tasks.ClientTask;
 
 @SuppressWarnings(&quot;unchecked&quot;)
 public interface AuthServiceAsync {
@@ -27,4 +28,6 @@ public interface AuthServiceAsync {
 	public void getAllPermissions(AsyncCallback&lt;ArrayList&lt;String&gt;&gt; async);
 	public void getAuthGroups(ClientAuth auth,
 			AsyncCallback&lt;ArrayList&lt;ClientGroup&gt;&gt; callback);
+	void getTasks(ClientAuth auth, AsyncCallback&lt;ArrayList&lt;ClientTask&gt;&gt; callback);
+	void saveTask(ClientTask task, AsyncCallback&lt;ClientTask&gt; callback);
 }</diff>
      <filename>src/com/norex/gtrax/client/authentication/AuthServiceAsync.java</filename>
    </modified>
    <modified>
      <diff>@@ -14,8 +14,11 @@ public interface ContactService extends RemoteService {
 	public void delete(ClientContact contact);
 	public ArrayList&lt;ClientProject&gt; getContactProjects(ClientContact contact);
 	
+	
+	// deals
 	public ClientDeal saveDeal(ClientDeal deal);
 	public ArrayList&lt;ClientDeal&gt; getDeals();
 	public ArrayList&lt;ClientDeal&gt; getDeals(ClientContact contact);
 	public void deleteDeal(ClientDeal deal);
+	
 }</diff>
      <filename>src/com/norex/gtrax/client/contact/ContactService.java</filename>
    </modified>
    <modified>
      <diff>@@ -19,10 +19,14 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Panel;
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.norex.gtrax.client.AsyncRemoteCall;
+import com.norex.gtrax.client.GTrax;
 import com.norex.gtrax.client.SaveEvent;
 import com.norex.gtrax.client.SaveHandler;
 import com.norex.gtrax.client.ViewInterface;
+import com.norex.gtrax.client.authentication.AuthService;
+import com.norex.gtrax.client.authentication.AuthServiceAsync;
 import com.norex.gtrax.client.contact.tasks.ClientTask;
+import com.norex.gtrax.client.contact.tasks.TaskWidget;
 import com.norex.gtrax.client.deal.ClientDeal;
 import com.norex.gtrax.client.deal.DealWidgetEditable;
 import com.norex.gtrax.client.widgets.SideSelectColumnItem;
@@ -98,6 +102,17 @@ public class ContactView implements ViewInterface {
 				}
 			}
 		});
+		
+		AuthServiceAsync authService = GWT.create(AuthService.class);
+		authService.getTasks(GTrax.getAuth(), new AsyncRemoteCall&lt;ArrayList&lt;ClientTask&gt;&gt;() {
+			public void onSuccess(ArrayList&lt;ClientTask&gt; result) {
+				if (!result.iterator().hasNext()) return;
+				
+				for (ClientTask t : result) {
+					doAddTask(t);
+				}
+			}
+		});
 	
 		return p;
 	}
@@ -162,6 +177,10 @@ public class ContactView implements ViewInterface {
 		tasks.add(new TaskWidget());
 	}
 	
+	public void doAddTask(ClientTask t) {
+		tasks.add(new TaskWidget(t));
+	}
+	
 	public ContactSubView showAllContacts() {
 		SideSelectColumnItem i = (SideSelectColumnItem) selectorColumn.getColumnHeader().getWidget(0);
 		selectorColumn.clearSelected();</diff>
      <filename>src/com/norex/gtrax/client/contact/ContactView.java</filename>
    </modified>
    <modified>
      <diff>@@ -2,10 +2,13 @@ package com.norex.gtrax.client.contact.tasks;
 
 import com.norex.gtrax.client.ClientModelInterface;
 
-public class ClientTask implements TaskInterface, ClientModelInterface {
+public class ClientTask implements TaskInterface&lt;String&gt;, ClientModelInterface {
 	
 	private String id;
 	private String name;
+	private String associatedObject;
+	private String authKey;
+	private boolean completed = false;
 
 	public String getName() {
 		return name;
@@ -23,4 +26,28 @@ public class ClientTask implements TaskInterface, ClientModelInterface {
 		this.id = key;
 	}
 
+	public String getAssociatedObject() {
+		return associatedObject;
+	}
+
+	public void setAssociatedObject(String key) {
+		this.associatedObject = key;
+	}
+
+	public String getAuth() {
+		return authKey;
+	}
+
+	public void setAuth(String authKey) {
+		this.authKey = authKey;
+	}
+
+	public boolean getCompleted() {
+		return completed;
+	}
+
+	public void setCompleted(boolean completed) {
+		this.completed = completed;
+	}
+
 }</diff>
      <filename>src/com/norex/gtrax/client/contact/tasks/ClientTask.java</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,12 @@
 package com.norex.gtrax.client.contact.tasks;
 
-public interface TaskInterface {
+public interface TaskInterface&lt;T&gt; {
 	public void setName(String name);
 	public String getName();
+	public void setAssociatedObject(T key);
+	public T getAssociatedObject();
+	public void setAuth(T authKey);
+	public T getAuth();
+	public void setCompleted(boolean completed);
+	public boolean getCompleted();
 }</diff>
      <filename>src/com/norex/gtrax/client/contact/tasks/TaskInterface.java</filename>
    </modified>
    <modified>
      <diff>@@ -23,6 +23,8 @@ import com.norex.gtrax.client.authentication.AuthService;
 import com.norex.gtrax.client.authentication.NotLoggedInException;
 import com.norex.gtrax.client.authentication.auth.ClientAuth;
 import com.norex.gtrax.client.authentication.group.ClientGroup;
+import com.norex.gtrax.client.contact.tasks.ClientTask;
+import com.norex.gtrax.client.deal.ClientDeal;
 
 @SuppressWarnings(&quot;serial&quot;)
 public class AuthServiceImpl extends GeneralServiceImpl implements
@@ -237,4 +239,38 @@ public class AuthServiceImpl extends GeneralServiceImpl implements
 		return null;
 	}
 
+	public ArrayList&lt;ClientTask&gt; getTasks(ClientAuth auth) {
+		if (auth.getId() == null) return null;
+		
+		PersistenceManager pm = PMF.getPersistenceManager();
+		
+		Query query = pm.newQuery(Task.class);
+		query.setFilter(&quot;authKey == ckey&quot;);
+		query.declareParameters(&quot;com.google.appengine.api.datastore.Key ckey&quot;);
+
+		ArrayList&lt;ClientTask&gt; tasks = new ArrayList&lt;ClientTask&gt;();
+		
+		try {
+			Auth a = Model.getObject(Auth.class, auth.getId());
+			List&lt;Task&gt; rs = (List&lt;Task&gt;) query.execute(a.getId());
+			for (Task d : rs) {
+				tasks.add(d.toClient());
+			}
+		} finally {
+			query.closeAll();
+			pm.close();
+		}
+		
+		
+		return tasks;
+	}
+
+	public ClientTask saveTask(ClientTask task) {
+		Task t = Model.getObject(Task.class, task.getId());
+		if (t == null) t = new Task();
+		t.save(task);
+		
+		return t.toClient();
+	}
+
 }</diff>
      <filename>src/com/norex/gtrax/server/AuthServiceImpl.java</filename>
    </modified>
    <modified>
      <diff>@@ -4,26 +4,52 @@ import javax.jdo.annotations.IdentityType;
 import javax.jdo.annotations.PersistenceCapable;
 import javax.jdo.annotations.Persistent;
 
+import com.google.appengine.api.datastore.Key;
 import com.google.appengine.api.datastore.KeyFactory;
 import com.norex.gtrax.client.contact.tasks.ClientTask;
 import com.norex.gtrax.client.contact.tasks.TaskInterface;
 
 @PersistenceCapable(identityType = IdentityType.APPLICATION)
-public class Task extends Model&lt;ClientTask&gt; implements TaskInterface {
+public class Task extends Model&lt;ClientTask&gt; implements TaskInterface&lt;Key&gt; {
 	
 	@Persistent
 	private String name;
+	
+	@Persistent(defaultFetchGroup=&quot;true&quot;)
+	private Key associatedObject;
+	
+	@Persistent(defaultFetchGroup=&quot;true&quot;)
+	private Key authKey;
+	
+	@Persistent
+	private boolean completed = false;
 
 	public ClientTask toClient() {
 		ClientTask t = new ClientTask();
 		t.setId(KeyFactory.keyToString(getId()));
 		t.setName(getName());
+		t.setAuth(KeyFactory.keyToString(getAuth()));
+		t.setCompleted(getCompleted());
+		
+		if (getAssociatedObject() != null) {
+			t.setAssociatedObject(KeyFactory.keyToString(getAssociatedObject()));
+		} else {
+			t.setAssociatedObject(null);
+		}
 		
 		return t;
 	}
 
 	public void update(ClientTask o) {
 		setName(o.getName());
+		setAuth(KeyFactory.stringToKey(o.getAuth()));
+		setCompleted(o.getCompleted());
+		
+		if (o.getAssociatedObject() != null) {
+			setAssociatedObject(KeyFactory.stringToKey(o.getAssociatedObject()));
+		} else {
+			setAssociatedObject(null);
+		}
 	}
 
 	public String getName() {
@@ -34,4 +60,29 @@ public class Task extends Model&lt;ClientTask&gt; implements TaskInterface {
 		this.name = name;
 	}
 
+	public void setAssociatedObject(Key associatedObject) {
+		this.associatedObject = associatedObject;
+	}
+
+	public Key getAssociatedObject() {
+		return associatedObject;
+	}
+
+	public Key getAuth() {
+		return authKey;
+	}
+
+	public void setAuth(Key authKey) {
+		this.authKey = authKey;
+	}
+	
+	public boolean getCompleted() {
+		return completed;
+	}
+
+	public void setCompleted(boolean completed) {
+		this.completed = completed;
+	}
+
+
 }</diff>
      <filename>src/com/norex/gtrax/server/Task.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>958af1012e02fb60c5531bc3840bf2a05f1e88cf</id>
    </parent>
  </parents>
  <author>
    <name>Christopher Troup</name>
    <email>chris@norex.ca</email>
  </author>
  <url>http://github.com/thurloat/GTrax/commit/6f69c22d0ea864efea455288125603ae7b06ed98</url>
  <id>6f69c22d0ea864efea455288125603ae7b06ed98</id>
  <committed-date>2009-10-26T13:43:28-07:00</committed-date>
  <authored-date>2009-10-26T13:43:28-07:00</authored-date>
  <message>add task getting and saving</message>
  <tree>015f516d5a344387e3d5318a117db1683d876697</tree>
  <committer>
    <name>Christopher Troup</name>
    <email>chris@norex.ca</email>
  </committer>
</commit>
