net.sf.ahtutils.controller.processor.ValidFromProcessor Maven / Gradle / Ivy
package net.sf.ahtutils.controller.processor;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import net.sf.ahtutils.model.interfaces.with.EjbWithValidFrom;
import net.sf.ahtutils.msgbundle.TranslationFactory;
import org.joda.time.DateTime;
import org.joda.time.MutableDateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ValidFromProcessor
{
private List list;
final static Logger logger = LoggerFactory.getLogger(TranslationFactory.class);
public ValidFromProcessor(List list)
{
this.list=list;
}
public List getValid(Date d)
{
List result = new ArrayList();
MutableDateTime dtCheck = new MutableDateTime(d);
dtCheck.setDayOfMonth(1);
dtCheck.setHourOfDay(0);
dtCheck.setMinuteOfHour(0);
dtCheck.setSecondOfMinute(0);
dtCheck.setMillisOfSecond(0);
logger.trace("Checlong after "+dtCheck+": "+list.size());
boolean nextAdd = false;
for(int i=0;i