Topic
4 replies Latest Post - ‏2012-05-21T12:21:33Z by Sravan Kumar Kadaveru
SystemAdmin
SystemAdmin
693 Posts
ACCEPTED ANSWER

Pinned topic Modifying content in-flight to write properties to documents

‏2010-12-09T13:24:42Z |

Problem


We've been trying to find information about the best way to write FileNet properties onto documens so that users can see these properties when viewing or printing.

We will focus primarily on Microsoft Office files (.doc and .docx) but we wish to find a more general solution for other formats as well (PDF, images with EXIF etc).

Assuming we are writing to the content object at some point, there are basically two ways we can accomplish this.

Writing to custom properties of the Microsoft Office document

We write to custom properties using Apache POI. This approach of course means that the document has to have the appropriate custom properties defined. Fields in the header and footer of the document then refer to these custom properties. At some point the fields must be updated, though. This can hopefully be done with Apache POI as well, but a solution using an embedded macro might be sufficient.

Writing directly to the appropriate elements in the Microsoft Office document

This approach requires the Apache POI code to be more intimately coupled with the Microsoft Office document at hand, but basically means substituting the actual text in the document at the appropriate places. This seems awfully brittle, but might work.

Possible solutions


The following are possible solutions that we've come up with including pros and cons.

1. Writing to the document on retrieve

This seems to be the most attractive solution. The document residing on the actual content element would not have the most recent FileNet properties, but we would modify the stream "in flight" if you will. This would work for users viewing, printing, checking out and downloading. However, there seems to be no way to hook in to retrieval using a Code Module or other mechanisms.

2. Using Event Actions on document check in

  • According to the documentation, Synchronous Event Actions may not modify the content elements, so that seems to be out of the picture.
  • Modifying content through the CE API without checking out the document can never be done, even as an administrator.
  • Asynchronous Event Actions would require checkout out the document and checking in the modified version. This would mean that for every version checked in by a user, a new version is created which supersedes the one the user checks in. It also becomes problematic with major and minor versioning.
  1. A user checks in version 0.1
  2. An Asynchronous Event Action creates a new version 0.2 (depending on major/minor policy in the Code Module)
  3. The user decides to check out 0.2 (which creates a 0.3 Reservation)
  4. The user checks in the document as major version and 0.3 becomes 1.0
  5. The Asynchronous Event Action creates version 2.0? Creating version 1.1 would create problems for users only seeing major versions.

3. Using a Servlet to modify content

Developing a Servlet to create a temporary file, modify the document using the above mentioned methods and then forwarding that to the user. This would require adding a custom action in Workplace XT to view the document. It would also not be transparent to other clients such as FIMO or when using Rendition Engine.

4. Using Rendition Engine

Somehow hooking into the rendition pipeline and modifying the document using the above mentioned methods could be a feasible solution, but have the obvious drawback that there would be a discrepancy between the source document and the rendered version (properties show in the header of the rendered PDF, but not in the original document).

5. Using FileNet Integration for Microsoft Office (FIMO)

Earlier versions of FileNet integration with Microsoft Office had the feature to insert and update properties. This feature seems to have been dropped. There might still be some script object we can access from macros, but the documentation seems to be lacking quite a bit here.

Updating properties when editing the document would also mean possible discrepancies regarding the major and minor version (these refer to the Reservation Object when working with the document and checking in as Major version would increment the major version number as well as making the minor version 0) as well as properties changed outside of Microsoft Office without checking in and out. For example, a workflow might update a property representing a document status.

6. Updating the document directly on the File Store

Let's pretend that this solution never crossed our mind and leave it at that...

Thank you for any contributions to this discussion and sorry for the wall of text.
Mattias Green
Updated on 2012-05-21T12:21:33Z at 2012-05-21T12:21:33Z by Sravan Kumar Kadaveru
  • SystemAdmin
    SystemAdmin
    693 Posts
    ACCEPTED ANSWER

    Re: Modifying content in-flight to write properties to documents

    ‏2010-12-24T18:53:45Z  in response to SystemAdmin
    This is an interesting use case. I think you've done a pretty thorough analysis of the possibilities, especially as regards #2. Unfortunately, I can't think of a good solution to this with the current feature set (where "good" would mean not suffering from the things you've already mentioned).

    I suggest that you surface this requirement to IBM (through your account team if you are a customer, through the partner channel if you are a business partner) so that the enhancement request can be evaluated, prioritized, etc. (That might sound like the usual "blah, blah, ... go away", but it's not.)

    There is one small window that can sometimes work for #2, but it probably does not help; I mention it for completeness. If a document is checked out and the content then updated, that document version is still a reservation until the checkin happens. An async handler could update the content without a checkout/checkin cycle in that case since content can be directly replaced on a reservation document. I'm sure you see the limitations for why this is not that helpful: some/many/most apps will do the checkin concurrent with the content update or promptly thereafter, so the checkin will have happened by the time the async handler runs. There are also all kinds of "client out of date" issues that can arise. So, this window only really helps if you are running only custom applications with known behaviors (in which case you would probably put this feature into those apps).
  • SystemAdmin
    SystemAdmin
    693 Posts
    ACCEPTED ANSWER

    Re: Modifying content in-flight to write properties to documents

    ‏2011-10-15T07:53:26Z  in response to SystemAdmin
    Bill,

    I believe it is time to revive this thread now that CE 5.1 has been released.

    Change Preprocessor Concepts
    http://publib.boulder.ibm.com/infocenter/p8docs/v5r1m0/topic/com.ibm.p8.ce.dev.ce.doc/changepreprocessor_concepts.htm

    This seems to solve this problem/question. However, since I've not had the time to verify this yet, let me ask you:

    1) Is modifying content elements supported in Change Preprocessors? The documentation only refers to it as the "source object", which I interpret as all of it - properties, security, content elements, etc.

    Thanks,
    Mattias
    • SystemAdmin
      SystemAdmin
      693 Posts
      ACCEPTED ANSWER

      Re: Modifying content in-flight to write properties to documents

      ‏2011-10-16T17:46:57Z  in response to SystemAdmin
      Alas, modifying content is not supported in a Change Preprocessor.
    • Sravan Kumar Kadaveru
      1 Post
      ACCEPTED ANSWER

      Re: Modifying content in-flight to write properties to documents

      ‏2012-05-21T12:21:33Z  in response to SystemAdmin
      Hi, Is this problem resolved? What is the best approach among the listed options? We need to add a bar code to the Autocad drawings. User is ok if we add while printing or creating a compound document or a rendition. Please suggest the best one.