HandlerChainsDocument hcd = (HandlerChainsDocument) XmlBeansUtil.typedCopy(xml, HandlerChainsDocument.type);
org.apache.geronimo.xbeans.javaee.HandlerChainsType handlerChains = hcd.getHandlerChains();
HandlerChainsType serviceRefHandlerChains = serviceRef.addNewHandlerChains();
for (org.apache.geronimo.xbeans.javaee.HandlerChainType handlerChain : handlerChains.getHandlerChainArray()) {
HandlerChainType serviceRefHandlerChain = serviceRefHandlerChains.addNewHandlerChain();
if (handlerChain.getPortNamePattern() != null) {
serviceRefHandlerChain.setPortNamePattern(handlerChain.getPortNamePattern());
}
if (handlerChain.getServiceNamePattern() != null) {
serviceRefHandlerChain.setServiceNamePattern(handlerChain.getServiceNamePattern());
}
if (handlerChain.getProtocolBindings() != null) {
serviceRefHandlerChain.setProtocolBindings(handlerChain.getProtocolBindings());
}
for (PortComponentHandlerType srcHandler : handlerChain.getHandlerArray()) {
HandlerType serviceRefHandler = serviceRefHandlerChain.addNewHandler();
serviceRefHandler.setId(srcHandler.getId());
//Copy HandlerName
org.apache.geronimo.xbeans.javaee.String srcHandlerName = srcHandler.getHandlerName();
org.apache.geronimo.xbeans.javaee6.String desHandlerName = serviceRefHandler.addNewHandlerName();
desHandlerName.setStringValue(srcHandlerName.getStringValue());