-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from hsy-kuntayhtyma/migrate-oskari-290-opensource
Migrate to 2.9.x Oskari
- Loading branch information
Showing
80 changed files
with
754 additions
and
1,097 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 10 additions & 11 deletions
21
hsy-resources/src/main/java/flyway/dev/V1_00_0__add_default_admin_user.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
package flyway.dev; | ||
|
||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
|
||
import fi.nls.oskari.log.LogFactory; | ||
import fi.nls.oskari.log.Logger; | ||
import fi.nls.oskari.service.ServiceException; | ||
import fi.nls.oskari.service.UserService; | ||
import fi.nls.oskari.user.DatabaseUserService; | ||
import org.flywaydb.core.api.migration.jdbc.JdbcMigration; | ||
|
||
import java.sql.Connection; | ||
|
||
public class V1_00_0__add_default_admin_user implements JdbcMigration { | ||
public class V1_00_0__add_default_admin_user extends BaseJavaMigration { | ||
|
||
private Logger log = LogFactory.getLogger(V1_00_0__add_default_admin_user.class); | ||
|
||
public void migrate(Connection connection) { | ||
|
||
public void migrate(Context context) { | ||
UserService dbService = null; | ||
try { | ||
dbService = DatabaseUserService.getInstance(); | ||
try { | ||
dbService.updateUserPassword("admin", "oskari"); | ||
} catch (ServiceException se) { | ||
log.error(se, "Cannot update password"); | ||
} | ||
} catch (ServiceException se) { | ||
log.error(se, "Unable to initialize User service!"); | ||
} | ||
try { | ||
dbService.updateUserPassword("admin", "oskari"); | ||
} catch (ServiceException se) { | ||
log.error(se, "Cannot update password"); | ||
} | ||
} | ||
} |
17 changes: 9 additions & 8 deletions
17
hsy-resources/src/main/java/flyway/hsy/V1_00_0__register_download_basket_bundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
package flyway.hsy; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
import org.flywaydb.core.api.migration.jdbc.JdbcMigration; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.oskari.helpers.BundleHelper; | ||
|
||
import fi.nls.oskari.db.BundleHelper; | ||
import fi.nls.oskari.domain.map.view.Bundle; | ||
|
||
public class V1_00_0__register_download_basket_bundle implements JdbcMigration{ | ||
public class V1_00_0__register_download_basket_bundle extends BaseJavaMigration { | ||
|
||
private static final String NAMESPACE = "hsy"; | ||
private static final String DOWNLOAD_BASKET = "download-basket"; | ||
|
||
public void migrate(Connection connection) { | ||
public void migrate(Context context) throws SQLException { | ||
// BundleHelper checks if these bundles are already registered | ||
Bundle downloadBasket = new Bundle(); | ||
downloadBasket.setConfig("{}"); | ||
downloadBasket.setState("{}"); | ||
downloadBasket.setName(DOWNLOAD_BASKET); | ||
downloadBasket.setStartup(BundleHelper.getDefaultBundleStartup(NAMESPACE, DOWNLOAD_BASKET, "Download basket")); | ||
BundleHelper.registerBundle(downloadBasket); | ||
//downloadBasket.setStartup(BundleHelper.getDefaultBundleStartup(NAMESPACE, DOWNLOAD_BASKET, "Download basket")); | ||
BundleHelper.registerBundle(context.getConnection(), downloadBasket); | ||
} | ||
|
||
} |
48 changes: 7 additions & 41 deletions
48
hsy-resources/src/main/java/flyway/hsy/V1_00_1__add_download_basket_to_views.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,15 @@ | ||
package flyway.hsy; | ||
|
||
import java.sql.Connection; | ||
import java.sql.PreparedStatement; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.oskari.helpers.AppSetupHelper; | ||
|
||
import org.flywaydb.core.api.migration.jdbc.JdbcMigration; | ||
|
||
import fi.nls.oskari.map.view.ViewService; | ||
import fi.nls.oskari.map.view.AppSetupServiceMybatisImpl; | ||
|
||
public class V1_00_1__add_download_basket_to_views implements JdbcMigration { | ||
public class V1_00_1__add_download_basket_to_views extends BaseJavaMigration { | ||
|
||
private static final ViewService VIEW_SERVICE = new AppSetupServiceMybatisImpl(); | ||
private static final String DOWNLOAD_BASKET = "download-basket"; | ||
|
||
public void migrate(Connection connection) throws Exception { | ||
long viewId = VIEW_SERVICE.getDefaultViewId(); | ||
makeInsert(viewId,connection); | ||
} | ||
|
||
private void makeInsert(long viewId, Connection connection) | ||
throws Exception { | ||
|
||
final PreparedStatement statement = | ||
connection.prepareStatement("INSERT INTO portti_view_bundle_seq" + | ||
"(view_id, bundle_id, seqno, config, state, startup, bundleinstance) " + | ||
"VALUES (" + | ||
"?, " + | ||
"(SELECT id FROM portti_bundle WHERE name=?), " + | ||
"(SELECT max(seqno)+1 FROM portti_view_bundle_seq WHERE view_id=?), " + | ||
"?, ?, " + | ||
"(SELECT startup FROM portti_bundle WHERE name=?), " + | ||
"?)"); | ||
|
||
statement.setLong(1, viewId); | ||
statement.setString(2, DOWNLOAD_BASKET); | ||
statement.setLong(3, viewId); | ||
statement.setString(4, "{}"); | ||
statement.setString(5, "{}"); | ||
statement.setString(6, DOWNLOAD_BASKET); | ||
statement.setString(7, DOWNLOAD_BASKET); | ||
|
||
try { | ||
statement.execute(); | ||
} finally { | ||
statement.close(); | ||
} | ||
public void migrate(Context context) throws Exception { | ||
AppSetupHelper.addBundleToApps(context.getConnection(), DOWNLOAD_BASKET); | ||
} | ||
|
||
} |
16 changes: 7 additions & 9 deletions
16
hsy-resources/src/main/java/flyway/hsy/V1_00_2__register_link_panel_bundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
package flyway.hsy; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
import org.flywaydb.core.api.migration.jdbc.JdbcMigration; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.oskari.helpers.BundleHelper; | ||
|
||
import fi.nls.oskari.db.BundleHelper; | ||
import fi.nls.oskari.domain.map.view.Bundle; | ||
|
||
public class V1_00_2__register_link_panel_bundle implements JdbcMigration{ | ||
public class V1_00_2__register_link_panel_bundle extends BaseJavaMigration { | ||
|
||
private static final String NAMESPACE = "hsy"; | ||
private static final String LINK_PANEL = "link-panel"; | ||
|
||
public void migrate(Connection connection) { | ||
// BundleHelper checks if these bundles are already registered | ||
public void migrate(Context context) throws SQLException { | ||
Bundle linkPanel = new Bundle(); | ||
linkPanel.setConfig("{}"); | ||
linkPanel.setState("{}"); | ||
linkPanel.setName(LINK_PANEL); | ||
linkPanel.setStartup(BundleHelper.getDefaultBundleStartup(NAMESPACE, LINK_PANEL, "Link panel")); | ||
BundleHelper.registerBundle(linkPanel); | ||
BundleHelper.registerBundle(context.getConnection(), linkPanel); | ||
} | ||
} |
48 changes: 7 additions & 41 deletions
48
hsy-resources/src/main/java/flyway/hsy/V1_00_3__add_link_panel_to_views.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,15 @@ | ||
package flyway.hsy; | ||
|
||
import java.sql.Connection; | ||
import java.sql.PreparedStatement; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.oskari.helpers.AppSetupHelper; | ||
|
||
import org.flywaydb.core.api.migration.jdbc.JdbcMigration; | ||
|
||
import fi.nls.oskari.map.view.ViewService; | ||
import fi.nls.oskari.map.view.AppSetupServiceMybatisImpl; | ||
|
||
public class V1_00_3__add_link_panel_to_views implements JdbcMigration{ | ||
public class V1_00_3__add_link_panel_to_views extends BaseJavaMigration { | ||
|
||
private static final ViewService VIEW_SERVICE = new AppSetupServiceMybatisImpl(); | ||
private static final String LINK_PANEL = "link-panel"; | ||
private static final String LINK_PANEL = "link-panel"; | ||
|
||
public void migrate(Connection connection) throws Exception { | ||
long viewId = VIEW_SERVICE.getDefaultViewId(); | ||
makeInsert(viewId,connection); | ||
public void migrate(Context context) throws Exception { | ||
AppSetupHelper.addBundleToApps(context.getConnection(), LINK_PANEL); | ||
} | ||
|
||
private void makeInsert(long viewId, Connection connection) | ||
throws Exception { | ||
|
||
final PreparedStatement statement = | ||
connection.prepareStatement("INSERT INTO portti_view_bundle_seq" + | ||
"(view_id, bundle_id, seqno, config, state, startup, bundleinstance) " + | ||
"VALUES (" + | ||
"?, " + | ||
"(SELECT id FROM portti_bundle WHERE name=?), " + | ||
"(SELECT max(seqno)+1 FROM portti_view_bundle_seq WHERE view_id=?), " + | ||
"?, ?, " + | ||
"(SELECT startup FROM portti_bundle WHERE name=?), " + | ||
"?)"); | ||
|
||
statement.setLong(1, viewId); | ||
statement.setString(2, LINK_PANEL); | ||
statement.setLong(3, viewId); | ||
statement.setString(4, "{}"); | ||
statement.setString(5, "{}"); | ||
statement.setString(6, LINK_PANEL); | ||
statement.setString(7, LINK_PANEL); | ||
|
||
try { | ||
statement.execute(); | ||
} finally { | ||
statement.close(); | ||
} | ||
} | ||
} |
19 changes: 9 additions & 10 deletions
19
hsy-resources/src/main/java/flyway/hsy/V1_00_4__register_lang_override_bundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
package flyway.hsy; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
import org.flywaydb.core.api.migration.jdbc.JdbcMigration; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.oskari.helpers.BundleHelper; | ||
|
||
import fi.nls.oskari.db.BundleHelper; | ||
import fi.nls.oskari.domain.map.view.Bundle; | ||
|
||
public class V1_00_4__register_lang_override_bundle implements JdbcMigration{ | ||
private static final String NAMESPACE = "hsy"; | ||
private static final String LANG_OVERRIDES = "hsy-lang-overrides"; | ||
public class V1_00_4__register_lang_override_bundle extends BaseJavaMigration { | ||
|
||
public void migrate(Connection connection) { | ||
// BundleHelper checks if these bundles are already registered | ||
private static final String LANG_OVERRIDES = "hsy-lang-overrides"; | ||
|
||
public void migrate(Context context) throws SQLException { | ||
Bundle linkPanel = new Bundle(); | ||
linkPanel.setConfig("{}"); | ||
linkPanel.setState("{}"); | ||
linkPanel.setName(LANG_OVERRIDES); | ||
linkPanel.setStartup(BundleHelper.getDefaultBundleStartup(NAMESPACE, LANG_OVERRIDES, "Lang overrides")); | ||
BundleHelper.registerBundle(linkPanel); | ||
BundleHelper.registerBundle(context.getConnection(), linkPanel); | ||
} | ||
} |
49 changes: 8 additions & 41 deletions
49
hsy-resources/src/main/java/flyway/hsy/V1_00_5__add_lang_override_to_views.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,15 @@ | ||
package flyway.hsy; | ||
|
||
import java.sql.Connection; | ||
import java.sql.PreparedStatement; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.oskari.helpers.AppSetupHelper; | ||
|
||
import org.flywaydb.core.api.migration.jdbc.JdbcMigration; | ||
public class V1_00_5__add_lang_override_to_views extends BaseJavaMigration { | ||
|
||
import fi.nls.oskari.map.view.ViewService; | ||
import fi.nls.oskari.map.view.AppSetupServiceMybatisImpl; | ||
private static final String LANG_OVERRIDES = "hsy-lang-overrides"; | ||
|
||
public class V1_00_5__add_lang_override_to_views implements JdbcMigration{ | ||
private static final ViewService VIEW_SERVICE = new AppSetupServiceMybatisImpl(); | ||
private static final String LANG_OVERRIDES = "hsy-lang-overrides"; | ||
|
||
public void migrate(Connection connection) throws Exception { | ||
long viewId = VIEW_SERVICE.getDefaultViewId(); | ||
makeInsert(viewId,connection); | ||
} | ||
|
||
private void makeInsert(long viewId, Connection connection) | ||
throws Exception { | ||
|
||
final PreparedStatement statement = | ||
connection.prepareStatement("INSERT INTO portti_view_bundle_seq" + | ||
"(view_id, bundle_id, seqno, config, state, startup, bundleinstance) " + | ||
"VALUES (" + | ||
"?, " + | ||
"(SELECT id FROM portti_bundle WHERE name=?), " + | ||
"(SELECT max(seqno)+1 FROM portti_view_bundle_seq WHERE view_id=?), " + | ||
"?, ?, " + | ||
"(SELECT startup FROM portti_bundle WHERE name=?), " + | ||
"?)"); | ||
|
||
statement.setLong(1, viewId); | ||
statement.setString(2, LANG_OVERRIDES); | ||
statement.setLong(3, viewId); | ||
statement.setString(4, "{}"); | ||
statement.setString(5, "{}"); | ||
statement.setString(6, LANG_OVERRIDES); | ||
statement.setString(7, LANG_OVERRIDES); | ||
|
||
try { | ||
statement.execute(); | ||
} finally { | ||
statement.close(); | ||
} | ||
public void migrate(Context context) throws Exception { | ||
AppSetupHelper.addBundleToApps(context.getConnection(), LANG_OVERRIDES); | ||
} | ||
|
||
} |
28 changes: 13 additions & 15 deletions
28
hsy-resources/src/main/java/flyway/hsy/V1_00_6__register_content_editor_bundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
package flyway.hsy; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
|
||
import org.flywaydb.core.api.migration.jdbc.JdbcMigration; | ||
import org.flywaydb.core.api.migration.BaseJavaMigration; | ||
import org.flywaydb.core.api.migration.Context; | ||
import org.oskari.helpers.BundleHelper; | ||
|
||
import fi.nls.oskari.db.BundleHelper; | ||
import fi.nls.oskari.domain.map.view.Bundle; | ||
|
||
public class V1_00_6__register_content_editor_bundle implements JdbcMigration{ | ||
public class V1_00_6__register_content_editor_bundle extends BaseJavaMigration { | ||
|
||
private static final String NAMESPACE = "tampere"; | ||
private static final String CONTENT_EDITOR = "content-editor"; | ||
private static final String CONTENT_EDITOR = "content-editor"; | ||
|
||
public void migrate(Connection connection) { | ||
// BundleHelper checks if these bundles are already registered | ||
Bundle contenEditorTool = new Bundle(); | ||
contenEditorTool.setConfig("{}"); | ||
contenEditorTool.setState("{}"); | ||
contenEditorTool.setName(CONTENT_EDITOR); | ||
contenEditorTool.setStartup(BundleHelper.getDefaultBundleStartup(NAMESPACE, CONTENT_EDITOR, "content-editor")); | ||
BundleHelper.registerBundle(contenEditorTool); | ||
} | ||
public void migrate(Context context) throws SQLException { | ||
Bundle contenEditorTool = new Bundle(); | ||
contenEditorTool.setConfig("{}"); | ||
contenEditorTool.setState("{}"); | ||
contenEditorTool.setName(CONTENT_EDITOR); | ||
BundleHelper.registerBundle(context.getConnection(), contenEditorTool); | ||
} | ||
} |
Oops, something went wrong.