IBM FileNet P8, Version 5.2            

Prepare import scripts

You can add JavaScript scripts to run at various points during the Content Engine import process (for an overview, see About import scripts). FileNet® Deployment Manager includes sample scripts that you can use as templates to develop your own custom scripts. See the following for a description of the sample JavaScript functions.

The sample scripts are part of the set of sample files that you generate with FileNet Deployment Manager. The scripts are placed in the Samples folder of the deployment tree. See Create sample files.

Sample JavaScript functions

To customize the import process, the sample scripts start the Java™ API (Java Platform, Standard Edition) and the Content Engine Java API. The scripts include the following import statements:

importClass(Packages.java.lang.System);
importClass(Packages.java.util.HashMap);
importPackage(Packages.com.filenet.api.core);
importPackage(Packages.com.filenet.api.collection);
importPackage(Packages.com.filenet.api.exception); 

Other package or class imports might be required depending upon your use cases. For information about the Content Engine Java API, see the Java and .NET Developer's Guide.

Each script run type is passed a HashMap object (java.util.HashMap), with which you can pass script execution state information between scripts. For example:

     // Created a marking set. Store the ID so other scripts know about it.
     var markingId = markingSet.get_Id();
     var markingName = markingSet.get_DisplayName();
     map.put(markingId, "MarkingSet Name: " + markingName); 

For more information about the HashMap class, see the Java SDK documentation.

The following tables describe the sample JavaScript functions:

Table 1. preImport. This table describes the function for the preImport run type.
JavaScript function Description
Run-type preImport
File samplePreImport.js
Purpose Access domain-level objects, object stores, or both before the import operation processes the converted deploy data set.
Syntax function preImport(domain, map)
Parameters domain - A FileNet P8 domain interface (com.filenet.api.core.Domain)

map - A HashMap object (java.util.HashMap) that maps a String to a String: HashMap<String, String>

Dependencies None
Table 2. preSave. This table describes the function for the preSave run type.
JavaScript function Description
Run-type preSave
File samplePreSave.js
Purpose Access the object that is processed from the converted deploy data set before the attempt to save it to the object store.
Syntax function preSave(object, map)
Parameters object - A Content Engine IndependentObject interface (com.filenet.api.core.IndependentObject)

map - A HashMap object (java.util.HashMap) that maps a String to a String: HashMap<String,String>

Dependencies None
Table 3. postSave. This table describes the function for the postSave run type.
JavaScript function Description
Run-type postSave
File samplePostSave.js
Purpose Access the object that is processed from the converted deploy data set after it is saved to the object store.
Syntax function postSave(object, map)
Parameters object - A Content Engine IndependentObject interface (com.filenet.api.core.IndependentObject)

map - A HashMap object (java.util.HashMap) that maps a String to a String: HashMap<String,String>

Dependencies None
Table 4. postImport. This table describes the function for the postImport run type.
JavaScript function Description
Run-type postImport
File samplePostImport.js
Purpose Access domain-level objects, object stores, or both after the import operation processes the converted deploy data set. If any objects fail to import, the post-import scripts do not run.
Syntax function postImport(domain, map)
Parameters domain - A FileNet P8 domain interface (com.filenet.api.core.Domain)

map - A HashMap object (java.util.HashMap) that maps a String to a String: HashMap<String,String>

Dependencies None


Feedback

Last updated: October 2013
deploy_ce_prepare_scripts.htm

© Copyright IBM Corporation 2014.
This information center is powered by Eclipse technology. (http://www.eclipse.org)