private void readDao(GtfsReader reader) throws IOException { dao = new GtfsRelationalDaoImpl(); reader.setEntityStore(dao); reader.setDefaultAgencyId(getFeedId().getId()); reader.run(); }
@Override public void close() { if (packStopTimes) { stopTimes.trimToSize(); } if (packShapePoints) { shapePoints.trimToSize(); } super.close(); }
public StopTime getStopTimeForId(int id) { if (packStopTimes) { return stopTimes.get(id); } return getEntityForId(StopTime.class, id); }
@SuppressWarnings("unchecked") @Override public <T> T getEntityForId(Class<T> type, Serializable id) { if (packStopTimes && type.equals(StopTime.class)) { return (T) stopTimes.get((Integer) id); } else if (packShapePoints && type.equals(ShapePoint.class)) { return (T) shapePoints.get((Integer) id); } return super.getEntityForId(type, id); }
@Override public <T> void clearAllEntitiesForType(Class<T> type) { if (packStopTimes && type.equals(StopTime.class)) { stopTimes.clear(); return; } else if (packShapePoints && type.equals(ShapePoint.class)) { shapePoints.clear(); return; } super.clearAllEntitiesForType(type); }
@Override public void saveEntity(Object entity) { if (packStopTimes && entity.getClass().equals(StopTime.class)) { stopTimes.add((StopTime) entity); return; } else if (packShapePoints && entity.getClass().equals(ShapePoint.class)) { shapePoints.add((ShapePoint) entity); return; } super.saveEntity(entity); }
/**** * {@link GenericMutableDao} Interface ****/ @Override public <K, V> Map<K, V> getEntitiesByIdForEntityType(Class<K> keyType, Class<V> entityType) { noKeyCheck(keyType); return super.getEntitiesByIdForEntityType(keyType, entityType); }
public ShapePoint getShapePointForId(int id) { if (packShapePoints) { return shapePoints.get(id); } return getEntityForId(ShapePoint.class, id); }
/**** * Private Methods ****/ private void ensureCalendarDatesByServiceIdRelation() { if (_calendarDatesByServiceId == null) { _calendarDatesByServiceId = mapToValueList(getAllCalendarDates(), "serviceId", AgencyAndId.class); } }
@Override public void update(final Object entity) { execute(new HibernateOperation() { @Override public Object doInHibernate(Session session) throws HibernateException, SQLException { session.update(entity); return null; } }); }
@Override public <T> List<T> findWithNamedParam(String queryString, String paramName, Object value) { return findWithNamedParams(queryString, new String[] {paramName}, new Object[] {value}); }
throws IOException { StoreImpl store = new StoreImpl(new GtfsRelationalDaoImpl()); store.open(); LOG.info("reading {}", gtfsBundle.toString());
@Override public void close() { if (packStopTimes) { stopTimes.trimToSize(); } if (packShapePoints) { shapePoints.trimToSize(); } super.close(); }
@SuppressWarnings("unchecked") @Override public <T> T getEntityForId(Class<T> type, Serializable id) { if (packStopTimes && type.equals(StopTime.class)) { return (T) stopTimes.get((Integer) id); } else if (packShapePoints && type.equals(ShapePoint.class)) { return (T) shapePoints.get((Integer) id); } return super.getEntityForId(type, id); }
@Override public <T> void clearAllEntitiesForType(Class<T> type) { if (packStopTimes && type.equals(StopTime.class)) { stopTimes.clear(); return; } else if (packShapePoints && type.equals(ShapePoint.class)) { shapePoints.clear(); return; } super.clearAllEntitiesForType(type); }
@Override public void saveEntity(Object entity) { if (packStopTimes && entity.getClass().equals(StopTime.class)) { stopTimes.add((StopTime) entity); return; } else if (packShapePoints && entity.getClass().equals(ShapePoint.class)) { shapePoints.add((ShapePoint) entity); return; } super.saveEntity(entity); }
public StopTime getStopTimeForId(int id) { if (packStopTimes) { return stopTimes.get(id); } return getEntityForId(StopTime.class, id); }
/**** * {@link GenericMutableDao} Interface ****/ @Override public <K, V> Map<K, V> getEntitiesByIdForEntityType(Class<K> keyType, Class<V> entityType) { noKeyCheck(keyType); return super.getEntitiesByIdForEntityType(keyType, entityType); }
public ShapePoint getShapePointForId(int id) { if (packShapePoints) { return shapePoints.get(id); } return getEntityForId(ShapePoint.class, id); }
@Override public void flush() { execute(new HibernateOperation() { public Object doInHibernate(Session session) throws HibernateException { session.flush(); _count = 0; return null; } }); }