diff app/models/UserModel.java @ 10:a8ea4191fa99

modified User.java
author one
date Mon, 01 Oct 2012 20:51:36 +0900
parents d050b7fb4cda
children 9b677755cb93
line wrap: on
line diff
--- a/app/models/UserModel.java	Mon Oct 01 20:23:19 2012 +0900
+++ b/app/models/UserModel.java	Mon Oct 01 20:51:36 2012 +0900
@@ -18,9 +18,9 @@
 	
 
 	public void setUserInfo() {
-		this.vertex.setProperty(CONSENSUS, "");
-		this.vertex.setProperty(CLAIMS, "");
-		this.vertex.setProperty(REQUESTS, "");
+		this.vertex.setProperty(CONSENSUS, null);
+		this.vertex.setProperty(CLAIMS, null);
+		this.vertex.setProperty(REQUESTS, null);
 	}
 	
 
@@ -32,12 +32,28 @@
 	}
 
 	public HashMap<Object, Object> getUserRequests() {
-		HashMap<Object, Object> hash = new HashMap<Object,Object>(1);
-		hash.put(REQUESTS, vertex.getProperty(REQUESTS));
+		HashMap<Object, Object> hash = getOneProperty(REQUESTS);
+		return hash;
+	}
+	
+	public HashMap<Object, Object> getUserConsensus() {
+		HashMap<Object, Object> hash = getOneProperty(CONSENSUS);
 		return hash;
 	}
 	
-	
+	public HashMap<Object, Object> getUserClaims() {
+		HashMap<Object, Object> hash = getOneProperty(CLAIMS);
+		return hash;
+	}
+
+	private HashMap<Object,Object> getOneProperty(String key) {
+		HashMap<Object, Object> hash = new HashMap<Object,Object>(1);
+		Object obj = vertex.getProperty(key);
+		if (obj == null) return null;
+		hash.put(key,obj);
+		return hash;
+	}
+