String rvar = ((OAssign.VariableRef) ocopy.from).variable.name;
QName tlvalue = ((OMessageVarType) ((OAssign.VariableRef) ocopy.to).variable.type).messageType;
QName trvalue = ((OMessageVarType) ((OAssign.VariableRef) ocopy.from).variable.type).messageType;
if (!tlvalue.equals(trvalue))
throw new CompilationException(__cmsgs.errMismatchedMessageAssignment(lvar, tlvalue, rvar, trvalue));
}
// If Message->Non-Message copy
else if (ocopy.from instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.from).isMessageRef()
&& (!(ocopy.to instanceof OAssign.VariableRef) || !((OAssign.VariableRef) ocopy.to).isMessageRef())) {
String rval = ((OAssign.VariableRef) ocopy.from).variable.name;
throw new CompilationException(__cmsgs.errCopyFromMessageToNonMessage(rval));
}
// If Non-Message->Message copy
else if (ocopy.to instanceof OAssign.VariableRef && ((OAssign.VariableRef) ocopy.to).isMessageRef()
&& (!(ocopy.from instanceof OAssign.VariableRef) || !((OAssign.VariableRef) ocopy.from).isMessageRef())) {
String lval = ((OAssign.VariableRef) ocopy.to).variable.name;
throw new CompilationException(__cmsgs.errCopyToMessageFromNonMessage(lval));
}
// If *->Partner Link copy
else if (ocopy.to instanceof OAssign.PartnerLinkRef
&& !((OAssign.PartnerLinkRef) ocopy.to).partnerLink.hasPartnerRole()) {
String lval = ((OAssign.PartnerLinkRef) ocopy.to).partnerLink.getName();
throw new CompilationException(__cmsgs.errCopyToUndeclaredPartnerRole(lval));
}
// If Partner Link->* copy
else if (ocopy.from instanceof OAssign.PartnerLinkRef) {
if (((OAssign.PartnerLinkRef) ocopy.from).isMyEndpointReference
&& !((OAssign.PartnerLinkRef) ocopy.from).partnerLink.hasMyRole()) {
String lval = ((OAssign.PartnerLinkRef) ocopy.from).partnerLink.getName();
throw new CompilationException(__cmsgs.errCopyFromUndeclaredPartnerRole(lval, "myRole"));
}
if (!((OAssign.PartnerLinkRef) ocopy.from).isMyEndpointReference
&& !((OAssign.PartnerLinkRef) ocopy.from).partnerLink.hasPartnerRole()) {
String lval = ((OAssign.PartnerLinkRef) ocopy.from).partnerLink.getName();
throw new CompilationException(__cmsgs.errCopyFromUndeclaredPartnerRole(lval, "partnerRole"));
}
}
__log.debug("Copy verified OK: " + ocopy);
}