Uploading supporting documents using the Flex APIWhen you upload your document, create a DocumentReference object and set the contentType attribute a MIME type, such as application/pdf for PDF files. (See MIME Types ). For more information about uploading the document, see Handling documents with LiveCycle Remoting in Programming with LiveCycle ES2.5 . The following code shows how to upload a PDF file using the Flex API: package customsolution {
import com.adobe.livecycle.rca.model.ReviewContext;
import com.adobe.livecycle.rca.model.ReviewContext;
import com.adobe.livecycle.rca.model.participant.Initiator;
import com.adobe.livecycle.rca.service.ServiceProvider;
import com.adobe.livecycle.rca.service.core.IReviewCommentingAndApprovalService;
import com.adobe.livecycle.rca.token.IAsyncToken;
import mx.messaging.ChannelSet;
import mx.messaging.channels.AMFChannel;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.livecycle.DocumentReference;
import mx.utils.ObjectUtil;
public class InitiateReview
{
public static var username:String;
public static var password:String;
public static var server_url:String;
public static var server_port:String;
public static var amfChannelURI:String;
public var _channelSet:ChannelSet = null;
public var rc : ReviewContext = null;
public var rcaService:IReviewCommentingAndApprovalService = null;
public function init():void
{
server_url="http://localhost";
server_port="8080";
amfChannelURI="/remoting/messagebroker/amf";
username= "administrator";
password = "password";
_channelSet = new ChannelSet();
_channelSet.addChannel(new AMFChannel('amf-channel',
server_url+":"+server_port+amfChannelURI));
_channelSet.login(username, password);
rcaService:IReviewCommentingAndApprovalService =
ServiceProvider.getReviewCommentingAndApprovalService(_channelSet);
}
public function initiateReview() : void
{
init();
//assumption A template with name "CustomSolutionTemplate" already exists in the
review zone.
var getRTToken:IAsyncToken =
rcaService.getReviewTemplate("SustomSolutionTemplate");
getRTToken.addHandlers(handleGetTemplateResult , handleGetTemplateFault);
}
public function handleInitiateReviewResult(event: ResultEvent):void{
trace(ObjectUtil.toString(event));
public function handleInitiateReviewFault(event: FaultEvent):void{
trace(ObjectUtil.toString(event));
public function handleGetTemplateResult(event: ResultEvent):void{
rc = event.result.reviewTemplate;
rc.initiator = new Initiator();
rc.initiator.domain = "DefaultDom";
rc.initiator.canonicalName = "apink";
rc.title="Initiate Review Quick Start";
var docRef:DocumentReference = new DocumentReference();
docRef.contentType = "application/pdf";
//It has been assumed that document is already available in content service.
// A document residing on local disk can be first uploaded to LiveCycle.
docRef.url =
"http://localhost:8080/contentspace/d/d/workspace/SpacesStore/6d6d1412-4fef-499e-970f-70838967d87f/test.pdf";
docRef.referenceType = DocumentReference.REF_TYPE_URL;
//supporting documents are null
var token:IAsyncToken = rcaService.initiateReview(rc, docRef, null);
token.addHandlers(handleInitiateReviewResult , handleInitiateReviewFault);
public function handleGetTemplateFault(event: FaultEvent):void{
trace(ObjectUtil.toString(event));
}
|
|
// Ethnio survey code removed