@Test public void testSaveTransformSpec() throws Exception { final String transformId = "new-transform-1"; final String testGroupLabel = "test-group"; final TransformSpecMetaData metaData = new TransformSpecMetaData(); final LeafTransformSpec leafSpec = new LeafTransformSpec(transformId, metaData, AffineModel2D.class.getName(), "1 0 0 1 0 0"); leafSpec.addLabel(testGroupLabel); dao.saveTransformSpec(stackId, leafSpec); final TransformSpec insertedSpec = dao.getTransformSpec(stackId, transformId); Assert.assertNotNull("null transformSpec retrieved after insert", insertedSpec); Assert.assertTrue("label missing after insert", insertedSpec.hasLabel(testGroupLabel)); insertedSpec.removeLabel(testGroupLabel); Assert.assertFalse("label exists after removal", insertedSpec.hasLabel(testGroupLabel)); final ListTransformSpec listSpec = new ListTransformSpec(transformId, null); listSpec.addSpec(new ReferenceTransformSpec("1")); dao.saveTransformSpec(stackId, listSpec); final TransformSpec updatedSpec = dao.getTransformSpec(stackId, transformId); Assert.assertNotNull("null transformSpec retrieved after update", updatedSpec); Assert.assertFalse("transformSpec should not be resolved after update", updatedSpec.isFullyResolved()); }
void saveTransformSpec(final StackId stackId, final TransformSpec transformSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("transformSpec", transformSpec); MongoUtil.validateRequiredParameter("transformSpec.id", transformSpec.getId()); final MongoCollection<Document> transformCollection = getTransformCollection(stackId); final String context = "transform spec with id '" + transformSpec.getId() + "'"; validateTransformReferences(context, stackId, transformSpec); final Document query = new Document(); query.put("id", transformSpec.getId()); final Document transformSpecObject = Document.parse(transformSpec.toJson()); final UpdateResult result = transformCollection.replaceOne(query, transformSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTransformSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(transformCollection), MongoUtil.action(result), query.toJson(), result.getUpsertedId()); }
RenderDao { void saveTransformSpec(final StackId stackId, final TransformSpec transformSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("transformSpec", transformSpec); MongoUtil.validateRequiredParameter("transformSpec.id", transformSpec.getId()); final MongoCollection<Document> transformCollection = getTransformCollection(stackId); final String context = "transform spec with id '" + transformSpec.getId() + "'"; validateTransformReferences(context, stackId, transformSpec); final Document query = new Document(); query.put("id", transformSpec.getId()); final Document transformSpecObject = Document.parse(transformSpec.toJson()); final UpdateResult result = transformCollection.replaceOne(query, transformSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTransformSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(transformCollection), MongoUtil.action(result), query.toJson(), result.getUpsertedId()); } }
RenderDao { void saveTransformSpec(final StackId stackId, final TransformSpec transformSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("transformSpec", transformSpec); MongoUtil.validateRequiredParameter("transformSpec.id", transformSpec.getId()); final MongoCollection<Document> transformCollection = getTransformCollection(stackId); final String context = "transform spec with id '" + transformSpec.getId() + "'"; validateTransformReferences(context, stackId, transformSpec); final Document query = new Document(); query.put("id", transformSpec.getId()); final Document transformSpecObject = Document.parse(transformSpec.toJson()); final UpdateResult result = transformCollection.replaceOne(query, transformSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTransformSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(transformCollection), MongoUtil.action(result), query.toJson(), result.getUpsertedId()); } RenderDao(final MongoClient client); }
RenderDao { void saveTransformSpec(final StackId stackId, final TransformSpec transformSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("transformSpec", transformSpec); MongoUtil.validateRequiredParameter("transformSpec.id", transformSpec.getId()); final MongoCollection<Document> transformCollection = getTransformCollection(stackId); final String context = "transform spec with id '" + transformSpec.getId() + "'"; validateTransformReferences(context, stackId, transformSpec); final Document query = new Document(); query.put("id", transformSpec.getId()); final Document transformSpecObject = Document.parse(transformSpec.toJson()); final UpdateResult result = transformCollection.replaceOne(query, transformSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTransformSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(transformCollection), 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 saveTransformSpec(final StackId stackId, final TransformSpec transformSpec) throws IllegalArgumentException { MongoUtil.validateRequiredParameter("stackId", stackId); MongoUtil.validateRequiredParameter("transformSpec", transformSpec); MongoUtil.validateRequiredParameter("transformSpec.id", transformSpec.getId()); final MongoCollection<Document> transformCollection = getTransformCollection(stackId); final String context = "transform spec with id '" + transformSpec.getId() + "'"; validateTransformReferences(context, stackId, transformSpec); final Document query = new Document(); query.put("id", transformSpec.getId()); final Document transformSpecObject = Document.parse(transformSpec.toJson()); final UpdateResult result = transformCollection.replaceOne(query, transformSpecObject, MongoUtil.UPSERT_OPTION); LOG.debug("saveTransformSpec: {}.{},({}), upsertedId is {}", MongoUtil.fullName(transformCollection), 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; }