changeset 73:b17c8a25195e draft

create copyRequestEdges method in ClaimModel.
author one
date Wed, 06 Mar 2013 16:57:13 +0900
parents 1c13476a0c1f
children c5ddd2cc52e1
files app/models/ClaimModel.java
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/app/models/ClaimModel.java	Wed Mar 06 16:00:15 2013 +0900
+++ b/app/models/ClaimModel.java	Wed Mar 06 16:57:13 2013 +0900
@@ -425,6 +425,17 @@
 		}
 		return null;
 	}
+
+	private void copyRequestEdges(ClaimModel newClaim) {
+		TPGraph tpGraph = TPGraph.getInstance();
+		Iterable<Edge> reqEdges = getEdgeIterable(Direction.OUT, L_REQUEST);
+		for (Edge e : reqEdges) {
+			Vertex userVertex = e.getVertex(Direction.IN);
+			String userName = (userVertex.getId()).toString();
+			String status = (e.getProperty(STATUS)).toString();
+			tpGraph.setLabelStatusToUser(newClaim, userName, L_REQUEST, status);
+		}
+	}
 	
 	public ClaimModel clone() {
 		TPGraph tpGraph = TPGraph.getInstance();
@@ -433,14 +444,9 @@
 		String author = (this.getProperty(L_AUTHOR)).toString();
 		String type = (this.getProperty(TYPE)).toString();
 		JsonNode toulmin = (JsonNode)this.getProperty(TOULMIN);
-		Object[] usersObj = getUsersId();
-		ArrayList<String> usersList = new ArrayList<String>(); 
-		for (Object o : usersObj) {
-			usersList.add(o.toString());
-		}
-		tpGraph.setLabelToAuthor(newClaim, author.toString());
 		newClaim.setClaimProperties(toulmin, type);
-		
+		tpGraph.setLabelToAuthor(newClaim, author);
+		copyRequestEdges(newClaim);
 		return newClaim;
 		
 	}