/**
  * Obtains an instance from an exchange, storing the object identifier if possible and the
  * external identifier bundle if not.
  *
  * @param exchange the exchange to store, not null
  * @return the link with one identifier set, not null
  */
 public static SimpleExchangeLink of(Exchange exchange) {
   ArgumentChecker.notNull(exchange, "exchange");
   SimpleExchangeLink link = new SimpleExchangeLink();
   if (exchange.getUniqueId() != null) {
     link.setObjectId(exchange.getUniqueId().getObjectId());
   } else {
     link.setExternalId(exchange.getExternalIdBundle());
   }
   return link;
 }
 /**
  * Obtains an instance from an exchange, storing the external identifier bundle.
  *
  * @param exchange the exchange to store, not null
  * @return the link with identifier bundle set, not null
  */
 public static SimpleExchangeLink ofBundleId(Exchange exchange) {
   ArgumentChecker.notNull(exchange, "exchange");
   SimpleExchangeLink link = new SimpleExchangeLink(exchange.getExternalIdBundle());
   link.setExternalId(exchange.getExternalIdBundle());
   return link;
 }