@CliAvailabilityIndicator({METADATA_FOR_MODULE_COMMAND, METADATA_CACHE_COMMAND, METADATA_FOR_ID_COMMAND, METADATA_FOR_TYPE_COMMAND, METADATA_STATUS_COMMAND, METADATA_TRACE_COMMAND}) public boolean isModuleMetadataAvailable() { return projectOperations.getFocusedModule() != null; }
private boolean isModuleRequired(ShellContext shellContext) { Pom module = projectOperations.getFocusedModule(); if (!isModuleVisible(shellContext) || typeLocationService.hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
@CliOptionAutocompleteIndicator(command = "service", param = "class", help = "--class option should be a new class.", validate = false, includeSpaceOnFinish = false) public List<String> getClassPossibleResults(ShellContext shellContext) { List<String> allPossibleValues = new ArrayList<String>(); // Add all modules to completions list Collection<String> modules = projectOperations.getModuleNames(); for (String module : modules) { if (StringUtils.isNotBlank(module) && !module.equals(projectOperations.getFocusedModule().getModuleName())) { allPossibleValues.add(module.concat(LogicalPath.MODULE_PATH_SEPARATOR) .concat(JavaPackageConverter.TOP_LEVEL_PACKAGE_SYMBOL).concat(".")); } else if (!projectOperations.isMultimoduleProject()) { // Add only JavaPackage and JavaType completion allPossibleValues.add(String.format("%s.service.impl.", JavaPackageConverter.TOP_LEVEL_PACKAGE_SYMBOL)); } } // Always add base package allPossibleValues.add("~."); return allPossibleValues; }
@CliOptionAutocompleteIndicator(command = "repository jpa", param = "interface", help = "--interface option should be a new type.", validate = false, includeSpaceOnFinish = false) public List<String> getInterfacePossibleResults(ShellContext shellContext) { List<String> allPossibleValues = new ArrayList<String>(); // Add all modules to completions list Collection<String> modules = projectOperations.getModuleNames(); for (String module : modules) { if (StringUtils.isNotBlank(module) && !module.equals(projectOperations.getFocusedModule().getModuleName())) { allPossibleValues.add(module.concat(LogicalPath.MODULE_PATH_SEPARATOR) .concat(JavaPackageConverter.TOP_LEVEL_PACKAGE_SYMBOL).concat(".")); } else if (!projectOperations.isMultimoduleProject()) { // Add only JavaPackage completion allPossibleValues.add(String.format("%s.repository.", JavaPackageConverter.TOP_LEVEL_PACKAGE_SYMBOL)); } } // Always add base package allPossibleValues.add(JavaPackageConverter.TOP_LEVEL_PACKAGE_SYMBOL.concat(".")); return allPossibleValues; }
@CliOptionAutocompleteIndicator(command = "service", param = "interface", help = "--interface option should be a new interface.", validate = false, includeSpaceOnFinish = false) public List<String> getInterfacePossibleResults(ShellContext shellContext) { List<String> allPossibleValues = new ArrayList<String>(); // Add all modules to completions list Collection<String> modules = projectOperations.getModuleNames(); for (String module : modules) { if (StringUtils.isNotBlank(module) && !module.equals(projectOperations.getFocusedModule().getModuleName())) { allPossibleValues.add(module.concat(LogicalPath.MODULE_PATH_SEPARATOR) .concat(JavaPackageConverter.TOP_LEVEL_PACKAGE_SYMBOL).concat(".")); } else if (!projectOperations.isMultimoduleProject()) { // Add only JavaPackage and JavaType completion allPossibleValues.add(String.format("%s.service.api.", JavaPackageConverter.TOP_LEVEL_PACKAGE_SYMBOL)); } } // Always add base package allPossibleValues.add("~."); return allPossibleValues; }
public JavaPackage convertFromText(String value, final Class<?> requiredType, final String optionContext) { if (StringUtils.isBlank(value)) { return null; } Pom module = projectOperations.getFocusedModule(); if (value.contains(MODULE_PATH_SEPARATOR)) { final String moduleName = value.substring(0, value.indexOf(MODULE_PATH_SEPARATOR)); module = projectOperations.getPomFromModuleName(moduleName); value = value.substring(value.indexOf(MODULE_PATH_SEPARATOR) + 1, value.length()).trim(); if (StringUtils.contains(optionContext, UPDATE)) { projectOperations.setModule(module); } } String moduleName = module == null ? null : module.getModuleName(); JavaPackage result = new JavaPackage(convertToFullyQualifiedPackageName(module, value), moduleName); if (optionContext != null && (optionContext.contains(UPDATE) || optionContext.contains(UPDATELAST))) { lastUsed.setPackage(result, module); } return result; }
@CliOptionMandatoryIndicator(command = "test integration", params = {"module"}) public boolean isModuleRequired(ShellContext shellContext) { Pom module = projectOperations.getFocusedModule(); if (!isModuleVisible(shellContext) || typeLocationService.hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
@CliOptionMandatoryIndicator(command = "web flow", params = "module") public boolean isModuleRequired(ShellContext shellContext) { Pom module = projectOperations.getFocusedModule(); if (!isModuleVisible(shellContext) || typeLocationService.hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
@CliOptionMandatoryIndicator(command = "email receiver setup", params = "module") public boolean isModuleRequiredReceiverSetup(ShellContext shellContext) { Pom module = projectOperations.getFocusedModule(); if (!isModuleVisibleReceiverSetup(shellContext) || typeLocationService.hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
@CliOptionMandatoryIndicator(params = "module", command = "jpa setup") public boolean isModuleRequired(ShellContext shellContext) { Pom module = projectOperations.getFocusedModule(); if (!isModuleVisible(shellContext) || typeLocationService.hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
@CliOptionMandatoryIndicator(params = "module", command = "security setup") public boolean isModuleRequired(ShellContext shellContext) { Pom module = projectOperations.getFocusedModule(); if (!isModuleVisible(shellContext) || typeLocationService.hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
@CliOptionMandatoryIndicator(command = "email sender setup", params = "module") public boolean isModuleRequiredSenderSetup(ShellContext shellContext) { Pom module = projectOperations.getFocusedModule(); if (!isModuleVisibleSenderSetup(shellContext) || typeLocationService.hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
@CliCommand(value = METADATA_FOR_MODULE_COMMAND, help = "Shows the ProjectMetadata for the indicated project module.") public String metadataForModule(@CliOption(key = {"", "module"}, mandatory = false, optionContext = INCLUDE_CURRENT_MODULE, help = "The module for which to retrieve the metadata. " + "Default if option not present: the Roo Shell focused module.") final Pom pom) { final Pom targetPom = ObjectUtils.defaultIfNull(pom, projectOperations.getFocusedModule()); if (targetPom == null) { return "This project has no modules"; } final String projectMID = ProjectMetadata.getProjectIdentifier(targetPom.getModuleName()); return metadataService.get(projectMID).toString(); }
@CliOptionMandatoryIndicator(params = "package", command = "jpa audit setup") public boolean isPackageRequired(ShellContext shellContext) { Pom module = getProjectOperations().getFocusedModule(); if (getTypeLocationService().getModuleNames(ModuleFeatureName.APPLICATION).size() <= 1 || getTypeLocationService().hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
private void setPromptPath(final String fullyQualifiedName) { if (topLevelPackage == null) { return; } String moduleName = ""; if (module != null && StringUtils.isNotBlank(module.getModuleName())) { moduleName = AnsiEscapeCode.decorate(module.getModuleName() + MODULE_PATH_SEPARATOR, AnsiEscapeCode.FG_CYAN); } topLevelPackage = new JavaPackage(typeLocationService.getTopLevelPackageForModule(projectOperations .getFocusedModule())); final String path = moduleName + fullyQualifiedName.replace(topLevelPackage.getFullyQualifiedPackageName(), TOP_LEVEL_PACKAGE_SYMBOL); shell.setPromptPath(path, StringUtils.isNotBlank(moduleName)); }
@CliOptionMandatoryIndicator(params = "module", command = "jpa audit setup") public boolean isModuleRequired(ShellContext shellContext) { Pom module = getProjectOperations().getFocusedModule(); if (!isModuleVisible(shellContext) || getTypeLocationService().hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
} else { targetModule = projectOperations.getFocusedModule(); heading = targetModule.getModuleName(); prefix = "";
/** * This indicator checks if --module parameter should be mandatory or not. * * If focused module doesn't match with the properties of ModuleFeature * APPLICATION, --module parameter should be mandatory. * * @param shellContext * @return */ @CliOptionMandatoryIndicator(command = "web mvc setup", params = {"module"}) public boolean isModuleRequired(ShellContext shellContext) { Pom module = getProjectOperations().getFocusedModule(); if (!isModuleVisible(shellContext) || getTypeLocationService().hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
/** * This indicator checks if --module parameter should be mandatory or not. * * If focused module doesn't match with the properties of ModuleFeature APPLICATION, * --module parameter should be mandatory. * * @param shellContext * @return */ @CliOptionMandatoryIndicator(command = "web mvc view setup", params = {"module"}) public boolean isModuleRequired(ShellContext shellContext) { Pom module = getProjectOperations().getFocusedModule(); if (!isModuleVisible(shellContext) || getTypeLocationService().hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }
/** * This indicator checks if --module parameter should be mandatory or not. * * If focused module doesn't match with the properties of ModuleFeature * APPLICATION, --module parameter should be mandatory. * * @param shellContext * @return */ @CliOptionMandatoryIndicator(command = "web mvc language", params = {"module"}) public boolean isModuleRequired(ShellContext shellContext) { Pom module = getProjectOperations().getFocusedModule(); if (!isModuleVisible(shellContext) || getTypeLocationService().hasModuleFeature(module, ModuleFeatureName.APPLICATION)) { return false; } return true; }