Created
March 14, 2024 19:29
-
-
Save TiloGit/6042e4e8cb2c0ba8dfff80f200f7a7d7 to your computer and use it in GitHub Desktop.
FileNet ACCE batch Action to create SAP properties (ICC4SAP) for SAP ILM (SAP BC-ILM)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//paste in ACCE bulk operation (select only one item) | |
//works on older CPE 5.5.5 (tested on cpe version ears-5.5.5-2-146) | |
// FN CPE Used: Mozilla Rhino scripting engine check what version in Engine-liberty.ear APP-INF/lib/js.jar | |
importClass(java.lang.System); | |
function OnCustomProcess(CEObject) { | |
var objStore = CEObject.getObjectStore(); | |
objStore.refresh(); | |
var sapprops = [ | |
{ title: "al_crep_id", desc:"The archive link content repository ID required for SAP BC-ILM certification.", max: 40}, | |
{ title: "al_doc_class", desc:"The archive link document class required for SAP BC-ILM certification.", max: 20}, | |
{ title: "al_doc_id", desc:"The archive link document ID required for SAP BC-ILM certification.", max: 50}, | |
{ title: "al_doc_type", desc:"The archive link document type required for SAP BC-ILM certification.", max: 10}, | |
{ title: "al_mime_type", desc:"The archive link mime type required for SAP BC-ILM certification.", max: 128}, | |
{ title: "al_obj_id", desc:"The archive link object ID required for SAP BC-ILM certification.", max: 50}, | |
{ title: "al_obj_type", desc:"The archive link object type required for SAP BC-ILM certification.", max: 10}, | |
{ title: "al_sid", desc:"The ID of a system where the specified content repository ID is registered for SAP BC-ILM certification.", max: 10}, | |
{ title: "al_store_date", desc:"The archive link store date required for SAP BC-ILM certification.", max: 10}, | |
{ title: "al_table", desc:"The archive link table required for SAP BC-ILM certification.", max: 5}, | |
{ title: "compulsory_destruction_date", desc:"The archive link compulsory destruction date required for SAP BC-ILM certification.", max: 10}, | |
{ title: "Origin", desc:"The origin property required for SAP BC-ILM certification.", max: 120}, | |
{ title: "start_of_retention", desc:"The start of retention property required for SAP BC-ILM certification.", max: 10} | |
]; | |
for (var i = 0; i < sapprops.length; i += 1) { | |
var newPropTemplate = com.filenet.api.core.Factory.PropertyTemplateString.createInstance(objStore); | |
var mypropertyName = sapprops[i].title ; | |
var mypropertyDesc = sapprops[i].desc ; | |
var mypropertyMax = sapprops[i].max ; | |
// Set cardinality of properties that will be created from the property template | |
newPropTemplate.set_Cardinality (com.filenet.api.constants.Cardinality.SINGLE); | |
// Set up locale | |
locStr = com.filenet.api.core.Factory.LocalizedString.createInstance(); | |
locStr.set_LocalizedText(mypropertyName); | |
locStr.set_LocaleName (objStore.get_LocaleName()); | |
// Create LocalizedString collection | |
newPropTemplate.set_DisplayNames (com.filenet.api.core.Factory.LocalizedString.createList()); | |
newPropTemplate.get_DisplayNames().add(locStr); | |
// Set up locale Desc | |
locStrDes = com.filenet.api.core.Factory.LocalizedString.createInstance(); | |
locStrDes.set_LocalizedText(mypropertyDesc); | |
locStrDes.set_LocaleName (objStore.get_LocaleName()); | |
//set sec | |
newPropTemplate.set_DescriptiveTexts (com.filenet.api.core.Factory.LocalizedString.createList()); | |
newPropTemplate.get_DescriptiveTexts().add(locStrDes); | |
//max lengh | |
newPropTemplate.set_MaximumLengthString(mypropertyMax); | |
// Save new property template to the sever | |
newPropTemplate.save(com.filenet.api.constants.RefreshMode.REFRESH); | |
System.out.println("VF SCRIPT END :: Property Template Name: " + mypropertyName +" has been created with desc: "+ mypropertyDesc +" and max Lengh: "+ mypropertyMax); | |
}; | |
} |
here some JavaScript engine version info:
## cpe version ears-5.5.5-2-146
java -jar .\js.jar -debug
Rhino 1.7 release 4 2012 06 18
##cpe version 21.0.3-IF030 (5.5.8)
Rhino 1.7.12 2020 01 13
## cpe version 23.0.2-IF002 (5.5.12)
Rhino 1.7.14
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also https://gist.github.com/TiloGit/c619a66d8d826c2e5b74ba86c4c50c23