|
5 | 5 | import com.docusign.iam.sdk.models.components.TriggerWorkflow; |
6 | 6 | import com.docusign.iam.sdk.models.operations.*; |
7 | 7 | import org.json.JSONObject; |
| 8 | +import org.springframework.core.io.ClassPathResource; |
| 9 | +import org.springframework.util.StreamUtils; |
8 | 10 |
|
9 | 11 | import java.io.IOException; |
10 | 12 | import java.net.URI; |
|
16 | 18 | import java.util.HashMap; |
17 | 19 | import java.util.Map; |
18 | 20 | import java.util.Objects; |
| 21 | +import java.util.Optional; |
19 | 22 | import java.util.UUID; |
20 | 23 |
|
21 | 24 | public class TriggerWorkflowService { |
@@ -101,10 +104,10 @@ private static String prepareWorkflowDefinition( |
101 | 104 | String triggerId, |
102 | 105 | String accountId) throws Exception { |
103 | 106 | try { |
104 | | - var templateFilePath = TriggerWorkflowService.class.getClassLoader().getResource(fileLocation); |
105 | | - var templateFile = Paths.get(Objects.requireNonNull(templateFilePath).toURI()); |
| 107 | + ClassPathResource resource = new ClassPathResource(fileLocation); |
| 108 | + byte[] buffer = StreamUtils.copyToByteArray(resource.getInputStream()); |
106 | 109 |
|
107 | | - String workflowDefinition = new String(Files.readAllBytes(templateFile)); |
| 110 | + String workflowDefinition = new String(buffer); |
108 | 111 | return workflowDefinition |
109 | 112 | .replace("TEMPLATE_ID", templateId) |
110 | 113 | .replace("ACCOUNT_ID", accountId) |
@@ -147,6 +150,6 @@ public static GetWorkflowsListResponse getMaestroWorkflow( |
147 | 150 | String accountId) throws Exception { |
148 | 151 | return client.maestro() |
149 | 152 | .workflows() |
150 | | - .getWorkflowsList(accountId); |
| 153 | + .getWorkflowsList(accountId, Optional.of(Status.ACTIVE), Optional.empty()); |
151 | 154 | } |
152 | 155 | } |
0 commit comments