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

/*
 *   Copyright 2015 Webpagebytes
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

package com.webpagebytes.wpbsample.controllers;




public class ReportDWController extends GenericController {
	
	private int getInterval(WPBModel model)
	{
		String intervalStr = model.getCmsModel().get(WPBModel.URI_PARAMETERS_KEY).get("interval");
		int interval = 1;
		try
		{
			interval = Integer.valueOf(intervalStr);
		}
		catch (NumberFormatException e)
		{
			// do nothing, go with the default
		}
		switch (interval)
		{
			case 1:
			case 7:
			case 30:
				break;
			default:
				interval = 1;
		}	
		return interval;
	}
	
	public void handleRequest(HttpServletRequest request,
			HttpServletResponse response, WPBModel model, WPBForward forward) throws WPBException {

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

/*
 *   Copyright 2015 Webpagebytes
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

package com.webpagebytes.wpbsample.controllers;




public class ReportDWController extends GenericController {
	
	private int getInterval(WPBModel model)
	{
		String intervalStr = model.getCmsModel().get(WPBModel.URI_PARAMETERS_KEY).get("interval");
		int interval = 1;
		try
		{
			interval = Integer.valueOf(intervalStr);
		}
		catch (NumberFormatException e)
		{
			// do nothing, go with the default
		}
		switch (interval)
		{
			case 1:
			case 7:
			case 30:
				break;
			default:
				interval = 1;
		}	
		return interval;
	}
	
	public void handleRequest(HttpServletRequest request,
			HttpServletResponse response, WPBModel model, WPBForward forward) throws WPBException {

		Session session = getSession(request, response);
