File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed
src/main/java/org/commonwl/viewer/services Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 30
30
*/
31
31
public interface WorkflowRepository extends PagingAndSortingRepository <Workflow , String > {
32
32
33
- // Finds a workflow model in the database based on where it was retrieved from
33
+ /**
34
+ * Finds a workflow model in the database based on where it was retrieved from
35
+ * @param retrievedFrom Details of where the workflow is from
36
+ * @return The workflow model
37
+ */
34
38
Workflow findByRetrievedFrom (GithubDetails retrievedFrom );
35
39
40
+ /**
41
+ * Finds a workflow model in the database based on which repository it is from
42
+ * @param owner The owner of the repository
43
+ * @param repoName The name of the repository
44
+ * @param branch The branch or commit ID of the repository
45
+ * @return The workflow model
46
+ */
47
+ Workflow findByRetrievedFromOwnerAndRetrievedFromRepoNameAndRetrievedFromBranch (String owner , String repoName , String branch );
48
+
49
+ /**
50
+ * Paged request to get all workflows
51
+ * @param pageable The details of the page to be retrieved
52
+ * @return The requested page of workflows
53
+ */
36
54
Page <Workflow > findAllByOrderByRetrievedOnDesc (Pageable pageable );
37
55
38
56
}
Original file line number Diff line number Diff line change @@ -89,10 +89,10 @@ public Workflow getWorkflow(String id) {
89
89
* @return The workflow model associated with githubInfo
90
90
*/
91
91
public Workflow getWorkflow (GithubDetails githubInfo ) {
92
- // Check database for existing workflow
92
+ // Check database for existing workflows from this repository
93
93
Workflow workflow = workflowRepository .findByRetrievedFrom (githubInfo );
94
94
95
- // Create a new workflow if we do not have one already
95
+ // Cache update
96
96
if (workflow != null ) {
97
97
// Delete the existing workflow if the cache has expired
98
98
if (cacheExpired (workflow )) {
@@ -256,4 +256,14 @@ private boolean cacheExpired(Workflow workflow) {
256
256
return false ;
257
257
}
258
258
}
259
+
260
+ /**
261
+ * Check for the repository already being parsed
262
+ * @param details The details of the repository on Github
263
+ * @return Whether the workflows from the repository have already been added
264
+ */
265
+ private boolean repoAlreadyParsed (GithubDetails details ) {
266
+ return (workflowRepository .findByRetrievedFromOwnerAndRetrievedFromRepoNameAndRetrievedFromBranch (
267
+ details .getOwner (), details .getRepoName (), details .getBranch ()) != null );
268
+ }
259
269
}
You can’t perform that action at this time.
0 commit comments