Exemplo n.º 1
0
 @Handler
 @Transactional
 @Override
 public void handle(Exchange exchange) throws InvalidPayloadException {
   Receipt receipt = ExchangeHelper.getMandatoryInBody(exchange, Receipt.class);
   if (!updateDatabase(receipt)) {
     LOG.warn(
         "Could not find batch for digipostBatchId='{}'. Stopping route.", receipt.getRefJobbId());
     exchange.setProperty(Exchange.ROUTE_STOP, true);
   }
 }
Exemplo n.º 2
0
  private List<Map<String, Object>> executeQuery(Exchange exchange) throws Exception {
    String query = ExchangeHelper.getMandatoryInBody(exchange, String.class);
    boolean retrieveContent =
        exchange
            .getIn()
            .getHeader(CamelCMISConstants.CAMEL_CMIS_RETRIEVE_CONTENT, false, Boolean.class);
    int readSize =
        exchange.getIn().getHeader(CamelCMISConstants.CAMEL_CMIS_READ_SIZE, 0, Integer.class);

    ItemIterable<QueryResult> itemIterable = cmisSessionFacade.executeQuery(query);
    return cmisSessionFacade.retrieveResult(retrieveContent, readSize, itemIterable);
  }
Exemplo n.º 3
0
  public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
    InputStream is = ExchangeHelper.getMandatoryInBody(exchange, InputStream.class);
    GZIPInputStream unzipInput = new GZIPInputStream(is);

    // Create an expandable byte array to hold the inflated data
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try {
      IOHelper.copy(unzipInput, bos);
      return bos.toByteArray();
    } finally {
      IOHelper.close(unzipInput);
    }
  }