diff --git a/modules/apis/src/main/java/com/axway/apim/OptionsCommon.java b/modules/apis/src/main/java/com/axway/apim/OptionsCommon.java new file mode 100644 index 000000000..d8dce5563 --- /dev/null +++ b/modules/apis/src/main/java/com/axway/apim/OptionsCommon.java @@ -0,0 +1,24 @@ +package com.axway.apim; + +import com.axway.apim.lib.CLIOptions; +import org.apache.commons.cli.Option; + +public class OptionsCommon { + + public void addDeprecateAndRetired(CLIOptions options){ + Option option = new Option("refAPIDeprecate", true, "If set the old/reference API will be flagged as deprecated. Defaults to false."); + option.setRequired(false); + option.setArgName("true"); + options.addOption(option); + + option = new Option("refAPIRetire", true, "If set the old/reference API will be retired. Default to false."); + option.setRequired(false); + option.setArgName("true"); + options.addOption(option); + + option = new Option("refAPIRetireDate", true, "Sets the retirement date of the old API. Supported formats: \"dd.MM.yyyy\", \"dd/MM/yyyy\", \"yyyy-MM-dd\", \"dd-MM-yyyy\""); + option.setRequired(false); + option.setArgName("2021/06/30"); + options.addOption(option); + } +} diff --git a/modules/apis/src/main/java/com/axway/apim/api/export/lib/cli/CLIAPIUpgradeAccessOptions.java b/modules/apis/src/main/java/com/axway/apim/api/export/lib/cli/CLIAPIUpgradeAccessOptions.java index 3e272caef..7e9552040 100644 --- a/modules/apis/src/main/java/com/axway/apim/api/export/lib/cli/CLIAPIUpgradeAccessOptions.java +++ b/modules/apis/src/main/java/com/axway/apim/api/export/lib/cli/CLIAPIUpgradeAccessOptions.java @@ -1,5 +1,6 @@ package com.axway.apim.api.export.lib.cli; +import com.axway.apim.OptionsCommon; import com.axway.apim.lib.utils.rest.Console; import org.apache.commons.cli.Option; @@ -45,21 +46,7 @@ public void addOptions() { option.setRequired(false); option.setArgName("*Org A*"); addOption(option); - - option = new Option("refAPIDeprecate", true, "If set the old/reference API will be flagged as deprecated. Defaults to false."); - option.setRequired(false); - option.setArgName("true"); - addOption(option); - - option = new Option("refAPIRetire", true, "If set the old/reference API will be retired. Default to false."); - option.setRequired(false); - option.setArgName("true"); - addOption(option); - - option = new Option("refAPIRetireDate", true, "Sets the retirement date of the old API. Supported formats: \"dd.MM.yyyy\", \"dd/MM/yyyy\", \"yyyy-MM-dd\", \"dd-MM-yyyy\""); - option.setRequired(false); - option.setArgName("2021/06/30"); - addOption(option); + new OptionsCommon().addDeprecateAndRetired(this); } @Override diff --git a/modules/apis/src/main/java/com/axway/apim/apiimport/lib/cli/CLIAPIImportOptions.java b/modules/apis/src/main/java/com/axway/apim/apiimport/lib/cli/CLIAPIImportOptions.java index 44ce97293..9b5472317 100644 --- a/modules/apis/src/main/java/com/axway/apim/apiimport/lib/cli/CLIAPIImportOptions.java +++ b/modules/apis/src/main/java/com/axway/apim/apiimport/lib/cli/CLIAPIImportOptions.java @@ -1,5 +1,6 @@ package com.axway.apim.apiimport.lib.cli; +import com.axway.apim.OptionsCommon; import com.axway.apim.lib.utils.rest.Console; import org.apache.commons.cli.Option; @@ -96,20 +97,9 @@ public void addOptions() { option.setRequired(false); addOption(option); - option = new Option("refAPIDeprecate", true, "If set the old/reference API will be flagged as deprecated. Defaults to false."); - option.setRequired(false); - option.setArgName("true"); - addOption(option); + new OptionsCommon().addDeprecateAndRetired(this); - option = new Option("refAPIRetire", true, "If set the old/reference API will be retired. Default to false."); - option.setRequired(false); - option.setArgName("true"); - addOption(option); - option = new Option("refAPIRetireDate", true, "Sets the retirement date of the old API. Supported formats: \"dd.MM.yyyy\", \"dd/MM/yyyy\", \"yyyy-MM-dd\", \"dd-MM-yyyy\""); - option.setRequired(false); - option.setArgName("2021/06/30"); - addOption(option); } @Override