package org.azavea.otm.data;

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

public abstract class Model {
	protected JSONObject data;
	
	protected long getLongOrDefault(String key, Long defaultValue) throws JSONException {
		if (data.isNull(key)){ 
			return defaultValue;
		} else {
			return data.getLong(key);
		}
	}
	public void setData(JSONObject data) {
		this.data = data;
	}
	
	public JSONObject getData() {
		return data;
	}
}

@@ -441,10 +441,136 @@
 ata;%0A%09%7D%0A
+%09%0A%09public Object getField(String key) %7B%0A%09%09try %7B%0A%09%09%09return data.get(key);%0A%09%09%7D catch (JSONException e) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%09%7D%0A
 %7D%0A

Add getField method to abstract model