Code Samples

Below code samples demonstrate the use of the 'PaperWork AJAX and Flex' libraries to build custom Rich Internet Applications for FileNet P8.

Using Action Script Library in Adobe Flex Applications

An example CE call: (getDocuments)

public function getDocuments():void {
    var sql:String = " SELECT Id, DocumentTitle from Documents " ;
    PWCEDataManager.search(sql,new mx.rpc.Responder(getDocumentsResultHandler, remoteCallFaultHandler));
}

private function getDocumentsResultHandler(event:ResultEvent):void {
    searchResults = event.result as ArrayCollection;
    documentActionPane.populate(caseCategoryGUID,selectedCase);
}

private function remoteCallFaultHandler(event:FaultEvent):void {
    var errorMessage:ErrorMessage = event.message as ErrorMessage;
    Alert.show(errorMessage.rootCause.message);
}

An example PE call: (launchWorkflow)

public function launchWorkflow():void {
    var workflowName:String = "My Test Workflow";
    var launchParms:Object = new Object();
    launchParms.workflowparm1 = "some value1";
    launchParms.workflowparm2 = "some value2";

   PWPEDataManager.launchWorkflow(workflowName,launchParms,new mx.rpc.Responder(launchResultHandler, remoteCallFaultHandler));
}

private function launchResultHandler( event:ResultEvent):void {
}

private function remoteCallFaultHandler(event:FaultEvent):void {
    var errorMessage:ErrorMessage = event.message as ErrorMessage;
    Alert.show(errorMessage.rootCause.message);
}

One more example PE call: (getQueue depths)

public function getQueues(qNames:String):void {
    PWPEDataManager.getQueueList(qNames,new mx.rpc.Responder(getQueuesResultHandler, remoteCallFaultHandler));
}

private function getQueuesResultHandler( event:ResultEvent):void {
}

private function remoteCallFaultHandler(event:FaultEvent):void {
    var errorMessage:ErrorMessage = event.message as ErrorMessage;
    Alert.show(errorMessage.rootCause.message);
}

NOTE: PWCEDataManager and PWCEDataManager are main classes of the ActionScript librray that provides various CE and PE API calls. Contact us for more details.

Using AJAX in Javascript based Web Applications

An example CE call: (getDocuments)

<script type="text/javascript" src="PWWEB/dwr/interface/PWCE.js"> </script>
<script type="text/javascript" src="PWWEB/dwr/engine.js"> </script>

<script type="text/javascript">

function handleGetDocs(results) {
//bind the results to HTML object.
}

PWCE.search("Select Id, DocumentTitle from Document",handleGetDocs);

</script>

An example PE call: (launchWorkflow)

<script type="text/javascript" src="PWWEB/dwr/interface/PWPE.js"> </script>
<script type="text/javascript" src="PWWEB/dwr/engine.js"> </script>

<script type="text/javascript">

var workflowName:String = "My Test Workflow";
var launchParms:Object = new Object();
launchParms.workflowparm1 = "some value1";
launchParms.workflowparm2 = "some value2";

function handleWorkflowLaunch(results) {
}

PWPE.launchWorkflow(workflowName,launchParms,handleWorkflowLaunch);

</script>

NOTE: PWCE and PWCE are the DWR exposed 'PaperWork Services API' classes that provides various CE and PE API calls. Contact us for more details.

more code samples to follow shortly ...

Framework

Javascript (AJAX) and Action Script (Adobe Flex) libraries for FileNet P8 CE and PE API.

Read More>>

Use Cases

Case Management CEVAs, Rich User Interfaces, Custom Web Application Development, Integration.

Read More>>

Screenshots

PaperWork out of the box has several pre-built Case Management based applications for FileNet P8

Click here for the Screen shots