protected Collection<Attack> findAttacks(SearchCriteria criteria, Collection<Attack> attacks) {
		if (criteria == null) {
			throw new IllegalArgumentException("criteria must be non-null");
		}

		Collection<Attack> matches = new HashSet<Attack>();

		User user = criteria.getUser();
		DetectionPoint detectionPoint = criteria.getDetectionPoint();
		Rule rule = criteria.getRule();
		Collection<String> detectionSystemIds = criteria.getDetectionSystemIds();
		DateTime earliest = DateUtils.fromString(criteria.getEarliest());

		for (Attack attack : attacks) {
			//check user match if user specified
			boolean userMatch = (user != null) ? user.equals(attack.getUser()) : true;

			//check detection system match if detection systems specified
			boolean detectionSystemMatch = (detectionSystemIds != null && detectionSystemIds.size() > 0) ?
					detectionSystemIds.contains(attack.getDetectionSystem().getDetectionSystemId()) : true;

			//check detection point match if detection point specified
			boolean detectionPointMatch = true;
			if (detectionPoint != null) {
				detectionPointMatch = (attack.getDetectionPoint() != null) ?
						detectionPoint.typeAndThresholdMatches(attack.getDetectionPoint()) : false;
			}

			//check rule match if rule specified
			boolean ruleMatch = true;
			if (rule != null) {
				ruleMatch = (attack.getRule() != null) ?
					rule.guidMatches(attack.getRule()) : false;
			}

			DateTime attackTimestamp = DateUtils.fromString(attack.getTimestamp());

			boolean earliestMatch = (earliest != null) ?
					(earliest.isBefore(attackTimestamp) || earliest.isEqual(attackTimestamp))
					: true;

			if (userMatch && detectionSystemMatch && detectionPointMatch && ruleMatch && earliestMatch) {
				matches.add(attack);
			}
		}

		return matches;
	}
protected Collection < Attack > findAttacks ( SearchCriteria criteria , Collection < Attack > attacks ) { if ( criteria == null ) { throw new IllegalArgumentException ( "criteria must be non-null" ) ; } Collection < Attack > matches = new HashSet < Attack > ( ) ; User user = criteria . getUser ( ) ; DetectionPoint detectionPoint = criteria . getDetectionPoint ( ) ; Rule rule = criteria . getRule ( ) ; Collection < String > detectionSystemIds = criteria . getDetectionSystemIds ( ) ; DateTime earliest = DateUtils . fromString ( criteria . getEarliest ( ) ) ; for ( Attack attack : attacks ) { boolean userMatch = ( user != null ) ? user . equals ( attack . getUser ( ) ) : true ; boolean detectionSystemMatch = ( detectionSystemIds != null && detectionSystemIds . size ( ) > 0 ) ? detectionSystemIds . contains ( attack . getDetectionSystem ( ) . getDetectionSystemId ( ) ) : true ; boolean detectionPointMatch = true ; if ( detectionPoint != null ) { detectionPointMatch = ( attack . getDetectionPoint ( ) != null ) ? detectionPoint . typeAndThresholdMatches ( attack . getDetectionPoint ( ) ) : false ; } boolean ruleMatch = true ; if ( rule != null ) { ruleMatch = ( attack . getRule ( ) != null ) ? rule . guidMatches ( attack . getRule ( ) ) : false ; } DateTime attackTimestamp = DateUtils . fromString ( attack . getTimestamp ( ) ) ; boolean earliestMatch = ( earliest != null ) ? ( earliest . isBefore ( attackTimestamp ) || earliest . isEqual ( attackTimestamp ) ) : true ; if ( userMatch && detectionSystemMatch && detectionPointMatch && ruleMatch && earliestMatch ) { matches . add ( attack ) ; } } return matches ; }
Finder for attacks in the AttackStore.

@param criteria the {@link org.owasp.appsensor.core.criteria.SearchCriteria} object to search by
@param attacks the {@link Attack} objects to match on - supplied by subclasses
@return a {@link java.util.Collection} of {@link org.owasp.appsensor.core.Attack} objects matching the search criteria.