private boolean checkForCollision( String layer, AnnotationData<?> annotation ) { List<Pair<String,Long>> certificate = new LinkedList<>(); certificate.add( annotation.getCertificate() ); return ( readDataFromIO( layer, certificate ).size() > 0 ) ; }
public boolean isRequestOutOfDate( String layer, Pair<String, Long> certificate ) { List<Pair<String, Long>> certificates = new LinkedList<>(); certificates.add( certificate ); List<AnnotationData<?>> annotations = readDataFromIO( layer, certificates ); if ( annotations.size() == 0 ) { // removed since client update, abort return true; } if ( !annotations.get(0).getTimestamp().equals( certificate.getSecond() ) ) { // clients timestamp doesn't not match most up to date, abort return true; } // everything seems to be in order return false; }
private void removeDataFromTiles( String layer, Pair<String, Long> certificate, TilePyramid pyramid ) { // read the annotation data List< Pair<String, Long> > certificates = new ArrayList<>(); certificates.add( certificate ); AnnotationData<?> data = readDataFromIO( layer, certificates ).get(0); // get list of the indices for all levels List< TileAndBinIndices > indices = _indexer.getIndices( data, pyramid ); // read existing tiles List< AnnotationTile > tiles = readTilesFromIO( layer, convert( indices ) ); // maintain lists of what bins to modify and what bins to remove List< AnnotationTile > tilesToWrite = new LinkedList<>(); List< TileIndex > tilesToRemove = new LinkedList<>(); // remove data from tiles and organize into lists to write and remove removeDataCertificateFromTiles( tilesToWrite, tilesToRemove, tiles, data, pyramid ); // write modified tiles writeTilesToIO( layer, tilesToWrite ); // remove empty tiles and data removeTilesFromIO( layer, tilesToRemove ); }
List<AnnotationData<?>> annotations = readDataFromIO( layer, certificates );