// Path: module-alfresco/source/java/com/atolcd/alfresco/audit/cmr/EnumPeriod.java
// public enum EnumPeriod {
// 	day, week, month, year, none
// };


import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import com.atolcd.alfresco.audit.cmr.EnumPeriod;

/**
 * Copyright (C) 2011 Atol Conseils et Développements.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA. **/

package com.atolcd.alfresco.audit.web.scripts;



public abstract class DateInterval {

	public static GregorianCalendar setInterval(Date date, String period, int interval) {
		return offset(date, period, interval);
	}

	private static GregorianCalendar offset(Date date, String period, int interval) {
		GregorianCalendar calendar = new GregorianCalendar();
		calendar.setTime(date);

// Path: module-alfresco/source/java/com/atolcd/alfresco/audit/cmr/EnumPeriod.java
// public enum EnumPeriod {
// 	day, week, month, year, none
// };


// Path: module-alfresco/source/java/com/atolcd/alfresco/audit/web/scripts/DateInterval.java
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import com.atolcd.alfresco.audit.cmr.EnumPeriod;

/**
 * Copyright (C) 2011 Atol Conseils et Développements.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA. **/

package com.atolcd.alfresco.audit.web.scripts;



public abstract class DateInterval {

	public static GregorianCalendar setInterval(Date date, String period, int interval) {
		return offset(date, period, interval);
	}

	private static GregorianCalendar offset(Date date, String period, int interval) {
		GregorianCalendar calendar = new GregorianCalendar();
		calendar.setTime(date);

		switch (EnumPeriod.valueOf(period)) {
