if ( elementType.equals( LINKTYPE_ELEMENT ) ) {
BPELPartnerLinkTypeExt pLinkExt = (BPELPartnerLinkTypeExt)theElement;
// Fetch the name of the partnerLinkType
String name = pLinkExt.getName();
QName qName = new QName( WSDLDefinition.getTargetNamespace(), name );
BPELPartnerLinkTypeElement pLinkElement = new BPELPartnerLinkTypeElement( qName );
// The partnerLinkType must have one and may have 2 role child elements
int count = 0;
for( int i = 0; i < 2; i++ ) {
if(pLinkExt.getRoleName(i) == null ) continue;
PortType pType = WSDLDefinition.getPortType(pLinkExt.getRolePortType(i));
if ( count == 0 ) {
pLinkElement.setRole1(pLinkExt.getRoleName(i),
pLinkExt.getRolePortType(i),
pType );
count++;
} else if (count == 1) {
pLinkElement.setRole2(pLinkExt.getRoleName(i),
pLinkExt.getRolePortType(i),
pType );
count++;
} else {
break;
} // end if
} // end for
if( count == 0 ) {
error("PartnerLinkTypeNoRoles", theElement, pLinkElement.getName());
throw new ContributionResolveException( "partnerLinkType " +
pLinkElement.getName() +" has no Roles defined" );
} else
thePLinks.add( pLinkElement );
} // end if
} // end for