annotate app/models/ClaimModel.java @ 18:c8ad59a52c7e

fix
author one
date Tue, 02 Oct 2012 21:50:31 +0900
parents 7cdc9d19834f
children 97b249d9fad1
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
18
one
parents: 16
diff changeset
20 public void setClaimProperties(JsonNode toulmin, String type) {
16
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(TYPE, type);
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
39 setProperty(MENTIONS, null);
18
one
parents: 16
diff changeset
40 setProperty(STATUS, FAIL); // Default Status is fail.
16
7cdc9d19834f modified createClaim
one
parents: 14
diff changeset
41 setProperty(TOULMIN, t);
18
one
parents: 16
diff changeset
42
14
792fdb0c10bf add ClaimModel.java
one
parents:
diff changeset
43 }
18
one
parents: 16
diff changeset
44
14
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 }