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

modified createClaim
author one
date Tue, 02 Oct 2012 13:52:31 +0900
parents 792fdb0c10bf
children c8ad59a52c7e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
1 package models;
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
2
16
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
3 import org.codehaus.jackson.JsonNode;
14
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
4 import org.codehaus.jackson.node.ObjectNode;
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
5
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
6 import play.libs.Json;
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
7
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
8 import com.tinkerpop.blueprints.Vertex;
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
9
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
10 public class ClaimModel extends NodeModel {
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
11
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
12
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
13
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
14
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
15 public ClaimModel(Vertex vertex) {
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
16 super(vertex);
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
17 }
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
18
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
19
16
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
20 public void setClaimProperties(JsonNode toulmin, String author, String users, String type) {
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
21 String title = toulmin.findPath(NodeModel.TITLE).getTextValue();
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
22 String contents = toulmin.findPath(NodeModel.CONTENTS).getTextValue();
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
23 String q = toulmin.findPath(NodeModel.QUALIFIER).getTextValue(); // Qualifier
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
24 String d = toulmin.findPath(NodeModel.DATA).getTextValue(); // Data
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
25 String w = toulmin.findPath(NodeModel.WARRANT).getTextValue(); // Warrant
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
26 String b = toulmin.findPath(NodeModel.BACKING).getTextValue(); // Backing
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
27 String r = toulmin.findPath(NodeModel.REBUTTLE).getTextValue(); // Rebuttle
14
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
28
16
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
29 ObjectNode t = Json.newObject();
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
30 t.put(TITLE, title);
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
31 t.put(CONTENTS, contents);
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
32 t.put(QUALIFIER, q);
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
33 t.put(DATA, d);
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
34 t.put(WARRANT, w);
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
35 t.put(BACKING, b);
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
36 t.put(REBUTTLE, r);
14
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
37
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
38 setProperty(AUTHOR,author);
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
39 setProperty(USERS, users);
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
40 setProperty(TYPE, type);
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
41 setProperty(MENTIONS, null);
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
42 setProperty(STATUS, FAIL);
16
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
43 setProperty(TOULMIN, t);
14
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
44 }
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
45
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
46
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
47
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
48
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
49
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
50 }