// Path: src/main/java/com/webpagebytes/wpbsample/data/DepositWithdrawal.java
// public class DepositWithdrawal {
// 	public enum OperationType
// 	{
// 		DEPOSIT,
// 		WITHDRAWAL
// 	};
// 	private long id;
// 	private OperationType type;
// 	private int user_id;
// 	private long amount;
// 	private Date date;
// 	public long getId() {
// 		return id;
// 	}
// 	public void setId(long id) {
// 		this.id = id;
// 	}
// 	public OperationType getType() {
// 		return type;
// 	}
// 	public void setType(OperationType type) {
// 		this.type = type;
// 	}
// 	public long getAmount() {
// 		return amount;
// 	}
// 	public void setAmount(long amount) {
// 		this.amount = amount;
// 	}
// 	public Date getDate() {
// 		return date;
// 	}
// 	public void setDate(Date date) {
// 		this.date = date;
// 	}
// 	public int getUser_id() {
// 		return user_id;
// 	}
// 	public void setUser_id(int user_id) {
// 		this.user_id = user_id;
// 	}
// 	
// 	
// 	
// }
// 
// Path: src/main/java/com/webpagebytes/wpbsample/data/Session.java
// public class Session {
// 	private String id;
// 	private Integer user_id;
// 	private Date create_timestamp;
// 	private HashMap<String, Object> sessionMap;
// 	
// 	public String getId() {
// 		return id;
// 	}
// 	public void setId(String id) {
// 		this.id = id;
// 	}
// 	public Integer getUser_id() {
// 		return user_id;
// 	}
// 	public void setUser_id(Integer user_id) {
// 		this.user_id = user_id;
// 	}
// 	public Date getCreate_timestamp() {
// 		return create_timestamp;
// 	}
// 	public void setCreate_timestamp(Date create_timestamp) {
// 		this.create_timestamp = create_timestamp;
// 	}
// 
// 	public HashMap<String, Object> getSessionMap()
// 	{
// 		if (sessionMap == null)
// 		{
// 			sessionMap = new HashMap<String, Object>();
// 		}
// 		return sessionMap;
// 	}
// 	public void setSessionMap(HashMap<String, Object> sessionMap)
// 	{
// 		this.sessionMap = sessionMap;
// 	}
// 	
// }
// 
// Path: src/main/java/com/webpagebytes/wpbsample/data/DepositWithdrawal.java
// public enum OperationType
// {
// 	DEPOSIT,
// 	WITHDRAWAL
// };
// 
// Path: src/main/java/com/webpagebytes/wpbsample/utility/DateUtility.java
// public class DateUtility {
// 	public static Date addDays(Date aDate, int days)
// 	{
// 		Calendar cal = Calendar.getInstance();
// 		cal.setTime(aDate);
// 		cal.add(Calendar.DATE, days);
// 		return cal.getTime();
// 	}
// 	public static Date getToday()
// 	{
// 		Calendar cal = Calendar.getInstance();
// 		cal.set(Calendar.HOUR_OF_DAY, 0);
// 		cal.set(Calendar.MINUTE, 0);
// 		cal.set(Calendar.SECOND, 0);
// 		cal.set(Calendar.MILLISECOND, 0);
// 		return cal.getTime();
// 	}
// }


import com.webpagebytes.wpbsample.data.DepositWithdrawal;
import com.webpagebytes.wpbsample.data.Session;
import com.webpagebytes.wpbsample.data.DepositWithdrawal.OperationType;
import com.webpagebytes.wpbsample.utility.DateUtility;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.webpagebytes.cms.WPBForward;
import com.webpagebytes.cms.WPBModel;
import com.webpagebytes.cms.exception.WPBException;

		Integer user_id = (Integer) session.getSessionMap().get(SESSION_LOGIN_USERID); 
		
		int interval = getInterval(model);
		
		
		Date past = DateUtility.addDays(new Date(), -interval);
		List<Date> dates = new ArrayList<Date>();
		List<String> keys = new ArrayList<String>();
		Map<String, Long> amountDepositsPerDays = new HashMap<String, Long>();
		Map<String, Integer> numDepositsPerDays = new HashMap<String, Integer>();
		Map<String, Long> amountWithdrawalsPerDays = new HashMap<String, Long>();
		Map<String, Integer> numWithdrawalsPerDays = new HashMap<String, Integer>();

		for(int i = 0; i<= interval-1 ; i++)
		{
			
			Date aDate = DateUtility.addDays(past, i);
			dates.add(aDate);
			String iStr = String.valueOf(i);
			amountDepositsPerDays.put(iStr, 0L);
			numDepositsPerDays.put(iStr, 0);
			amountWithdrawalsPerDays.put(iStr, 0L);
			numWithdrawalsPerDays.put(iStr, 0);
			keys.add(iStr);
		}
		int maxNumOperations = 0;
		long maxAmountPerDay = 0;
		OutputStream os = null;
		try
		{

// Path: src/main/java/com/webpagebytes/wpbsample/data/DepositWithdrawal.java
// public class DepositWithdrawal {
// 	public enum OperationType
// 	{
// 		DEPOSIT,
// 		WITHDRAWAL
// 	};
// 	private long id;
// 	private OperationType type;
// 	private int user_id;
// 	private long amount;
// 	private Date date;
// 	public long getId() {
// 		return id;
// 	}
// 	public void setId(long id) {
// 		this.id = id;
// 	}
// 	public OperationType getType() {
// 		return type;
// 	}
// 	public void setType(OperationType type) {
// 		this.type = type;
// 	}
// 	public long getAmount() {
// 		return amount;
// 	}
// 	public void setAmount(long amount) {
// 		this.amount = amount;
// 	}
// 	public Date getDate() {
// 		return date;
// 	}
// 	public void setDate(Date date) {
// 		this.date = date;
// 	}
// 	public int getUser_id() {
// 		return user_id;
// 	}
// 	public void setUser_id(int user_id) {
// 		this.user_id = user_id;
// 	}
// 	
// 	
// 	
// }
// 
// Path: src/main/java/com/webpagebytes/wpbsample/data/Session.java
// public class Session {
// 	private String id;
// 	private Integer user_id;
// 	private Date create_timestamp;
// 	private HashMap<String, Object> sessionMap;
// 	
// 	public String getId() {
// 		return id;
// 	}
// 	public void setId(String id) {
// 		this.id = id;
// 	}
// 	public Integer getUser_id() {
// 		return user_id;
// 	}
// 	public void setUser_id(Integer user_id) {
// 		this.user_id = user_id;
// 	}
// 	public Date getCreate_timestamp() {
// 		return create_timestamp;
// 	}
// 	public void setCreate_timestamp(Date create_timestamp) {
// 		this.create_timestamp = create_timestamp;
// 	}
// 
// 	public HashMap<String, Object> getSessionMap()
// 	{
// 		if (sessionMap == null)
// 		{
// 			sessionMap = new HashMap<String, Object>();
// 		}
// 		return sessionMap;
// 	}
// 	public void setSessionMap(HashMap<String, Object> sessionMap)
// 	{
// 		this.sessionMap = sessionMap;
// 	}
// 	
// }
// 
// Path: src/main/java/com/webpagebytes/wpbsample/data/DepositWithdrawal.java
// public enum OperationType
// {
// 	DEPOSIT,
// 	WITHDRAWAL
// };
// 
// Path: src/main/java/com/webpagebytes/wpbsample/utility/DateUtility.java
// public class DateUtility {
// 	public static Date addDays(Date aDate, int days)
// 	{
// 		Calendar cal = Calendar.getInstance();
// 		cal.setTime(aDate);
// 		cal.add(Calendar.DATE, days);
// 		return cal.getTime();
// 	}
// 	public static Date getToday()
// 	{
// 		Calendar cal = Calendar.getInstance();
// 		cal.set(Calendar.HOUR_OF_DAY, 0);
// 		cal.set(Calendar.MINUTE, 0);
// 		cal.set(Calendar.SECOND, 0);
// 		cal.set(Calendar.MILLISECOND, 0);
// 		return cal.getTime();
// 	}
// }


// Path: src/main/java/com/webpagebytes/wpbsample/controllers/ReportDWController.java
import com.webpagebytes.wpbsample.data.DepositWithdrawal;
import com.webpagebytes.wpbsample.data.Session;
import com.webpagebytes.wpbsample.data.DepositWithdrawal.OperationType;
import com.webpagebytes.wpbsample.utility.DateUtility;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.webpagebytes.cms.WPBForward;
import com.webpagebytes.cms.WPBModel;
import com.webpagebytes.cms.exception.WPBException;

		Integer user_id = (Integer) session.getSessionMap().get(SESSION_LOGIN_USERID); 
		
		int interval = getInterval(model);
		
		
		Date past = DateUtility.addDays(new Date(), -interval);
		List<Date> dates = new ArrayList<Date>();
		List<String> keys = new ArrayList<String>();
		Map<String, Long> amountDepositsPerDays = new HashMap<String, Long>();
		Map<String, Integer> numDepositsPerDays = new HashMap<String, Integer>();
		Map<String, Long> amountWithdrawalsPerDays = new HashMap<String, Long>();
		Map<String, Integer> numWithdrawalsPerDays = new HashMap<String, Integer>();

		for(int i = 0; i<= interval-1 ; i++)
		{
			
			Date aDate = DateUtility.addDays(past, i);
			dates.add(aDate);
			String iStr = String.valueOf(i);
			amountDepositsPerDays.put(iStr, 0L);
			numDepositsPerDays.put(iStr, 0);
			amountWithdrawalsPerDays.put(iStr, 0L);
			numWithdrawalsPerDays.put(iStr, 0);
			keys.add(iStr);
		}
		int maxNumOperations = 0;
		long maxAmountPerDay = 0;
		OutputStream os = null;
		try
		{

			List<DepositWithdrawal> operations = database.getDepositsWithdrawalsForUser(user_id, DepositWithdrawal.OperationType.DEPOSIT, past, 1, MAX_RECORDS);
