Skip to content

Commit

Permalink
Merge pull request #567 from soul2zimate/JBEAP-26694-1.1.x
Browse files Browse the repository at this point in the history
[JBEAP-26694] install feature pack based on the user input
  • Loading branch information
spyrkob committed Mar 13, 2024
2 parents 5462d60 + 7bc120c commit 16083df
Showing 1 changed file with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,29 +83,33 @@ public Integer call() throws Exception {
return ReturnCodes.INVALID_ARGUMENTS;
}

final boolean accepted;
if (!skipConfirmation) {
console.confirm(CliMessages.MESSAGES.featuresAddPrompt(),
accepted = console.confirm(CliMessages.MESSAGES.featuresAddPrompt(),
CliMessages.MESSAGES.featuresAddPromptAccepted(),
CliMessages.MESSAGES.featuresAddPromptCancelled());
} else {
console.println(CliMessages.MESSAGES.featuresAddPromptAccepted());
accepted = true;
}

try {
featuresAddAction.addFeaturePackWithLayers(fpl, layers, parseConfigName(config));
} catch (FeaturesAddAction.LayerNotFoundException e) {
if (!e.getSupportedLayers().isEmpty()) {
console.error(CliMessages.MESSAGES.layerNotSupported(fpl, e.getLayers(), e.getSupportedLayers()));
} else {
console.error(CliMessages.MESSAGES.layerNotSupported(fpl));
if(accepted) {
try {
featuresAddAction.addFeaturePackWithLayers(fpl, layers, parseConfigName(config));
} catch (FeaturesAddAction.LayerNotFoundException e) {
if (!e.getSupportedLayers().isEmpty()) {
console.error(CliMessages.MESSAGES.layerNotSupported(fpl, e.getLayers(), e.getSupportedLayers()));
} else {
console.error(CliMessages.MESSAGES.layerNotSupported(fpl));
}
return ReturnCodes.INVALID_ARGUMENTS;
} catch (FeaturesAddAction.ModelNotDefinedException e) {
console.error(CliMessages.MESSAGES.modelNotSupported(fpl, e.getModel(), e.getSupportedModels()));
return ReturnCodes.INVALID_ARGUMENTS;
} catch (FeaturesAddAction.ConfigurationNotFoundException e) {
console.error(CliMessages.MESSAGES.galleonConfigNotSupported(fpl, e.getModel(), e.getName()));
return ReturnCodes.INVALID_ARGUMENTS;
}
return ReturnCodes.INVALID_ARGUMENTS;
} catch (FeaturesAddAction.ModelNotDefinedException e) {
console.error(CliMessages.MESSAGES.modelNotSupported(fpl, e.getModel(), e.getSupportedModels()));
return ReturnCodes.INVALID_ARGUMENTS;
} catch (FeaturesAddAction.ConfigurationNotFoundException e) {
console.error(CliMessages.MESSAGES.galleonConfigNotSupported(fpl, e.getModel(), e.getName()));
return ReturnCodes.INVALID_ARGUMENTS;
}

final float totalTime = (System.currentTimeMillis() - startTime) / 1000f;
Expand Down

0 comments on commit 16083df

Please sign in to comment.