diff app/models/ClaimModel.java @ 39:870553e92e3e

create getUserConsensusStatus action
author one
date Thu, 04 Oct 2012 01:39:44 +0900
parents a2abe67d7c7a
children f78442777849
line wrap: on
line diff
--- a/app/models/ClaimModel.java	Thu Oct 04 01:05:19 2012 +0900
+++ b/app/models/ClaimModel.java	Thu Oct 04 01:39:44 2012 +0900
@@ -78,6 +78,22 @@
 		return getInfoArray(L_REQUEST);
 	}
 	
+	public ObjectNode getUserRequestStatus(UserModel user) {
+		GremlinPipeline<Vertex,Edge> pipeEdge = new GremlinPipeline<Vertex,Edge>();		
+		pipeEdge.start(vertex).outE(L_REQUEST);
+		ObjectNode info = Json.newObject();
+		for (Edge e : pipeEdge) {
+			GremlinPipeline<Edge,Vertex> pipeChildVertex = new GremlinPipeline<Edge,Vertex>();		
+			pipeChildVertex.start(e).inV();
+			Vertex childVertex = pipeChildVertex.next();
+			if (childVertex.getId() == user.getId()) {
+				info.put(STATUS, Json.toJson(e.getProperty(STATUS)));
+				break;
+			}
+		}		
+		return info;
+	}
+	
 	public Object[] getUsersIdAndStatus() {
 		GremlinPipeline<Vertex,Edge> pipeEdge = new GremlinPipeline<Vertex,Edge>();		
 		pipeEdge.start(vertex).outE(L_REQUEST);