<commit_before>package org.springframework.roo.addon.dbre;

import java.io.File;
import java.util.Set;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.springframework.roo.addon.dbre.model.Schema;
import org.springframework.roo.model.JavaPackage;
import org.springframework.roo.shell.CliAvailabilityIndicator;
import org.springframework.roo.shell.CliCommand;
import org.springframework.roo.shell.CliOption;
import org.springframework.roo.shell.CommandMarker;

/**
 * Shell commands for {@link DbreOperations}.
 * 
 * @author <NAME>
 * @since 1.1
 */
@Component
@Service
public class DbreCommands implements CommandMarker {
	
	// Fields
	@Reference private DbreOperations dbreOperations;

	@CliAvailabilityIndicator({ "database introspect", "database reverse engineer" })
	public boolean isDbreAvailable() {
		return dbreOperations.isDbreAvailable();
	}

	@CliCommand(value = "database introspect", help = "Displays database metadata")
	public void displayDatabaseMetadata(
		@CliOption(key = "schema", mandatory = true, help = "The database schema name") Set<Schema> schemas, 
		@CliOption(key = "file", mandatory = false, help = "The file to save the metadata to") File file,
		@CliOption(key = "enableViews", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Display database views") boolean view) {

		dbreOperations.displayDatabaseMetadata(schemas, file, view);
	}

	@CliCommand(value = "database reverse engineer", help = "Create and update entities based on database metadata")
	public void serializeDatabaseMetadata(
		@CliOption(key = "schema", mandatory = true, optionContext = "schema", help = "The database schema names. Multiple schema names must be separated by spaces and enclosed by pairs of double quotes") Set<Schema> schemas, 
		@CliOption(key = "package", mandatory = false, help = "The package in which new entities will be placed") JavaPackage destinationPackage,
		@CliOption(key = "testAutomatically", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Create automatic integration tests for entities") boolean testAutomatically, 
		@CliOption(key = "enableViews", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Reverse engineer database views") boolean view,
		@CliOption(key = "includeTables", mandatory = false, specifiedDefaultValue = "", optionContext = "include-tables", help = "The tables to include in reverse engineering. Must be separated by spaces and enclosed by pairs of double quotes") Set<String> includeTables,
		@CliOption(key = "excludeTables", mandatory = false, specifiedDefaultValue = "", optionContext = "exclude-tables", help = "The tables to exclude from reverse engineering. Must be separated by spaces and enclosed by pairs of double quotes") Set<String> excludeTables,
		@CliOption(key = "includeNonPortableAttributes", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Include non-portable JPA @Column attributes such as 'columnDefinition'") boolean includeNonPortableAttributes,
		@CliOption(key = "activeRecord", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "true", help = "Generate CRUD active record methods for each entity") boolean activeRecord)
	{
		dbreOperations.reverseEngineerDatabase(schemas, destinationPackage, testAutomatically, view, includeTables, excludeTables, includeNonPortableAttributes, activeRecord);
	}
}<commit_msg>ROO-1408: DBRE multiple schema support - fixed bug in introspect command<commit_after>package org.springframework.roo.addon.dbre;

import java.io.File;
import java.util.Set;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.springframework.roo.addon.dbre.model.Schema;
import org.springframework.roo.model.JavaPackage;
import org.springframework.roo.shell.CliAvailabilityIndicator;
import org.springframework.roo.shell.CliCommand;
import org.springframework.roo.shell.CliOption;
import org.springframework.roo.shell.CommandMarker;

/**
 * Shell commands for {@link DbreOperations}.
 * 
 * @author <NAME>
 * @since 1.1
 */
@Component
@Service
public class DbreCommands implements CommandMarker {
	
	// Fields
	@Reference private DbreOperations dbreOperations;

	@CliAvailabilityIndicator({ "database introspect", "database reverse engineer" })
	public boolean isDbreAvailable() {
		return dbreOperations.isDbreAvailable();
	}

	@CliCommand(value = "database introspect", help = "Displays database metadata")
	public void displayDatabaseMetadata(
		@CliOption(key = "schema", mandatory = true, optionContext = "schema", help = "The database schema names. Multiple schema names must be a double-quoted list separated by spaces") Set<Schema> schemas, 
		@CliOption(key = "file", mandatory = false, help = "The file to save the metadata to") File file,
		@CliOption(key = "enableViews", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Display database views") boolean view) {

		dbreOperations.displayDatabaseMetadata(schemas, file, view);
	}

	@CliCommand(value = "database reverse engineer", help = "Create and update entities based on database metadata")
	public void serializeDatabaseMetadata(
		@CliOption(key = "schema", mandatory = true, optionContext = "schema", help = "The database schema names. Multiple schema names must be a double-quoted list separated by spaces") Set<Schema> schemas, 
		@CliOption(key = "package", mandatory = false, help = "The package in which new entities will be placed") JavaPackage destinationPackage,
		@CliOption(key = "testAutomatically", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Create automatic integration tests for entities") boolean testAutomatically, 
		@CliOption(key = "enableViews", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Reverse engineer database views") boolean view,
		@CliOption(key = "includeTables", mandatory = false, specifiedDefaultValue = "", optionContext = "include-tables", help = "The tables to include in reverse engineering. Multiple table names must be a double-quoted list separated by spaces") Set<String> includeTables,
		@CliOption(key = "excludeTables", mandatory = false, specifiedDefaultValue = "", optionContext = "exclude-tables", help = "The tables to exclude from reverse engineering. Multiple table names must be a double-quoted list separated by spaces") Set<String> excludeTables,
		@CliOption(key = "includeNonPortableAttributes", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Include non-portable JPA @Column attributes such as 'columnDefinition'") boolean includeNonPortableAttributes,
		@CliOption(key = "activeRecord", mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "true", help = "Generate CRUD active record methods for each entity") boolean activeRecord)
	{
		dbreOperations.reverseEngineerDatabase(schemas, destinationPackage, testAutomatically, view, includeTables, excludeTables, includeNonPortableAttributes, activeRecord);
	}
}
{'fraction_non_alphanumeric': 0.102195716996476, 'fraction_numerical': 0.0010843046896177825, 'mean_word_length': 6.262795275590551, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '19624', 'n_tokens_mistral': 1997, 'n_tokens_neox': 1881, 'n_words': 624}