Mercurial > hg > Members > nobuyasu > Consensus
changeset 70:290a5883ac5e draft
add TIMESTAMP. modified getClaimInfoTraverse.
author | one |
---|---|
date | Wed, 20 Feb 2013 03:06:42 +0900 |
parents | db075978fcb1 |
children | c76b3b60eb18 |
files | app/controllers/Claim.java app/controllers/User.java app/init/InitialData.java app/models/ClaimModel.java app/models/NodeModel.java app/models/TPGraph.java |
diffstat | 6 files changed, 19 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/app/controllers/Claim.java Tue Feb 05 15:49:44 2013 +0900 +++ b/app/controllers/Claim.java Wed Feb 20 03:06:42 2013 +0900 @@ -46,7 +46,7 @@ newClaim.setClaimProperties(toulmin, type); String[] users = toStringArray(usersJson); tpGraph.setLabelStatusToUsers(newClaim, users, NodeModel.L_REQUEST, NodeModel.UNKNOWN); - tpGraph.setLabelToRootClaim(newClaim); + tpGraph.setLabelFromRootClaim(newClaim); return created(); } @@ -81,7 +81,7 @@ claim.setClaimProperties(toulmin, type); Object[] users = toStringObject(usersJson); claim.editRequestsEdgeUsers(users); - tpGraph.setLabelToRootClaim(claim); + tpGraph.setLabelFromRootClaim(claim); return created(); } @@ -153,7 +153,7 @@ newClaim.setClaimProperties(toulmin, type); String[] users = toStringArray(usersJson); tpGraph.setLabelStatusToUsers(newClaim, users, NodeModel.L_REQUEST, NodeModel.UNKNOWN); - tpGraph.setLabelToRootClaim(newClaim); + tpGraph.setLabelFromRootClaim(newClaim); ClaimModel mentionV = new ClaimModel(graph.getVertex(id)); tpGraph.setLabelMention(mentionV, newClaim, mentionType); newClaim.computeAndUpdateStatus();
--- a/app/controllers/User.java Tue Feb 05 15:49:44 2013 +0900 +++ b/app/controllers/User.java Wed Feb 20 03:06:42 2013 +0900 @@ -25,7 +25,7 @@ return status(CONFLICT, name+" already exists"); } newUser = new UserModel(v); - tpGraph.setLabelToRootUser(newUser); + tpGraph.setLabelFromRootUser(newUser); // newUser.setName(name); // user node hasn't name property only TinkerGraph. return created(); }
--- a/app/init/InitialData.java Tue Feb 05 15:49:44 2013 +0900 +++ b/app/init/InitialData.java Wed Feb 20 03:06:42 2013 +0900 @@ -51,18 +51,18 @@ UserModel userModel1 = new UserModel(graph.addVertex(takaaki)); UserModel userModel2 = new UserModel(graph.addVertex(akifumi)); UserModel userModel3 = new UserModel(graph.addVertex(yosiaki)); - tpGraph.setLabelToRootUser(userModel1); - tpGraph.setLabelToRootUser(userModel2); - tpGraph.setLabelToRootUser(userModel3); + tpGraph.setLabelFromRootUser(userModel1); + tpGraph.setLabelFromRootUser(userModel2); + tpGraph.setLabelFromRootUser(userModel3); /* Demo2 Users */ UserModel userModel4 = new UserModel(graph.addVertex(tatsumi)); UserModel userModel5 = new UserModel(graph.addVertex(yana)); UserModel userModel6 = new UserModel(graph.addVertex(ikuhiro)); UserModel userModel7 = new UserModel(graph.addVertex(shiomi)); - tpGraph.setLabelToRootUser(userModel4); - tpGraph.setLabelToRootUser(userModel5); - tpGraph.setLabelToRootUser(userModel6); - tpGraph.setLabelToRootUser(userModel7); + tpGraph.setLabelFromRootUser(userModel4); + tpGraph.setLabelFromRootUser(userModel5); + tpGraph.setLabelFromRootUser(userModel6); + tpGraph.setLabelFromRootUser(userModel7); } public static void enterDataDemo1() { @@ -170,7 +170,7 @@ String author, String[] users, String type) { TPGraph tpGraph = TPGraph.getInstance(); createClaimSetToulmin(claim, t, author, users, type); - tpGraph.setLabelToRootClaim(claim); + tpGraph.setLabelFromRootClaim(claim); } public static void createClaimSetToulmin(ClaimModel claim, ObjectNode t,
--- a/app/models/ClaimModel.java Tue Feb 05 15:49:44 2013 +0900 +++ b/app/models/ClaimModel.java Wed Feb 20 03:06:42 2013 +0900 @@ -44,6 +44,7 @@ if (getProperty(STATUS) == null) { setProperty(STATUS, UNKNOWN); // Default Status is unknown. } + setProperty(TIMESTAMP, Long.toString(System.currentTimeMillis())); setProperty(TOULMIN, t); } @@ -51,7 +52,8 @@ ObjectNode property = Json.newObject(); property.put(TYPE, Json.toJson(getProperty(TYPE))); property.put(STATUS, Json.toJson(getProperty(STATUS))); - property.put(TOULMIN, Json.toJson(getProperty(TOULMIN))); + property.put(TIMESTAMP, Json.toJson(getProperty(TIMESTAMP))); + property.put(TOULMIN, Json.toJson(getProperty(TOULMIN))); property.put(L_AUTHOR, Json.toJson(getAuthorId())); property.put(MENTIONS, Json.toJson(getMentionsId())); property.put(USERS, Json.toJson(getUsersId())); @@ -59,11 +61,7 @@ } public ObjectNode getClaimInfoTraverse() { - ObjectNode property = Json.newObject(); - property.put(TYPE, Json.toJson(getProperty(TYPE))); - property.put(STATUS, Json.toJson(getProperty(STATUS))); - property.put(TOULMIN, Json.toJson(getProperty(TOULMIN))); - property.put(L_AUTHOR, Json.toJson(getAuthorId())); + ObjectNode property = getSimpleClaimInfo(); property.put(MENTIONS, Json.toJson(getClaimMentionsRecursive())); property.put(USERS, Json.toJson(getUsersIdAndStatus())); return property;
--- a/app/models/NodeModel.java Tue Feb 05 15:49:44 2013 +0900 +++ b/app/models/NodeModel.java Wed Feb 20 03:06:42 2013 +0900 @@ -16,6 +16,7 @@ public static final String TYPE = "type"; public static final String MENTIONS = "mentions"; + public static final String TIMESTAMP = "timestamp"; /* * Edge Labels.
--- a/app/models/TPGraph.java Tue Feb 05 15:49:44 2013 +0900 +++ b/app/models/TPGraph.java Wed Feb 20 03:06:42 2013 +0900 @@ -82,13 +82,13 @@ return graph.addEdge(null, fromV, toV, label); } - public Edge setLabelToRootUser(UserModel user) { + public Edge setLabelFromRootUser(UserModel user) { Vertex rootUser = getUserRootVertex(); // rootUser ---child---> newUser return setLabel(rootUser, user.getVertex(), CHILD); } - public Edge setLabelToRootClaim(ClaimModel claim) { + public Edge setLabelFromRootClaim(ClaimModel claim) { Vertex rootClaim = getClaimRootVertex(); // rootUser ---child---> newUser return setLabel(rootClaim, claim.getVertex(), CHILD);