Skip to content

Commit 10e9555

Browse files
committed
Look up any git commit
In preparation for #167 so we can build raw URIs (Really the datamodel is upside-down to support that at the moment) Should probably return a Stream rather than a List for effiency (later we'll just pick the first one that has the commit). also.. is it possible to return the RetrievedFrom object instead of Workflow?
1 parent 3690c40 commit 10e9555

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/main/java/org/commonwl/view/workflow/WorkflowRepository.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
package org.commonwl.view.workflow;
2121

22+
import java.util.List;
23+
2224
import org.commonwl.view.git.GitDetails;
2325
import org.springframework.data.domain.Page;
2426
import org.springframework.data.domain.Pageable;
2527
import org.springframework.data.mongodb.repository.Query;
2628
import org.springframework.data.repository.PagingAndSortingRepository;
2729

28-
import java.util.List;
29-
3030
/**
3131
* Stores and retrieved workflow objects from the database
3232
*
@@ -51,9 +51,21 @@ public interface WorkflowRepository extends PagingAndSortingRepository<Workflow,
5151
@Query("{\"lastCommit\": ?0, \"retrievedFrom.path\": ?1}")
5252
List<Workflow> findByCommitAndPath(String commitId, String path);
5353

54+
/**
55+
* Find all known workflow models in the database for a commit ID
56+
*
57+
* @param commitId
58+
* The latest commit ID of the workflow
59+
* @return The workflow model
60+
*/
61+
@Query("{\"lastCommit\": ?0}")
62+
List<Workflow> findByCommit(String commitId);
63+
5464
/**
5565
* Paged request to get workflows of a specific status
56-
* @param pageable The details of the page to be retrieved
66+
*
67+
* @param pageable
68+
* The details of the page to be retrieved
5769
* @return The requested page of workflows
5870
*/
5971
Page<Workflow> findAllByOrderByRetrievedOnDesc(Pageable pageable);

0 commit comments

Comments
 (0)