package beaform.entities;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.annotations.GenericGenerator;

@Entity
public class Formula {

	@Id @GeneratedValue(generator = "uuid")
	@GenericGenerator(name="uuid", strategy="uuid2")

	private String id;
	private String name;
	private String description;

	public String getId() {
		return this.id;
	}

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

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append(this.id);
		builder.append(" | ");
		builder.append(this.name);
		builder.append(" | ");
		builder.append(this.description);

		return builder.toString();

	}

}

@@ -20,16 +20,120 @@
 ities;%0A%0A
+import java.util.HashMap;%0Aimport java.util.Iterator;%0Aimport java.util.Map;%0Aimport java.util.Map.Entry;%0A%0A
 import j
@@ -157,16 +157,16 @@
 Entity;%0A
-
 import j
@@ -226,16 +226,52 @@
 ence.Id;
+%0Aimport javax.persistence.OneToMany;
 %0A%0Aimport
@@ -512,16 +512,111 @@
 ption;%0A%0A
+%09@OneToMany%0A%09private final Map%3CString, Formula%3E ingredients = new HashMap%3CString, Formula%3E();%0A%0A
 %09public 
@@ -928,24 +928,24 @@
 cription) %7B%0A
-
 %09%09this.descr
@@ -970,16 +970,270 @@
 on;%0A%09%7D%0A%0A
+%09public void addIngredient(Formula ingredient, String amount) %7B%0A%09%09this.ingredients.put(ingredient.getName() + %22%7C%22 + amount, ingredient);%0A%09%7D%0A%0A%09public Iterator%3CEntry%3CString, Formula%3E%3E getIngredients() %7B%0A%09%09return this.ingredients.entrySet().iterator();%0A%09%7D%0A%0A
 %09@Overri

Make Formulas able to contain other Formulas