package fr.openwide.core.jpa.more.business.task.search;

import java.util.Collection;
import java.util.Date;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import fr.openwide.core.jpa.more.business.search.query.AbstractHibernateSearchSearchQuery;
import fr.openwide.core.jpa.more.business.task.model.QueuedTaskHolder;
import fr.openwide.core.jpa.more.business.task.util.TaskResult;
import fr.openwide.core.jpa.more.business.task.util.TaskStatus;
import fr.openwide.core.jpa.more.util.binding.CoreJpaMoreBindings;

@Component
@Scope("prototype")
public class QueuedTaskHolderSearchQueryImpl extends AbstractHibernateSearchSearchQuery<QueuedTaskHolder, QueuedTaskHolderSort>
		implements IQueuedTaskHolderSearchQuery {

	public QueuedTaskHolderSearchQueryImpl() {
		super(QueuedTaskHolder.class, QueuedTaskHolderSort.CREATION_DATE);
	}

	@Override
	public IQueuedTaskHolderSearchQuery name(String name) {
		matchAllTermsIfGiven(name, CoreJpaMoreBindings.queuedTaskHolder().name());
		return this;
	}

	@Override
	public IQueuedTaskHolderSearchQuery statuses(Collection<TaskStatus> statuses) {
		matchOneIfGiven(CoreJpaMoreBindings.queuedTaskHolder().status(), statuses);
		return this;
	}

	@Override
	public IQueuedTaskHolderSearchQuery results(Collection<TaskResult> results) {
		matchOneIfGiven(CoreJpaMoreBindings.queuedTaskHolder().result(), results);
		return this;
	}

	@Override
	public IQueuedTaskHolderSearchQuery types(Collection<String> types) {
		matchOneIfGiven(CoreJpaMoreBindings.queuedTaskHolder().taskType(), types);
		return this;
	}

	@Override
	public IQueuedTaskHolderSearchQuery queueIds(Collection<String> queueIds) {
		matchOneIfGiven(CoreJpaMoreBindings.queuedTaskHolder().queueId(), queueIds);
		return this;
	}

	@Override
	public IQueuedTaskHolderSearchQuery creationDate(Date creationDate) {
		matchRangeMax(CoreJpaMoreBindings.queuedTaskHolder().creationDate(), creationDate);
		return this;
	}

	@Override
	public IQueuedTaskHolderSearchQuery startDate(Date startDate) {
		matchRangeMax(CoreJpaMoreBindings.queuedTaskHolder().startDate(), startDate);
		return this;
	}

	@Override
	public IQueuedTaskHolderSearchQuery endDate(Date endDate) {
		matchRangeMax(CoreJpaMoreBindings.queuedTaskHolder().endDate(), endDate);
		return this;
	}

}

@@ -951,24 +951,29 @@
 g name) %7B%0A%09%09
+must(
 matchAllTerm
@@ -1033,16 +1033,17 @@
 .name())
+)
 ;%0A%09%09retu
@@ -1141,32 +1141,37 @@
 %3E statuses) %7B%0A%09%09
+must(
 matchOneIfGiven(
@@ -1228,16 +1228,17 @@
 tatuses)
+)
 ;%0A%09%09retu
@@ -1338,24 +1338,29 @@
 esults) %7B%0A%09%09
+must(
 matchOneIfGi
@@ -1420,16 +1420,17 @@
 results)
+)
 ;%0A%09%09retu
@@ -1522,24 +1522,29 @@
  types) %7B%0A%09%09
+must(
 matchOneIfGi
@@ -1604,16 +1604,17 @@
 , types)
+)
 ;%0A%09%09retu
@@ -1712,24 +1712,29 @@
 eueIds) %7B%0A%09%09
+must(
 matchOneIfGi
@@ -1796,16 +1796,17 @@
 ueueIds)
+)
 ;%0A%09%09retu
@@ -1894,32 +1894,37 @@
 eationDate) %7B%0A%09%09
+must(
 matchRangeMax(Co
@@ -1985,24 +1985,25 @@
 reationDate)
+)
 ;%0A%09%09return t
@@ -2081,32 +2081,37 @@
  startDate) %7B%0A%09%09
+must(
 matchRangeMax(Co
@@ -2166,24 +2166,25 @@
 , startDate)
+)
 ;%0A%09%09return t
@@ -2266,16 +2266,21 @@
 te) %7B%0A%09%09
+must(
 matchRan
@@ -2343,16 +2343,17 @@
 endDate)
+)
 ;%0A%09%09retu

Fixed the task search engine