-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dolfinus
committed
Dec 27, 2018
1 parent
e2634a4
commit 94cc1cb
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.camunda.latera.bss.apis | ||
|
||
import org.camunda.latera.bss.http.HTTPRestProcessor | ||
import org.camunda.latera.bss.logging.SimpleLogger | ||
import org.camunda.latera.bss.utils.IO | ||
import org.camunda.bpm.engine.delegate.DelegateExecution | ||
|
||
class Imprint { | ||
HTTPRestProcessor processor | ||
LinkedHashMap headers | ||
DelegateExecution execution | ||
SimpleLogger logger | ||
|
||
Imprint(DelegateExecution execution) { | ||
this.execution = execution | ||
this.logger = new SimpleLogger(execution) | ||
|
||
def url = execution.getVariable("imprintUrl") | ||
def version = execution.getVariable("imprintVersion") | ||
def token = execution.getVariable("imprintToken") | ||
this.headers = [ | ||
'X_IMPRINT_API_VERSION': version, | ||
'X_IMPRINT_API_TOKEN': token | ||
] | ||
this.processor = new HTTPRestProcessor(baseUrl: url, user: user, password: password, execution: execution) | ||
} | ||
|
||
def print(LinkedHashMap json) { | ||
this.logger.info("Printing begin...") | ||
def result = this.processor.sendRequest(path: '/api/print', body: json, headers: this.headers, requestContentType: 'application/json', 'post') | ||
def file = IO.getBytes(result) | ||
return file | ||
} | ||
} |