Category Archives: ECM

How to count results from a query

When programming with P8, one recurrent task is counting how many results a query has.

There are a few options to do this, none of them being count(*) and I’ll explain why. The purpose of this post is to expose them and compare their execution time and limitations with benchmarks. We will also see how to optimize each of them separately. Hopefully, after reading this post, you will be able to choose which one best fits your needs. Before introducing all options IBM made available to us, a little introduction important to understand this post and its benchmarks.

When counting, it may be strange, but it is a lot better to expect something. Or if you can’t, at least have a limit over which the result doesn’t really matter, you are happy enough knowing it is more than this limit. Actually in most case that’s enough. For UI you would say over something, to forbid an operation you usually have a limit over which you will forbid it anyway, and so on. Of course, if you want the exact number of item, it can be done but it will be a lot slower.

Benchmarks will be counting the number of documents in a 5/4/10 folder hierarchy, meaning 5 level of sub-folders, each level with 4 sub-folders and 10 documents. This is about 55,000 documents in 5,500 folders. And we don’t always want to count exactly, in the benchmarks we will ask if there is more than 5, 10, 15,50 … until 40,000 documents. Because sometimes knowing than there is more than 50 documents is enough to forbid an operation.

Now let’s introduce the few options we have to count.
Continue reading

Working with Entry Templates

The two states of the Entry Templates

Be careful with the Entry Template, they can have two states, retrieved or not retrieved. They contain a lot less information when they are not retrieved.

Here is how to check if it’s retrieved or not, and retrieve it if you need to:

if (!entryTemplate.isRetrieved) {
    // Retrieve it
    entryTemplate.retrieveEntryTemplate(lang.hitch(this, function (retrievedEntryTemplate) {
        // Do something with retrievedEntryTemplate
    }), false, true);
}

Here is the JSDoc of the ecm.model.EntryTemplate class, and the one of the retrieveEntryTemplate function. Actually the entry template object itself is updated so most of the time you won’t have to do anything in the callback except wait for it to happen. Example (function converting to classic callback to promise):
Continue reading

Working with documents

Retrieving the ecm.model.ContentItem from the ecm.model.item

repository.retrieveItem(documentOrFolderId, function (contentItem) {
    // Do something with the ContentItem
});
repository.retrieveItem(folderPath, function (contentItem) {
    // Do something with the ContentItem
});

Note: Unlike the documentation says, that does not work with an document path (see this), only with a folder path. However that works with both Document and Folder ID.

Example:

repository.retrieveItem(item.id, function (contentItem) {
    // Do something with the ContentItem
});
repository.retrieveItem('/Folder/MySubFolder', function (contentItem) {
    // Do something with the ContentItem
});

JSDoc.
Continue reading

Changing an ICN file type filter name

Have you ever changed a File Type filter name in ICN? Well don’t, that’s not pretty. All the associations of Entry Templates you’ve done on folders will just stop working, or at least stop offering the user the right Entry Template for the document’s MIME Type. In the configuration it looks like this:

icn_filetype_filter_broken

Explanation is simple. In ICN, apparently there is no ID for File Type filter, or more specifically the name is the ID, which means where you are doing an Entry Template association in ICN, an JSON object is stored as a folder preferences annotation, persisting the File Type filter name directly. Of course if you change the File Type filter name, they won’t look for all folder preferences annotations and change the File Type filter name in it, which means they will all be broken.

Continue reading

How to access your plug-in’s ressources

There are times where you need to know the URL of a ressource within your plug-in. An example is when you want to embedded an applet and add it to your page, or get the link to an image. In order to do that, you can use the following code:

Request.getPluginResourceUrl("PluginName", "myFolderWithingWebContentFolder/path");

An example if you want to embedded an applet:

var appletHTML = '<applet alt="MyApplet" name="MyApplet" width="1px" height="1px" code="my.package.MyClass.class" codebase="'
    + Request.getPluginResourceUrl('PluginName', 'applets')
    + '" archive="MyApplet.jar" mayscript="true">';
appletHTML = appletHTML + '</applet>';
appletDiv = document.createElement("div");
appletDiv.innerHTML = appletHTML;
applet = appletDiv.firstChild;
document.body.appendChild(applet);

That can be convenient .

Create your first Object Store

After a CPIT installation, you will still have to create an Object Store in order to have a fully functional platform. Luckily, when using the CPIT installer, IBM already provides the database and datasources for one more Object Store, They also pre-set the database connection in the Administrative Console for Content Engine (ACCE). So the procedure is really easy, we only have to create the Object Store using the pre-set database connection.

Here are the procedure in pictures:
Continue reading

Start and stop a FileNet CPIT platform

I was reading a few posts on ecmplace today and I saw that some persons are struggling with starting and stopping the FileNet platform after they got their CPIT installation done. So here are two scripts to start and stop all components. They start in order (and stop in reverse order) the following components:

  1. The DBMS DB2
  2. The LDAP Tivoli Directory Server (admin server then instance)
  3. The Application Server WebSphere Application Server (hosting the Platform Engine and possibly IBM Content Navigator or any client application)

To start the platform (I include the iptables config but if you saved it once for all you don’t need those lines):

#!/bin/bash
iptables -I INPUT 4 -i eth0 -p tcp --dport 9080 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -i eth0 -p tcp --dport 9043 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -i eth0 -p tcp --dport 2809 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -i eth0 -p tcp --dport 9100 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT 4 -i eth0 -p tcp --dport 9403 -m state --state NEW,ESTABLISHED -j ACCEPT
# DB2
su - dsrdbm01 -c db2start
# TDS admin server
/opt/ibm/ldap/V6.3/sbin/idsdiradm -I dsrdbm01
# TDS instance
/opt/ibm/ldap/V6.3/sbin/ibmslapd -n -I dsrdbm01
# WAS
/opt/ibm/WebSphere/AppServer/bin/startServer.sh server1

To stop the platform:

#!/bin/bash
# WAS
/opt/ibm/WebSphere/AppServer/bin/stopServer.sh server1 -username P8Admin -password PASSWORD
# TDS instance
/opt/ibm/ldap/V6.3/sbin/ibmslapd -I dsrdbm01 -k
# TDS admin server
/opt/ibm/ldap/V6.3/sbin/idsdiradm -I dsrdbm01 -k
# DB2
su - dsrdbm01 -c db2stop

Hopefully it will help someone.

Get started with Selenium

Last post of a three posts series about testing, after Unit Testing and Integration Testing, let’s talk about UI testing.

Introduction

Selenium is a Browser driver, basically it does what you would do if you were manually testing, i.e. clicking, looking for elements, selecting, scrolling…, except it does it alone, and can do it for hours without a break, every night…

How it works is quite simple, you are targeting DOM elements (or node, or WebElement, or any name you would like to call them) with selectors, and then you can do various operations on those like a user would do: wait for them to be present, to be visible, to be clickable, click on them, drag and drop something, enter information in a text field, …

Keep in mind that Selenium does the same thing that you would do. So if an element is not visible on the page and you would scroll to catch it before clicking, you have to do the same with Selenium, or it will throw an exception saying the element is not clickable because it is out of the view, which makes sense.

This article is an introduction to Selenium, if you want more applied examples for ICN and Dojo, you can read this post, but I would recommend you to read this one first to get familiar with Selenium.

Get started with Selenium

Continue reading

How to install IBM CMIS

In its version 1.0, IBM CMIS was shipped as a separate application. But now, where can you get it and how can you install IBM CMIS? If you are looking for it in the Software Catalog from IBM, you won’t find it. And that’s normal because it is now part of IBM Content Navigator.

We’ll see how to install CMIS. You can follow this procedure when you install ICN, upgrade ICN, or even if you have already installed it, just re-open the configuration tool. The procedure start when you are starting the IBM Content Navigator Configuration and Deployment Tool. If you are installing/upgrading ICN, it will start by itself. If you have ICN already installed, you can launch this tool by running:
Continue reading