@Override public Registration createRegistration(Registration registration) { ShardedNHRegistrationId regId = createNewShardedId(); Registration intraHubReg = (Registration) registration.clone(); intraHubReg.setRegistrationId(regId.getRegistrationId()); Registration returned = hubs.get(regId.getShard()).createRegistration(intraHubReg); returned.setRegistrationId( new ShardedNHRegistrationId(regId.getShard(), regId.getRegistrationId()).toString()); return returned; }
@Override public Registration getRegistration(String registrationId) { ShardedNHRegistrationId regId = new ShardedNHRegistrationId(registrationId); Registration intraHubReg = hubs.get(regId.getShard()).getRegistration(regId.getRegistrationId()); intraHubReg.setRegistrationId(regId.toString()); return intraHubReg; }
private void copyPartialsInResults( Integer shard, CollectionResult result, CollectionResult partial) { for (Registration r : partial.getRegistrations()) { ShardedNHRegistrationId shardedId = new ShardedNHRegistrationId(shard, r.getRegistrationId()); r.setRegistrationId(shardedId.toString()); result.getRegistrations().add(r); } }