}
public static ServiceBinding getServiceBinding(BindingTemplate businessTemplate, LifeCycleManager lifeCycleManager)
throws JAXRException
{
ServiceBinding serviceBinding = new ServiceBindingImpl(lifeCycleManager);
String keystr = businessTemplate.getServiceKey();
if (keystr != null)
{
Service svc = new ServiceImpl(lifeCycleManager);
svc.setKey(lifeCycleManager.createKey(keystr));
((ServiceBindingImpl)serviceBinding).setService(svc);
}
String bindingKey = businessTemplate.getBindingKey();
if(bindingKey != null) serviceBinding.setKey(new KeyImpl(bindingKey));
//Access URI
AccessPoint access = businessTemplate.getAccessPoint();
if (access != null) serviceBinding.setAccessURI(access.getValue());
//Description
Description desc = null;
if (businessTemplate.getDescription().size()>0) desc = businessTemplate.getDescription().get(0);
if (desc!=null) {
serviceBinding.setDescription(new InternationalStringImpl(desc.getValue()));
}
/**Section D.10 of JAXR 1.0 Specification */
TModelInstanceDetails details = businessTemplate.getTModelInstanceDetails();
List<TModelInstanceInfo> tmodelInstanceInfoList = details.getTModelInstanceInfo();
for (TModelInstanceInfo info: tmodelInstanceInfoList)
{
if (info!=null && info.getInstanceDetails()!=null) {
InstanceDetails idetails = info.getInstanceDetails();
Collection<ExternalLink> elinks = getExternalLinks(idetails.getOverviewDoc(),lifeCycleManager);
SpecificationLink slink = new SpecificationLinkImpl(lifeCycleManager);
slink.addExternalLinks(elinks);
serviceBinding.addSpecificationLink(slink);
ConceptImpl c = new ConceptImpl(lifeCycleManager);
c.setExternalLinks(elinks);
c.setKey(lifeCycleManager.createKey(info.getTModelKey()));
c.setName(lifeCycleManager.createInternationalString(idetails.getInstanceParms()));
c.setValue(idetails.getInstanceParms());
slink.setSpecificationObject(c);
}
}
HostingRedirector hr = businessTemplate.getHostingRedirector();
if(hr != null)
{
ServiceBinding sb = lifeCycleManager.createServiceBinding();
sb.setKey(new KeyImpl(hr.getBindingKey()));
serviceBinding.setTargetBinding(sb);
}
return serviceBinding;
}