public static JSONArray getStartupSequence(final View view) throws ViewException {
   final JSONArray startupSequence = new JSONArray();
   final List<Bundle> bundles = view.getBundles();
   log.debug("Got", bundles.size(), "states for view", view.getId());
   for (Bundle s : bundles) {
     final String startup = s.getStartup();
     final String name = s.getName();
     if (startup != null) {
       try {
         startupSequence.put(new JSONObject(startup));
       } catch (JSONException jsonex) {
         log.error(
             jsonex,
             "Malformed JSON in startup sequence fragment for bundle:",
             name,
             "- JSON:",
             startup);
       }
     } else {
       throw new ViewException(
           "Could not get startup sequence fragment for bundle '" + name + "'");
     }
   }
   return startupSequence;
 }