use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class EntityDao method getEntityHistory.
private ReleasableIterator<EntityHistory<T>> getEntityHistory(String selectedEntityStatement, MapSqlParameterSource parameterSource) {
ReleasableContainer releasableContainer;
releasableContainer = new ReleasableContainer();
try {
ReleasableIterator<EntityHistory<T>> entityIterator;
ReleasableIterator<DbFeatureHistory<DbFeature<Tag>>> tagIterator;
List<FeatureHistoryPopulator<T, ?, ?>> featurePopulators;
EntityHistoryReader<T> entityHistoryReader;
entityIterator = releasableContainer.add(getFeaturelessEntityHistory(selectedEntityStatement, parameterSource));
tagIterator = releasableContainer.add(getTagHistory(selectedEntityStatement, parameterSource));
featurePopulators = getFeatureHistoryPopulators(selectedEntityStatement, parameterSource);
for (FeatureHistoryPopulator<T, ?, ?> featurePopulator : featurePopulators) {
releasableContainer.add(featurePopulator);
}
entityHistoryReader = new EntityHistoryReader<T>(entityIterator, tagIterator, featurePopulators);
// The sources are now all attached to the history reader so we don't want to release
// them in the finally block.
releasableContainer.clear();
return entityHistoryReader;
} finally {
releasableContainer.close();
}
}
use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class EntityDao method getTagHistory.
private ReleasableIterator<DbFeatureHistory<DbFeature<Tag>>> getTagHistory(String selectedEntityStatement, MapSqlParameterSource parameterSource) {
FileBasedSort<DbFeatureHistory<DbFeature<Tag>>> sortingStore = new FileBasedSort<DbFeatureHistory<DbFeature<Tag>>>(new SingleClassObjectSerializationFactory(DbFeatureHistory.class), new DbFeatureHistoryComparator<Tag>(), true);
try {
String sql;
SortingStoreRowMapperListener<DbFeatureHistory<DbFeature<Tag>>> storeListener;
DbFeatureHistoryRowMapper<DbFeature<Tag>> dbFeatureHistoryRowMapper;
DbFeatureRowMapper<Tag> dbFeatureRowMapper;
TagRowMapper tagRowMapper;
ReleasableIterator<DbFeatureHistory<DbFeature<Tag>>> resultIterator;
sql = "SELECT et." + entityName + "_id AS id, et.k, et.v, et.version" + " FROM " + entityName + "_tags et" + " INNER JOIN " + selectedEntityStatement + " t ON et." + entityName + "_id = t." + entityName + "_id AND et.version = t.version";
LOG.log(Level.FINER, "Tag history query: " + sql);
// Sends all received data into the object store.
storeListener = new SortingStoreRowMapperListener<DbFeatureHistory<DbFeature<Tag>>>(sortingStore);
// Retrieves the version information associated with the tag.
dbFeatureHistoryRowMapper = new DbFeatureHistoryRowMapper<DbFeature<Tag>>(storeListener);
// Retrieves the entity information associated with the tag.
dbFeatureRowMapper = new DbFeatureRowMapper<Tag>(dbFeatureHistoryRowMapper);
// Retrieves the basic tag information.
tagRowMapper = new TagRowMapper(dbFeatureRowMapper);
// Perform the query passing the row mapper chain to process rows in a streamy fashion.
namedParamJdbcTemplate.query(sql, parameterSource, tagRowMapper);
// Open a iterator on the store that will release the store upon completion.
resultIterator = new StoreReleasingIterator<DbFeatureHistory<DbFeature<Tag>>>(sortingStore.iterate(), sortingStore);
// The store itself shouldn't be released now that it has been attached to the iterator.
sortingStore = null;
return resultIterator;
} finally {
if (sortingStore != null) {
sortingStore.close();
}
}
}
use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class BoundingBoxFilterTest method setUp.
/**
* Performs pre-test activities.
*/
@Before
public void setUp() {
OsmUser user;
List<Tag> tags;
user = new OsmUser(12, "OsmosisTest");
// All nodes have an empty tags list.
tags = new ArrayList<Tag>();
entityInspector = new SinkEntityInspector();
// simpleAreaFilter doesn't cross antimeridian; no complete ways or relations
simpleAreaFilter = new BoundingBoxFilter(IdTrackerType.Dynamic, -20, 20, 20, -20, false, false, false, false);
simpleAreaFilter.setSink(entityInspector);
intersectingBound = new Bound(30, 10, 30, 10, "intersecting");
nonIntersectingBound = new Bound(-30, -50, 10, -10, "nonintersecting");
inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 10, 10);
outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 30, 30);
edgeNodeEast = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 10, 20);
edgeNodeWest = new Node(new CommonEntityData(1237, 0, new Date(), user, 0, tags), 10, -20);
edgeNodeNorth = new Node(new CommonEntityData(1238, 0, new Date(), user, 0, tags), 20, 10);
edgeNodeSouth = new Node(new CommonEntityData(1239, 0, new Date(), user, 0, tags), -20, 10);
}
use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class PolygonFilterTest method setUp.
/**
* Performs pre-test activities.
*/
@Before
public void setUp() {
OsmUser user;
List<Tag> tags;
user = new OsmUser(12, "OsmosisTest");
// All nodes have an empty tags list.
tags = new ArrayList<Tag>();
polygonFile = new File(getClass().getResource("testPolygon.txt").getFile());
entityInspector = new SinkEntityInspector();
// polyAreaFilter has a notch out of the Northeast corner.
polyAreaFilter = new PolygonFilter(IdTrackerType.Dynamic, polygonFile, false, false, false, false);
polyAreaFilter.setSink(entityInspector);
intersectingBound = new Bound(30, 0, 30, 0, "intersecting");
crossingIntersectingBound = new Bound(-10, 10, 30, -30, "crossing intersecting");
nonIntersectingBound = new Bound(30, 15, 30, 15, "nonintersecting");
inAreaNode = new Node(new CommonEntityData(1234, 0, new Date(), user, 0, tags), 5, 10);
outOfAreaNode = new Node(new CommonEntityData(1235, 0, new Date(), user, 0, tags), 15, 15);
edgeNode = new Node(new CommonEntityData(1236, 0, new Date(), user, 0, tags), 15, 10);
}
use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class WayKeyFilter method process.
/**
* {@inheritDoc}
*/
public void process(WayContainer container) {
Way way = container.getEntity();
boolean matchesFilter = false;
for (Tag tag : way.getTags()) {
if (allowedKeys.contains(tag.getKey())) {
matchesFilter = true;
break;
}
}
if (matchesFilter) {
sink.process(container);
}
}
Aggregations