Since a week i have been trying to create an camel route for following requirement.
- With Request key, route looks into filenet
- If there is a document for key in filenet - it will be retrieved and sent to Portal
- If not - request will be sent to Outside WS, retrieved document will be stored in filenet.
- For Next same request key, document will be retrieved from filenet based on metadata and sent as response
Below are the 2 interfaces/camel-routes for retreiving from and storing in filenet
Store document
from("activemq:queue:STORE_DOCUMENT_QUEUE")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().getHeaders().put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "application/pdf; charset=UTF-8");
exchange.getIn().getHeaders().put(PropertyIds.NAME, exchange.getIn().getHeader(Exchange.FILE_NAME));
exchange.getIn().getHeaders().put(CamelCMISConstants.CMIS_FOLDER_PATH, "/TEST");
}
})
.to("cmis://${header.cmisUrl}");
Retrieve document
from("activemq:queue:RETRIEVE_DOCUMENT_QUEUE")
.setBody(constant("SELECT * FROM cmis:document WHERE cmis:name LIKE '%requestkey%'"))
.to("cmis://${header.cmisUrl}")
.split(body())
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
Map<String, Object> body = (Map<String, Object>)exchange.getIn().getBody();
exchange.getIn().getHeaders().put(Exchange.FILE_NAME, body.get(PropertyIds.NAME));
exchange.getIn().setBody(body.get(CamelCMISConstants.CAMEL_CMIS_CONTENT_STREAM));
}
})
.to("file:src/test");
In above routes, there is no/very less metadata information... If i need to search for document by metadata or store to filenet a doc using metadata as key. Example : Store a document with following key as metadata and retrieving using same 1. Identity Number 2. Type of Document 3. Receipt Date
Can somebody give me a knowledge of setting metadata in camel exchange or using metadata for storing and retreival of document ??