|
19 | 19 |
|
20 | 20 | package org.commonwl.view.workflow;
|
21 | 21 |
|
| 22 | +import java.io.File; |
| 23 | +import java.io.IOException; |
| 24 | +import java.nio.file.Files; |
| 25 | +import java.nio.file.Path; |
| 26 | +import java.nio.file.Paths; |
| 27 | +import java.util.ArrayList; |
| 28 | +import java.util.Calendar; |
| 29 | +import java.util.Date; |
| 30 | +import java.util.List; |
| 31 | +import java.util.Objects; |
| 32 | +import java.util.Optional; |
| 33 | + |
22 | 34 | import org.commonwl.view.cwl.CWLService;
|
23 | 35 | import org.commonwl.view.cwl.CWLToolRunner;
|
24 | 36 | import org.commonwl.view.cwl.CWLToolStatus;
|
|
40 | 52 | import org.springframework.data.domain.Pageable;
|
41 | 53 | import org.springframework.stereotype.Service;
|
42 | 54 |
|
43 |
| -import java.io.File; |
44 |
| -import java.io.IOException; |
45 |
| -import java.nio.file.Files; |
46 |
| -import java.nio.file.Path; |
47 |
| -import java.nio.file.Paths; |
48 |
| -import java.util.ArrayList; |
49 |
| -import java.util.Calendar; |
50 |
| -import java.util.Date; |
51 |
| -import java.util.List; |
52 |
| - |
53 | 55 | @Service
|
54 | 56 | public class WorkflowService {
|
55 | 57 |
|
@@ -532,4 +534,18 @@ private boolean cacheExpired(Workflow workflow) {
|
532 | 534 | }
|
533 | 535 | return false;
|
534 | 536 | }
|
| 537 | + |
| 538 | + public Optional<String> findRawBaseForCommit(String commitId) { |
| 539 | + for (Workflow w : workflowRepository.findByCommit(commitId)) { |
| 540 | + String potentialRaw = w.getRetrievedFrom().getRawUrl(commitId); |
| 541 | + String path = w.getRetrievedFrom().getPath(); |
| 542 | + if (potentialRaw.endsWith(path)) { |
| 543 | + return Optional.of(potentialRaw.replace(path, "")); |
| 544 | + } |
| 545 | + } |
| 546 | + // Not found, or not at GitHub/GitLab |
| 547 | + return Optional.empty(); |
| 548 | + |
| 549 | + } |
| 550 | + |
535 | 551 | }
|
0 commit comments