@CliOptionMandatoryIndicator(command = "service", params = "repository") public boolean isRepositoryParameterMandatory(ShellContext shellContext) { if (shellContext.getParameters().containsKey("entity") && projectOperations.isMultimoduleProject()) { return true; } return false; }
@CliOptionMandatoryIndicator(command = "service", params = "interface") public boolean isInterfaceParameterMandatory(ShellContext shellContext) { if (shellContext.getParameters().containsKey("repository") && projectOperations.isMultimoduleProject()) { return true; } return false; }
/** * This indicator says if --interface parameter should be mandatory or not * * If --entity parameter has been specified and we are working under multimodule * project, --interface parameter will be mandatory. * * @param context ShellContext * @return */ @CliOptionMandatoryIndicator(params = "interface", command = "repository jpa") public boolean isInterfaceParameterMandatory(ShellContext context) { if (context.getParameters().containsKey("entity") && projectOperations.isMultimoduleProject()) { return true; } return false; }
@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; }
@CliOptionAutocompleteIndicator( command = "jms sender", param = "destinationName", validate = false, includeSpaceOnFinish = false, help = "--destinationName parameter composed by application type module and destination name. If focus module is application type, will be selected by default") public List<String> returnApplicationModules(ShellContext shellContext) { List<String> applicationModules = new ArrayList<String>(); Collection<String> moduleNames = typeLocationService.getModuleNames(ModuleFeatureName.APPLICATION); if (projectOperations.isMultimoduleProject() && moduleNames.size() > 1) { String focusedModuleName = projectOperations.getFocusedModuleName(); for (String moduleName : moduleNames) { if (!focusedModuleName.equals(moduleName)) { applicationModules.add(moduleName.concat(":")); } } } return applicationModules; }
if (projectOperations.isMultimoduleProject()) { Collection<String> modules = projectOperations.getModuleNames(); for (String module : modules) {
/** * Writes a label with a default exception message on messages.properties files * * @param exception * @param moduleName */ private void addExceptionLabel(JavaType exception, String moduleName) { if (getProjectOperations().isMultimoduleProject()) { Validate.notBlank(moduleName, "Module name is required"); } final LogicalPath resourcesPath = LogicalPath.getInstance(Path.SRC_MAIN_RESOURCES, moduleName); final String targetDirectory = getPathResolver().getIdentifier(resourcesPath, ""); final String exceptionName = exception.getSimpleTypeName(); final String labelKey = LABEL_PREFIX.concat(exceptionName.toLowerCase()); Set<I18n> supportedLanguages = getI18nSupport().getSupportedLanguages(); for (I18n i18n : supportedLanguages) { String messageBundle = String.format("messages_%s.properties", i18n.getLocale().getLanguage()); String bundlePath = String.format("%s%s%s", targetDirectory, AntPathMatcher.DEFAULT_PATH_SEPARATOR, messageBundle); if (getFileManager().exists(bundlePath)) { getPropFilesManager().addPropertyIfNotExists(resourcesPath, messageBundle, labelKey, String.format(LABEL_MESSAGE, exceptionName), true); } } // Always update english message bundles getPropFilesManager().addPropertyIfNotExists(resourcesPath, "messages.properties", labelKey, String.format(LABEL_MESSAGE, exceptionName), true); }
if (getProjectOperations().isMultimoduleProject()) { Collection<String> moduleNames = getTypeLocationService().getModuleNames(ModuleFeatureName.APPLICATION);
JavaType interfaceType, JavaType implType) { Validate.notNull(domainType, "ERROR: Domain type required to be able to generate service."); if (projectOperations.isMultimoduleProject()) { Validate .notNull(repositoryType,
String module = ""; String topLevelPackage = ""; if (getProjectOperations().isMultimoduleProject()) {
if (getProjectOperations().isMultimoduleProject()) {
if (projectOperations.isMultimoduleProject()) { String managedEntityModuleName = managedEntity.getModule(); Pom managedEntityModule = projectOperations.getPomFromModuleName(managedEntityModuleName);
if (projectOperations.isMultimoduleProject()) { String managedEntityModuleName = managedEntity.getModule(); Pom managedEntityModule = projectOperations.getPomFromModuleName(managedEntityModuleName);
if (projectOperations.isMultimoduleProject()) {
if (projectOperations.isMultimoduleProject()) { String managedEntityModuleName = managedEntity.getModule(); Pom managedEntityModule = projectOperations.getPomFromModuleName(managedEntityModuleName);
/** * Add dependencies between modules if needed * * @param entity * @param relatedRepository * @param relatedService * @param controllerToUpdateOrCreate */ private void addModuleDependencies(JavaType entity, ClassOrInterfaceTypeDetails relatedRepository, JavaType relatedService, ClassOrInterfaceTypeDetails controllerToUpdateOrCreate) { if (projectOperations.isMultimoduleProject()) { // Add service module dependency projectOperations.addModuleDependency(controllerToUpdateOrCreate.getType().getModule(), relatedService.getModule()); // Add repository module dependency projectOperations.addModuleDependency(controllerToUpdateOrCreate.getType().getModule(), relatedRepository.getType().getModule()); // Add model module dependency projectOperations.addModuleDependency(controllerToUpdateOrCreate.getType().getModule(), entity.getModule()); } }
final List<Element> plugins; if (getProjectOperations().isMultimoduleProject()) { dependencies = XmlUtils if (getProjectOperations().isMultimoduleProject()) {
if (projectOperations.isMultimoduleProject()) { projectOperations.addDependency(implType.getModule(), new Dependency("org.springframework", "spring-tx", "", DependencyType.JAR, DependencyScope.COMPILE));