private void initPolicies(RouteDefinition route) {
// setup the policies as JAXB yet again have not created a correct model for us
List<ProcessorDefinition> types = route.getOutputs();
// we need two types as transacted cannot extend policy due JAXB limitations
PolicyDefinition policy = null;
TransactedDefinition transacted = null;
// add to correct type
for (ProcessorDefinition type : types) {
if (type instanceof PolicyDefinition) {
policy = (PolicyDefinition) type;
} else if (type instanceof TransactedDefinition) {
transacted = (TransactedDefinition) type;
} else if (policy != null) {
// the outputs should be moved to the policy
policy.addOutput(type);
} else if (transacted != null) {
// the outputs should be moved to the transacted policy
transacted.addOutput(type);
}
}