diff --git a/demo-shell-ng2/app/components/activiti/form-viewer.component.html b/demo-shell-ng2/app/components/activiti/form-viewer.component.html
index 0d499088c8..93f3252d5c 100644
--- a/demo-shell-ng2/app/components/activiti/form-viewer.component.html
+++ b/demo-shell-ng2/app/components/activiti/form-viewer.component.html
@@ -1,11 +1,11 @@
diff --git a/ng2-components/ng2-activiti-form/README.md b/ng2-components/ng2-activiti-form/README.md
index cd66c1e8f6..8673ecb1ce 100644
--- a/ng2-components/ng2-activiti-form/README.md
+++ b/ng2-components/ng2-activiti-form/README.md
@@ -78,6 +78,38 @@ Only form definition will be fetched
```
+### Display form definition by ECM nodeId, in this case the metadata of the node are showed in an activiti Form. If there are no form
+definied in activiti for the type of the node, a new form will be automaticaly created in activiti.
+
+```html
+
+
+```
+
+### Display form definition by form name, and store the form field as metadata. The param nameNode is optional.
+
+```html
+
+
+```
+
+### Display form definition by ECM nodeId, in this case the metadata of the node are showed in an activiti Form, and store the form field
+ as metadata. The param nameNode is optional.
+
+```html
+
+
+```
+
## Configuration
### Properties
@@ -95,7 +127,15 @@ The recommended set of properties can be found in the following table:
| showSaveButton | boolean | true | Toggle rendering of the `Save` outcome button. |
| readOnly | boolean | false | Toggle readonly state of the form. Enforces all form widgets render readonly if enabled. |
| showRefreshButton | boolean | true | Toggle rendering of the `Refresh` button. |
+| saveMetadata | boolean | false | Store the value of the form as metadata. |
+| path | string | | Path of the folder where to store the metadata. |
+| nameNode (optional) | string | true | Name to assign to the new node where the metadata are stored. |
+
+ *
+ * {path} string - path of the folder where the to store the metadata
+ *
+ * {nameNode} string (optional) - name of the node stored, if not defined the node will be sotred with an uuid as name
#### Advanced properties
The following properties are for complex customisation purposes:
diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts
index d68d7e0741..d763eb0128 100644
--- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts
+++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts
@@ -39,19 +39,23 @@ import { WidgetVisibilityService } from './../services/widget-visibility.servic
/**
* @Input
- * ActivitiForm can show 3 forms searching by 3 type of params:
+ * ActivitiForm can show 4 types of forms searching by 4 type of params:
* 1) Form attached to a task passing the {taskId}.
+ *
* 2) Form that are only defined with the {formId} (in this case you receive only the form definition and the form will not be
* attached to any process, useful in case you want to use ActivitiForm as form designer), in this case you can pass also other 2
* parameters:
* - {saveOption} as parameter to tell what is the function to call on the save action.
* - {data} to fill the form field with some data, the id of the form must to match the name of the field of the provided data object.
+ *
* 3) Form that are only defined with the {formName} (in this case you receive only the form definition and the form will not be
* attached to any process, useful in case you want to use ActivitiForm as form designer),
* in this case you can pass also other 2 parameters:
* - {saveOption} as parameter to tell what is the function to call on the save action.
* - {data} to fill the form field with some data, the id of the form must to match the name of the field of the provided data object.
*
+ * 4) Form that show the metadata of a {nodeId}
+ *
* {showTitle} boolean - to hide the title of the form pass false, default true;
*
* {showRefreshButton} boolean - to hide the refresh button of the form pass false, default true;
@@ -60,6 +64,12 @@ import { WidgetVisibilityService } from './../services/widget-visibility.servic
*
* {showSaveButton} boolean - to hide the save button of the form pass false, default true;
*
+ * {saveMetadata} boolean - store the value of the form as metadata, default false;
+ *
+ * {path} string - path of the folder where to store the metadata;
+ *
+ * {nameNode} string (optional) - Name to assign to the new node where the metadata are stored;
+ *
* @Output
* {formLoaded} EventEmitter - This event is fired when the form is loaded, it pass all the value in the form.
* {formSaved} EventEmitter - This event is fired when the form is saved, it pass all the value in the form.
@@ -411,11 +421,11 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges {
}
private storeFormAsMetadata() {
- this.ecmModelService.createEcmTypeForActivitiForm(this.formName, this.form).subscribe(type => {
- if (this.saveMetadata) {
+ if (this.saveMetadata) {
+ this.ecmModelService.createEcmTypeForActivitiForm(this.formName, this.form).subscribe(type => {
this.nodeService.createNodeMetadata(type.nodeType || type.entry.prefixedName, EcmModelService.MODEL_NAMESPACE, this.form.values, this.path, this.nameNode);
- }
- }, this.handleError
- );
+ }, this.handleError
+ );
+ }
}
}
diff --git a/ng2-components/ng2-activiti-form/src/services/ecm-model.service.spec.ts b/ng2-components/ng2-activiti-form/src/services/ecm-model.service.spec.ts
index 58ad8b656b..9f5dfcd9e9 100644
--- a/ng2-components/ng2-activiti-form/src/services/ecm-model.service.spec.ts
+++ b/ng2-components/ng2-activiti-form/src/services/ecm-model.service.spec.ts
@@ -14,3 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
diff --git a/ng2-components/ng2-activiti-form/src/services/node.service.spec.ts b/ng2-components/ng2-activiti-form/src/services/node.service.spec.ts
index 58ad8b656b..9f5dfcd9e9 100644
--- a/ng2-components/ng2-activiti-form/src/services/node.service.spec.ts
+++ b/ng2-components/ng2-activiti-form/src/services/node.service.spec.ts
@@ -14,3 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+