protected Collection<String> getScripts(
     Map<Schema, Collection<String>> schemaScripts,
     ScriptGeneratorManager scriptGeneratorManager,
     boolean dropSchema,
     boolean useSchema) {
   Collection<String> scripts = newArrayList();
   if (schemaScripts.size() == 1) {
     Map.Entry<Schema, Collection<String>> schemaScript =
         schemaScripts.entrySet().iterator().next();
     Schema schema = schemaScript.getKey();
     if (dropSchema) {
       scripts.add(getDropSchema(schema, scriptGeneratorManager));
     }
     if (useSchema) {
       scripts.add(getUseSchema(schema, scriptGeneratorManager));
     }
     scripts.addAll(schemaScript.getValue());
   } else {
     for (Map.Entry<Schema, Collection<String>> schemaScript : schemaScripts.entrySet()) {
       Schema schema = schemaScript.getKey();
       Dialect dialect = scriptGeneratorManager.getTargetDialect();
       if (dropSchema) {
         scripts.add(getDropSchema(schema, scriptGeneratorManager));
       }
       if (useSchema) {
         scripts.add(
             schema.getIdentifier() != null
                 ? dialect.getUseSchema(scriptGeneratorManager.getName(schema))
                 : dialect.getUseSchema(scriptGeneratorManager.getName(schema.getCatalog())));
       }
       scripts.addAll(schemaScript.getValue());
     }
   }
   return scripts;
 }
 protected boolean addScripts(Schema schema, ScriptGeneratorManager manager) {
   boolean generate = true;
   Identifier catalogId = valueOf(manager.getSourceCatalog());
   if (catalogId != null) {
     generate = ObjectUtils.equals(catalogId, schema.getCatalog().getIdentifier());
   }
   Identifier schemaId = valueOf(manager.getSourceSchema());
   if (generate && schemaId != null) {
     generate = ObjectUtils.equals(schemaId, schema.getIdentifier());
   }
   return generate;
 }
 public static String getDropSchema(Schema schema, ScriptGeneratorManager scriptGeneratorManager) {
   String dropSchema = null;
   Dialect dialect = scriptGeneratorManager.getTargetDialect();
   if (scriptGeneratorManager.getTargetSchema() != null) {
     dropSchema = dialect.getDropSchema(scriptGeneratorManager.getTargetSchema(), true);
   } else if (scriptGeneratorManager.getTargetCatalog() != null) {
     dropSchema = dialect.getDropSchema(scriptGeneratorManager.getTargetCatalog(), true);
   }
   if (dropSchema == null) {
     dropSchema =
         schema.getIdentifier() != null
             ? dialect.getDropSchema(scriptGeneratorManager.getName(schema))
             : dialect.getDropSchema(scriptGeneratorManager.getName(schema.getCatalog()));
   }
   return dropSchema;
 }