public class OpenCNPredicate implements Predicate {
private static Logger logger =
LoggerFactory.getLogger(OpenCNPredicate.class);
/**
* Checks RMS to see if the CN in the STPCaseNo header exists in RMS or
not
*
* @param exchange the exchange object subject to the test
* @return true if the CN exists in RMS, false otherwise
* @see Predicate#matches(Exchange)
*/
@Override
public boolean matches(Exchange exchange) {
logger.trace("Method matches(Exchange) called.");
Message inMsg = exchange.getIn();
String cn = inMsg.getHeader("STPCaseNo", String.class);
RMSDAO dao = new RMSDAO();
boolean result = false;
try {
result = dao.cnIsInRMS(cn);
logger.debug(MessageFormat.format("CN {0} {1} in RMS", cn,
(result ? "is" : "is not")));
} catch(CADException ex) {
logger.error("Exception thrown trying to match a CN", ex);
}
return result;
}
}
--
View this message in context:
http://camel.465427.n5.nabble.com/Using-method-inside-a-choice-when-tp5795092p5795094.html
Sent from the Camel - Users mailing list archive at Nabble.com.