### Bash Example: Interactive Process Setup Execution Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Demonstrates the execution of a process property within an interactive setup, showing user prompts, task execution, and the resulting applied properties. This example highlights user feedback and the outcome of a configured process. ```bash === MyModule Integration === (2 properties) 🔧 Property: myModule.variables.setup [PROCESS] ℹ️ MyModule variables configuration 💡 Help: Executes automated setup to configure module integration variables 🎯 Execute process? (Y/n): Y 🚀 Executing task: myModule.variables.setup... 🔧 Configuring MyModule integration... ✅ MyModule configuration completed: 5 properties configured 📊 Process Results Applied: 🔧 myModule.api.endpoint = https://api.mymodule.com 🔧 myModule.api.key = ******** 🔧 myModule.workspace.id = ws_abc123 🔧 myModule.features.enabled = true 🔧 myModule.version = 1.0.0 🔖 Process property marked as: EXECUTED:5_properties_configured ``` -------------------------------- ### Etendo Interactive Setup Configuration Summary Example (Text) Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Demonstrates the confirmation summary presented by the Etendo interactive setup before applying changes. It lists configured properties, categorizes them, masks sensitive data, and prompts for final user confirmation. ```text 📊 Configuration Summary ============================================================ 📋 Database Configuration: 🔧 bbdd.host = localhost 🔧 bbdd.password = ******** 📋 Security Settings: 🔧 githubToken = ******** 📊 Total: 3 properties configured 🔐 Including 2 sensitive properties (shown masked) ✅ Confirm configuration? (Y/N): ``` -------------------------------- ### Complete Installation using Gradle Source: https://github.com/etendosoftware/docs/blob/main/docs/getting-started/interactive-installation.md This code snippet demonstrates how to perform the Etendo installation using Gradle wrapper commands. It covers the installation process for Source, JAR, and Docker formats, along with starting the Tomcat service where applicable. Dependencies can also be listed. ```bash # Installation ./gradlew install smartbuild # Start Tomcat sudo /etc/init.d/tomcat start ``` ```bash # Dependencies ./gradlew dependencies # Installation ./gradlew install smartbuild # Start Tomcat sudo /etc/init.d/tomcat start ``` ```bash # Launch Docker services ./gradlew resources.up # Installation ./gradlew install smartbuild ``` -------------------------------- ### Etendo Interactive Setup Property Configuration Example (Text) Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Illustrates the interactive prompts for configuring properties during the Etendo setup. It shows how the system displays property names, descriptions, current values, and handles secure input for sensitive data like passwords. ```text 📋 Database Configuration ================================================== 🔧 Property: bbdd.host ℹ️ Database server hostname or IP address Current value: localhost ✏️ New value: [Enter to keep current, or type new value] 🔧 Property: bbdd.password ℹ️ Database connection password Current value: ******** 🔐 New value (hidden): [Password input is hidden] ``` -------------------------------- ### Interactive Setup for Etendo Main UI using Gradle Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/getting-started/installation/install-etendo-main-ui.md This command initiates an interactive setup process for the Etendo Main UI. It guides the user through configuring necessary variables for the installation. Dependencies include Gradle and the 'interactive' property must be set to true. ```bash ./gradlew setup -Pinteractive=true --console=plain ``` -------------------------------- ### Run Gradle Setup and Database Installation Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/bundles/platform/docker-management.md These bash commands are used to apply configuration changes and manage the Dockerized Postgres database service. './gradlew setup' applies configuration changes, './gradlew resources.up' starts the database service, and './gradlew install' installs the database from scratch or restores a backup. ```bash ./gradlew setup ``` ```bash ./gradlew resources.up ``` ```bash ./gradlew install ``` -------------------------------- ### Groovy Example: Property Organization and Naming Conventions Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Illustrates Groovy code for organizing project properties with clear descriptions, default values, and specified order. It demonstrates good practices for naming properties, including custom mapping, and contrasts them with less desirable examples. ```groovy // Good examples - include name field and order for clarity api { baseUrl { description = "API base URL" value = "https://api.example.com" name = "api.base.url" order = 10 } connectionTimeout { description = "Connection timeout in seconds" value = "30" name = "api.connection.timeout" order = 20 } retryAttempts { description = "Number of retry attempts" value = "3" name = "api.retry.attempts" order = 30 } // Legacy compatibility example systemUser { description = "System user for API access" value = "etendo_system" name = "api.system.user" // → api.system.user (custom mapping) order = 40 } } // Still avoid api { url { /* too generic */ } timeout { /* unclear which timeout */ } class { /* reserved word */ } } ``` -------------------------------- ### Gradle Task for Process Property Implementation (Groovy) Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md This Gradle task example demonstrates how to implement process property configuration. It supports an optional 'output' parameter, uses the `writeResultsForInteractiveSetup` project closure for JSON output when available, and includes error handling and user feedback. It falls back to console output if the interactive setup writer is not present or fails. ```groovy task 'myModule.variables.setup' { description = "Configures MyModule integration variables" doLast { try { // Get the optional output parameter (may be provided by the interactive runner) def outputPath = project.findProperty('output') // Execute configuration logic println "🔧 Configuring MyModule integration..." // Your custom configuration logic here def apiEndpoint = "https://api.mymodule.com" def workspaceId = generateWorkspaceId() def apiKey = generateApiKey() // Prepare results for the interactive setup def results = [ "myModule.api.endpoint" : apiEndpoint, "myModule.workspace.id" : workspaceId, "myModule.api.key" : apiKey, "myModule.features.enabled": "true", "myModule.version" : "1.0.0" ] // Use the reusable function for JSON output (if the project has the closure) boolean wasWrittenAsJson = false if (project.hasProperty('writeResultsForInteractiveSetup')) { try { // Call the closure; pass outputPath when present wasWrittenAsJson = outputPath ? project.writeResultsForInteractiveSetup(results, outputPath) : project.writeResultsForInteractiveSetup(results) } catch (Exception e) { project.logger.debug("Failed to call project.writeResultsForInteractiveSetup: ${e.message}") wasWrittenAsJson = false } } else { project.logger.lifecycle('Interactive setup writer not registered on project; falling back to console output.') } if (wasWrittenAsJson) { println "✅ MyModule configuration completed: ${results.size()} properties configured" } else { throw new RuntimeException("Failed to write configuration results") } } catch (Exception e) { throw new RuntimeException("MyModule setup failed: ${e.message}", e) } } } ``` -------------------------------- ### Groovy config.gradle Example for Module Configuration Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Provides a comprehensive example of a `config.gradle` file using Groovy's ConfigSlurper. This file defines various configuration blocks for API settings, automation processes, feature flags, and database connections, each with detailed metadata. ```groovy // modules/com.yourcompany.yourmodule/config.gradle /** * Interactive configuration for Your Custom Module */ // API Configuration api { baseUrl { description = "Base URL for the external API service" value = "https://api.example.com" help = "Full URL including protocol and port. Example: https://api.example.com:8443/v1" sensitive = false required = true group = "API Configuration" name = "api.base.url" order = 10 } apiKey { description = "API key for authentication with external service" value = "" help = "Secret key obtained from your API provider dashboard" sensitive = true required = false group = "API Configuration" name = "API_SECRET_KEY" order = 20 } timeout { description = "API request timeout in seconds" value = "30" help = "Maximum time to wait for API responses before timing out" sensitive = false required = false group = "API Configuration" name = "api.timeout.seconds" order = 30 } // Example using custom name field for specific gradle.properties key customEndpoint { description = "Custom API endpoint URL" value = "" name = "custom.api.endpoint" // Maps to custom.api.endpoint in gradle.properties help = "Alternative endpoint for specialized API operations" sensitive = false required = false group = "API Configuration" order = 40 } } // Process Properties - Automated Configuration automation { databaseSetup { description = "Automated database configuration" value = "" help = "Executes database setup tasks including schema creation and connection pooling" sensitive = false required = false process = true // This is a process property group = "Automated Setup" name = "database.setup.automated" order = 10 } apiIntegration { description = "API integration setup process" value = "" help = "Automatically configures API endpoints, credentials, and feature flags" sensitive = false required = false process = true // This will execute automation.apiIntegration task group = "Automated Setup" name = "api.integration.configure" order = 20 } } // Feature Settings features { enableAdvancedReporting { description = "Enable advanced reporting features" value = "false" help = "Activates enhanced reporting capabilities with chart generation" sensitive = false required = false group = "Feature Settings" name = "features.advanced.reporting.enabled" order = 10 } maxReportSize { description = "Maximum report size in MB" value = "10" help = "Limits the size of generated reports to prevent memory issues" sensitive = false required = false group = "Feature Settings" name = "features.reports.max.size.mb" order = 20 } } // Database Settings (if your module needs separate DB config) database { connectionPool { description = "Database connection pool size for module operations" value = "5" help = "Number of concurrent database connections for this module" sensitive = false required = false group = "Database Settings" name = "database.connection.pool.size" order = 10 } } ``` -------------------------------- ### Run Etendo Interactive Setup (Bash) Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Executes the interactive configuration wizard for Etendo projects using the Gradle wrapper. The '-Pinteractive=true' flag enables the interactive mode, and '--console=plain' ensures a clean output. A standard setup without interactive mode is also shown. ```bash # Run interactive configuration (recommended) ./gradlew setup -Pinteractive=true --console=plain # Standard setup ./gradlew setup ``` -------------------------------- ### Groovy: Display Order for Properties Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Demonstrates how properties are displayed in the interactive setup, prioritizing process properties and then sorting by the 'order' field. This configuration block illustrates the grouping and ordering logic. ```groovy database { // This process property will appear first (process = true) setup { description = "Automated database setup" process = true order = 10 } // Regular properties appear after process properties, sorted by order host { description = "Database hostname" order = 10 // First regular property } port { description = "Database port" order = 20 // Second regular property } password { description = "Database password" order = 30 // Third regular property } } ``` -------------------------------- ### Run Tutorial Project Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-rx/tutorials/creating-a-new-microservice.md Execute this Gradle task to run the newly created microservice. After execution, you can access the generated HTML page displaying order data via a web browser at the specified URL. ```bash ./gradlew :com.tutorial.rxtutorial:bootRun ``` -------------------------------- ### Process Property Definition in Groovy Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Defines process properties in Groovy, marking them with `process = true`. The property key must match the Gradle task name to be executed. This example shows configurations for 'myModule' variables setup and 'database' setup. ```groovy myModule { variables { setup { description = "MyModule variables configuration" value = "" help = "Executes automated setup to configure module integration variables" process = true // Marks this as a process property sensitive = false required = false group = "MyModule Integration" order = 1 // This will execute the Gradle task: "myModule.variables.setup" } } } // Database setup process database { setup { description = "Automated database configuration" value = "" help = "Configures database connection settings and initializes schema" process = true sensitive = false required = false group = "Database Configuration" order = 1 // This will execute the Gradle task: "database.setup" } } // Alternative naming for complex task names databaseMigration { description = "Database migration and schema updates" value = "" help = "Runs database migrations and schema updates" process = true group = "Database Configuration" order = 2 // This will execute the Gradle task: "databaseMigration" } ``` -------------------------------- ### Provisioning a new client - JSON Input Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-copilot/available-tools/client-init-tool.md Example JSON input for provisioning a new client using the ClientInitTool. It includes client name, username, passwords, and currency. ```json { "client_name": "ACME Corp", "client_username": "acmeadmin", "password": "Secret123!", "confirm_password": "Secret123!", "currency": "USD" } ``` -------------------------------- ### Setup Properties and Configuration Files with Gradle Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-gradle-plugin.md The `setup` Gradle task creates essential properties and configuration files for the project. It can be used with optional parameters to recreate specific files like default properties, backup properties, or quartz properties from their templates. ```bash ./gradlew setup ./gradlew setup -PforceDefaultProps=true ./gradlew setup -PforceBackupProps=true ./gradlew setup -PforceQuartzProps=true ``` -------------------------------- ### Properties: gradle.properties Output Example Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Illustrates the resulting 'gradle.properties' file content based on the preceding Groovy configuration for regular properties. It shows the direct mapping of the custom 'name' field. ```properties MYMODULE_DEBUG=false ``` -------------------------------- ### Install Database and Reference Data with Gradle Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-gradle-plugin.md The `install` Gradle task handles the creation of the project's database and the installation of necessary reference data. This is a fundamental step for setting up a new environment or resetting the database. ```bash ./gradlew install ``` -------------------------------- ### Groovy: Naming Regular Properties for gradle.properties Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Shows how the 'name' field is used for regular properties to define the exact variable name written to 'gradle.properties'. This example customizes the name to 'MYMODULE_DEBUG'. ```groovy // Example with custom name field myModule { debugMode { description = "Enable debug mode" help = "🔧 Enable verbose debugging for module development and troubleshooting" value = "false" sensitive = false required = false group = "MyModule Configuration (Advanced)" order = 20 name = "MYMODULE_DEBUG" // This will be the variable name in gradle.properties } } ``` -------------------------------- ### Install Etendo (Bash) Source: https://github.com/etendosoftware/docs/blob/main/docs/getting-started/installation.md Runs the Gradle `install` and `smartbuild` tasks to compile sources, create the database, and deploy Etendo to Apache Tomcat. This is the final build and deployment step for JAR format installation. ```bash ./gradlew install smartbuild ``` -------------------------------- ### Enable Etendo RX Dockerized Services Configuration Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-rx/getting-started.md This configuration variable in `gradle.properties` enables the Etendo RX Dockerized Services. It's a crucial step for distributing infrastructure with Etendo RX. ```groovy docker_com.etendoerp.etendorx=true ``` -------------------------------- ### Example URL for Calling a Web Service Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/how-to-guides/.How_to_create_a_new_REST_webservice.md This is an example URL to call a registered web service. It follows the pattern http:///openbravo/ws/.. The URL includes parameters such as 'product' and 'stateless' to filter results and manage session state. ```bash http://localhost:8080/openbravo/ws/org.openbravo.howtos.doIt?product=1000001&stateless=true ``` -------------------------------- ### Groovy: Naming Process Properties as Gradle Task Names Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Demonstrates how the 'name' field is used for process properties to specify the exact Gradle task name to execute. This example sets the task name to 'database.configure.production'. ```groovy // Example with custom task name automation { setupDatabase { description = "Database configuration setup" value = "" help = "Executes automated database configuration" process = true group = "Automation" name = "database.configure.production" // This will execute the task: database.configure.production } } ``` -------------------------------- ### Interactive SSO Configuration with Gradle Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/bundles/platform/etendo-rx.md This command initiates an interactive setup wizard for Single Sign-On (SSO) configuration in Etendo. It streamlines the process by guiding the user through the necessary steps. Ensure you have Gradle installed and the project is accessible. ```bash ./gradlew setup -Pinteractive=true --console=plain ``` -------------------------------- ### Provisioning a new client - JSON Output Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-copilot/available-tools/client-init-tool.md Example JSON output from the ClientInitTool after successfully provisioning a new client. It indicates success and provides the new client ID and admin username. ```json { "status": "success", "client_id": "12345", "admin_username": "acmeadmin", "message": "Client 'ACME Corp' initialized successfully." } ``` -------------------------------- ### Process Property Lifecycle Example in Bash Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/developer-tools/etendo-interactive-configuration.md Illustrates the lifecycle of a process property from user selection to task execution and result application. It shows how the system prompts for execution, runs the task, updates gradle.properties with results, and marks the process as executed. ```bash # User selects process property in interactive setup myModule.variables.setup = "" (process property) # System prompts for execution "Execute myModule variables setup process? (Y/n): Y" # Task execution "Executing task: myModule.variables.setup..." # Results applied automatically myModule.api.endpoint = "https://api.mymodule.com" myModule.api.key = "********" myModule.workspace.id = "ws_abc123" # Original property marked as executed myModule.variables.setup = "EXECUTED:3_properties_configured" ``` -------------------------------- ### Java - Supplier Strategy Implementation Example Source: https://github.com/etendosoftware/docs/blob/main/docs/developer-guide/etendo-classic/bundles/platform/print-provider.md Provides a skeleton example of a Java class implementing the PrintProviderStrategy. This class defines methods to fetch available printers, generate a label file from a template, and send the generated label to a specific printer. It highlights the use of utility classes like PrinterUtils and exception handling with PrintProviderException. ```java public class MyProviderStrategy extends PrintProviderStrategy {  // (optional) constants for timeouts, MIME, etc.  @Override  public List fetchPrinters(Provider provider) throws PrintProviderException {    // 1) Validate provider and required params    final ProviderParam printersUrl = PrinterUtils.getRequiredParam(provider, "printersurl");    PrinterUtils.providerParamContentCheck(printersUrl, "printersurl");    // 2) Build HTTP client/request    // 3) Send and handle InterruptedException (re-set interrupt + rethrow with context)    // 4) Validate statusCode and parse JSON → List    // 5) Return list  }  @Override  public File generateLabel(Provider provider, Table table, String recordId,  TemplateLine templateRef, JSONObject params) throws PrintProviderException {    // Use PrinterUtils.resolveTemplateFile + loadOrCompileJasperReport    // Fill report (DOCUMENT_ID, SUBREPORT_DIR)    // Export PDF to a temp file and return it  }  @Override  public String sendToPrinter(Provider provider, Printer printer, int numberOfCopies, File labelFile)      throws PrintProviderException {    // 1) Validate inputs (provider/printer/file)    // 2) Read required ProviderParams (e.g., printjoburl, apikey)    // 3) Prepare request body (e.g., base64, title, source)    // 4) POST; validate response; extract jobId (if available)  }  @Override  public File generateLabel(Provider provider, Table table, String recordId,                            TemplateLine templateRef, JSONObject params) throws PrintProviderException {    // Use PrinterUtils.resolveTemplateFile + loadOrCompileJasperReport    // Fill report (DOCUMENT_ID, SUBREPORT_DIR)    // Export PDF to a temp file and return it  }  @Override  public String sendToPrinter(Provider provider, Printer printer, int numberOfCopies, File labelFile)      throws PrintProviderException {    // 1) Validate inputs (provider/printer/file)    // 2) Read required ProviderParams (e.g., printjoburl, apikey)    // 3) Prepare request body (e.g., base64, title, source)    // 4) POST; validate response; extract jobId (if available)  } } ```