package com.alexrnl.commons.database;

import java.util.EnumMap;
import java.util.Map;

/**
 * Dummy entity for test purposes.
 * @author Alex
 */
public class Dummy extends Entity {
	/** Serial version UID */
	private static final long	serialVersionUID	= 1L;
	
	/** Map with the columns */
	private EnumMap<Dummy.DummyColumn, Column> map;
	/** Id of the class */
	private Integer id;
	/** Name of the dummy */
	private String name;

	/**
	 * Constructor #1.<br />
	 */
	public Dummy () {
		this(null);
	}
	
	/**
	 * Constructor #.<br />
	 * @param id
	 *        the id.
	 */
	public Dummy (final Integer id) {
		super();
		this.id = id;
	}

	@Override
	public String getEntityName () {
		return "Dummy";
	}
	
	/** Dummy columns enumeration */
	public enum DummyColumn implements EntityColumn {
		/** The id column */
		ID ("Id"),
		/** The name column */
		NAME ("Name");
		
		/** The name of the attribute */
		private final String attributeName;
		
		/**
		 * Constructor #1.<br />
		 * Unique constructor.
		 * @param attributeName
		 *        the name of the attribute.
		 */
		private DummyColumn (final String attributeName) {
			this.attributeName = attributeName;
		}
		
		@Override
		public String getFieldName () {
			return attributeName;
		}
		
	}
	
	@Override
	protected void setEntityColumns () {
		// No synchronization for the tests
		map = new EnumMap<>(Dummy.DummyColumn.class);
		map.put(DummyColumn.ID, new Column(Integer.class, "id", true));
		map.put(DummyColumn.NAME, new Column(String.class, "name"));
	}
	
	@Override
	public Map<? extends Enum<? extends EntityColumn>, Column> getEntityColumns () {
		return map;
	}
	
	@Override
	public String getID () {
		return String.valueOf(getId());
	}
	
	/**
	 * Return the attribute id.
	 * @return the attribute id.
	 */
	public Integer getId () {
		return id;
	}
	
	/**
	 * Set the attribute id.
	 * @param id the attribute id.
	 */
	public void setId (final Integer id) {
		this.id = id;
	}
	
	/**
	 * Return the attribute name.
	 * @return the attribute name.
	 */
	public String getName () {
		return name;
	}
	
	/**
	 * Set the attribute name.
	 * @param name the attribute name.
	 */
	public void setName (final String name) {
		this.name = name;
	}

	@Override
	public Dummy clone () throws CloneNotSupportedException {
		final Dummy clone = new Dummy();
		clone.setId(getId());
		clone.setName(getName());
		return clone;
	}
	
}
@@ -81,16 +81,171 @@
 l.Map;%0A%0A
+import com.alexrnl.commons.utils.object.AutoCompare;%0Aimport com.alexrnl.commons.utils.object.AutoHashCode;%0Aimport com.alexrnl.commons.utils.object.Field;%0A%0A
 /**%0A * D
@@ -448,16 +448,23 @@
 private 
+static 
 EnumMap%3C
@@ -651,16 +651,25 @@
 %0A%09%09this(
+(String) 
 null);%0A%09
@@ -694,16 +694,17 @@
 ructor #
+2
 .%3Cbr /%3E%0A
@@ -803,24 +803,168 @@
 d = id;%0A%09%7D%0A%0A
+%09/**%0A%09 * Constructor #3.%3Cbr /%3E%0A%09 * @param name%0A%09 *        the name.%0A%09 */%0A%09public Dummy (final String name) %7B%0A%09%09super();%0A%09%09this.name = name;%0A%09%7D%0A%0A
 %09@Override%0A%09
@@ -1949,24 +1949,195 @@
 n map;%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Return the columns of the map.%0A%09 * @return the columns.%0A%09 */%0A%09public static Map%3C? extends Enum%3C? extends EntityColumn%3E, Column%3E getColumns () %7B%0A%09%09return map;%0A%09%7D%0A%0A
 %09@Override%0A%09
@@ -2261,32 +2261,40 @@
 ribute id.%0A%09 */%0A
+%09@Field%0A
 %09public Integer 
@@ -2516,32 +2516,40 @@
 bute name.%0A%09 */%0A
+%09@Field%0A
 %09public String g
@@ -2896,12 +2896,378 @@
 lone;%0A%09%7D
+%0A%0A%09@Override%0A%09public String toString () %7B%0A%09%09return %22Dummy%5B id=%22 + id + %22; name=%22 + name + %22%5D%22;%0A%09%7D%0A%0A%09@Override%0A%09public int hashCode () %7B%0A%09%09return AutoHashCode.getInstance().hashCode(this);%0A%09%7D%0A%0A%09@Override%0A%09public boolean equals (final Object obj) %7B%0A%09%09if (!(obj instanceof Dummy)) %7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%09return AutoCompare.getInstance().compare(this, (Dummy) obj);%0A%09%7D
 %0A%09%0A%7D

Update the Dummy entity to meet the requirements for DB testing