use of org.onebusaway.gtfs.serialization.NoDefaultAgencyIdException in project onebusaway-gtfs-modules by OneBusAway.
the class DeferredValueSupport method resolveAgencyAndId.
/**
* Returns a {@link AgencyAndId} with the specified new id value and the
* appropriate agency id prefix. By default, we use the GTFS reader's default
* agency id. However, if the specified bean+property has an existing
* {@link AgencyAndId} value, we use the agency-id specified there.
*/
public AgencyAndId resolveAgencyAndId(BeanWrapper bean, String propertyName, String newId) {
GtfsReaderContext context = _reader.getGtfsReaderContext();
String agencyId = null;
try {
agencyId = context.getDefaultAgencyId();
} catch (NoDefaultAgencyIdException ndaie) {
agencyId = null;
}
AgencyAndId existingId = (AgencyAndId) bean.getPropertyValue(propertyName);
if (existingId != null) {
agencyId = existingId.getAgencyId();
}
return new AgencyAndId(agencyId, newId);
}
Aggregations