// validate request
if (request == null) {
throw new MissingRequest(KAM_INTERSECTION_REQUEST);
}
KamHandle kam1 = request.getKam1();
if (null == kam1) {
throw new RequestException("kamHandle for Kam1 payload is missing");
}
KamHandle kam2 = request.getKam2();
List<KamEdge> kamEdges = request.getKamEdges();
if (kam2 == null && noItems(kamEdges)) {
final String msg = "Missing kam2 and kamEdges - nothing to do";
throw new RequestException(msg);
}
org.openbel.framework.api.Kam objKam1;
objKam1 = kamCacheService.getKam(kam1.getHandle());
if (objKam1 == null) {
throw new RequestException(format(KAM_REQUEST_NO_KAM_FOR_HANDLE,
kam1.getHandle()));
}
org.openbel.framework.api.Kam objNewKam = null;
if (null != kam2) {
// Get the real Kam from the KamCache
org.openbel.framework.api.Kam objKam2;
objKam2 = kamCacheService.getKam(kam2.getHandle());
if (objKam2 == null) {
throw new RequestException(format(
KAM_REQUEST_NO_KAM_FOR_HANDLE, kam2.getHandle()));
}
objNewKam = intersection(objKam1, objKam2);
} else {
List<org.openbel.framework.api.Kam.KamEdge> edges =
convertEdges(