throw new ValueNotAllowedException(new ErrorMessage("errors.keybag.NoInput"));
String transferTokenId = new String(apiTransferToken.getOpaqueToken());
org.apache.juddi.model.TransferToken modelTransferToken = em.find(org.apache.juddi.model.TransferToken.class, transferTokenId);
if (modelTransferToken == null)
throw new TransferNotAllowedException(new ErrorMessage("errors.transferentities.TokenNotFound", transferTokenId));
Date now = new Date();
if (now.after(modelTransferToken.getExpirationDate()))
throw new TransferNotAllowedException(new ErrorMessage("errors.transferentities.TokenExpired", transferTokenId));
List<TransferTokenKey> transferKeyList = modelTransferToken.getTransferKeys();
List<String> modelKeyList = new ArrayList<String>(0);
if (transferKeyList != null && transferKeyList.size() > 0) {
for (TransferTokenKey ttk : transferKeyList)
modelKeyList.add(ttk.getEntityKey());
}
// The keys in the supplied key bag must match exactly the keys in the stored transfer and the entities must exist
Collections.sort(apiKeyList);
Collections.sort(modelKeyList);
int count = 0;
for (String key : apiKeyList) {
if (!key.equalsIgnoreCase(modelKeyList.get(count)))
throw new TransferNotAllowedException(new ErrorMessage("errors.transferentities.KeyMismatch", key + " & " + modelKeyList.get(count)));
UddiEntity uddiEntity = em.find(UddiEntity.class, key);
if (uddiEntity == null)
throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.EntityNotFound", key));