package edu.uiowa.icts.datatable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude( JsonInclude.Include.NON_NULL )
@JsonPropertyOrder( { "recordsFiltered", "data", "draw", "recordsTotal" } )
public class DataTable {

	@JsonProperty( "recordsFiltered" )
	private Integer recordsFiltered;

	@JsonProperty( "data" )
	private List<LinkedHashMap<String, Object>> data = new ArrayList<LinkedHashMap<String, Object>>();

	@JsonProperty( "draw" )
	private String draw;

	@JsonProperty( "error" )
	private String error;

	@JsonProperty( "recordsTotal" )
	private Integer recordsTotal;

	@JsonIgnore
	private Map<String, Object> additionalProperties = new HashMap<String, Object>();

	/**
	 * 
	 * @return The recordsFiltered
	 */
	@JsonProperty( "recordsFiltered" )
	public Integer getRecordsFiltered() {
		return recordsFiltered;
	}

	/**
	 * 
	 * @param recordsFiltered
	 *            The recordsFiltered
	 */
	@JsonProperty( "recordsFiltered" )
	public void setRecordsFiltered( Integer recordsFiltered ) {
		this.recordsFiltered = recordsFiltered;
	}

	/**
	 * 
	 * @return The data
	 */
	@JsonProperty( "data" )
	public List<LinkedHashMap<String, Object>> getData() {
		return data == null ? new ArrayList<LinkedHashMap<String, Object>>() : data;
	}

	/**
	 * 
	 * @param data
	 *            The data
	 */
	@JsonProperty( "data" )
	public void setData( List<LinkedHashMap<String, Object>> data ) {
		this.data = data;
	}

	/**
	 * 
	 * @return The draw
	 */
	@JsonProperty( "draw" )
	public String getDraw() {
		return draw;
	}

	/**
	 * 
	 * @param draw
	 *            The draw
	 */
	@JsonProperty( "draw" )
	public void setDraw( String draw ) {
		this.draw = draw;
	}

	/**
	 * 
	 * @return The recordsTotal
	 */
	@JsonProperty( "recordsTotal" )
	public Integer getRecordsTotal() {
		return recordsTotal;
	}

	/**
	 * 
	 * @param recordsTotal
	 *            The recordsTotal
	 */
	@JsonProperty( "recordsTotal" )
	public void setRecordsTotal( Integer recordsTotal ) {
		this.recordsTotal = recordsTotal;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString( this );
	}

	@JsonAnyGetter
	public Map<String, Object> getAdditionalProperties() {
		return this.additionalProperties;
	}

	@JsonAnySetter
	public void setAdditionalProperty( String name, Object value ) {
		this.additionalProperties.put( name, value );
	}

	/**
	 * 
	 * @return The error
	 */
	@JsonProperty( "error" )
	public String getError() {
		return error;
	}

	/**
	 * 
	 * @param error
	 *            The error
	 */
	@JsonProperty( "error" )
	public void setError( String error ) {
		this.error = error;
	}

}

@@ -761,16 +761,20 @@
 Filtered
+ = 0
 ;%0A%0A%09@Jso
@@ -1054,16 +1054,20 @@
 rdsTotal
+ = 0
 ;%0A%0A%09@Jso
@@ -1159,24 +1159,141 @@
 t%3E();%0A%0A%09
-/**%0A%09 * 
+public DataTable() %7B%0A%0A%09%7D%0A%0A%09public DataTable( String draw, String error ) %7B%0A%09%09this.draw = draw;%0A%09%09this.error = error;%0A%09%7D%0A%0A%09/**
 %0A%09 * @re
@@ -1424,37 +1424,32 @@
 tered;%0A%09%7D%0A%0A%09/**%0A
-%09 * %0A
 %09 * @param recor
@@ -1458,31 +1458,16 @@
 Filtered
-%0A%09 *           
  The rec
@@ -1624,37 +1624,32 @@
 tered;%0A%09%7D%0A%0A%09/**%0A
-%09 * %0A
 %09 * @return The 
@@ -1819,37 +1819,32 @@
  data;%0A%09%7D%0A%0A%09/**%0A
-%09 * %0A
 %09 * @param data%0A
@@ -1842,31 +1842,16 @@
 ram data
-%0A%09 *           
  The dat
@@ -1970,37 +1970,32 @@
  data;%0A%09%7D%0A%0A%09/**%0A
-%09 * %0A
 %09 * @return The 
@@ -2072,37 +2072,32 @@
  draw;%0A%09%7D%0A%0A%09/**%0A
-%09 * %0A
 %09 * @param draw%0A
@@ -2095,31 +2095,16 @@
 ram draw
-%0A%09 *           
  The dra
@@ -2194,37 +2194,32 @@
  draw;%0A%09%7D%0A%0A%09/**%0A
-%09 * %0A
 %09 * @return The 
@@ -2329,37 +2329,32 @@
 Total;%0A%09%7D%0A%0A%09/**%0A
-%09 * %0A
 %09 * @param recor
@@ -2360,31 +2360,16 @@
 rdsTotal
-%0A%09 *           
  The rec
@@ -2854,29 +2854,24 @@
 );%0A%09%7D%0A%0A%09/**%0A
-%09 * %0A
 %09 * @return 
@@ -2968,13 +2968,8 @@
 /**%0A
-%09 * %0A
 %09 * 
@@ -2984,23 +2984,8 @@
 rror
-%0A%09 *           
  The
@@ -3089,9 +3089,8 @@
 r;%0A%09%7D%0A%0A%7D
-%0A

add DataTable constructor