|
|
p:create(
|
|
$name as xs:string,
|
|
$description as xs:string,
|
|
$success-action as element(p:action)?,
|
|
$failure-action as element(p:action)?,
|
|
$status-transitions as element(p:status-transition)*,
|
|
$state-transitions as element(p:state-transition)*
|
| ) as xs:unsignedLong |
|
 |
Summary:
Create a new content processing pipeline.
|
Parameters:
$name
:
The name of the pipeline. It must be unique.
|
$description
:
A description of the pipeline.
|
$success-action
:
The default action for successful transitions. If none is provided the
system default success action will be used. Create using p:action.
|
$failure-action
:
The default action for failed transitions. If none is provided the
system default failure action will be used. Create using p:action.
|
$status-transitions
:
Status transition definitions. There should be exactly one status
transition for the statuses "created", "deleted", and
"updated". Create using p:status-transition.
|
$state-transitions
:
State transition definitions. There should be at most one state transition
for a given state. Create using p:state-transition.
|
|
Example:
import module namespace p = "http://marklogic.com/cpf/pipelines"
at "/MarkLogic/cpf/pipelines.xqy"
let $init-state := xs:anyURI("http://example.com/states/init")
let $error-state := xs:anyURI("http://example.com/states/error")
return
p:create( "Empty", "No nothing much", (), (),
( p:status-transition("created", "",
$init-state,
$error-state,
(), () ),
p:status-transition("deleted", "",
(),
$error-state,
(), () ),
p:status-transition("updated", "",
(),
$error-state,
(), () )
)
)
|
|
|
|
p:state-transition(
|
|
$state as xs:anyURI,
|
|
$description as xs:string,
|
|
$on-success as xs:anyURI?,
|
|
$on-failure as xs:anyURI?,
|
|
$default-action as element(p:action)?,
|
|
$rules as element(p:execute)*
|
| ) as element(p:state-transition) |
|
 |
Summary:
Construct a new state transition element.
|
Parameters:
$state
:
The name of the state.
|
$description
:
A description of the transition.
|
$on-success
:
The successor state, should the transition succeed. If no successor state
is defined, the document will remain in its current state.
|
$on-failure
:
The successor state, should the transition fail. If no successor state
is defined, the document will remain in its current state.
|
$default-action
:
The default action to execute on entry into this state, if none of the
rules apply.
|
$rules
:
The execution rules to apply in this transition. The first rule whose
condition is true will have its action executed.
|
|
Example:
import module namespace p = "http://marklogic.com/cpf/pipelines"
at "/MarkLogic/cpf/pipelines.xqy"
p:state-transition( xs:anyURI("http://example.com/states/review"),
"Document review state",
(), xs:anyURI("http://example.com/states/error"),
p:action("/app/send-to-reviewer.xqy",(), ()),
() )
|
|
|
|
p:status-transition(
|
|
$status as xs:string,
|
|
$description as xs:string,
|
|
$on-success as xs:anyURI?,
|
|
$on-failure as xs:anyURI?,
|
|
$default-action as element(p:action)?,
|
|
$rules as element(p:execute)*
|
| ) as element(p:status-transition) |
|
 |
Summary:
Construct a new status transition element.
|
Parameters:
$status
:
The status: either "created", "updated", or
"deleted".
|
$description
:
A description of the transition.
|
$on-success
:
The successor state, should the transition succeed. If no successor state
is defined, the document will remain in its current state.
|
$on-failure
:
The successor state, should the transition fail. If no successor state
is defined, the document will remain in its current state.
|
$default-action
:
The default action to execute on entry into this status, if none of the
rules apply.
|
$rules
:
The execution rules to apply in this transition. The first rule whose
condition is true will have its action executed.
|
|
Example:
import module namespace p = "http://marklogic.com/cpf/pipelines"
at "/MarkLogic/cpf/pipelines.xqy"
p:status-transition("created",
"Document creation: Put in initial state.",
xs:anyURI("http://example.com/states/initial"), (),
(), () )
|
|
|