changeset 3:d0ee9edfff28

add libs, models/NodeModel.java
author one
date Mon, 01 Oct 2012 16:39:19 +0900
parents e7678d361e67
children cb0baf808047
files .classpath .settings/org.scala-ide.sdt.core.prefs app/controllers/Application.java app/controllers/User.java app/models/NodeModel.java lib/blueprints-core-2.2.0-SNAPSHOT.jar lib/gremlin-java-2.2.0-SNAPSHOT.jar lib/pipes-2.2.0-SNAPSHOT.jar logs/application.log project/project/target/config-classes/$60248ea5edf127a3d4b7$$anonfun$$sbtdef$1.class project/project/target/config-classes/$60248ea5edf127a3d4b7$.class project/project/target/config-classes/$60248ea5edf127a3d4b7.class project/project/target/config-classes/$905ecb45ba0fe1f8b758$.class project/project/target/config-classes/$905ecb45ba0fe1f8b758.class project/project/target/config-classes/$f6c5bcb932278671af90$$anonfun$$sbtdef$1.class project/project/target/config-classes/$f6c5bcb932278671af90$.class project/project/target/config-classes/$f6c5bcb932278671af90.class project/target/scala-2.9.1/sbt-0.11.3/cache/compile/compile project/target/scala-2.9.1/sbt-0.11.3/cache/update/inputs project/target/scala-2.9.1/sbt-0.11.3/cache/update/output target/.history target/scala-2.9.1/cache/compile/compile target/scala-2.9.1/cache/compile/copy-resources target/scala-2.9.1/cache/copy-assets target/scala-2.9.1/cache/update/inputs target/scala-2.9.1/cache/update/output target/scala-2.9.1/classes/controllers/Application.class target/scala-2.9.1/classes_managed/controllers/routes$javascript.class target/scala-2.9.1/classes_managed/controllers/routes$ref.class target/scala-2.9.1/classes_managed/controllers/routes.class target/streams/compile/compile/$global/out
diffstat 31 files changed, 140 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/.classpath	Mon Oct 01 16:13:44 2012 +0900
+++ b/.classpath	Mon Oct 01 16:39:19 2012 +0900
@@ -2,7 +2,10 @@
 <classpath>
 	<classpathentry kind="src" output=".target" path="app"/>
 	<classpathentry kind="src" output=".target" path="test"/>
-	<classpathentry kind="lib" path="/Users/aotokage/testProgram/play/Consensus/target/scala-2.9.1/classes_managed"/>
+	<classpathentry kind="lib" path="lib/jackson-annotations-2.0.2.jar"/>
+	<classpathentry kind="lib" path="lib/jackson-core-2.0.2.jar"/>
+	<classpathentry kind="lib" path="lib/jackson-databind-2.0.2.jar"/>
+	<classpathentry kind="lib" path="/Users/aotokage/workspace/Consensus/target/scala-2.9.1/classes_managed"/>
 	<classpathentry kind="lib" path="/Users/aotokage/opt/play/repository/local/play/play_2.9.1/2.0.3/jars/play_2.9.1.jar"/>
 	<classpathentry kind="lib" path="/Users/aotokage/opt/play/repository/local/play/templates_2.9.1/2.0.3/jars/templates_2.9.1.jar"/>
 	<classpathentry kind="lib" path="/Users/aotokage/opt/play/repository/local/com.github.scala-incubator.io/scala-io-file_2.9.1/0.4.0/jars/scala-io-file_2.9.1.jar"/>
@@ -89,8 +92,8 @@
 	<classpathentry kind="lib" path="/Users/aotokage/opt/play/repository/local/org.easytesting/fest-util/1.1.6/jars/fest-util.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="/Users/aotokage/opt/play/framework/sbt/boot/scala-2.9.1/lib/scala-library.jar"/>
-	<classpathentry kind="lib" path="lib/jackson-annotations-2.0.2.jar"/>
-	<classpathentry kind="lib" path="lib/jackson-core-2.0.2.jar"/>
-	<classpathentry kind="lib" path="lib/jackson-databind-2.0.2.jar"/>
+	<classpathentry kind="lib" path="lib/blueprints-core-2.2.0-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/gremlin-java-2.2.0-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/pipes-2.2.0-SNAPSHOT.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
--- a/.settings/org.scala-ide.sdt.core.prefs	Mon Oct 01 16:13:44 2012 +0900
+++ b/.settings/org.scala-ide.sdt.core.prefs	Mon Oct 01 16:39:19 2012 +0900
@@ -1,5 +1,5 @@
 #Generated by sbteclipse
-#Mon Oct 01 06:39:25 JST 2012
+#Mon Oct 01 16:31:59 JST 2012
 Xcheckinit=true
 deprecation=true
 encoding=utf8
--- a/app/controllers/Application.java	Mon Oct 01 16:13:44 2012 +0900
+++ b/app/controllers/Application.java	Mon Oct 01 16:39:19 2012 +0900
@@ -26,7 +26,7 @@
 
 	@BodyParser.Of(BodyParser.Json.class)
 	public static Result hello() {
-/*
+
 		JsonNode json = request().body().asJson();
 		ObjectNode result = Json.newObject();
 		String name = json.findPath("name").getTextValue();
@@ -40,12 +40,7 @@
 			return ok(result);
 
 		}
-		*/
-		System.out.println(request().body().asText());
-		RequestBody body = request().body();
-		return ok("Got Json:" + body.asJson());
-		
-		
+
 
 	}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/controllers/User.java	Mon Oct 01 16:39:19 2012 +0900
@@ -0,0 +1,21 @@
+package controllers;
+
+import play.mvc.Controller;
+import play.mvc.Result;
+
+public class User extends Controller {
+
+	public static Result create() {
+		
+		
+		
+		return ok();
+	}
+	
+	
+	
+	
+	
+	
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/models/NodeModel.java	Mon Oct 01 16:39:19 2012 +0900
@@ -0,0 +1,94 @@
+package models;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.tinkerpop.blueprints.Vertex;
+
+public class NodeModel {
+
+	private Vertex vertex;
+	private Object id;
+
+	final String ID = "id";
+
+	final String TOULMIN = "toulmin";
+	final String TITLE = "title";
+	final String CONTENTS = "contents";
+	final String DATA = "d";
+	final String WARRANT = "w";
+	final String BACKING = "b";
+	final String REBUTTLE = "r";
+	final String AUTHOR = "author";
+	final String USERS = "users";
+	final String TYPE = "type";
+	final String MENTIONS = "mentions";
+
+	final String STATUS = "status";
+	final String PASS = "pass";
+	final String FAIL = "fail";
+	final String AGREED = "agreed";
+	final String DENIED = "denied"; 
+	
+	final String QUESTION = "question";
+	final String REFUTATION = "refutation";
+
+	final String MAJORITY = "majority";
+	final String UNANIMOUSLY = "unanimously";
+	
+	JSONObject properties = new JSONObject();
+	
+	public NodeModel(Vertex vertex) {
+		this.vertex = vertex;
+		this.id = vertex.getId();
+	}
+	
+	public JSONObject getProperties() throws JSONException {
+		for (String key: vertex.getPropertyKeys() ) {
+			properties.put(key, vertex.getProperty(key));
+		}
+		return properties;
+	}
+	
+	public void setId(Object id) {
+		this.id = id;
+	}
+
+	public Object getId() {
+		return this.id;
+	}
+	
+	public Vertex getVertex() {
+		return this.vertex;
+	}
+	
+	public void setJsonProperty(String key, Object value) throws JSONException {
+		properties.put(key, value);
+	}
+	
+	public void setPropetiesFromJson(JSONObject jobj) throws JSONException {
+		for (Iterator<String> iter=jobj.keys(); iter.hasNext();) {
+			String key = iter.next();
+			this.setJsonProperty(key, jobj.get(key));
+		}
+	}
+	
+	public void writeProperties() throws JSONException {
+		for (Iterator<String> iter=properties.keys(); iter.hasNext(); ) {
+			String key = iter.next();
+			vertex.setProperty(key, properties.get(key));
+		}
+	}
+	
+	public JSONObject getNodeJson() throws JSONException {
+		JSONObject jobj = new JSONObject();
+		jobj.put("id",this.id);
+		jobj.put("data", this.properties);
+		return jobj; 
+	}
+	
+	
+}
Binary file lib/blueprints-core-2.2.0-SNAPSHOT.jar has changed
Binary file lib/gremlin-java-2.2.0-SNAPSHOT.jar has changed
Binary file lib/pipes-2.2.0-SNAPSHOT.jar has changed
--- a/logs/application.log	Mon Oct 01 16:13:44 2012 +0900
+++ b/logs/application.log	Mon Oct 01 16:39:19 2012 +0900
@@ -1,3 +1,6 @@
-2012-10-01 15:59:25,575 - [INFO] - from play in main 
+2012-10-01 16:33:22,607 - [INFO] - from play in main 
 Listening for HTTP on port 9000...
 
+2012-10-01 16:33:29,036 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
+Application started (Dev)
+
Binary file project/project/target/config-classes/$60248ea5edf127a3d4b7$$anonfun$$sbtdef$1.class has changed
Binary file project/project/target/config-classes/$60248ea5edf127a3d4b7$.class has changed
Binary file project/project/target/config-classes/$60248ea5edf127a3d4b7.class has changed
Binary file project/project/target/config-classes/$905ecb45ba0fe1f8b758$.class has changed
Binary file project/project/target/config-classes/$905ecb45ba0fe1f8b758.class has changed
Binary file project/project/target/config-classes/$f6c5bcb932278671af90$$anonfun$$sbtdef$1.class has changed
Binary file project/project/target/config-classes/$f6c5bcb932278671af90$.class has changed
Binary file project/project/target/config-classes/$f6c5bcb932278671af90.class has changed
Binary file project/target/scala-2.9.1/sbt-0.11.3/cache/compile/compile has changed
Binary file project/target/scala-2.9.1/sbt-0.11.3/cache/update/inputs has changed
Binary file project/target/scala-2.9.1/sbt-0.11.3/cache/update/output has changed
--- a/target/.history	Mon Oct 01 16:13:44 2012 +0900
+++ b/target/.history	Mon Oct 01 16:39:19 2012 +0900
@@ -2,3 +2,13 @@
 run
 run 
 run
+help
+run
+eclipsify
+run
+play run
+debug run
+debug
+play debug
+help
+run
Binary file target/scala-2.9.1/cache/compile/compile has changed
Binary file target/scala-2.9.1/cache/compile/copy-resources has changed
Binary file target/scala-2.9.1/cache/copy-assets has changed
Binary file target/scala-2.9.1/cache/update/inputs has changed
Binary file target/scala-2.9.1/cache/update/output has changed
Binary file target/scala-2.9.1/classes/controllers/Application.class has changed
Binary file target/scala-2.9.1/classes_managed/controllers/routes$javascript.class has changed
Binary file target/scala-2.9.1/classes_managed/controllers/routes$ref.class has changed
Binary file target/scala-2.9.1/classes_managed/controllers/routes.class has changed
--- a/target/streams/compile/compile/$global/out	Mon Oct 01 16:13:44 2012 +0900
+++ b/target/streams/compile/compile/$global/out	Mon Oct 01 16:39:19 2012 +0900
@@ -0,0 +1,1 @@
+[info] Compiling 1 Java source to /Users/aotokage/workspace/Consensus/target/scala-2.9.1/classes...