protected void handleSubscriptionRequest(Collection<SubscriptionHandle> subHandles) {
ArgumentChecker.notEmpty(subHandles, "Subscription handle collection");
// Determine common user and subscription type
UserPrincipal user = null;
SubscriptionType type = null;
ArrayList<LiveDataSpecification> specs = new ArrayList<>();
for (SubscriptionHandle subHandle : subHandles) {
// TODO - as a LiveDataSpec is immutable, why do we copy rather than just use it?
specs.add(new LiveDataSpecification(subHandle.getRequestedSpecification()));
if (user == null) {
user = subHandle.getUser();
} else if (!user.equals(subHandle.getUser())) {
throw new OpenGammaRuntimeException("Not all usernames are equal");
}
if (type == null) {
type = subHandle.getSubscriptionType();
} else if (!type.equals(subHandle.getSubscriptionType())) {
throw new OpenGammaRuntimeException("Not all subscription types are equal");
}
}
// Build request message