Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 5358240

Browse files
authored
Merge pull request #82 from Alfresco/dev-eromano-76
add getProcessDefinitionStartForm() input param processDefinitionId #76
2 parents 9d8e725 + 15f7250 commit 5358240

File tree

6 files changed

+114
-5
lines changed

6 files changed

+114
-5
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ Alfresco JS API
66

77
_This project provides a JavaScript client API into the v1 Alfresco REST API_
88

9+
<a name="0.3.8"></a>
10+
# [0.3.8](https://github.com/Alfresco/alfresco-js-api/releases/tag/0.3.8) (2016-xx-xx)
11+
12+
## Fix
13+
- [Activiti API processApi.getProcessDefinitionStartForm() does not take a process def ID #76](https://github.com/Alfresco/alfresco-js-api/issues/76)
14+
15+
```javascript
16+
17+
var processDefinitionId = "pprocessDefinitionId_example"; // String | processDefinitionId
18+
19+
this.alfrescoJsApi.activiti.processApi.getProcessDefinitionStartForm(processDefinitionId);
20+
```
21+
22+
923
<a name="0.3.7"></a>
1024
# [0.3.7](https://github.com/Alfresco/alfresco-js-api/releases/tag/0.3.7) (2016-10-29)
1125

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "alfresco-js-api",
3-
"version": "0.3.7",
3+
"version": "0.3.8",
44
"description": "JavaScript client library for the Alfresco REST API",
55
"main": "main.js",
66
"typings": "index.d.ts",

src/alfresco-activiti-rest-api/docs/ProcessApi.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ Retrieve the start form for a process definition
9292
### Example
9393
```javascript
9494

95-
this.alfrescoJsApi.activiti.processApi.getProcessDefinitionStartForm();
95+
var processDefinitionId = "pprocessDefinitionId_example"; // String | processDefinitionId
96+
97+
this.alfrescoJsApi.activiti.processApi.getProcessDefinitionStartForm(processDefinitionId);
9698
```
9799

98100
### Parameters
99-
This endpoint does not need any parameter.
100-
101+
Name | Type | Description | Notes
102+
------------- | ------------- | ------------- | -------------
103+
**processDefinitionId** | **String**| processDefinitionId |
104+
101105
### Return type
102106

103107
[**FormDefinitionRepresentation**](FormDefinitionRepresentation.md)

src/alfresco-activiti-rest-api/src/api/ProcessApi.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,21 @@
124124

125125
/**
126126
* Retrieve the start form for a process definition
127+
* @param {String} processDefinitionId processDefinitionId
127128
*/
128-
this.getProcessDefinitionStartForm = function() {
129+
this.getProcessDefinitionStartForm = function(processDefinitionId) {
129130
var postBody = null;
130131

132+
// verify the required parameter 'processInstanceId' is set
133+
if (processDefinitionId == undefined || processDefinitionId == null) {
134+
throw "Missing the required parameter 'processDefinitionId' when calling getProcessInstanceContent";
135+
}
136+
131137

132138
var pathParams = {
139+
'processDefinitionId': processDefinitionId
133140
};
141+
134142
var queryParams = {
135143
};
136144
var headerParams = {

test/activitProcessApi.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,14 @@ describe('Activiti Process Api', function () {
5353
});
5454
});
5555

56+
it('get process definition startForm', function (done) {
57+
this.processMock.get200getProcessDefinitionStartForm();
58+
var processDefinitionId = 'testProcess:1:7504';
59+
60+
this.alfrescoJsApi.activiti.processApi.getProcessDefinitionStartForm(processDefinitionId).then((data)=> {
61+
expect(data.processDefinitionId).equal('testProcess:1:7504');
62+
done();
63+
});
64+
});
65+
5666
});

test/mockObjects/activiti/processMock.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,79 @@ class ProcessMock extends BaseMock {
6868
});
6969
}
7070

71+
get200getProcessDefinitionStartForm() {
72+
nock(this.host, {'encodedQueryParams': true})
73+
.get('/activiti-app/api/enterprise/process-definitions/testProcess%3A1%3A7504/start-form')
74+
.reply(200, {
75+
'id': 2002,
76+
'processDefinitionId': 'testProcess:1:7504',
77+
'processDefinitionName': 'test process',
78+
'processDefinitionKey': 'testProcess',
79+
'tabs': [],
80+
'fields': [{
81+
'fieldType': 'DynamicTableRepresentation',
82+
'id': 'label',
83+
'name': 'Label',
84+
'type': 'dynamic-table',
85+
'value': null,
86+
'required': false,
87+
'readOnly': false,
88+
'overrideId': false,
89+
'colspan': 1,
90+
'placeholder': null,
91+
'minLength': 0,
92+
'maxLength': 0,
93+
'minValue': null,
94+
'maxValue': null,
95+
'regexPattern': null,
96+
'optionType': null,
97+
'hasEmptyValue': null,
98+
'options': null,
99+
'restUrl': null,
100+
'restResponsePath': null,
101+
'restIdProperty': null,
102+
'restLabelProperty': null,
103+
'tab': null,
104+
'className': null,
105+
'params': {'existingColspan': 1, 'maxColspan': 1},
106+
'layout': {'row': -1, 'column': -1, 'colspan': 2},
107+
'sizeX': 2,
108+
'sizeY': 2,
109+
'row': -1,
110+
'col': -1,
111+
'visibilityCondition': null,
112+
'columnDefinitions': [{
113+
'id': 'user',
114+
'name': 'User',
115+
'type': 'Dropdown',
116+
'value': null,
117+
'optionType': 'rest',
118+
'options': [{'id': null, 'name': 'Option 1'}],
119+
'restResponsePath': null,
120+
'restUrl': 'https://jsonplaceholder.typicode.com/users',
121+
'restIdProperty': 'id',
122+
'restLabelProperty': 'name',
123+
'amountCurrency': null,
124+
'amountEnableFractions': false,
125+
'required': true,
126+
'editable': true,
127+
'sortable': true,
128+
'visible': true,
129+
'endpoint': null,
130+
'requestHeaders': null
131+
}]
132+
}],
133+
'outcomes': [],
134+
'javascriptEvents': [],
135+
'className': '',
136+
'style': '',
137+
'customFieldTemplates': {},
138+
'metadata': {},
139+
'variables': [],
140+
'gridsterForm': false
141+
});
142+
}
143+
71144
}
72145

73146
module.exports = ProcessMock;

0 commit comments

Comments
 (0)