WebSquare.ModelUtil Package
Type
- engine
Property Summary
Event Summary
Method Summary
- abort( submissionId )
- Aborts the currently running submission.
- copyChildrenNodes( srcXPath , destXPath , mode )
- Copies the child nodes of scrXPath to the child nodes specified by destXPath.
- copyNode( srcXPath , destXPath )
- Appends the srcXPath node to the child node of the destXPath.
- executeParallel( submission , processMsg , resolveCallback , rejectCallback , id )
- Executes the submissions in parallel without creating a workflow.
- executeSerial( submission , processMsg , resolveCallback , rejectCallback , id )
- Executes the submissions in serial without creating a workflow.
- executeSubmission( submissionID , requestData , obj )
- Executes the submission of the corresponding submissionID.
- executeWhilst( submission , condFn , maxRepeat , processMsg , resolveCallback , rejectCallback , id )
- Repeatedly calls a certain submission without creating a workflow.
- executeWorkflow( workflowId )
- Executes the workflow of the received workflowId or workflowObj.
- findInstanceNode( xpath )
- Returns the nodes of the specified XPath inside the instance.
- findInstanceNodes( xpath )
- An array of document elements (or nodes) found by XPath
- findSerializedNode( xpath )
- WebSquare
- getInstanceValue( xpath )
- Returns the nodeValue of the instance of the corresponding XPath.
- getRefToReqData( submissionObj )
- Converts the ref of the submission into string, and returns the converted string.
- getRunningWorkflow( workflowID )
- Returns the object of the currently running first workflow.
- getRunningWorkflowID( )
- Returns the ID of the currently running workflow.
- getSubmission( id )
- Returns the submission of the corresponding ID.
- getWorkflow( id )
- Gets the workflow object of the corresponding ID.
- isRunningWorkflow( workflowID )
- Check whether there is a currently running workflow.
- rejectWorkflow( reject , workflowID )
- Rejects the currently running workflow.
- removeChildNodes( xpath )
- Removes the child nodes of the XPath.
- removeInstanceNode( xpath )
- Removes the instance nodes of the XPath.
- removeInstanceNodes( xpath )
- Removes the instance nodes of the XPath.Removes the instance nodes of the XPath.
- setInstanceNode( doc , xpath , modelID , mode )
- Sets the document or element in the instance node of the XPath.
- setInstanceValue( xpath , value )
- Sets the nodeValue in the instance node of the XPath.
Property Detail
Event Detail
Method Detail
- abort( submissionId )
-
Aborts the currently running submission.
Parameter name type required description submissionId String Y ID of the submission to abort SampleWebSquare.ModelUtil.abort( "ID of the submission to abort" ); - copyChildrenNodes( srcXPath , destXPath , mode )
-
Copies the child nodes of scrXPath to the child nodes specified by destXPath in one of the following ways:
replaces all child nodes (replaceAll),
erges the child nodes of srcXPath and destXPath (overwrite),
appends child nodes of srcXPath to destXPath (append),
sets only the child nodes of destXPath (replaceOnly).Parameter name type required description srcXPath String Y xPath of the data to copy destXPath String Y xPath of the destination mode String Y ( "replaceAll", "overwrite", "replaceOnly", "append" ) SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Learning XML2 39.952 Erik T. Ray Learning XML 39.95 Learning XML 39.95 Erik T. Ray Learning XML2 39.952 Erik T. Ray Learning XML 39.95 - copyNode( srcXPath , destXPath )
-
Appends the srcXPath node to the child node of the destXPath.
The existing nodes under destXPath will be removed.Parameter name type required description srcXPath String Y xPath of the data to append destXPath String Y xPath of the destination SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Learning XML 39.95 - executeParallel( submission , processMsg , resolveCallback , rejectCallback , id )
-
Executes the submissions in parallel without creating a workflow.
submission1 call -> submission2 call -> submission1 callback -> submission2 callbackParameter name type required description submission array Y id array ex) ["submission1", "submission2", "submission3"] processMsg String N resolveCallback function N function rejectCallback function N function id String N SampleWebSquare.ModelUtil.executeParallel( ["submission1", "submission2", "submission3"],processMsg, final_callback, reject_callback, id) ; submission1,submission2, submission3 call -> submission1 callback -> submission2 callback -> submission3 callback -> final_callback or reject_callback - executeSerial( submission , processMsg , resolveCallback , rejectCallback , id )
-
Executes the submissions in serial without creating a workflow.
submission1 call -> submission1 callback -> submission2 call -> submission2 callbackParameter name type required description submission array Y id array ex) ["submission1", "submission2", "submission3"] processMsg String N resolveCallback function N function rejectCallback function N function id String N SampleWebSquare.ModelUtil.executeSerial( ["submission1", "submission2", "submission3"], processMsg,final_callback, reject_callback) ; submission1 call/callback -> submission2 call/callback -> submission3 call/callback -> final_callback or reject_callback - executeSubmission( submissionID , requestData , obj )
-
Executes the submission of the specified submissionID.
Parameter name type required description submissionID String Y ID of the submission requestData Object N Requested data obj Object N Component to disable during submission SampleWebSquare.ModelUtil.executeSubmission ("submission1") ; Execute submission1. - executeWhilst( submission , condFn , maxRepeat , processMsg , resolveCallback , rejectCallback , id )
-
Repeatedly calls a certain submission without creating a workflow.
Parameter name type required description submission String Y ID condFn function Y pre function checking the execution status maxRepeat int Y Maximum execution count. Can be used to control infinite loops when the workflow can be identified only by the condition. processMsg String N resolveCallback function N function rejectCallback function N function id String N SampleWebSquare.ModelUtil.executeSerial( "submission1", cond_check, 100, processMsg,final_callback, reject_callback, id) ; Repeatedly calls (and calls back) the submission not more than 100 times when cond_check is success. -> final_callback or reject_callback - executeWorkflow( workflowId )
-
Executes the workflow of the received workflowId or workflowObj.
Parameter name type required description workflowId Object Y workflow ID or workflowObj SampleWebSquare.ModelUtil.executeWorkflow ("workflow1") ; workflowCollection/Run the workflow of which ID is workflow1. Or var workflowObj= {"id":"workflow1", "processMsg" : "Running.. ", "step" : [{ "type":"submit", "action" : "submission1"}, { "type":"submit","pre": cond, "action" : "submission2"}, { "type":"submitDone", "action" : "submission1", "post":post}, { "type":"submitDone", "action" : "submission2", "post":post} ], "resolveCallback" : final_callback, "rejectCallback": reject_callback }) ; WebSquare.ModelUtil.executeWorkflow (workflowObj) ; Run the workflow with the workflowObj object. - findInstanceNode( xpath )
-
Finds the nodeValue of the instance of the corresponding XPath. If multiple nodes exists, returns the first node.
Parameter name type required description xpath String Y XPath of the instance node to find Return type description Xml Element XML element found by XPath SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Harry Potter 29.99 - findInstanceNodes( xpath )
-
Finds the nodeValue of the instance of the corresponding XPath as an array.
Parameter name type required description xpath String Y XPath of the instance node to find Return type description Object An array of document elements (or nodes) found by XPath SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Harry Potter 29.99 Learning XML 39.95 - findSerializedNode( xpath )
-
Serializes the node found by WebSquare.ModelUtil.findInstanceNode, and returns the result.
Parameter name type required description xpath String Y XPath of the instance node to find Return type description String Serialized document element (node) SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Harry Potter 29.99 - getInstanceValue( xpath )
-
Returns the nodeValue of the instance of the corresponding XPath.
f the node is an element, child nodes will be searched from the first to the last.
If the node is an attribute, child nodes will not be searched.
Instead, the nodeValue will be immeidately returned.Parameter name type required description xpath String Y XPath of the instance node to find Return type description String nodeValue found by XPath SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 - getRefToReqData( submissionObj )
-
Converts the ref of the submission into string, and returns the converted string.
Parameter name type required description submissionObj Object Y submission object - getRunningWorkflow( workflowID )
-
Returns the ID of the currently running first workflow.
Parameter name type required description workflowID String N workflow ID Return type description Object Currently running workflow object Samplef the submission has been dynamically created, the objects can be obtained only in the running node (pre, defaultCallback, callback, resolveCallback, rejectCallback, etc.) Use workflowObj.result to get the result of the completed submissions. var workflowObj = WebSquare.ModelUtil.getRunningWorkflow( ); - getRunningWorkflowID( )
-
Returns the ID of the currently running workflow.
Return type description String ID of the currently running workflow SampleReturn the currently running workflow ID var runID = WebSquare.ModelUtil.getRunningWorkflowID( ); - getSubmission( id )
-
Submission of the specified ID will be returned.
Parameter name type required description id String Y ID of the submission Return type description Object Submission of the specified ID SampleThe submission is as shown below. - getWorkflow( id )
-
Gets the workflow object of the corresponding ID.
Parameter name type required description id String Y workflow ID Return type description Object Workflow of the corresponding ID SampleIf workflow1 is defined in XML, the workflow object can be obtained even before execution. If the submission has been dynamically created, the objects can be obtained only in the running node (pre, defaultCallback, callback, resolveCallback, rejectCallback, etc.) Use workflowObj.result to get the result of the completed submissions. var workflowObj = WebSquare.ModelUtil.getWorkflow( "workflow1" ); - isRunningWorkflow( workflowID )
-
Check whether there is a currently running workflow.
If the workflow ID is known, the execution status of the workflow will be returned.Parameter name type required description workflowID String N workflow ID Return type description boolean Execution status SampleCheck whether there is a currently running workflow. var isRun = WebSquare.ModelUtil.isRunningWorkflow( ); - rejectWorkflow( reject , workflowID )
-
Rejects the currently running workflow. When the workflow ID is given, the workflow will be rejected only when in running.
Parameter name type required description reject String N Reason of rejection workflowID String N Return type description Object Rejected workflow Object Samplevar workflowObj = WebSquare.ModelUtil.rejectWorkflow( ); - removeChildNodes( xpath )
-
Removes the child nodes of the XPath.
Parameter name type required description xpath String Y XPath of the parent to remove the child nodes SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Learning XML 39.95 - removeInstanceNode( xpath )
-
Removes the child node of the XPath.
Parameter name type required description xpath String Y XPath of the node to remove SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Learning XML 39.95 - removeInstanceNodes( xpath )
-
Removes the instance nodes of the XPath.
Parameter name type required description xpath String Y XPath of the node to remove SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 - setInstanceNode( doc , xpath , modelID , mode )
-
Sets the document or element in the instance node of the XPath.
In the replace mode, the existing nodes will be removed and new nodes will be added.
In append mode, new nodes will be appended to the existing nodes.
If not specified, the replace mode will be used.Parameter name type required description doc Object Y Document or Document Element (node) xpath String Y XPath to set the node modelID String N Model ID of the XPath to set the node (Currently not available.) mode String N mode ("replace", "append") SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Learning XML2 39.952 Erik T. Ray Harry Potter 29.99 Learning XML2 39.952 Erik T. Ray Harry Potter 29.99 - setInstanceValue( xpath , value )
-
Sets the nodeValue in the instance node of the XPath.
Parameter name type required description xpath String Y XPath of the instance node value String Y Text value to set Return type description Boolean If the mode does not exist, false. Otherwise, true. SampleBind the data with the model as shown below. Harry Potter 29.99 Learning XML 39.95 Harry Potter 29.99 .. Omitted