class EnsPortal.BPLEditor
extends EnsPortal.Template.devPage, EnsPortal.Util.CodeEditorBase, EnsPortal.Util.PageLinks
Business Process Designer.
This class should be considered as INTERNAL.
parameter DEFAULTVIEWMODE = "bpl";
If this page has multiple views, this is its initial display mode.
parameter DEFAULTZOOM = 75;
parameter DESIGNERURL = "EnsPortal.BPLEditor.zen";
URL for BP Designer.
parameter EDITRESOURCE = "%Ens_BPL:WRITE,%Ens_Code:WRITE";
User needs WRITE permissions on either the %Ens_Code or the %Ens_BPL resource to make changes on this page.
parameter JSINCLUDES;
Comma-separated list of additional JS include files for the page.
parameter PAGENAME = "Business Process Designer";
Displayed name of this page.
parameter RESOURCE = "%Ens_BPL:READ,%Ens_Code:READ";
User needs READ permissions on either the %Ens_Code or the %Ens_BPL resource to view this page.
property %bpl
as Ens.BPL.UI.Diagram;
Local copy of BPL diagram object.
property activityDesc
as array of %String;
Array of brief descriptions on each activity.
property bpAsName
as %String;
Target SaveAs name of Business Process used by EnsPortal.Dialog.BusinessProcessSave.
property bpId
as %String(MAXLEN=250,ZENURL="BP");
ID (full classname) of Business Process to display.
property codeValidation
as %Boolean [ InitialExpression = 1 ];
Flag to control whether code elements are checked for leading whitespace.
property currItem
as %Integer;
ID (index number, 1-based) of current selected item.
property designerURL
as %ZEN.Datatype.string [ InitialExpression = ..#DESIGNERURL ];
URL for designer.
property diagramLoaded
as %Boolean [ InitialExpression = 0 ];
Flag to indicate that the SVG diagram has been loaded.
property msgDocReadOnly
as %ZEN.Datatype.caption [ InitialExpression = $$$TextJS("This business process is read only") ];
property tipCompile
as %ZEN.Datatype.caption [ InitialExpression = $$$Text("Compile this Business Process into executable code") ];
property tipNew
as %ZEN.Datatype.caption [ InitialExpression = $$$Text("Create a new Business Process") ];
property tipOpen
as %ZEN.Datatype.caption [ InitialExpression = $$$Text("Load an existing Business Process") ];
property tipSave
as %ZEN.Datatype.caption [ InitialExpression = $$$Text("Save this Business Process") ];
property tipSaveAs
as %ZEN.Datatype.caption [ InitialExpression = $$$Text("Save this Business Process with a new name") ];
classmethod %ActivitytoJSON(pActivity As Ens.BPL.Activity)
as %Status
Output an activity (for a request/response) in JSON format.
classmethod %BPLtoJSON(pBPLName As %String, pDiagram As Ens.BPL.UI.Diagram)
as %Status
Output the contents of the given diagram to JSON.
classmethod %ConnectortoJSON(pShape As Ens.BPL.UI.Connector)
as %Status
Output a connector in JSON format.
classmethod %CreateDiagramFromProxy(pObject As %ZEN.proxyObject, Output pDiagram As Ens.BPL.UI.Diagram, ByRef pShapeIndex As Ens.BPL.UI.Shape)
as %Status
Convert data in the given proxy object into a Diagram.
classmethod %CreateReqRespFromProxy(pIsRequest As %Boolean, pObject As %ZEN.proxyObject, Output pOutput As Ens.BPL.Message)
as %Status
Convert a proxy object into a request or response.
classmethod %CreateShapeListFromProxy(ByRef pShapeIndex As Ens.BPL.UI.Shape, pObjectList As %ListOfObjects, Output pParentIndex As Ens.BPL.UI.Shape)
as %Status
Convert an array of proxy objects into a local array of shapes (pShapeIndex) and an index by parent (pParentIndex).
method %OnAfterCreatePage()
as %Status
This class method callback is called just before the server-side page
object is created.
method %OnDrawHTMLHead()
as %Status
Add the Studio API methods.
method %OnGetPageName()
as %String
Get the (localized) name of the page.
This should be implemented in a subclass.
method %OnGetTitle()
as %String
Get the (localized) title string for the page.
This should be implemented in a subclass.
classmethod %PropertyListtoJSON(pList As Ens.BPL.PropertyList)
as %Status
Output the contents of the given property list to JSON.
classmethod %ShapetoJSON(pShape As Ens.BPL.UI.Shape)
as %Status
Output a shape in JSON format.
method DrawLoadingMsg(pSeed As %String)
as %Status
Get the (localized) title string for the page.
This should be implemented in a subclass.
method GetBPLDefinition(ByRef pParms)
as %Status
Get BPL definition for JSON provider
and write out JSON version of it.
classmethod GetCodeValidation(pBPL As %String = "")
as %Boolean
[ ZenMethod ]
method GetInternalName()
as %String
Return the internal name of the current BPL document.
classmethod IsCodeValid(pCode As %String = "")
as %Boolean
[ ZenMethod ]
Test if a code fragment contains valid ObjectScript code.
method LoadBPLDiagram()
as %Status
Helper method to load BPL diagram from disk.
method OnDrawRibbon()
as %Status
Add content to ribbon bar.
method OnGetRibbonInfo(Output pDisplay As %Boolean, Output pViewIcons As %List, Output pSortOptions As %List, Output pSearchBox As %Boolean, Output pRibbonTitle As %String)
as %Status
Get information to display in the ribbon bar.
classmethod SetCodeValidation(pBPL As %String = "", pNewValue As %Boolean = 1)
as %Boolean
[ ZenMethod ]
classmethod SetPreference(pPref As %String, pValue As %String)
as %Boolean
[ ZenMethod ]
Set a value in the preference global.
method SubmitBPL(pCommand As %String, pProvider As %ZEN.Auxiliary.jsonProvider, pSubmitObject As %RegisteredObject, ByRef pResponseObject As %RegisteredObject)
as %Status
Object submit handler JSON provider.
This is called when the client saves the Business Process.
method activityChange(isText As %Boolean = 0)
[ Language = javascript ]
User has changed an activity value.
languageOverrideChanging is an optional parameter.
Supplied ONLY when the select list for a LanguageOverride is modified.
The values used will be for example: '', 'objectscript', 'python'
Required for cross-validation of controls on the Activity form
method addCallActivity(prop, reset, action, annotation, key, property, value)
[ Language = javascript ]
Helper method to allow Call Builder to create valid Activity list in current window context.
method addNewGroup(groupType)
[ Language = javascript ]
method addNewShape(shapeType)
[ Language = javascript ]
User has selected a new shape to add.
method adjustSizes()
[ Language = javascript ]
Adjust sizes of components on the page.
method arrange()
[ Language = javascript ]
method autoConnect(startShape, endShape)
[ Language = javascript ]
method bpSave()
[ Language = javascript ]
method buildActivityMap()
[ Language = javascript ]
Build a map of the properties expected in various shapes and the controls to fetch the values from.
method canUndo()
[ Language = javascript ]
Return true if it is possible to undo an action
method changeCodeValidation(newValue)
[ Language = javascript ]
Modify the codeValidation flag and trigger
validation using the new value.
method changePreference(pref, value)
[ Language = javascript ]
Change value of a BPL editor preference.
method chooseSCMenu(menuName, commandName, saveFlags)
[ Language = javascript ]
Handle a source control menu selection.
method clearUndoBuffer()
[ Language = javascript ]
Clear the current undo buffer.
method cloneObject(obj, clone, noSVG)
[ Language = javascript ]
Create a clone of an object supplied in obj.
If noSVG is specified, any properties with an _ other
than _type, _class and _className will not be cloned.
method compile()
[ Language = javascript ]
Launch the compile dialog.
method connectorChange(isText As %Boolean = 1)
[ Language = javascript ]
User has changed a connector value
method copyShape(isCut, warnings)
[ Language = javascript ]
Copy selected shape(s).
Note that we copy parents *BEFORE* children so that we can translate ParentShape references during paste.
method copyShapeChild(shape)
[ Language = javascript ]
method createConnectorModel(fromShape, toShape, name, connType, condition)
[ Language = javascript ]
method createShapeModel(type, name, parentIndex, xPos, yPos, annotation, allAuto)
[ Language = javascript ]
method cutShape()
[ Language = javascript ]
Cut selected item(s).
method deleteAction(which, idx)
[ Language = javascript ]
Delete an action in a req/resp list.
method deleteContextProperty(idx)
[ Language = javascript ]
Delete a context property.
method deleteShape(isCut)
[ Language = javascript ]
Delete selected item(s).
method deleteShapeModel(bplModel, shape, warnings)
[ Language = javascript ]
Helper method to recurse through children of selected items.
method deleteXSLTParm(idx)
[ Language = javascript ]
Delete an XSLT parameter.
method diagramChange(field)
[ Language = javascript ]
User has changed a diagram value.
method drillDown()
[ Language = javascript ]
method drillUp()
[ Language = javascript ]
method editAction(which, idx)
[ Language = javascript ]
Launch the action property dialog.
method editContextProperty(idx)
[ Language = javascript ]
Launch the context property dialog.
method editPropertyValue(name, type, languageOverride)
[ Language = javascript ]
Launch the property editor dialog.
method editXSLTParm(idx)
[ Language = javascript ]
Launch the XSLT parameter dialog.
method endUndoAction()
[ Language = javascript ]
Close off an undo block. If the undoLevel is back to 0, update icons and mark the page as modified.
method findRule(prop)
[ Language = javascript ]
Launch rule finder.
method findTransform(prop)
[ Language = javascript ]
Launch the data transform finder dialog.
method getAction(which, actionIndex)
[ Language = javascript ]
method getActionListHTML(which, array)
[ Language = javascript ]
Return HTML for an action table.
method getBPLObject()
[ Language = javascript ]
Return the BPL definition object.
method getClientModel()
[ Language = javascript ]
Get the jsonProvider object on the client.
Subclasses MUST override this method to return the jsonProvider.
method getContextProperties(asCommaList)
[ Language = javascript ]
Helper method to list the names of context properties.
method getContextPropertiesTypes(asCommaList)
[ Language = javascript ]
Helper method to list the types of context properties.
method getControlLanguage(controlPrefix)
[ Language = javascript ]
Resolve the language used in scope of a given control
method getCurrShape(which)
[ Language = javascript ]
Called from request/response builder to get action list for current shape.
method getCurrentName()
[ Language = javascript ]
Return the current name of the class/object being modified
method getMapProperty(shapeModel, map, field)
[ Language = javascript ]
Helper method to invoke the correct get code in the activity map
method getSVGWindow()
[ Language = javascript ]
Get the SVG window object for the diagram.
This provides a way to access scripts in the SVG diagram.
method getSelectedItem()
[ Language = javascript ]
Return the selected item in the editor.
method initializeSVG()
[ Language = javascript ]
method loadBP()
[ Language = javascript ]
Launch the finder dialog.
method newBP()
[ Language = javascript ]
Create a new Business Process.
method notify(type)
[ Language = javascript ]
Event raised on canvas.
method onDocumentReload(reason)
[ Language = javascript ]
Ensure we redraw the diagram if a reload was requested
method onDocumentSaveComplete(contentUpdated)
[ Language = javascript ]
Ensure we redraw the diagram if the model was updated.
method onPopupAction(popupName, action, value)
[ Language = javascript ]
This client event is fired when the a popup page launched from this page fires an action.
method onSVGLoad()
[ Language = javascript ]
Notification from SVG frame that its contents are loaded.
method onlayoutHandler(load)
[ Language = javascript ]
Adjust sizes of components on the page.
No HyperEvents should be executed before initializeSVG() is executed, as that method
calls checkStudioHyperEvents() to ensure that we maintain consistent session behaviour under Studio.
method onshowTab()
[ Language = javascript ]
Ensure tab content is correctly sized when the tab is shown.
method paste()
[ Language = javascript ]
Paste items from the clipboard.
The logic is predicated on parents being copied before children.
method removeConnectorFromModel(connectorModel)
[ Language = javascript ]
Remove a connector definition from the model.
method renderActionList(which, shapeModel)
[ Language = javascript ]
Update the contents of the Call Request or Response Action table.
method renderContextTable()
[ Language = javascript ]
Update the contents of the Context Properties table.
method renderXSLTList(shapeModel)
[ Language = javascript ]
Update the contents of the XSLT parameters table.
method replaceBPLObject(bpl)
[ Language = javascript ]
Replace the current BPL object with the supplied BPL object.
This is used by the undo framework.
method saveBP(showDialog, force)
[ Language = javascript ]
Launch the save dialog.
method selectContextClass()
[ Language = javascript ]
Launch the select context super dialog.
method selectMessageClass(which, prop, isDiagramProperty)
[ Language = javascript ]
Launch the finder for request or response messages.
which should be 'Request' or 'Response'.
method setActionItem(which, idx, actionType, prop, value, key, annotation)
[ Language = javascript ]
Set the values for an action item.
method setCanvasSize(width, height)
[ Language = javascript ]
Called from diagram to set size of svg canvas.
method setContextProperty(idx, propName, propType, propDefault, propDesc, propCollection, propInstantiate)
[ Language = javascript ]
Set the values for a context property.
method setDescription(desc)
[ Language = javascript ]
Update the description (annotation) of this BP.
method setOption(option, value)
[ Language = javascript ]
method setReadOnly(readOnly)
[ Language = javascript ]
Set readOnly to the value of readOnly.
Subclasses MUST implement this method to update the controls on the page
so that the page's behaviour actually matches the value of the readOnly flag.
method setXSLTParm(idx, parm, value)
[ Language = javascript ]
Set the values for an XSLT parameter.
method setZoom(zoom, updateSelect)
[ Language = javascript ]
User has selected a new zoom level.
method showActivityDoc(type)
[ Language = javascript ]
Show documentation for given activity.
method showBuilder(which)
[ Language = javascript ]
Request/Response (DTL) builder.
method showDTLEditor()
[ Language = javascript ]
Open DTL editor in a new window.
method showRuleEditor()
[ Language = javascript ]
Open Rule editor in a new window.
method showSCMenu()
[ Language = javascript ]
Call UpdateSCMenu() first in case the document has been modified elsewhere,
then display the source control menu based on the contents of the _sourceControlMenu data
created by UpdateSCMenu().
method startUndoAction(tabNum)
[ Language = javascript ]
Start an undo block. If the undo level is 0, save a copy of the current BPL model including
which items are selected.
method studioSave()
[ Language = javascript ]
Method to produce and save the XML expected by Studio.
method toggleSettings()
[ Language = javascript ]
Toggle display of settings box.
method undo()
[ Language = javascript ]
Undo change.
method updateActivitySettings(shape, isUpdate, noTabSelect)
[ Language = javascript ]
Update the Activities tab on the settings panel.
LanguageOverride appearing in PropertyBag
This code executes whenever an activity item or canvas background is clicked on
method updateIcons()
[ Language = javascript ]
Update the state of icons in the toolbar.
method updateLanguageOverride(controlprefix, isBasic, shapeModel)
[ Language = javascript ]
method updateSettings(noTabSelect)
[ Language = javascript ]
Update the settings panel.
method validateCode(code, currWindow, showConfirm, languageOverride="", control)
[ Language = javascript ]
Method to ensure code elements contain leading whitespace.
This validation can be disabled from the UI for BPs which
do contain routine tags.
method validateExpression(expr, languageOverride="", control)
[ Language = javascript ]
Validate a code expression.
This expression is not necessarily the object this.getSelectedItem();
ie: Validation applied when navigating away from a shape
method validateShape(shape)
[ Language = javascript ]
Test if current shape is valid. Show error message if not.