@@ -0,0 +1,1427 @@
+package flyway.pti3d;%0A%0Aimport java.sql.Connection;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.flywaydb.core.api.migration.jdbc.JdbcMigration;%0A%0Aimport fi.nls.oskari.util.FlywayHelper;%0A%0Apublic class V1_6__add_camera_controls_3d_bundle_to_3D_views implements JdbcMigration%7B%0A%0A%09private static final String BUNDLE_ID = %22camera-controls-3d%22;%0A%09%0A%09@Override%0A%09public void migrate(Connection connection) throws Exception %7B%0A%09%09final List%3CLong%3E views = get3DApplicationViewIds(connection);%0A%09%09for (Long viewId : views) %7B%0A%09%09%09if (FlywayHelper.viewContainsBundle(connection, BUNDLE_ID, viewId)) %7B%0A%09%09%09%09continue;%0A%09%09%09%7D%0A%09%09%09FlywayHelper.addBundleWithDefaults(connection, viewId, BUNDLE_ID);%0A%09%09%7D%0A%09%7D%0A%09%0A%09private static List%3CLong%3E get3DApplicationViewIds(Connection connection) throws SQLException %7B%0A        ArrayList%3CLong%3E ids = new ArrayList%3C%3E();%0A        StringBuilder sql = new StringBuilder(%22SELECT id FROM portti_view WHERE application IN ('geoportal-3D','embedded-3D') AND type IN ('DEFAULT','PUBLISH')%22);%0A%0A        try (final PreparedStatement statement =%0A                     connection.prepareStatement(sql.toString())) %7B%0A            try (ResultSet rs = statement.executeQuery()) %7B%0A                while (rs.next()) %7B%0A                    ids.add(rs.getLong(%22id%22));%0A                %7D%0A            %7D%0A        %7D%0A        return ids;%0A    %7D%0A%7D%0A

Add camera-controls-3d bundle to 3D views