Skip to content

Instantly share code, notes, and snippets.

@TiloGit
Last active March 14, 2024 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TiloGit/c619a66d8d826c2e5b74ba86c4c50c23 to your computer and use it in GitHub Desktop.
Save TiloGit/c619a66d8d826c2e5b74ba86c4c50c23 to your computer and use it in GitHub Desktop.
FileNet ACCE batch Action to create SAP properties (ICC4SAP)
//paste in ACCE bulk operation (select only one item)
//works on CPE 5.5.8 or newer (due to for loop);
//see comments below for loop with older version
importClass(java.lang.System);
function OnCustomProcess(CEObject) {
var objStore = CEObject.getObjectStore();
objStore.refresh();
var sapprops = [
{ title: "ALFdpages", desc:"The total number of ALF description pages, if the document is paginated.", max: 3},
{ title: "ALFpages", desc:"The total number of ALF pages, if the document is paginated.", max: 3},
{ title: "Barcode", desc:"The bar code.", max: 40},
{ title: "PageSize", desc:"The page size of a paginated document.", max: 239},
{ title: "SAPCompCharset", desc:"The character sets in which the content of the components is encoded.", max: 239},
{ title: "SAPCompCreated", desc:"The date and time, in Coordinated Universal Time (UTC) format, when the components were created.", max: 239},
{ title: "SAPCompModified", desc:"The date and time, in UTC format, when the components were last modified.", max: 239},
{ title: "SAPComps", desc:"The component IDs.", max: 239},
{ title: "SAPCompSize", desc:"The component sizes. This property prevents the components from being retrieved to determine the component sizes.", max: 239},
{ title: "SAPCompVersion ", desc:"The versions of the SAP applications that are used to create the components.", max: 239},
{ title: "SAPContType", desc:"The MIME type, such as text/plain or image/tiff. This property is needed for viewing the document. ", max: 239},
{ title: "SAPDocDate", desc:"The date and time when the document was created. The time stamp is shown in UTC format.", max: 239},
{ title: "SAPDocId", desc:"The SAP document ID. Specify this property as index property.", max: 40},
{ title: "SAPDocProt", desc:"The SAP document protection (create, read, update, delete).", max: 4},
{ title: "SAPType", desc: "The SAP document class, such as TXT or TIF. This property is needed for processing the bar code.", max: 3}
];
sapprops.forEach((item) => {
var newPropTemplate = com.filenet.api.core.Factory.PropertyTemplateString.createInstance(objStore);
var mypropertyName = item.title ;
var mypropertyDesc = item.desc ;
var mypropertyMax = item.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);
});
}
@TiloGit
Copy link
Author

TiloGit commented Sep 13, 2023

based on this: https://www.ibm.com/docs/en/ccfsa/4.0.0?topic=p8-creating-properties for IBM Content Collector for SAP

@TiloGit
Copy link
Author

TiloGit commented Mar 14, 2024

for SAP ILM see here: https://gist.github.com/TiloGit/6042e4e8cb2c0ba8dfff80f200f7a7d7 has also example for older CPE version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment