diff app/models/ClaimModel.java @ 16:7cdc9d19834f

modified createClaim
author one
date Tue, 02 Oct 2012 13:52:31 +0900
parents 792fdb0c10bf
children c8ad59a52c7e
line wrap: on
line diff
--- a/app/models/ClaimModel.java	Tue Oct 02 11:41:23 2012 +0900
+++ b/app/models/ClaimModel.java	Tue Oct 02 13:52:31 2012 +0900
@@ -1,5 +1,6 @@
 package models;
 
+import org.codehaus.jackson.JsonNode;
 import org.codehaus.jackson.node.ObjectNode;
 
 import play.libs.Json;
@@ -16,30 +17,30 @@
 	}
 	
 	
-	public void setClaimProperties(String author, String title, String contents, String q,
-			String d, String w, String b, String r, String users, String type) {
-		
+	public void setClaimProperties(JsonNode toulmin, String author, String users, String type) {
+		String title = toulmin.findPath(NodeModel.TITLE).getTextValue();
+		String contents = toulmin.findPath(NodeModel.CONTENTS).getTextValue();
+		String q = toulmin.findPath(NodeModel.QUALIFIER).getTextValue(); // Qualifier
+		String d = toulmin.findPath(NodeModel.DATA).getTextValue(); // Data
+		String w = toulmin.findPath(NodeModel.WARRANT).getTextValue(); // Warrant
+		String b = toulmin.findPath(NodeModel.BACKING).getTextValue(); // Backing
+		String r = toulmin.findPath(NodeModel.REBUTTLE).getTextValue(); // Rebuttle
 
-		
-		ObjectNode toulmin = Json.newObject();
-		toulmin.put(TITLE, title);
-		toulmin.put(CONTENTS, contents);
-		toulmin.put(QUALIFIER, q);
-		toulmin.put(DATA, d);
-		toulmin.put(WARRANT, w);
-		toulmin.put(BACKING, b);
-		toulmin.put(REBUTTLE, r);
+		ObjectNode t = Json.newObject();
+		t.put(TITLE, title);
+		t.put(CONTENTS, contents);
+		t.put(QUALIFIER, q);
+		t.put(DATA, d);
+		t.put(WARRANT, w);
+		t.put(BACKING, b);
+		t.put(REBUTTLE, r);
 
 		setProperty(AUTHOR,author);
 		setProperty(USERS, users);
 		setProperty(TYPE, type);
 		setProperty(MENTIONS, null);
 		setProperty(STATUS, FAIL);
-		setProperty(TOULMIN, toulmin);
-		
-		
-		
-		
+		setProperty(TOULMIN, t);
 	}