// fetch extension descriptor from back-end or inline
var extensionDescriptorStr;
var qaPackage = JSON.parse(extensionDescriptorStr);
var modeler = new BpmnJS({
moddleExtensions: {
qa: qaPackage
}
});
// continue as usual
This assumes you integrated the BPMN modeler via webjar into your webapp. It publishes BpmnJS via UMD, either as a global, RequireJS or CommonJS module.
A custom meta model within a WebJar project typically means customizing or extending the functionality of a UI component, data model, or library while using resources provided by a WebJar.
Here’s an example of how you could create a custom meta model in a Spring Boot application using a WebJar for Bootstrap and Angular:
Expose WebJar Resources: In a Spring Boot application, you don’t need extra configuration as WebJar resources are automatically accessible under /webjars.
Define Your Custom Meta Model:
// myMetaModel.js
const customMetaModel = {
title: ‘Custom Meta Model Example’,
properties: {
name: { type: ‘string’, required: true },
age: { type: ‘number’, required: false },
},
};
export default customMetaModel;
Serve and Test: Start your application, navigate to the appropriate endpoint, and verify that your custom meta model integrates with the WebJar resources.
Yes, you can add a custom meta model while using the webjar approach. Although the example you referenced uses Node.js, the core concepts remain applicable. Here’s how you can adapt it:
Modify bpmn-modeler.js: You can customize the bpmn-modeler.js file to include your custom meta model. Extend the BPMN Moddle schema by importing your custom descriptors directly into the webjar setup.
Custom Schema Integration: Create a JSON file for your custom meta model descriptors and load it as part of your webjar bundle. Inject it during the initialization of the BPMN modeler.
Dynamic Injection: Update the additionalModules configuration in the BPMN Modeler to include your custom modules. This is similar to the Node.js approach but tailored to your setup.
Feel free to share any specific challenges or code snippets if you need more guidance!