Added basic workflow support

This commit is contained in:
Rick Rongen
2019-03-12 16:26:55 +01:00
parent 99e3526865
commit b246f07340

View File

@@ -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).