Class: DocumentsArray

DocumentsArray()

new DocumentsArray()

Methods

addPageToDocument(successCallback, errorCallback, parameters)

Method to Add page to the Document
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the documenttype and page ids.
Properties
Name Type Attributes Default Description
documentID String <optional>
"" id of the document where you would like to add the page
pageID String <optional>
"" id of the page you want to add to document
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back . errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var createdDocument = null;
var pageObject = null;
var pagearray = kfxCordova.kfxLibLogistics.createPagesArray();
var docarray = kfxCordova.kfxLibLogistics.createDocumentsArray();
pagearray.createPageObject(function(pageObj){
     pageObject = pageObj;
},function(error){
     alert(JSON.stringify(error));
},{side:"FRONT"});// use side:"BACK" to create back side image
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
   createdDocument = docObject;
},function(error){
   alert(JSON.stringify(error));
},"document type name");
docarray.addPageToDocument(function(document){
   alert("updated document is "+ JSON.stringify(document));
},function(error){
   alert (JSON.stringify(error));
},{documentID:createdDocument.documentID,pageID:pageObject.pageID});

createDocumentWithDocumentType(successCallback, errorCallback, docTypeName)

Method to Create document using documentType and add in DocumentsArray.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
docTypeName String A JSON object contains the documenttype name.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The library returns KMC_SUCCESS. errorCallback - error message would contain the appropriate error description.Possible error objects are Exception,KmcException,JSONException.
Example
var createdDocument = null;
var captureServer = null;
var documentTypesArray = null;
kfxCordova.kfxLibLogistics.createCaptureServer(function(captureServerObj){
     captureServer = captureServerObj;
},function(error){
     alert(JSON.stringify(error));
},{serverUrl:"valid url",serverType:"SERVER_KFS"});
captureServer.registerDevice(function(success){
     captureServer.loginAnonymously(function(success){
         documentTypesArray = success;
     },function(registerError){
         alert(JSON.stringify(registerError));
     });
},function(registerError){
     alert(JSON.stringify(registerError));
});

kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
    createdDocument = docObject;
},function(createDocumentError){
     alert(JSON.stringify(createDocumentError));
},documentTypesArray[0].typeName);

createDocumentWithDocumentTypeAndId(successCallback, errorCallback, docTypeNameAndId)

Method to Create document using documentType and id and add in DocumentsArray.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
docTypeNameAndId Object :A JSON object contains the documenttype name and id.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The library returns KMC_SUCCESS. errorCallback - error message would contain the appropriate error description.Possible error objects are Exception,KmcException,JSONException.
Example
var createdDocument = null;
var captureServer = null;
var documentTypesArray = null;
kfxCordova.kfxLibLogistics.createCaptureServer(function(captureServerObj){
     captureServer = captureServerObj;
},function(error){
     alert(JSON.stringify(error));
},{serverUrl:"valid url",serverType:"SERVER_KFS"});

captureServer.registerDevice(function(success){
     captureServer.loginAnonymously(function(success){
         documentTypesArray = success;
     },function(registerError){
         alert(JSON.stringify(registerError));
     });
},function(registerError){
     alert(JSON.stringify(registerError));
});

var kfsdocumentTypeReadyCallback = function(documentType){
  docarray.createDocumentWithDocumentTypeAndId(function(docObject){
      createdDocument = docObject;
  },function(error){
      alert(JSON.stringify(error));
  },{ documentTypeName:documentTypesArray[0].typeName, documentID: "document id what do you want to give"});
};

deleteDocuments(successCallback, errorCallback, documentIDs:A)

Method to Delete Documents from DocumentsArray which you wants to delete.
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
documentIDs:A Array JSON array contains the ids of the documents.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The library returns KMC_SUCCESS. errorCallback - error message would contain the appropriate error description.Possible error objects are Exception,KmcException,JSONException.
Example
var docIDArray = [];
var docarray = kfxCordova.kfxLibLogistics.createDocumentsArray();
docarray.deleteDocuments(function(success){
      alert(JSON.stringify(success));
},function(error){
      alert(JSON.stringify(error));
},docIDArray); //docIDArray contains the Docids which you wants to delete.

getDocumentIds(successCallback, errorCallback)

Method to get all document ids from DocumentsArray
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back jsonArray of page ids. errorCallback - error message would contain the appropriate error description.Possible error objects are Exception,KmcException,JSONException.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var docarray = kfxCordova.kfxLibLogistics.createDocumentsArray();
docarray.getDocumentIds(successCallback,errorCallback);

getPropertiesOfDocument(successCallback, errorCallback, documentID)

Get the properties of the Document from DocumentsArray
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
documentID Object A JSON object contains the document id.
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back with document Object properties. errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var createdDocument = null;
var docarray = kfxCordova.kfxLibLogistics.createDocumentsArray();
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
   createdDocument = docObject;
},function(error){
   alert(JSON.stringify(error));
},"document type name");
docarray.getPropertiesOfDocument(successCallback,errorCallback,{documentID : createdDocument.documentID});

removeAllDocuments(successCallback, errorCallback)

Method to remove all documents from DocumentsArray
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - The library returns KMC_SUCCESS. errorCallback - error message would contain the appropriate error description.Possible error objects are Exception,KmcException,JSONException.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var docarray = kfxCordova.kfxLibLogistics.createDocumentsArray();
docarray.removeAllDocuments(successCallback,errorCallback);

removePageFromDocument(successCallback, errorCallback, parameters)

Method to remove page to the Document
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the documenttype and page ids.
Properties
Name Type Attributes Default Description
documentID String <optional>
"" id of the document where you would like to remove the page
pageID String <optional>
"" id of the page you want to remove from document
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back. errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
var createdDocument =null;
var pageObject = null;
var pagearray = kfxCordova.kfxLibLogistics.createPagesArray();
var docarray = kfxCordova.kfxLibLogistics.createDocumentsArray();
pagearray.createPageObject(function(pageObj){
     pageObject = pageObj;
},function(error){
     alert(JSON.stringify(error));
},{side:"FRONT"});// use side:"BACK" to create back side image
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
   createdDocument = docObject;
},function(error){},"document type name");
docarray.removePageFromDocument(function(document){
   alert("updated document is "+ JSON.stringify(document));
},function(error){
   alert(JSON.stringify(error));
},{documentID:createdDocument.documentID,pageID:pageObject.pageID});

updateFieldsOfDocument(successCallback, errorCallback, parameters)

Update the fields of the Document
Parameters:
Name Type Description
successCallback function Default Success Call back function name
errorCallback function Default Error call back function name
parameters Object A JSON object contains the documentType id and fields array.
Properties
Name Type Attributes Description
documentID String <optional>
the id of the document in which you want to update the fields
fields Array <optional>
updated list of fields
Returns:
The return value is captured in the 'successCallback' for a successful operation, and might return in 'errorCallback' for an incomplete/invalid operation. Returns the following values in the corresponding functions successCallback - KMC_SUCCESS success call back . errorCallback - error message would contain the appropriate error description.Possible error objects are KmcRuntimeException,Exception.
Example
function successCallback(response){
      alert(JSON.stringify(response));
}
function errorCallback(error){
      alert(JSON.stringify(error));
}
var createdDocument = null;
var docarray = kfxCordova.kfxLibLogistics.createDocumentsArray();
kfxCordova.kfxLibLogistics.createDocumentWithDocumentType(function(docObject){
      createdDocument = docObject;
},function(error){
      alert(JSON.stringify(error));
},"document type name");
docarray.updateFieldsOfDocument(successCallback,errorCallback,{documentID:createdDocument.documentID,fields:createdDocument.fields});