DBPMMS Form¶
Form Services Usage Guide¶
This document provides instructions on how to use the FormService and BPMPlatformFormService in an Angular application to manage Form entities.
Setup¶
How to install¶
Step 1: Import Required Modules¶
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { FormService, BPMPlatformFormService } from '@dnext-angular/dbpmms-form';
import { AuthorizationService, HttpHelperService } from '@dnext-angular/http';
@NgModule({
imports: [
HttpClientModule,
// other imports
],
providers: [
FormService,
BPMPlatformFormService,
AuthorizationService,
HttpHelperService,
// other providers
],
})
export class AppModule { }
Step 2: Inject Services in a Component¶
import { Component, OnInit } from '@angular/core';
import { FormService, BPMPlatformFormService } from '@dnext-angular/dbpmms-form';
import { Form, FormFVO, FormMVO } from '@dnext-angular/dbpmms-form';
@Component({
selector: 'app-form-management',
templateUrl: './form-management.component.html'
})
export class FormManagementComponent implements OnInit {
constructor(
private formService: FormService,
private bpmPlatformFormService: BPMPlatformFormService
) { }
ngOnInit(): void {
this.createForm();
this.retrieveForm('1');
this.listForms();
this.updateForm('1');
this.deleteForm('1');
this.retrieveBPMForm('deploymentId');
}
createForm(): void {
const newForm: FormFVO = { /* initialize with appropriate values */ };
this.formService.createForm(newForm).subscribe(
(forms: Form[]) => {
console.log('Form created:', forms);
},
error => console.error('Error creating form:', error)
);
}
retrieveForm(id: string): void {
this.formService.retrieveForm(id).subscribe(
(form: Form) => {
console.log('Form retrieved:', form);
},
error => console.error('Error retrieving form:', error)
);
}
listForms(): void {
this.formService.listForm().subscribe(
(forms: Form[]) => {
console.log('Forms list:', forms);
},
error => console.error('Error listing forms:', error)
);
}
updateForm(id: string): void {
const updatedForm: FormMVO = { /* initialize with appropriate values */ };
this.formService.putForm(id, updatedForm).subscribe(
(forms: Form[]) => {
console.log('Form updated:', forms);
},
error => console.error('Error updating form:', error)
);
}
deleteForm(id: string): void {
this.formService.deleteForm(id).subscribe(
() => {
console.log('Form deleted');
},
error => console.error('Error deleting form:', error)
);
}
retrieveBPMForm(deploymentId: string): void {
this.bpmPlatformFormService.retrieveFormByIdDeployedOnBpmPLatform(deploymentId)
.subscribe(
form => console.log('BPM form retrieved:', form),
error => console.error('Error retrieving BPM form:', error)
);
}
}
Step 3: Create HTML Template¶
<div>
<h1>Form Management</h1>
<button (click)="createForm()">Create Form</button>
<button (click)="retrieveForm('1')">Retrieve Form</button>
<button (click)="listForms()">List Forms</button>
<button (click)="updateForm('1')">Update Form</button>
<button (click)="deleteForm('1')">Delete Form</button>
<button (click)="retrieveBPMForm('deploymentId')">Get BPM Form</button>
</div>
FormService Methods¶
createForm¶
- Creates a new Form entity
deleteForm¶
- Deletes an existing Form entity
listForm¶
- Lists or finds Form objects with optional filters
putForm¶
- Fully updates (replaces) an existing Form entity
retrieveForm¶
- Retrieves a specific Form by ID
BPMPlatformFormService Methods¶
retrieveFormByIdDeployedOnBpmPLatform¶
- Retrieves a Form by deployment ID from BPM platform
retrieveFormByNameDeployedOnBpmPLatform¶
- Retrieves a Form by deployment name from BPM platform
Error Handling¶
The services implement comprehensive error handling: - Parameter validation - HTTP error responses - Type checking - Required field validation
HTTP Headers¶
Automatically managed headers:
- Content-Type: application/json
- Accept: application/json
- transactionId (when provided)
- Authorization (via DNextBase)
Dependencies¶
- @angular/core: ^18.0.0
- @angular/common: ^18.0.0
- @dnext-angular/common
- @dnext-angular/http
- rxjs: ^7.0.0
License¶
DNext PiAGroup