Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiyanwso2 committed Aug 16, 2024
1 parent 6ef372d commit 16028cd
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public TemplateGenerator execute(ToolContext toolContext) throws CodeGenExceptio
String targetRoot = ballerinaProjectToolConfig.getTargetDir();
String targetDirectory = targetRoot + File.separator;
BallerinaProjectGenerator cdsBalGenerator = new BallerinaProjectGenerator(targetDirectory);

Map<String, Object> generatorProperties = new HashMap<>();
generatorProperties.put(CONFIG, ballerinaProjectToolConfig);
cdsBalGenerator.setGeneratorProperties(generatorProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public BallerinaProjectGenerator(String targetDir) throws CodeGenException {
public void generate(ToolContext toolContext, Map<String, Object> generatorProperties) throws CodeGenException {

BallerinaProjectToolConfig ballerinaProjectToolConfig = (BallerinaProjectToolConfig) generatorProperties.get(CONFIG);

//evaluate usage of ? typed map as generator properties.
String packagePath = this.getTargetDir() + ballerinaProjectToolConfig.getMetadataConfig().getNamePrefix() + File.separator;

// Provide option to check and overwrite the existing package
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ballerina/http;
import thiyanarumugam/health.fhir.cds;
import ballerinax/health.fhir.cds;

service http:InterceptableService / on new http:Listener(8080) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ballerina/http;
import ballerina/lang.regexp;
import thiyanarumugam/health.fhir.cds;
import ballerinax/health.fhir.cds;

service class ResponseErrorInterceptor {
*http:ResponseErrorInterceptor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ballerina/constraint;

import ballerina/http;
import thiyanarumugam/health.fhir.cds;
import ballerinax/health.fhir.cds;

# This method will engage the followings
# Request validation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import thiyanarumugam/health.fhir.cds;
import ballerinax/health.fhir.cds;

#set ($map = $service.getCdsHooks())
# This method acts like an interface to route the request appropriate decision support
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import thiyanarumugam/health.fhir.cds;
import ballerinax/health.fhir.cds;

#set ($map = $service.getCdsHooks())
# This method acts like an interface to route the feedback request appropriate feedback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public boolean engageSubCommand(List<String> argList) {
argsMap.put(CMD_OPTION_ORG_NAME, orgName);
argsMap.put(CMD_OPTION_PACKAGE_VERSION, packageVersion);
getTargetOutputPath();

//spec path is the last argument
//resolved path from the input parameter
Path cdsToolConfigFilePath;
Expand All @@ -157,6 +158,7 @@ public boolean engageSubCommand(List<String> argList) {
printStream.println(HealthCmdConstants.PrintStrings.INVALID_SPEC_PATH);
throw new BLauncherException();
}

Handler toolHandler;
try {
toolHandler = HandlerFactory.createHandler(toolName, mode, printStream, cdsToolConfigFilePath.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ public class HealthCmdConstants {
public class PrintStrings {

public static final String HELP_FOR_MORE_INFO = "[INFO] Try bal health --help for more information.";
public static final String TEMPLATE_GEN_SUCCESS = "[INFO] Ballerina FHIR API templates generation completed " +
public static final String TEMPLATE_GEN_SUCCESS = "[INFO] Ballerina templates generation completed " +
"successfully. Generated templates can be found at: ";
public static final String PKG_GEN_SUCCESS = "[INFO] Ballerina FHIR package generation completed successfully."
+ " Generated package can be found at: ";

public static final String INVALID_SPEC_PATH = "[ERROR] Invalid specification path received.";
public static final String HELP_NOT_AVAILABLE = "[ERROR] Helper text is not available.";
public static final String HELP_ERROR = "[ERROR] An Error occurred internally while fetching the Help text.";
public static final String INVALID_NUM_OF_ARGS = "[ERROR] Invalid number of arguments received for FHIR tool "
+ "command.";
public static final String INVALID_MODE = "[ERROR] Invalid mode received for FHIR tool command.";
public static final String INVALID_NUM_OF_ARGS = "[ERROR] Invalid number of arguments received for the command.";
public static final String INVALID_MODE = "[ERROR] Invalid mode received for tool command.";
public static final String PKG_NAME_REQUIRED = "[ERROR] Package name [--package-name] is required for package "
+ "generation.";
public static final String DEPENDENT_REQUIRED = "[ERROR] Dependent package [--dependent-package] is required "
Expand Down

0 comments on commit 16028cd

Please sign in to comment.