// Path: acmeair-customer-common/src/main/java/com/acmeair/entities/CustomerSession.java
// public interface CustomerSession {
// 
// 	String SESSIONID_COOKIE_NAME = "sessionid";
// 
// 	String getId();
// 
// 
// 	String getCustomerid();
// 
// 
// 	Date getLastAccessedTime();
// 	
// 
// 	Date getTimeoutTime();
// 
// 	
// }
// 
// Path: acmeair-customer-service/src/main/java/com/acmeair/morphia/repositories/CustomerRepository.java
// public interface CustomerRepository extends CrudRepository<CustomerImpl, String> {
// 
// }
// 
// Path: acmeair-customer-service/src/main/java/com/acmeair/morphia/repositories/CustomerSessionRepository.java
// public interface CustomerSessionRepository extends CrudRepository<CustomerSessionImpl, String> {
// 
// }
// 
// Path: acmeair-customer-service/src/main/java/com/acmeair/service/CustomerServiceSupport.java
// public abstract class CustomerServiceSupport implements CustomerService {
// 	protected static final int DAYS_TO_ALLOW_SESSION = 1;
// 	
// 	@Inject
// 	protected KeyGenerator keyGenerator;
// 	
// 	
// 	protected abstract Customer getCustomer(String username);
// 	
// 	@Override
// 	public Customer getCustomerByUsername(String username) {
// 		Customer c = getCustomer(username);
// 		if (c != null) {
// 			c.setPassword(null);
// 		}
// 		return c;
// 	}
// 
// 	@Override
// 	public boolean validateCustomer(String username, String password) {
// 		boolean validatedCustomer = false;
// 		Customer customerToValidate = getCustomer(username);
// 		if (customerToValidate != null) {
// 			validatedCustomer = password.equals(customerToValidate.getPassword());
// 		}
// 		return validatedCustomer;
// 	}
// 	
// 	@Override
// 	public Customer getCustomerByUsernameAndPassword(String username, String password) {
// 		Customer c = getCustomer(username);
// 		if (c != null && !c.getPassword().equals(password)) {
// 			return null;
// 		}
// 		// Should we also set the password to null?
// 		return c;
// 	}
// 		
// 	@Override
// 	public CustomerSession validateSession(String sessionid) {
// 		CustomerSession cSession = getSession(sessionid);
// 		if (cSession == null) {
// 			return null;
// 		}
// 
// 		Date now = new Date();
// 
// 		if (cSession.getTimeoutTime().before(now)) {
// 			removeSession(cSession);
// 			return null;
// 		}
// 		return cSession;		
// 	}
// 	
// 	protected abstract CustomerSession getSession(String sessionid);
// 	
// 	protected abstract void removeSession(CustomerSession session);
// 	
// 	@Override
// 	public CustomerSession createSession(String customerId) {
// 		String sessionId = keyGenerator.generate().toString();
// 		Date now = new Date();
// 		Calendar c = Calendar.getInstance();
// 		c.setTime(now);
// 		c.add(Calendar.DAY_OF_YEAR, DAYS_TO_ALLOW_SESSION);
// 		Date expiration = c.getTime();
// 		
// 		return createSession(sessionId, customerId, now, expiration);
// 	}
// 	
// 	protected abstract CustomerSession createSession(String sessionId, String customerId, Date creation, Date expiration);
// 	
// }


import com.acmeair.entities.Customer;
import com.acmeair.entities.Customer.MemberShipStatus;
import com.acmeair.entities.Customer.PhoneType;
import com.acmeair.entities.CustomerSession;
import com.acmeair.morphia.entities.CustomerAddressImpl;
import com.acmeair.morphia.entities.CustomerImpl;
import com.acmeair.morphia.entities.CustomerSessionImpl;
import com.acmeair.morphia.repositories.CustomerRepository;
import com.acmeair.morphia.repositories.CustomerSessionRepository;
import com.acmeair.service.CustomerServiceSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
	}
	
	public CustomerAddressImpl createAddress (String streetAddress1, String streetAddress2,
			String city, String stateProvince, String country, String postalCode){
		return new CustomerAddressImpl(streetAddress1, streetAddress2,
				 city, stateProvince,  country,  postalCode);
	}

	@Override
	public Customer updateCustomer(Customer customer) {
		customerRepository.save((CustomerImpl) customer);
		return customer;
	}

	@Override
	protected Customer getCustomer(String username) {
		return customerRepository.findOne(username);
	}

	@Override
	protected CustomerSession getSession(String sessionid){
		return sessionRepository.findOne(sessionid);
	}
	
	@Override
	protected void removeSession(CustomerSession session){		
		sessionRepository.delete(session.getId());
	}
	
	@Override
// Path: acmeair-customer-common/src/main/java/com/acmeair/entities/CustomerSession.java
// public interface CustomerSession {
// 
// 	String SESSIONID_COOKIE_NAME = "sessionid";
// 
// 	String getId();
// 
// 
// 	String getCustomerid();
// 
// 
// 	Date getLastAccessedTime();
// 	
// 
// 	Date getTimeoutTime();
// 
// 	
// }
// 
// Path: acmeair-customer-service/src/main/java/com/acmeair/morphia/repositories/CustomerRepository.java
// public interface CustomerRepository extends CrudRepository<CustomerImpl, String> {
// 
// }
// 
// Path: acmeair-customer-service/src/main/java/com/acmeair/morphia/repositories/CustomerSessionRepository.java
// public interface CustomerSessionRepository extends CrudRepository<CustomerSessionImpl, String> {
// 
// }
// 
// Path: acmeair-customer-service/src/main/java/com/acmeair/service/CustomerServiceSupport.java
// public abstract class CustomerServiceSupport implements CustomerService {
// 	protected static final int DAYS_TO_ALLOW_SESSION = 1;
// 	
// 	@Inject
// 	protected KeyGenerator keyGenerator;
// 	
// 	
// 	protected abstract Customer getCustomer(String username);
// 	
// 	@Override
// 	public Customer getCustomerByUsername(String username) {
// 		Customer c = getCustomer(username);
// 		if (c != null) {
// 			c.setPassword(null);
// 		}
// 		return c;
// 	}
// 
// 	@Override
// 	public boolean validateCustomer(String username, String password) {
// 		boolean validatedCustomer = false;
// 		Customer customerToValidate = getCustomer(username);
// 		if (customerToValidate != null) {
// 			validatedCustomer = password.equals(customerToValidate.getPassword());
// 		}
// 		return validatedCustomer;
// 	}
// 	
// 	@Override
// 	public Customer getCustomerByUsernameAndPassword(String username, String password) {
// 		Customer c = getCustomer(username);
// 		if (c != null && !c.getPassword().equals(password)) {
// 			return null;
// 		}
// 		// Should we also set the password to null?
// 		return c;
// 	}
// 		
// 	@Override
// 	public CustomerSession validateSession(String sessionid) {
// 		CustomerSession cSession = getSession(sessionid);
// 		if (cSession == null) {
// 			return null;
// 		}
// 
// 		Date now = new Date();
// 
// 		if (cSession.getTimeoutTime().before(now)) {
// 			removeSession(cSession);
// 			return null;
// 		}
// 		return cSession;		
// 	}
// 	
// 	protected abstract CustomerSession getSession(String sessionid);
// 	
// 	protected abstract void removeSession(CustomerSession session);
// 	
// 	@Override
// 	public CustomerSession createSession(String customerId) {
// 		String sessionId = keyGenerator.generate().toString();
// 		Date now = new Date();
// 		Calendar c = Calendar.getInstance();
// 		c.setTime(now);
// 		c.add(Calendar.DAY_OF_YEAR, DAYS_TO_ALLOW_SESSION);
// 		Date expiration = c.getTime();
// 		
// 		return createSession(sessionId, customerId, now, expiration);
// 	}
// 	
// 	protected abstract CustomerSession createSession(String sessionId, String customerId, Date creation, Date expiration);
// 	
// }


// Path: acmeair-customer-service/src/main/java/com/acmeair/morphia/services/CustomerServiceImpl.java
import com.acmeair.entities.Customer;
import com.acmeair.entities.Customer.MemberShipStatus;
import com.acmeair.entities.Customer.PhoneType;
import com.acmeair.entities.CustomerSession;
import com.acmeair.morphia.entities.CustomerAddressImpl;
import com.acmeair.morphia.entities.CustomerImpl;
import com.acmeair.morphia.entities.CustomerSessionImpl;
import com.acmeair.morphia.repositories.CustomerRepository;
import com.acmeair.morphia.repositories.CustomerSessionRepository;
import com.acmeair.service.CustomerServiceSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;

	}
	
	public CustomerAddressImpl createAddress (String streetAddress1, String streetAddress2,
			String city, String stateProvince, String country, String postalCode){
		return new CustomerAddressImpl(streetAddress1, streetAddress2,
				 city, stateProvince,  country,  postalCode);
	}

	@Override
	public Customer updateCustomer(Customer customer) {
		customerRepository.save((CustomerImpl) customer);
		return customer;
	}

	@Override
	protected Customer getCustomer(String username) {
		return customerRepository.findOne(username);
	}

	@Override
	protected CustomerSession getSession(String sessionid){
		return sessionRepository.findOne(sessionid);
	}
	
	@Override
	protected void removeSession(CustomerSession session){		
		sessionRepository.delete(session.getId());
	}
	
	@Override
	protected  CustomerSession createSession(String sessionId, String customerId, Date creation, Date expiration) {