@Path("doc")
public Response findDocumentByNumberAndDate(@QueryParam("name")String docName, @QueryParam("num") String number, @QueryParam("date") String sDate, @QueryParam("dateformat") @DefaultValue("dd.MM.yyyy HH:mm:ss") String pattern) throws ParseException, JIException, IOException, ConfigurationException {
Date date = (new SimpleDateFormat(pattern)).parse(sDate);
OCApp app = getApplication();
OCDocumentManager manager = app.getDocumentManager(docName);
OCDocumentRef ref = manager.findByNumber(number, date);
if (ref.isEmpty()) {
return Response.status(Status.NOT_FOUND).build();
} else {
OCXDTOSerializer serializer = app.getXDTOSerializer();
return Response.ok(serializer.writeXML(ref.getObject())
).build();
}
}