public Registration getNonRegisteredRegistration() throws RegistrationException
{
//TODO: this might be better to place somewhere else and use the RegistrationHandler.register instead of
// doing basically the same thing below.
Consumer unregConsumer = getConsumerByIdentity(NON_REGISTERED_CONSUMER);
if (unregConsumer == null)
{
Registration registration = addRegistrationTo(NON_REGISTERED_CONSUMER, new HashMap<QName, Object>(), null, true);
registration.setStatus(RegistrationStatus.VALID);
getPersistenceManager().saveChangesTo(registration);
return registration;
}
else
{
//The unregistered consumer should only ever have one registration, return that
final Registration registration = unregConsumer.getRegistrations().iterator().next();
// but first check that we don't have an improper persisted state due to GTNWSRP-283
if (registration.getRegistrationHandle() == null || RegistrationStatus.PENDING == registration.getStatus())
{
// if we have improper persisted state, correct it