From b246f0734055aaf96e61e2d0f2e4c036a20fde86 Mon Sep 17 00:00:00 2001 From: Rick Rongen Date: Tue, 12 Mar 2019 16:26:55 +0100 Subject: [PATCH] Added basic workflow support --- Crx/connection.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Crx/connection.py b/Crx/connection.py index 8731cc6..c6fd61e 100644 --- a/Crx/connection.py +++ b/Crx/connection.py @@ -26,6 +26,9 @@ CRX_QUERY = '/crx/de/query.jsp' WCM_REFERENCES = '/bin/wcm/references.json' WCM_REPLICATE = '/bin/replicate.json' +WORKFLOW_INSTANCES = '/etc/workflow/instances' +WORKFLOW_LIST_MODELS = '/libs/cq/workflow/content/console/workflows.json' + CREATE_ASSET = '.createasset.html' JSON_DATA_EXTENSION = '.1.json' @@ -192,6 +195,25 @@ class Connection: resp = self._session.post(self._wcm_replicate, files={'path': path, 'cmd': command}) resp.raise_for_status() + def get_workflow_models(self): + resp = self._session.get(self._host + WORKFLOW_LIST_MODELS) + return resp.json()['workflows'] + + def start_workflow_path(self, model: str, path: str, comment: str = None, title: str = None): + resp = self._session.post( + self._host + WORKFLOW_INSTANCES, + data={ + '_charset_': 'utf-8', + 'payloadType': 'JCR_PATH', + ':status': 'browser', # ? + 'payload': path, + 'model': model, + 'startComment': comment or '', + 'workflowTitle': title or '' + } + ) + resp.raise_for_status() + def download_binary(self, path: str) -> bytes: """ Download the binary data of a node. (usually jcr:data).