Merge "Issue #2193 - Fix for DD data browser subscription column." into development

Former-commit-id: 674aeafa6f5d317a30e1f078b1ee38acff6acf95
This commit is contained in:
Dustin Johnson 2013-07-19 10:40:45 -05:00 committed by Gerrit Code Review
commit 8e78f80ddd
2 changed files with 34 additions and 7 deletions

View file

@ -33,6 +33,7 @@ import com.raytheon.uf.common.registry.IResultFormatter;
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Return the name of the data set the subscription is subscribed to.
@ -45,6 +46,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
* ------------ ---------- ----------- --------------------------
* Aug 24, 2012 0743 djohnson Initial creation
* Jun 24, 2013 2106 djohnson Pass encoder to result formatters.
* Jul 18, 2013 2193 mpduff Updated to work with site and shared subscriptions.
*
* </pre>
*
@ -54,15 +56,23 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class SubscriptionDataSetNameQuery extends
SubscriptionFilterableQuery<String> implements
IResultFormatter<String> {
SubscriptionFilterableQuery<String> implements IResultFormatter<String> {
@DynamicSerializeElement
private String registryObjectClass;
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public Class<Subscription> getObjectType() {
return Subscription.class;
public Class<? extends Subscription> getObjectType() {
try {
return (Class<? extends Subscription>) Class
.forName(registryObjectClass);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException(e);
}
}
/**
@ -72,13 +82,13 @@ public class SubscriptionDataSetNameQuery extends
public Class<String> getResultType() {
return String.class;
}
/**
* {@inheritDoc}
*/
@Override
public String decodeObject(RegistryObjectType registryObjectType,
IRegistryEncoder encoderStrategy)
throws SerializationException {
IRegistryEncoder encoderStrategy) throws SerializationException {
Set<SlotType> returnedSlots = registryObjectType.getSlot();
// Cherry pick the values to return...
@ -92,4 +102,18 @@ public class SubscriptionDataSetNameQuery extends
return null;
}
/**
* @return the registryObjectClass
*/
public String getRegistryObjectClass() {
return registryObjectClass;
}
/**
* @param registryObjectClass
* the registryObjectClass to set
*/
public void setRegistryObjectClass(String registryObjectClass) {
this.registryObjectClass = registryObjectClass;
}
}

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
* Feb 20, 2013 1543 djohnson Add ability to filter on routes.
* May 28, 2013 1650 djohnson Add getByNames.
* Jun 24, 2013 2106 djohnson Now composes a registryHandler.
* Jul 18, 2013 2193 mpduff Changes for SubscriptionDataSetNameQuery.
*
* </pre>
*
@ -127,8 +128,10 @@ public abstract class BaseSubscriptionHandler<T extends Subscription, QUERY exte
@Override
public Set<String> getSubscribedToDataSetNames()
throws RegistryHandlerException {
SubscriptionDataSetNameQuery query = new SubscriptionDataSetNameQuery();
query.setRegistryObjectClass(getRegistryObjectClass().getName());
RegistryQueryResponse<String> response = registryHandler
.getObjects(new SubscriptionDataSetNameQuery());
.getObjects(query);
checkResponse(response, "getSubscribedToDataSetNames");