Mercurial > hg > Members > nobuyasu > Consensus
diff app/models/NodeModel.java @ 13:9b677755cb93
create action Claim/createClaim
author | one |
---|---|
date | Tue, 02 Oct 2012 11:39:39 +0900 (2012-10-02) |
parents | ef434ebd64ae |
children | c8ad59a52c7e |
line wrap: on
line diff
--- a/app/models/NodeModel.java Tue Oct 02 10:38:08 2012 +0900 +++ b/app/models/NodeModel.java Tue Oct 02 11:39:39 2012 +0900 @@ -1,7 +1,6 @@ package models; import java.util.HashMap; -import java.util.Iterator; import com.tinkerpop.blueprints.Vertex; @@ -10,32 +9,48 @@ protected Vertex vertex; protected Object id; - protected final String ID = "id"; + protected HashMap<Object,Object> properties = new HashMap<Object,Object>(); + + public static final String ID = "id"; + + + public static final String AUTHOR = "author"; + public static final String TYPE = "type"; + public static final String MENTIONS = "mentions"; + + + public static final String QUESTION = "question"; + public static final String REFUTATION = "refutation"; - protected final String TOULMIN = "toulmin"; - protected final String TITLE = "title"; - protected final String CONTENTS = "contents"; - protected final String DATA = "d"; - protected final String WARRANT = "w"; - protected final String BACKING = "b"; - protected final String REBUTTLE = "r"; - protected final String AUTHOR = "author"; - protected final String USERS = "users"; - protected final String TYPE = "type"; - protected final String MENTIONS = "mentions"; - - protected final String STATUS = "status"; - protected final String PASS = "pass"; - protected final String FAIL = "fail"; - protected final String AGREED = "agreed"; - protected final String DENIED = "denied"; + public static final String MAJORITY = "majority"; + public static final String UNANIMOUSLY = "unanimously"; + + /* + * User property + */ + public static final String CONSENSUS = "consensus"; + public static final String CLAIMS = "claims"; + public static final String REQUESTS = "requests"; - protected final String QUESTION = "question"; - protected final String REFUTATION = "refutation"; - - protected final String MAJORITY = "majority"; - protected final String UNANIMOUSLY = "unanimously"; - + /* + * Claim property + */ + public static final String TOULMIN = "toulmin"; + public static final String TITLE = "title"; + public static final String CONTENTS = "contents"; + public static final String QUALIFIER = "q"; + public static final String DATA = "d"; + public static final String WARRANT = "w"; + public static final String BACKING = "b"; + public static final String REBUTTLE = "r"; + public static final String USERS = "users"; + public static final String STATUS = "status"; + // Status statement + public static final String PASS = "pass"; + public static final String FAIL = "fail"; + public static final String AGREED = "agreed"; + public static final String DENIED = "denied"; + public NodeModel(Vertex vertex) { this.vertex = vertex; @@ -53,6 +68,18 @@ public Vertex getVertex() { return this.vertex; } + + public void setProperty(String key, Object value) { + this.vertex.setProperty(key, value); + } + + public HashMap<Object,Object> getAllProperty() { + for (String key : vertex.getPropertyKeys()) { + properties.put(key, vertex.getProperty(key)); + } + return properties; + } + }