{
Metaclass contactClass = getMetadata().getMetaclass("Contact");
Metaclass doctorClass = getMetadata().getMetaclass("Doctor");
Metaclass surgeonClass = getMetadata().getMetaclass("Surgeon");
Metaclass specialClass = getMetadata().getMetaclass("Special");
Message contactMsg = new Message("ContactMessage");
Message doctorMsg = new Message("DoctorMessage");
Message surgeonMsg1 = new Message("SurgeonMessage1");
Message surgeonMsg2 = new Message("SurgeonMessage2");
CompositeMessagePartInstance contactPart = new CompositeMessagePartInstance(contactMsg.getName());
CompositeMessagePartInstance doctorPart = new CompositeMessagePartInstance(doctorMsg.getName());
CompositeMessagePartInstance surgeonPart1 = new CompositeMessagePartInstance(surgeonMsg1.getName());
CompositeMessagePartInstance surgeonPart2 = new CompositeMessagePartInstance(surgeonMsg2.getName());
ObjectMessagePartMapping contactMapping = new ObjectMessagePartMapping();
ObjectMessagePartMapping doctorMapping = new ObjectMessagePartMapping();
ObjectMessagePartMapping surgeonMapping1 = new ObjectMessagePartMapping();
ObjectMessagePartMapping surgeonMapping2 = new ObjectMessagePartMapping();
contactMsg.setRoot(contactPart);
doctorMsg.setRoot(doctorPart);
surgeonMsg1.setRoot(surgeonPart1);
surgeonMsg2.setRoot(surgeonPart2);
contactPart.setDeclarator(contactMsg);
doctorPart.setDeclarator(doctorMsg);
surgeonPart1.setDeclarator(surgeonMsg1);
surgeonPart2.setDeclarator(surgeonMsg2);
doctorMsg.setBaseMessage(contactMsg);
contactMsg.addDerivedMessage(doctorMsg);
surgeonMsg1.setBaseMessage(doctorMsg);
doctorMsg.addDerivedMessage(surgeonMsg1);
surgeonMsg2.setBaseMessage(doctorMsg);
doctorMsg.addDerivedMessage(surgeonMsg2);
contactPart.setMapping(contactMapping);
doctorPart.setMapping(doctorMapping);
surgeonPart1.setMapping(surgeonMapping1);