// Path: WoundManagement/src/main/java/com/fau/amos/team2/WoundManagement/model/BusinessObject.java
// public interface BusinessObject extends Serializable {
// 
// }
// 
// Path: WoundManagement/src/main/java/com/fau/amos/team2/WoundManagement/model/Constants.java
// public final class Constants 
// {
// 	/**
// 	 * Profile name for a local database connection
// 	 * with username: 'postgres', password: 'postgres'
// 	 * on a local postgreSQL server
// 	 */
// 	public static final String PERSISTANCE_UNIT = "fauDB";
// 	public static final String PERSISTANCE_UNIT_LOCAL = "testdb";
// }


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import com.fau.amos.team2.WoundManagement.model.BusinessObject;
import com.fau.amos.team2.WoundManagement.model.Constants;
import com.vaadin.addon.jpacontainer.JPAContainer;
import com.vaadin.addon.jpacontainer.provider.CachingMutableLocalEntityProvider;
package com.fau.amos.team2.WoundManagement.provider;




public class ConnectionProvider<T extends BusinessObject> {

	protected Class<T> type;
	
	protected EntityManager entityManager;
	protected EntityManagerFactory entityManagerFactory;
	
	protected JPAContainer<T> container;
	protected CachingMutableLocalEntityProvider<T> entityProvider;
	
	protected static String user = null;
	protected static String password = null;
	
	public ConnectionProvider(Class<T> c) 
	{
		type = c;
		
		entityManagerFactory = 
				Persistence.createEntityManagerFactory(Constants.PERSISTANCE_UNIT);

		entityManager = entityManagerFactory.createEntityManager();
		
		entityProvider =  new CachingMutableLocalEntityProvider<T>(type, entityManager);
	}
	
	public JPAContainer<T> getContainer()
	{
		if(container == null) {
			container = new JPAContainer<T> (type);
// Path: WoundManagement/src/main/java/com/fau/amos/team2/WoundManagement/model/BusinessObject.java
// public interface BusinessObject extends Serializable {
// 
// }
// 
// Path: WoundManagement/src/main/java/com/fau/amos/team2/WoundManagement/model/Constants.java
// public final class Constants 
// {
// 	/**
// 	 * Profile name for a local database connection
// 	 * with username: 'postgres', password: 'postgres'
// 	 * on a local postgreSQL server
// 	 */
// 	public static final String PERSISTANCE_UNIT = "fauDB";
// 	public static final String PERSISTANCE_UNIT_LOCAL = "testdb";
// }


// Path: WoundManagement/src/main/java/com/fau/amos/team2/WoundManagement/provider/ConnectionProvider.java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import com.fau.amos.team2.WoundManagement.model.BusinessObject;
import com.fau.amos.team2.WoundManagement.model.Constants;
import com.vaadin.addon.jpacontainer.JPAContainer;
import com.vaadin.addon.jpacontainer.provider.CachingMutableLocalEntityProvider;

package com.fau.amos.team2.WoundManagement.provider;




public class ConnectionProvider<T extends BusinessObject> {

	protected Class<T> type;
	
	protected EntityManager entityManager;
	protected EntityManagerFactory entityManagerFactory;
	
	protected JPAContainer<T> container;
	protected CachingMutableLocalEntityProvider<T> entityProvider;
	
	protected static String user = null;
	protected static String password = null;
	
	public ConnectionProvider(Class<T> c) 
	{
		type = c;
		
		entityManagerFactory = 
				Persistence.createEntityManagerFactory(Constants.PERSISTANCE_UNIT);

		entityManager = entityManagerFactory.createEntityManager();
		
		entityProvider =  new CachingMutableLocalEntityProvider<T>(type, entityManager);
	}
	
	public JPAContainer<T> getContainer()
	{
		if(container == null) {
			container = new JPAContainer<T> (type);
			container.setEntityProvider(entityProvider);