// Path: acmeair-common/src/main/java/com/acmeair/entities/Customer.java
// public interface Customer {
// 
// 	public enum MemberShipStatus { NONE, SILVER, GOLD, PLATINUM, EXEC_PLATINUM, GRAPHITE };
// 	public enum PhoneType { UNKNOWN, HOME, BUSINESS, MOBILE };
// 	
// 	
// 	public String getCustomerId();
// 	
// 	public String getUsername();
// 	
// 	public void setUsername(String username);
// 	
// 	public String getPassword();
// 	
// 	public void setPassword(String password);
// 	
// 	public MemberShipStatus getStatus();
// 	
// 	public void setStatus(MemberShipStatus status);
// 	
// 	public int getTotal_miles();
// 	
// 	public int getMiles_ytd();
// 	
// 	public String getPhoneNumber();
// 
// 	public void setPhoneNumber(String phoneNumber);
// 
// 	public PhoneType getPhoneNumberType();
// 
// 	public void setPhoneNumberType(PhoneType phoneNumberType);
// 
// 	public CustomerAddress getAddress();
// 
// 	public void setAddress(CustomerAddress address);
// 
// }
// 
// Path: acmeair-common/src/main/java/com/acmeair/entities/CustomerAddress.java
// public interface CustomerAddress {
// 
// 	
// 	public String getStreetAddress1();
// 	public void setStreetAddress1(String streetAddress1);
// 	public String getStreetAddress2();
// 	public void setStreetAddress2(String streetAddress2);
// 	public String getCity();
// 	public void setCity(String city);
// 	public String getStateProvince();
// 	public void setStateProvince(String stateProvince);
// 	public String getCountry();
// 	public void setCountry(String country);
// 	public String getPostalCode();
// 	public void setPostalCode(String postalCode);
// 		
// }
// 
// Path: acmeair-common/src/main/java/com/acmeair/entities/Customer.java
// public enum MemberShipStatus { NONE, SILVER, GOLD, PLATINUM, EXEC_PLATINUM, GRAPHITE };
// 
// Path: acmeair-common/src/main/java/com/acmeair/entities/Customer.java
// public enum PhoneType { UNKNOWN, HOME, BUSINESS, MOBILE };
// 
// Path: acmeair-common/src/main/java/com/acmeair/entities/CustomerSession.java
// public interface CustomerSession {
// 
// 	
// 	public String getId();
// 
// 
// 	public String getCustomerid();
// 
// 
// 	public Date getLastAccessedTime();
// 	
// 
// 	public Date getTimeoutTime();
// 
// 	
// }


import java.util.Calendar;
import java.util.Date;
import javax.inject.Inject;
import com.acmeair.entities.Customer;
import com.acmeair.entities.CustomerAddress;
import com.acmeair.entities.Customer.MemberShipStatus;
import com.acmeair.entities.Customer.PhoneType;
import com.acmeair.entities.CustomerSession;
		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);
	
	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);

	public abstract void invalidateSession(String sessionid);
	
	public abstract Long count();
	
// Path: acmeair-common/src/main/java/com/acmeair/entities/Customer.java
// public interface Customer {
// 
// 	public enum MemberShipStatus { NONE, SILVER, GOLD, PLATINUM, EXEC_PLATINUM, GRAPHITE };
// 	public enum PhoneType { UNKNOWN, HOME, BUSINESS, MOBILE };
// 	
// 	
// 	public String getCustomerId();
// 	
// 	public String getUsername();
// 	
// 	public void setUsername(String username);
// 	
// 	public String getPassword();
// 	
// 	public void setPassword(String password);
// 	
// 	public MemberShipStatus getStatus();
// 	
// 	public void setStatus(MemberShipStatus status);
// 	
// 	public int getTotal_miles();
// 	
// 	public int getMiles_ytd();
// 	
// 	public String getPhoneNumber();
// 
// 	public void setPhoneNumber(String phoneNumber);
// 
// 	public PhoneType getPhoneNumberType();
// 
// 	public void setPhoneNumberType(PhoneType phoneNumberType);
// 
// 	public CustomerAddress getAddress();
// 
// 	public void setAddress(CustomerAddress address);
// 
// }
// 
// Path: acmeair-common/src/main/java/com/acmeair/entities/CustomerAddress.java
// public interface CustomerAddress {
// 
// 	
// 	public String getStreetAddress1();
// 	public void setStreetAddress1(String streetAddress1);
// 	public String getStreetAddress2();
// 	public void setStreetAddress2(String streetAddress2);
// 	public String getCity();
// 	public void setCity(String city);
// 	public String getStateProvince();
// 	public void setStateProvince(String stateProvince);
// 	public String getCountry();
// 	public void setCountry(String country);
// 	public String getPostalCode();
// 	public void setPostalCode(String postalCode);
// 		
// }
// 
// Path: acmeair-common/src/main/java/com/acmeair/entities/Customer.java
// public enum MemberShipStatus { NONE, SILVER, GOLD, PLATINUM, EXEC_PLATINUM, GRAPHITE };
// 
// Path: acmeair-common/src/main/java/com/acmeair/entities/Customer.java
// public enum PhoneType { UNKNOWN, HOME, BUSINESS, MOBILE };
// 
// Path: acmeair-common/src/main/java/com/acmeair/entities/CustomerSession.java
// public interface CustomerSession {
// 
// 	
// 	public String getId();
// 
// 
// 	public String getCustomerid();
// 
// 
// 	public Date getLastAccessedTime();
// 	
// 
// 	public Date getTimeoutTime();
// 
// 	
// }


// Path: acmeair-services/src/main/java/com/acmeair/service/CustomerService.java
import java.util.Calendar;
import java.util.Date;
import javax.inject.Inject;
import com.acmeair.entities.Customer;
import com.acmeair.entities.CustomerAddress;
import com.acmeair.entities.Customer.MemberShipStatus;
import com.acmeair.entities.Customer.PhoneType;
import com.acmeair.entities.CustomerSession;

		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);
	
	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);

	public abstract void invalidateSession(String sessionid);
	
	public abstract Long count();
	
	public abstract Long countSessions();