Product Documentation
Abstract
By using IBM Content Manager Records Enabler with IBM Lotus Notes, you can declare and classify email messages and their attachments as records. Before you can use Content Manager Records Enabler with Lotus Notes, you must develop a Lotus Notes client plug-in and deploy it into your Lotus Notes client.
Content
The Lotus Notes client plug-in performs the following functions:
- Exports the email message and its attachments as local DXL data.
- Calls the IBM Content Manager API to import the exported DXL data into the IBM Content Manager repository.
- Communicates with Content Manager Records Enabler to get the manual declare URL, and sends the declaration request URL to the Content Manager Records Enabler server.
This techdoc describes how to develop the Lotus Notes client plug-in as a Lotus Notes agent. Agents are stand-alone programs that perform a specific task in one or more databases. You can use IBM Lotus Domino Designer 8.5 to create an agent. You can use Lotus Notes script or the Java language to write a Lotus Notes agent. The example in this techdoc uses the Java language. For more information about Lotus Notes agents, see Creating an agent in the IBM Lotus Domino Designer 8.5 documentation. To obtain a sample Lotus Notes client plug-in, download IBM Records Manager Version 8.5 Toolkit Interim Fix 001 from Fix Central.
The following figure shows the architecture of the email declaration agent plug-in:

Exporting the email message and attachments as local DXL data
This function includes step 1 in the figure. Call the Lotus Notes DxlExporter.exportDxl(Document doc) API to export the selected email as DXL data. The doc parameter is the email to export. Before you can call the DxlExporter.exportDxl(Document arg0) API, the email must be located. The following snippet of code shows how to locate the selected email. For more information about the Lotus Domino Java API, see Java Classes in the Lotus Domino Designer 8.5 documentation.
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
Document doc = agentContext.getDocumentContext();
String noteID = doc.getNoteID();
doc.recycle();
doc = db.getDocumentByID(noteID);
The following snippet of code shows how to export the email as a local DXL file.
Stream stream = session.createStream();
if (stream.open(filePath)) {
stream.truncate();
DxlExporter exporter = session.createDxlExporter();
System.out.println("Exported "
+ stream.writeText(exporter.exportDxl(doc)) + " bytes to "
+ filePath);
} else
System.out.println("Cannot open " + filePath);
stream.close();
Calling the IBM Content Manager API to import the exported DXL data
This function includes steps 2, 3, 4, and 5 in the previous figure.
Before you can call the IBM Content Manager API to import the exported DXL data into the repository, you must create an item type into which you want to import the emails. For instructions, see Creating an item type in the IBM Content Manager documentation.
Retrieve the email properties that you want to set as attributes of the email item type. The following snippet of code shows how to get the email properties. Item is the Lotus Domino Java class.
for (int j = 0; j < items.size(); j++) {
Item item = (Item) items.elementAt(j);
if (item.getName().equalsIgnoreCase("Subject")){
subject = item.getValueString();
}
else if(item.getName().equalsIgnoreCase("from"))
{
from = item.getValueString();
}
else if(item.getName().equalsIgnoreCase("sendto"))
{
sendto = item.getText();
}
else if(item.getName().equalsIgnoreCase("copyto"))
{
copyto = item.getText();
}
else if(item.getName().equalsIgnoreCase("blindcopyto"))
{
blindcopyto = item.getText();
}
else if(item.getName().equalsIgnoreCase("posteddate"))
{
DateTime time = item.getDateTimeValue();
DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hhmm:ss");
posteddate = format.format(formatter.parse(time.getGMTTime()));
}
else if(item.getName().equalsIgnoreCase("delivereddate"))
{
DateTime time = item.getDateTimeValue();
DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
delivereddate = format.format(formatter.parse(time.getGMTTime()));
}
else if(item.getName().equalsIgnoreCase("importance"))
{
importance = item.getValueString();
}
}
Then call the IBM Content Manager API to import the local DXL data into the repository, as shown in the following snippet of code.
DKDatastoreICM dsICM = new DKDatastoreICM();
String attr = "FlPlnCmpntNm";
dsICM.connect(dbname, username, password, "");
DKDDO ddo = new DKDDO();
DKTextICM lob;
DKParts part;
ddo = dsICM.createDDO(itemType, DKConstant.DK_CM_DOCUMENT);
for (short i = 1; i <= ddo.dataCount(); i++)
{
String dataName = ddo.getDataName(i);
if (attr.equals(dataName))
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, attr), documentName);
if (dataName.equals("eRecord"))
if (autoDeclare)
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, "eRecord"), "aut");
else
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, "eRecord"), "no");
if (dataName.equals("FlPlnCmpntTtl"))
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, "FlPlnCmpntTtl"), documentName);
if (dataName.equals("OriginatingOrganization"))
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, "OriginatingOrganization"), Organization);
if (dataName.equals(rmeHostCfg.getFrom()))
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, “FromCMAttribute”),from);
if (dataName.equals(rmeHostCfg.getBindCopyTo()))
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, “BindCopyToCMAttribute), BindCopyTo));
if (dataName.equals(rmeHostCfg.getCopyTo()))
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, “CopyToCMAttribute”), CopyTo));
if (dataName.equals(rmeHostCfg.getSendTo()))
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, “SendToCMAttribute”), SendTo));
if (dataName.equals(rmeHostCfg.getImportance()))
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, “ImportanceCMAttribute”), Importance));
if (dataName.equals(rmeHostCfg.getDeliveredDate())){
java.sql.Timestamp date = java.sql.Timestamp.valueOf(DeliveredDate));
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, “DeliveredDateCMAttribute”), date);
}
if (dataName.equals(rmeHostCfg.getPostedDate())){
java.sql.Timestamp date = java.sql.Timestamp.valueOf(PostedDate));
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, “PostedDateCMAttribute”), date);
}
}
lob = (DKTextICM) dsICM.createDDO("ICMBASETEXT", DKConstantICM.DK_ICM_SEMANTIC_TYPE_BASETEXT);
lob.setTextSearchableFlag(false);
lob.setMimeType(mimeType);
lob.setContentFromClientFile(filePath);
part = (DKParts) ddo.getData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR, DKConstant.DK_CM_DKPARTS));
part.addElement(lob);
ddo.add();
String pid = ddo.getPidObject().pidString();
For more information about the IBM Content Manager APIs, see Java classes and APIs in the IBM Content Manager documentation.
Communicating with Content Manager Records Enabler to get the manual declare URL, generate the request URL, and send the declaration request URL to the Content Manager Records Enabler server.
This function includes steps 6, 7, and 8 in the previous figure.
You can get the Content Manager Records Enabler manual declaration URL by using the following URL to send a request to the Content Manager Records Enabler server:
http://rmeserver:port/RMEServer/RMEClientServlet?Cmd=RMEGetManualDeclar…
After you get the URL, you must append the host name, user name, encrypted password, and the items to be declared. The following URL is an example of the final URL:
https://server.com:9444/RMEWebClient/IRMHookAction.do ?hiddenExecuteClassName=com.ibm.rme.md.RMEDeclareRec &Host=ICMNLSDB&UserID=myUser&Password=mmmMMM!!!111mmm &XML=
Note: If you enable token support for Content Manager Records Enabler, the URL includes the &TokenP parameter instead of the &Password parameter.
The following snippet of code shows an example of how to generate the manual declaration URL.
URL u = null;
HttpURLConnection connection = null;
u = new URL("http://" + host + ":" + port
+ "/RMEServer/RMEClientServlet?Cmd=RMEGetManualDeclareURL");
connection = (HttpURLConnection) u.openConnection();
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setAllowUserInteraction(true);
connection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
connection.connect();
String line = "";
StringBuffer manualDeclareURL = null;
InputStream in = null;
try {
manualDeclareURL = new StringBuffer();
in = connection.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while (br.ready() && ((line = br.readLine()) != null)) {
manualDeclareURL.append(line);
}
} catch (Exception e) {
e.printStackTrace();
}
String encodePW = encryptPW(CMPassword);
manualDeclareURL
//.append(
// "?hiddenExecuteClassName=com.ibm.rme.md.RMEDeclareRec&Host=")
.append("&Host=")
.append(CMhost)
.append("&UserID=")
.append(CMuser)
.append("&TokenP=")
.append(encodePW)
.append(
"&XML=<Request><Record><SemanticType>email</SemanticType><Items>");
for (int i= 0; i < PIDs.size(); i++)
{
manualDeclareURL.append("<Item>").append(((String)PIDs.elementAt(i)).replace(' ', '+')).append("</Item>");
}
manualDeclareURL.append("</Items></Record></Request>");
String url = manualDeclareURL.toString();
Deploying the sample email design template
Complete the following steps to deploy the sample email design template that is provided in IBM Records Manager Version 8.5 Toolkit Interim Fix 001 into your email database.
- Copy the sample email design template to the Lotus Notes data directory, for example, C:\Lotus\notes\data.
- In the Lotus Notes client workspace, right-click the mail database and click Application > Replace Design.
- Select Mail (R8.5) template with CMRE 85 support and click Replace.
- When you see the message that informs you that replacing a database design changes the database's views, click Yes to proceed.
After the design is replaced, the Records>Declare Record option is added to the Action menu.
Before you can declare an email as a record, you must complete the following steps:
- Save the RMEHost.param file that is attached to this techdoc into your home directory, such as C:\Documents and Settings\Administrator. Edit the file and specify values for the following parameters:
- ICMSERVER: The IBM Content Manager server name. To determine the server name, open the cmbicmsrvs.ini file and find the value of the ICMSERVER parameter. To determine the path to the cmbicmsrvs.ini file, open the IBMCMROOT/cmgmt/cmbcmenv.properties file and find the value of the CMCFGDIR parameter.
- ITEM_TYPE: Name of the IBM Content Manager item type name into which you want to import the email.
- IMPORT_MODE: Whether to import the email and its attachments as a single item (SINGLE) or multiple items (SEPARATE).
- SUBJECT, FROM, SENDTO, COPYTO, BINDCOPYTO, POSTEDDATE, DELIVEREDDATE, IMPORTANCE: Attributes that you defined for the email item type in IBM Content Manager.
- RME_SERVER_HOST: Host name of the Content Manager Records Enabler server.
- RME_SERVER_PORT: Port number of the Content Manager Records Enabler server.
- Update your notes.ini file to include the required IBM Content Manager JAR file in the CLASSPATH, as shown in the following example:
JavaUserClassesExt=JDBC,CMConnector,CMLIB
JDBC=C:\Progra~1\IBM\db2cmv8\lib\db2jcc.jar;C:\Progra~1\IBM\db2cmv8\lib\db2jcc_license_cu.jar
CMConnector=C:\Progra~1\IBM\db2cmv8\cmgmt;C:\Progra~1\IBM\db2cmv8\cmgmt\connectors\cmbicmenv.ini;C:\Progra~1\IBM\db2cmv8\cmgmt\connectors\cmbicmsrvs.ini
CMLIB=C:\Progra~1\IBM\db2cmv8\lib\cmb81.jar;C:\Progra~1\IBM\db2cmv8\lib\cmbcm81.jar;C:\Progra~1\IBM\db2cmv8\lib\cmbicm81.jar;C:\Progra~1\IBM\db2cmv8\lib\cmblog4j81.jar;C:\Progra~1\IBM\db2cmv8\lib\log4j-1.2.15.jar;C:\Progra~1\IBM\db2cmv8\lib\cmbsdk81.jar - Modify the java.policy file to add the required security permissions if there is a permission exception. In the following example, all permissions are added.
grant {
permission java.security.AllPermission;
}
For more information about declaring Lotus Notes emails as records, see the steps in Declaring a new e-mail message as a record in the Content Manager Records Enabler 8.5 documentation. For Lotus Notes emails, the following steps replace the first three steps in the topic:
- Start the Lotus Notes client.
- Click Action > Records > Declare Record.
- If this is the first time that you are declaring a record in a Lotus Notes session, you are prompted to log on to IBM Content Manager. Enter your IBM Content Manager user ID and password, and click Login.
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
swg27038400