text: 
  --------------------------------------------
  --------------------------------------------
  -- Creates a popup print map view (paikkatietoikkuna.fi)
  -- Notice these statements should be executed in the same order they are listed here
  -- for startupsequence to work correctly
  --------------------------------------------
  --------------------------------------------
  
  ---- Checking bundle order ---
  SELECT b.name, s.config, s.state, s.startup
      FROM portti_view_bundle_seq s, portti_bundle b 
      WHERE s.bundle_id = b.id AND s.view_id = (SELECT id FROM portti_view WHERE type='PRINT')
      ORDER BY s.seqno;
  
  
  --------------------------------------------
  -- View
  --------------------------------------------
  
  INSERT INTO portti_view (name, type, is_default,  application, page, application_dev_prefix)
      VALUES ('print', 
              'PRINT', 
               true,
               'full-map',
               'print',
               '/applications/paikkatietoikkuna.fi');
  
  
  --------------------------------------------
  -- 1. Openlayers
  --------------------------------------------
  
  -- add bundle to view
  INSERT INTO portti_view_bundle_seq (view_id, bundle_id, seqno, config, state, startup) 
         VALUES ((SELECT id FROM portti_view WHERE type='PRINT'), 
          (SELECT id FROM portti_bundle WHERE name = 'openlayers-default-theme'), 
          1, '{}','{}', '{}');
  
  -- update proper startup for view
  UPDATE portti_view_bundle_seq set startup = '{
      "title" : "OpenLayers",
      "fi" : "OpenLayers",
      "sv" : "OpenLayers",
      "en" : "OpenLayers",
      "bundlename" : "openlayers-default-theme",
      "bundleinstancename" : "openlayers-default-theme",
      "metadata" : {
          "Import-Bundle" : {
              "openlayers-single-full" : {
                  "bundlePath" : "/Oskari/packages/openlayers/bundle/"
              },
              "openlayers-default-theme" : {
                  "bundlePath" : "/Oskari/packages/openlayers/bundle/"
              }
          },
          "Require-Bundle-Instance" : []
       },
       "instanceProps" : {}
  }' WHERE bundle_id = (SELECT id FROM portti_bundle WHERE name = 'openlayers-default-theme') 
      AND view_id=(SELECT id FROM portti_view WHERE type='PRINT');
  
  --------------------------------------------
  -- 2. Mapfull
  --------------------------------------------
  
  -- add bundle to view
  INSERT INTO portti_view_bundle_seq (view_id, bundle_id, seqno, config, state, startup) 
         VALUES ((SELECT id FROM portti_view WHERE type='PRINT'), 
          (SELECT id FROM portti_bundle WHERE name = 'mapfull'), 
          (SELECT (max(seqno) + 1) FROM portti_view_bundle_seq WHERE view_id = (SELECT id FROM portti_view WHERE type='PRINT')), 
          '{}','{}', '{}');
  
  -- update proper startup for view
  UPDATE portti_view_bundle_seq set startup = '{
      "title" : "Map",
      "fi" : "mapfull",
      "sv" : "mapfull",
      "en" : "mapfull",
      "bundlename" : "mapfull",
      "bundleinstancename" : "mapfull",
      "metadata" : {
          "Import-Bundle" : {
              "core-base" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "core-map" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "sandbox-base" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "sandbox-map" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "event-base" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "event-map" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "event-map-layer" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "request-base" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "request-map" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "request-map-layer" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "service-base" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "service-map" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "domain" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "mapmodule-plugin" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "mapwfs" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "mapwmts" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "mapstats" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "oskariui" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              },
              "mapfull" : {
                  "bundlePath" : "/Oskari/packages/framework/bundle/"
              }
          },
          "Require-Bundle-Instance" : []
      },
      "instanceProps" : {}
  }' WHERE bundle_id = (SELECT id FROM portti_bundle WHERE name = 'mapfull') 
      AND view_id=(SELECT id FROM portti_view WHERE type='PRINT');
  
  
  -- update proper config for view
  UPDATE portti_view_bundle_seq set config = '{
      "globalMapAjaxUrl": "[REPLACED BY HANDLER]",
      "imageLocation": "/Oskari/resources",
      "plugins" : [
         { "id" : "Oskari.mapframework.bundle.mapmodule.plugin.LayersPlugin" },
         { "id" : "Oskari.mapframework.mapmodule.WmsLayerPlugin" },
         { "id" : "Oskari.mapframework.mapmodule.MarkersPlugin" },
         { "id" : "Oskari.mapframework.mapmodule.ControlsPlugin" },
         { "id" : "Oskari.mapframework.mapmodule.GetInfoPlugin" },
         { "id" : "Oskari.mapframework.bundle.mapwfs.plugin.wfslayer.WfsLayerPlugin" },
         { "id" : "Oskari.mapframework.wmts.mapmodule.plugin.WmtsLayerPlugin" } ,
         { "id" : "Oskari.mapframework.bundle.mapmodule.plugin.ScaleBarPlugin" }
        ],
        "layers": [
        ]
  }' WHERE bundle_id = (SELECT id FROM portti_bundle WHERE name = 'mapfull') 
      AND view_id=(SELECT id FROM portti_view WHERE type='PRINT');
  
  
  -- update proper state for view
  UPDATE portti_view_bundle_seq set state = '{
      "east": "517620",
      "north": "6874042",
      "selectedLayers": [{"id": "base_35"}],
      "zoom": 1
  }' WHERE bundle_id = (SELECT id FROM portti_bundle WHERE name = 'mapfull') 
      AND view_id=(SELECT id FROM portti_view WHERE type='PRINT');
  
  