0

A simple test of setting the document class of document stored in filenet worked in camel-cmis 2.16.2. Below is the route

from("file://C:/Target/DMS/").process(new Processor() {
            @Override
            public void process(Exchange e) throws Exception {
                e.getIn().getHeaders().put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "application/pdf; charset=UTF-8");
                e.getIn().getHeaders().put(CamelCMISConstants.CMIS_FOLDER_PATH, "/Test");
                e.getIn().getHeaders().put("cmis:objectTypeId", "doc_Test");
                e.getIn().getHeaders().put(PropertyIds.NAME, e.getIn().getHeader(Exchange.FILE_NAME));
            }
        }).to("cmis://http://test:9080/fncmis/resources/Service?repositoryId=TEST_REPO&username=TEST&password=RAW(TEST)");

When i check the document class of file stored in IBM Filenet - i could see the doc class as Test (symbolic name: doc_Test). But when i add atleast one of the parameter value of that class like below

e.getOut().getHeaders().put("prp_Field1","TestValue1");

Im getting NoSuchHeaderException for parameter "cmis:name" which i have already set as you can see the above route. Is this the correct way to set metadata parameters??

Balaji Kannan
  • 407
  • 6
  • 24
  • 1
    See this FAQ about using getOut vs getIn: http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html – Claus Ibsen May 31 '16 at 15:47

1 Answers1

0

Below route for storing worked. Decide on the Customized classes,fields & data types, create metadata based on that & then same field names are to be set in camel headers before sending to cmis uri (Storing).

ObjectTypeId - Customized class name
CMIS_FOLDER_PATH - filenet folder path inside repository
NAME - File name to be stored


from("file://C:/Target/DMS/").process(new Processor() {
            @Override
            public void process(Exchange e) throws Exception {
                e.getIn().getHeaders().put(CamelCMISConstants.CMIS_FOLDER_PATH, "/TEST");
                e.getIn().getHeaders().put("cmis:objectTypeId", "doc_Test");
                e.getIn().getHeaders().put(PropertyIds.NAME, fileName + ".pdf");
                e.getOut().getHeaders().put("prp_Field1","TestValue1");
                e.getOut().getHeaders().put("prp_Field2","TestValue2");
                e.getOut().getHeaders().put("prp_Field3","TestValue3");
            }
        }).to("cmis://http://test:9080/fncmis/resources/Service?repositoryId=TEST_REPO&username=TEST&password=RAW(TEST)");

Hope it helps someone..

Balaji Kannan
  • 407
  • 6
  • 24