@Test public void testSaveTileSpec() throws Exception { final String tileId = "new-tile-1"; final String temca = "0"; final LayoutData layoutData = new LayoutData("s123", temca, null, null, null, null, null, null); final TileSpec tileSpec = new TileSpec(); tileSpec.setTileId(tileId); tileSpec.setLayout(layoutData); dao.saveTileSpec(stackId, tileSpec); final TileSpec insertedTileSpec = dao.getTileSpec(stackId, tileId, false); Assert.assertNotNull("null tileSpec retrieved after insert", insertedTileSpec); final LayoutData insertedLayoutData = insertedTileSpec.getLayout(); Assert.assertNotNull("null layout retrieved after insert", insertedLayoutData); Assert.assertEquals("invalid temca retrieved after insert", temca, insertedLayoutData.getTemca()); Assert.assertFalse("tileSpec is has transforms after insert", tileSpec.hasTransforms()); final String changedTemca = "1"; final LayoutData changedLayoutData = new LayoutData("s123", changedTemca, null, null, null, null, null, null); tileSpec.setLayout(changedLayoutData); final List<TransformSpec> list = new ArrayList<>(); list.add(new ReferenceTransformSpec("1")); tileSpec.addTransformSpecs(list); dao.saveTileSpec(stackId, tileSpec); final TileSpec updatedTileSpec = dao.getTileSpec(stackId, tileId, false); Assert.assertNotNull("null tileSpec retrieved after update", updatedTileSpec); final LayoutData updatedLayoutData = updatedTileSpec.getLayout(); Assert.assertNotNull("null layout retrieved after update", updatedLayoutData); Assert.assertEquals("invalid temca retrieved after update", changedTemca, updatedLayoutData.getTemca()); Assert.assertTrue("tileSpec is missing transforms after update", tileSpec.hasTransforms()); }
void saveTileSpec(final StackId stackId, final TileSpec tileSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("tileSpec", tileSpec); MongoUtil.validateRequiredParameter("tileSpec.tileId", tileSpec.getTileId()); final MongoCollection<Document> tileCollection = getTileCollection(stackId); final String context = "tile spec with id '" + tileSpec.getTileId(); validateTransformReferences(context, stackId, tileSpec.getTransforms()); final Document query = new Document(); query.put("tileId", tileSpec.getTileId()); final Document tileSpecObject = Document.parse(tileSpec.toJson()); final UpdateResult result = tileCollection.replaceOne(query, tileSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTileSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(tileCollection), MongoUtil.action(result), query.toJson(), result.getUpsertedId()); }
RenderDao { void saveTileSpec(final StackId stackId, final TileSpec tileSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("tileSpec", tileSpec); MongoUtil.validateRequiredParameter("tileSpec.tileId", tileSpec.getTileId()); final MongoCollection<Document> tileCollection = getTileCollection(stackId); final String context = "tile spec with id '" + tileSpec.getTileId(); validateTransformReferences(context, stackId, tileSpec.getTransforms()); final Document query = new Document(); query.put("tileId", tileSpec.getTileId()); final Document tileSpecObject = Document.parse(tileSpec.toJson()); final UpdateResult result = tileCollection.replaceOne(query, tileSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTileSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(tileCollection), MongoUtil.action(result), query.toJson(), result.getUpsertedId()); } }
RenderDao { void saveTileSpec(final StackId stackId, final TileSpec tileSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("tileSpec", tileSpec); MongoUtil.validateRequiredParameter("tileSpec.tileId", tileSpec.getTileId()); final MongoCollection<Document> tileCollection = getTileCollection(stackId); final String context = "tile spec with id '" + tileSpec.getTileId(); validateTransformReferences(context, stackId, tileSpec.getTransforms()); final Document query = new Document(); query.put("tileId", tileSpec.getTileId()); final Document tileSpecObject = Document.parse(tileSpec.toJson()); final UpdateResult result = tileCollection.replaceOne(query, tileSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTileSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(tileCollection), MongoUtil.action(result), query.toJson(), result.getUpsertedId()); } RenderDao(final MongoClient client); }
RenderDao { void saveTileSpec(final StackId stackId, final TileSpec tileSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("tileSpec", tileSpec); MongoUtil.validateRequiredParameter("tileSpec.tileId", tileSpec.getTileId()); final MongoCollection<Document> tileCollection = getTileCollection(stackId); final String context = "tile spec with id '" + tileSpec.getTileId(); validateTransformReferences(context, stackId, tileSpec.getTransforms()); final Document query = new Document(); query.put("tileId", tileSpec.getTileId()); final Document tileSpecObject = Document.parse(tileSpec.toJson()); final UpdateResult result = tileCollection.replaceOne(query, tileSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTileSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(tileCollection), MongoUtil.action(result), query.toJson(), result.getUpsertedId()); } RenderDao(final MongoClient client); static RenderDao build(); RenderParameters getParameters(final StackId stackId,
                                          final String groupId,
                                          final Double x,
                                          final Double y,
                                          final Double z,
                                          final Integer width,
                                          final Integer height,
                                          final Double scale); RenderParameters getParameters(final StackId stackId,
                                          final Double z,
                                          final Double scale); long getTileCount(final StackId stackId,
                             final Double x,
                             final Double y,
                             final Double z,
                             final Integer width,
                             final Integer height); TileSpec getTileSpec(final StackId stackId,
                                final String tileId,
                                final boolean resolveTransformReferences); List<TileSpec> getTileSpecs(final StackId stackId,
                                       final Double x,
                                       final Double y,
                                       final Double z); List<TileSpec> getTileSpecs(final StackId stackId,
                                       final List<String> tileIds); void writeCoordinatesWithTileIds(final StackId stackId,
                                            final Double z,
                                            final List<TileCoordinates> worldCoordinatesList,
                                            final OutputStream outputStream); List<TileSpec> getTileSpecs(final StackId stackId,
                                       final Double z); ResolvedTileSpecCollection getResolvedTiles(final StackId stackId,
                                                       final Double z); ResolvedTileSpecCollection getResolvedTiles(final StackId stackId,
                                                       final Double minZ,
                                                       final Double maxZ,
                                                       final String groupId,
                                                       final Double minX,
                                                       final Double maxX,
                                                       final Double minY,
                                                       final Double maxY); void saveResolvedTiles(final StackId stackId,
                                  final ResolvedTileSpecCollection resolvedTileSpecs); TransformSpec getTransformSpec(final StackId stackId,
                                          final String transformId); List<Double> getZValues(final StackId stackId); List<Double> getZValues(final StackId stackId,
                                   final Double minZ,
                                   final Double maxZ); Double getZForSection(final StackId stackId,
                                 final String sectionId); void updateZForSection(final StackId stackId,
                                  final String sectionId,
                                  final Double z); void updateZForTiles(final StackId stackId,
                                final Double z,
                                final List<String> tileIds); List<SectionData> getSectionData(final StackId stackId,
                                            final Double minZ,
                                            final Double maxZ); List<String> getOwners(); List<String> getProjects(final String owner); List<StackMetaData> getStackMetaDataList(final String owner,
                                                    final String project); StackMetaData getStackMetaData(final StackId stackId); void saveStackMetaData(final StackMetaData stackMetaData); StackMetaData ensureIndexesAndDeriveStats(final StackMetaData stackMetaData); void removeStack(final StackId stackId,
                            final boolean includeMetaData); void removeTilesWithSectionId(final StackId stackId,
                                         final String sectionId); void removeTilesWithZ(final StackId stackId,
                                 final Double z); void removeTile(final StackId stackId,
                           final String tileId); Bounds getLayerBounds(final StackId stackId,
                                 final Double z); List<SectionData> getSectionDataForZ(final StackId stackId,
                                                final Double z); List<TileBounds> getTileBoundsForZ(final StackId stackId,
                                              final Double z); List<TileBounds> getTileBoundsForSection(final StackId stackId,
                                                    final String sectionId); void cloneStack(final StackId fromStackId,
                           final StackId toStackId,
                           final List<Double> zValues,
                           final Boolean skipTransforms); void renameStack(final StackId fromStackId,
                            final StackId toStackId); void writeLayoutFileData(final StackMetaData stackMetaData,
                                    final String stackRequestUri,
                                    final Double minZ,
                                    final Double maxZ,
                                    TileSpecLayout.Format format,
                                    final OutputStream outputStream); void writeTileIds(final StackId stackId,
                             final OutputStream outputStream); }
RenderDao { void saveTileSpec(final StackId stackId, final TileSpec tileSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("tileSpec", tileSpec); MongoUtil.validateRequiredParameter("tileSpec.tileId", tileSpec.getTileId()); final MongoCollection<Document> tileCollection = getTileCollection(stackId); final String context = "tile spec with id '" + tileSpec.getTileId(); validateTransformReferences(context, stackId, tileSpec.getTransforms()); final Document query = new Document(); query.put("tileId", tileSpec.getTileId()); final Document tileSpecObject = Document.parse(tileSpec.toJson()); final UpdateResult result = tileCollection.replaceOne(query, tileSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTileSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(tileCollection), MongoUtil.action(result), query.toJson(), result.getUpsertedId()); } RenderDao(final MongoClient client); static RenderDao build(); RenderParameters getParameters(final StackId stackId,
                                          final String groupId,
                                          final Double x,
                                          final Double y,
                                          final Double z,
                                          final Integer width,
                                          final Integer height,
                                          final Double scale); RenderParameters getParameters(final StackId stackId,
                                          final Double z,
                                          final Double scale); long getTileCount(final StackId stackId,
                             final Double x,
                             final Double y,
                             final Double z,
                             final Integer width,
                             final Integer height); TileSpec getTileSpec(final StackId stackId,
                                final String tileId,
                                final boolean resolveTransformReferences); List<TileSpec> getTileSpecs(final StackId stackId,
                                       final Double x,
                                       final Double y,
                                       final Double z); List<TileSpec> getTileSpecs(final StackId stackId,
                                       final List<String> tileIds); void writeCoordinatesWithTileIds(final StackId stackId,
                                            final Double z,
                                            final List<TileCoordinates> worldCoordinatesList,
                                            final OutputStream outputStream); List<TileSpec> getTileSpecs(final StackId stackId,
                                       final Double z); ResolvedTileSpecCollection getResolvedTiles(final StackId stackId,
                                                       final Double z); ResolvedTileSpecCollection getResolvedTiles(final StackId stackId,
                                                       final Double minZ,
                                                       final Double maxZ,
                                                       final String groupId,
                                                       final Double minX,
                                                       final Double maxX,
                                                       final Double minY,
                                                       final Double maxY); void saveResolvedTiles(final StackId stackId,
                                  final ResolvedTileSpecCollection resolvedTileSpecs); TransformSpec getTransformSpec(final StackId stackId,
                                          final String transformId); List<Double> getZValues(final StackId stackId); List<Double> getZValues(final StackId stackId,
                                   final Double minZ,
                                   final Double maxZ); Double getZForSection(final StackId stackId,
                                 final String sectionId); void updateZForSection(final StackId stackId,
                                  final String sectionId,
                                  final Double z); void updateZForTiles(final StackId stackId,
                                final Double z,
                                final List<String> tileIds); List<SectionData> getSectionData(final StackId stackId,
                                            final Double minZ,
                                            final Double maxZ); List<String> getOwners(); List<String> getProjects(final String owner); List<StackMetaData> getStackMetaDataList(final String owner,
                                                    final String project); StackMetaData getStackMetaData(final StackId stackId); void saveStackMetaData(final StackMetaData stackMetaData); StackMetaData ensureIndexesAndDeriveStats(final StackMetaData stackMetaData); void removeStack(final StackId stackId,
                            final boolean includeMetaData); void removeTilesWithSectionId(final StackId stackId,
                                         final String sectionId); void removeTilesWithZ(final StackId stackId,
                                 final Double z); void removeTile(final StackId stackId,
                           final String tileId); Bounds getLayerBounds(final StackId stackId,
                                 final Double z); List<SectionData> getSectionDataForZ(final StackId stackId,
                                                final Double z); List<TileBounds> getTileBoundsForZ(final StackId stackId,
                                              final Double z); List<TileBounds> getTileBoundsForSection(final StackId stackId,
                                                    final String sectionId); void cloneStack(final StackId fromStackId,
                           final StackId toStackId,
                           final List<Double> zValues,
                           final Boolean skipTransforms); void renameStack(final StackId fromStackId,
                            final StackId toStackId); void writeLayoutFileData(final StackMetaData stackMetaData,
                                    final String stackRequestUri,
                                    final Double minZ,
                                    final Double maxZ,
                                    TileSpecLayout.Format format,
                                    final OutputStream outputStream); void writeTileIds(final StackId stackId,
                             final OutputStream outputStream); static final String RENDER_DB_NAME; static final String STACK_META_DATA_COLLECTION_NAME; }