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 3030 */
3131public interface WorkflowRepository extends PagingAndSortingRepository <Workflow , String > {
3232
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+ */
3438 Workflow findByRetrievedFrom (GithubDetails retrievedFrom );
3539
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+ */
3654 Page <Workflow > findAllByOrderByRetrievedOnDesc (Pageable pageable );
3755
3856}
Original file line number Diff line number Diff line change @@ -89,10 +89,10 @@ public Workflow getWorkflow(String id) {
8989 * @return The workflow model associated with githubInfo
9090 */
9191 public Workflow getWorkflow (GithubDetails githubInfo ) {
92- // Check database for existing workflow
92+ // Check database for existing workflows from this repository
9393 Workflow workflow = workflowRepository .findByRetrievedFrom (githubInfo );
9494
95- // Create a new workflow if we do not have one already
95+ // Cache update
9696 if (workflow != null ) {
9797 // Delete the existing workflow if the cache has expired
9898 if (cacheExpired (workflow )) {
@@ -256,4 +256,14 @@ private boolean cacheExpired(Workflow workflow) {
256256 return false ;
257257 }
258258 }
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+ }
259269}
You can’t perform that action at this time.
0 commit comments