Skip to content

Commit

Permalink
- Fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rathnapandi committed Oct 24, 2024
1 parent 7b45dc6 commit 2820a8f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
24 changes: 24 additions & 0 deletions modules/apis/src/main/java/com/axway/apim/OptionsCommon.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2820a8f

Please sign in to comment.