1

I am new to FileNet. We are using P8 Content Engine - 5.1.0.2 I need to change MimeType for existing document using Filenet WCM API. Workuround is to download the document, change the MimeType and re-upload the document but in this case the documnet Id will be changed. I prefer to update existing document instead of re-uploading the document.

Basically I need to do same thing that described in Changing the content element MIME type programmatically throught Filenet WCM API.

the code is

public boolean changeDocumnetMimeType(String documentId, String docMimeType) throws IOException {

    com.filenet.wcm.api.TransportInputStream in1 = null;
    com.filenet.wcm.api.ObjectStore docObjectStore;
    com.filenet.wcm.api.Session session;

    try {

        session = ObjectFactory.getSession(this.applicationId, null, this.user,this.password);
        session.setRemoteServerUrl(this.remoteServerUrl);
        session.setRemoteServerUploadUrl(this.remoteServerUploadUrl);
        session.setRemoteServerDownloadUrl(this.remoteServerDownloadUrl);

        docObjectStore = ObjectFactory.getObjectStore(this.objectStoreName, session);
        Document doc = (Document) docObjectStore.getObject(BaseObject.TYPE_DOCUMENT, documentId);
        in1 = doc.getContent();
        System.out.println("documnet MIME type is : " + in1.getMimeType());
        //how to Update mimeType for the document???

    } catch (Exception ex) {
        ex.printStackTrace();
    }

    if (in1 != null) {
        in1.close();
    }

    return true;
}

Thank you in advance.

ᄂ ᄀ
  • 5,669
  • 6
  • 43
  • 57
David Abragimov
  • 524
  • 2
  • 6
  • 24
  • 1
    What you are asking cannot be done. Document objects are unable to update contentElements unless they are a reservation. The MimeType (known as ContentType) is a property of the ContentTransfer object. The ContentTransfer object is held in a ContentElementList. – Christopher Powell Nov 08 '18 at 17:34
  • @Christopher Powell not sure that I understand your comment. it can't be done using Document object or can not be done through WCM API? the code is just test example that I tryed to implement for the task. – David Abragimov Nov 08 '18 at 18:12
  • 3
    It doesn't matter which API you use, the FileNet system will not let a Document Object (or a sub-class of Document) alter content that has been Checked-In. This is a Constraint on the (FileNet) Document Class. Annotation Class however will allow changing of the Content without a reservation. FileNet is structured much like an OOP language. You create Document Objects based on the Document Class. – Christopher Powell Nov 08 '18 at 19:14
  • @ChristopherPowell so, the only option is to create new documnet with same content and new MimeType and remove old documnet? Thank you – David Abragimov Nov 08 '18 at 19:19
  • 3
    Yep. You need a new reservation, so you will need to check out, replace content with different MimeType, check in. – Christopher Powell Nov 08 '18 at 19:20

1 Answers1

2

FileNet is an EDMS system that structures it's records in a OOP fashion.

FileNet Document objects are instantiated from the FileNet Document Class. Regardless of the API used, FileNet will not allow an update to occur on MimeType. This is a constraint of the MimeType property.

IBM FileNet MimeType Properties

The link above defines the MimeType property, and displays its contraints: The key point here is : Settability: SETTABLE_ONLY_BEFORE_CHECKIN

This means that the MimeType property can only be set during the RESERVATION state of a Versionable object. Non-Versionable objects (like Annotations) are not able to have this constraint.

  • 1
    Simply put, that is not possible because versioning assumes the content of any persisted document version is read-only. And MIME-type is inherent attribute of content. PS "FileNet" is not a system. It was the name of the company acquired by IBM. – ᄂ ᄀ Dec 02 '18 at 19:55