// of ProxyInfo objects will be returned. If its a single-value find operation then a
// single ProxyInfo object is returned.
if (callMethod.getReturnType() == Collection.class || callMethod.getReturnType() == Enumeration.class) {
List<ProxyInfo> proxies = new ArrayList<ProxyInfo>();
for (Object value : results) {
EntityBean bean = (EntityBean) value;
if (value == null) {
proxies.add(null);
} else {
// get the primary key
Object primaryKey = kg.getPrimaryKey(bean);
// create a new ProxyInfo based on the deployment info and primary key and add it to the vector
proxies.add(new ProxyInfo(deploymentInfo, primaryKey));
}
}
if (callMethod.getReturnType() == Enumeration.class) {
return new Enumerator(proxies);
} else {
return proxies;
}
} else {
if (results.size() != 1) {
throw new ObjectNotFoundException("A Enteprise bean with deployment_id = " + deploymentInfo.getDeploymentID() + " and primarykey = " + args[0] + " Does not exist");
}
// create a new ProxyInfo based on the deployment info and primary key
EntityBean bean = (EntityBean) results.get(0);
if (bean == null) {
return null;
} else {
Object primaryKey = kg.getPrimaryKey(bean);
return new ProxyInfo(deploymentInfo, primaryKey);