package org.commonwl.view.workflow;

import org.commonwl.view.git.GitDetails;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * Stores workflows in the queue waiting for cwltool
 */
public interface QueuedWorkflowRepository extends PagingAndSortingRepository<QueuedWorkflow, String> {

    /**
     * Finds a queued workflow based on where it was retrieved from
     * @param retrievedFrom Details of where the queued workflow is from
     * @return The queued workflow
     */
    @Query("{tempRepresentation.retrievedFrom: ?0}")
    QueuedWorkflow findByRetrievedFrom(GitDetails retrievedFrom);

    /**
     * Deletes a queued workflow based on where it was retrieved from
     * @param retrievedFrom Details of where the queued workflow is from
     */
    @Query("{tempRepresentation.retrievedFrom: ?0}")
    void deleteByRetrievedFrom(GitDetails retrievedFrom);

}

@@ -201,16 +201,63 @@
 itory;%0A%0A
+import java.util.Date;%0Aimport java.util.List;%0A%0A
 /**%0A * S
@@ -996,10 +996,676 @@
 From);%0A%0A
+    /**%0A     * Deletes all queued workflows with date retrieved on older or equal to the Date argument passed.%0A     * @param retrievedOn Date of when the queued workflow was retrieved%0A     * @return The number of queued workflows deleted%0A     */%0A    Long deleteByTempRepresentation_RetrievedOnLessThanEqual(Date retrievedOn);%0A%0A%0A    /**%0A     * Finds and returns all queued workflows with date retrieved on older or equal to the Date argument passed.%0A     * @param retrievedOn Details of where the queued workflow is from%0A     * @return A list of queued workflows%0A     */%0A    List%3CQueuedWorkflow%3E findByTempRepresentation_RetrievedOnLessThanEqual(Date retrievedOn);%0A%0A%0A
 %7D%0A

Add delete by date retrieved on method to queued workflow repository