package org.owasp.appsensor.core.criteria;

import java.util.Collection;

import org.owasp.appsensor.core.DetectionPoint;
import org.owasp.appsensor.core.User;

public class SearchCriteria {
	
	private User user;
	
	private DetectionPoint detectionPoint;
	
	private Collection<String> detectionSystemIds;
	
	private String earliest;
	
	public User getUser() {
		return user;
	}

	public SearchCriteria setUser(User user) {
		this.user = user;

		return this;
	}

	public DetectionPoint getDetectionPoint() {
		return detectionPoint;
	}

	public SearchCriteria setDetectionPoint(DetectionPoint detectionPoint) {
		this.detectionPoint = detectionPoint;

		return this;
	}

	public Collection<String> getDetectionSystemIds() {
		return detectionSystemIds;
	}

	public SearchCriteria setDetectionSystemIds(Collection<String> detectionSystemIds) {
		this.detectionSystemIds = detectionSystemIds;

		return this;
	}

	public String getEarliest() {
		return earliest;
	}

	public SearchCriteria setEarliest(String earliest) {
		this.earliest = earliest;
		
		return this;
	}

}

@@ -67,16 +67,78 @@
 ction;%0A%0A
+import org.joda.time.DateTime;%0Aimport org.joda.time.Duration;%0A
 import o
@@ -214,16 +214,64 @@
 re.User;
+%0Aimport org.owasp.appsensor.core.util.DateUtils;
 %0A%0Apublic
@@ -1128,36 +1128,348 @@
 %7B%0A%09%09
-this.earliest = earliest;%0A%09%09
+return setEarliest(earliest, true);%0A%09%7D%0A%0A%09public SearchCriteria setEarliest(String earliest, boolean inclusive) %7B%0A%09%09if(inclusive) %7B%0A%09%09%09this.earliest = earliest;%0A%09%09%7D else %7B%0A%09%09%09DateTime time = DateUtils.fromString(earliest);%0A%0A%09%09%09this.earliest = time%0A%09%09%09%09%09.plus(Duration.standardSeconds(1))%09// add one second if exclusive%0A%09%09%09%09%09.toString();%0A%09%09%7D%0A
 %0A%09%09r

add new helper overloaded method to provide option for tail inclusion on setting date