view src/main/java/de/mpiwg/indexmeta/web/utils/JSONUtils.java @ 7:bc57f2660b0f

implementation of web service
author Jorge Urzua <jurzua@mpiwg-berlin.mpg.de>
date Fri, 12 Apr 2013 17:48:42 +0200
parents
children
line wrap: on
line source

package de.mpiwg.indexmeta.web.utils;

import org.json.JSONException;
import org.json.JSONObject;

import de.mpiwg.indexmeta.bo.Contextualization;

public class JSONUtils {

	public static JSONObject ctx2JSON(Contextualization ctx) throws JSONException{
		JSONObject json = new JSONObject();
		
		json.put("comment", ctx.getComment());
		json.put("content", ctx.getContent());
		json.put("elementId", ctx.getElementId());
		json.put("id", ctx.getId());
		json.put("indexMetaId", ctx.getIndexMetaId());
		json.put("remoteId", ctx.getRemoteId());
		json.put("state", ctx.getState());
		json.put("type", ctx.getType());
		json.put("xpath", ctx.getXpath());
		
		return json;
	}
	
}