Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
clausnagel committed Nov 6, 2024
1 parent 4c470b8 commit ac6c158
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import picocli.CommandLine;

public class IndexOption implements Option {
public class IndexOptions implements Option {
public enum Mode {keep, drop, drop_create}

@CommandLine.Option(names = "--index-mode", defaultValue = "keep",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import picocli.CommandLine;

public class ThreadsOption implements Option {
public class ThreadsOptions implements Option {
@CommandLine.Option(names = "--threads",
description = "Number of threads to use for parallel processing.")
private Integer threads;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Arrays;
import java.util.List;

public class TypeNameOption implements Option {
public class TypeNameOptions implements Option {
@CommandLine.Option(names = {"-t", "--type-name"}, split = ",", paramLabel = "<[prefix:]name>", required = true,
description = "Names of the features to process.")
private String[] typeNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum Mode {delete, terminate}
private Mode mode;

@CommandLine.Mixin
protected IndexOption indexOption;
protected IndexOptions indexOptions;

@CommandLine.Option(names = "--preview",
description = "Run in preview mode. Features will not be deleted.")
Expand Down Expand Up @@ -111,10 +111,10 @@ public Integer call() throws ExecutionException {
tempDirectory,
databaseManager.getAdapter());

IndexOption.Mode indexMode = indexOption.getMode();
IndexOptions.Mode indexMode = indexOptions.getMode();
AtomicLong counter = new AtomicLong();

if (indexMode != IndexOption.Mode.keep) {
if (indexMode != IndexOptions.Mode.keep) {
logger.info("Dropping database indexes...");
helper.dropIndexes(databaseManager.getAdapter());
}
Expand Down Expand Up @@ -159,7 +159,7 @@ public Integer call() throws ExecutionException {
}
}

if (shouldRun && indexMode == IndexOption.Mode.drop_create) {
if (shouldRun && indexMode == IndexOptions.Mode.drop_create) {
logger.info("Re-creating database indexes. This operation may take some time...");
helper.createIndexes(databaseManager.getAdapter());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import org.citydb.cli.common.CountLimitOptions;
import org.citydb.cli.common.FilterOptions;
import org.citydb.cli.common.Option;
import org.citydb.cli.common.TypeNameOption;
import org.citydb.cli.common.TypeNameOptions;
import org.citydb.query.Query;
import org.citydb.query.filter.encoding.FilterParseException;
import picocli.CommandLine;

public class QueryOptions implements Option {
@CommandLine.ArgGroup(exclusive = false)
private TypeNameOption typeNameOption;
private TypeNameOptions typeNameOptions;

@CommandLine.ArgGroup(exclusive = false)
private FilterOptions filterOptions;
Expand All @@ -41,8 +41,8 @@ public class QueryOptions implements Option {

public Query getQuery() throws FilterParseException {
Query query = new Query();
if (typeNameOption != null) {
query.setFeatureTypes(typeNameOption.getTypeNames());
if (typeNameOptions != null) {
query.setFeatureTypes(typeNameOptions.getTypeNames());
}

if (filterOptions != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public abstract class ExportController implements Command {
protected Path tempDirectory;

@CommandLine.Mixin
protected ThreadsOption threadsOption;
protected ThreadsOptions threadsOptions;

@CommandLine.Mixin
protected CrsOptions crsOptions;
Expand Down Expand Up @@ -260,8 +260,8 @@ protected ExportOptions getExportOptions() throws ExecutionException {
throw new ExecutionException("Failed to get export options from config.", e);
}

if (threadsOption.getNumberOfThreads() != null) {
exportOptions.setNumberOfThreads(threadsOption.getNumberOfThreads());
if (threadsOptions.getNumberOfThreads() != null) {
exportOptions.setNumberOfThreads(threadsOptions.getNumberOfThreads());
}

if (crsOptions.getTargetSrs() != null) {
Expand Down Expand Up @@ -302,8 +302,8 @@ protected WriteOptions getWriteOptions(ExportOptions exportOptions, DatabaseAdap
writeOptions.setTempDirectory(tempDirectory.toString());
}

if (threadsOption.getNumberOfThreads() != null) {
writeOptions.setNumberOfThreads(threadsOption.getNumberOfThreads());
if (threadsOptions.getNumberOfThreads() != null) {
writeOptions.setNumberOfThreads(threadsOptions.getNumberOfThreads());
}

if (outputFileOptions.getEncoding() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.citydb.cli.common.CountLimitOptions;
import org.citydb.cli.common.FilterOptions;
import org.citydb.cli.common.Option;
import org.citydb.cli.common.TypeNameOption;
import org.citydb.cli.common.TypeNameOptions;
import org.citydb.query.Query;
import org.citydb.query.filter.Filter;
import org.citydb.query.filter.encoding.FilterParseException;
Expand All @@ -33,13 +33,13 @@

public class QueryOptions implements Option {
@CommandLine.ArgGroup(exclusive = false)
private TypeNameOption typeNameOption;
private TypeNameOptions typeNameOptions;

@CommandLine.ArgGroup(exclusive = false)
private FilterOptions filterOptions;

@CommandLine.ArgGroup(exclusive = false)
private SortingOption sortingOption;
private SortingOptions sortingOptions;

@CommandLine.ArgGroup(exclusive = false)
private CountLimitOptions countLimitOptions;
Expand All @@ -52,8 +52,8 @@ public class QueryOptions implements Option {

public Query getQuery() throws FilterParseException {
Query query = new Query();
if (typeNameOption != null) {
query.setFeatureTypes(typeNameOption.getTypeNames());
if (typeNameOptions != null) {
query.setFeatureTypes(typeNameOptions.getTypeNames());
}

if (filterOptions != null) {
Expand All @@ -63,8 +63,8 @@ public Query getQuery() throws FilterParseException {
query.setFilter(Filter.of(QueryHelper.terminationDateIsNull()));
}

if (sortingOption != null) {
query.setSorting(sortingOption.getSorting());
if (sortingOptions != null) {
query.setSorting(sortingOptions.getSorting());
}

if (countLimitOptions != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.citydb.query.sorting.Sorting;
import picocli.CommandLine;

public class SortingOption implements Option {
public class SortingOptions implements Option {
@CommandLine.Option(names = {"-s", "--sort-by"}, split = ",", paramLabel = "<property[+|-]>", required = true,
description = "Properties and sort orders for sorting features.")
private String[] sortBy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ public abstract class ImportController implements Command {
protected Path tempDirectory;

@CommandLine.Mixin
protected ThreadsOption threadsOption;
protected ThreadsOptions threadsOptions;

@CommandLine.Option(names = "--preview",
description = "Run in preview mode. Features will not be imported.")
protected boolean preview;

@CommandLine.Mixin
protected IndexOption indexOption;
protected IndexOptions indexOptions;

@CommandLine.Option(names = "--compute-extent",
description = "Compute and overwrite extents of features.")
Expand Down Expand Up @@ -114,9 +114,9 @@ protected boolean doImport() throws ExecutionException {
ImportOptions importOptions = getImportOptions();

ImportLogger importLogger = new ImportLogger(preview, databaseManager.getAdapter());
IndexOption.Mode indexMode = indexOption.getMode();
IndexOptions.Mode indexMode = indexOptions.getMode();

if (indexMode != IndexOption.Mode.keep) {
if (indexMode != IndexOptions.Mode.keep) {
logger.info("Dropping database indexes...");
helper.dropIndexes(databaseManager.getAdapter());
}
Expand Down Expand Up @@ -171,7 +171,7 @@ protected boolean doImport() throws ExecutionException {
}
}

if (shouldRun && indexMode == IndexOption.Mode.drop_create) {
if (shouldRun && indexMode == IndexOptions.Mode.drop_create) {
logger.info("Re-creating database indexes. This operation may take some time...");
helper.createIndexes(databaseManager.getAdapter());
}
Expand Down Expand Up @@ -219,8 +219,8 @@ protected ReadOptions getReadOptions() throws ExecutionException {
readOptions.setTempDirectory(tempDirectory.toString());
}

if (threadsOption.getNumberOfThreads() != null) {
readOptions.setNumberOfThreads(threadsOption.getNumberOfThreads());
if (threadsOptions.getNumberOfThreads() != null) {
readOptions.setNumberOfThreads(threadsOptions.getNumberOfThreads());
}

if (inputFileOptions.getEncoding() != null) {
Expand All @@ -246,8 +246,8 @@ protected ImportOptions getImportOptions() throws ExecutionException {
importOptions.setTempDirectory(tempDirectory.toString());
}

if (threadsOption.getNumberOfThreads() != null) {
importOptions.setNumberOfThreads(threadsOption.getNumberOfThreads());
if (threadsOptions.getNumberOfThreads() != null) {
importOptions.setNumberOfThreads(threadsOptions.getNumberOfThreads());
}

return importOptions;
Expand Down

0 comments on commit ac6c158

Please sign in to comment.