view app/models/NodeModel.java @ 39:870553e92e3e

create getUserConsensusStatus action
author one
date Thu, 04 Oct 2012 01:39:44 +0900
parents bc3ac73320f9
children f78442777849
line wrap: on
line source

package models;

import java.util.HashMap;

import com.tinkerpop.blueprints.Vertex;

public class NodeModel {

	protected Vertex vertex;
	protected Object id;

	protected HashMap<Object,Object> properties = new HashMap<Object,Object>();

	public static  final String ID = "id";

	
	public static  final String TYPE = "type";
	public static  final String MENTIONS = "mentions";

	/*
	 *  Edge Labels.
	 */
	public static  final String L_AUTHOR = "author";
	public static  final String L_REQUEST = "request";
	public static  final String L_QUESTION = "question";
	public static  final String L_REFUTATION = "refutation";
	public static  final String L_SUGGESTION = "suggestion";

	public static  final String MAJORITY = "majority";
	public static  final String UNANIMOUSLY = "unanimously";
	
	
	/*
	 * Claim information key.
	 */
	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 FAILED = "failed";
	public static  final String AGREED = "agreed";
	public static  final String DENIED = "denied"; 
	public static  final String UNKNOWN = "unknown"; 
		
	// Use This key Json Data
	public static  final String CLAIM = "claim";
	public static  final String REQUESTS = "requests";	
	public static  final String CONSENSUS = "consensus";
	
	
	public NodeModel(Vertex vertex) {
		this.vertex = vertex;
		if (vertex == null) {
			this.id = null;
		} else {
			this.id = vertex.getId();
		}
	}

	public void setId(Object id) {
		this.id = id;
	}

	public Object getId() {
		return this.id;
	}
	
	public Vertex getVertex() {
		return this.vertex;
	}
	
	public void setProperty(String key, Object value) {
		this.vertex.setProperty(key, value);
	}

	public Object getProperty(String key) {
		return this.vertex.getProperty(key);
	}
	
	public HashMap<Object,Object> getAllProperty() {
		for (String key : vertex.getPropertyKeys()) {
			properties.put(key, vertex.getProperty(key));
		}
		return properties;
	}
	


}