### GitLab CI/CD: Example .gitlab-ci.yml for Scheduled Builds Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCILJAtVTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCJIvo_dd28fd_xlZC1CdWlsZHMtZm9yLUdpdGxhYi1DSQY7CFQ6CXJhbmtpCA%3D%3D--48f41fdd82a49a3ed3ed4a78742b87d058a2e81d A comprehensive GitLab CI/CD configuration file example. It includes setup for build environment, variables, two distinct jobs ('BuildAndUpload' and 'Test') that extend a common setup, and are configured to run exclusively on schedules. It also includes artifact configuration for build logs. ```yaml variables: CUSTOM_REPO: "myBrand" BASE_VERSION: "version10.0" .SetupBuildEnv: before_script: # Base has to be cloned outside the repo, because of default git clean options - cd .. - if not exist base (git clone https://gitlab-ci-token:%CI_JOB_TOKEN%@git.configura.com/cet/external/base.git) # Set CM environment variables + add custom to cm class_path args - powershell.exe -file "base/bin/createsetenv.ps1" - call setenv.cmd # Setup base branch - cd base - git checkout %BASE_VERSION% - git reset --hard - git clean -fd - git pull # Make symlink in extensions/custom/myBrand to to match folder structure we usually get. # (extensions/custom/xxx) # We need this until they fix -https://gitlab.com/gitlab-org/gitlab-runner/issues/4167 - cd .. - if exist "extensions" rmdir /s /q "extensions" - mkdir "extensions/custom" - mklink /D "extensions/custom/%CUSTOM_REPO%" "%CI_PROJECT_DIR%" # Clean write folder + BuildOutput - if exist write rd /s /q write - if exist BuildOutput rd /s /q BuildOutput # Always runs even script/build fails. after_script: # We have to move BuildLogs within the original repo if we want to upload it # (Artifacts limitation that isn't clearly documented by Gitlab :D ) - cd %CI_PROJECT_DIR%/.. - move BuildLogs %CI_PROJECT_DIR% BuildAndUpload: tags: - build variables: GIT_STRATEGY: Fetch GIT_DEPTH: 1000 extends: .SetupBuildEnv script: # Make operator/cop recognise the workspace - cd %CI_PROJECT_DIR%/.. - powershell.exe -file "base/cm/core/test/runner/cop/Workspace/createcopcmws.ps1" # Build/Upload - Set uploadname as "runner--" - cop clean - cop repair - cop build [myBrand] -minggwformat - cop upload [myBrand] /uploadname="runner-%CI_COMMIT_REF_NAME%-%CI_JOB_ID%" # Upload build logs even on job failure so we know what went wrong artifacts: when: always paths: - BuildLogs/* # Only on scheduled jobs. only: - schedules Test: tags: - build variables: GIT_STRATEGY: Fetch GIT_DEPTH: 1000 extends: .SetupBuildEnv script: # Make operator/cop recognise the workspace - cd %CI_PROJECT_DIR%/.. - powershell.exe -file "base/cm/core/test/runner/cop/Workspace/createcopcmws.ps1" # Just test - cop clean - cop repair - cop build [myBrand TestGroup] -minggwformat # Upload build logs even on job failure so we know what went wrong artifacts: when: always paths: - BuildLogs/* # Only on scheduled jobs. only: - schedules ``` -------------------------------- ### Extension Lifecycle Methods - extension.cm Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCDI23NRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCBdTX_354239_LzM2MDA1MzQ4NzE1NC1leHRlbnNpb24tY20GOwhUOglyYW5raQo%3D--36eccc1a5bcdf27a7462bd9e10b2d54d73647d9d This snippet illustrates the extension lifecycle methods: initialize, start, stop, and terminate. It outlines the execution order and provides context on when each method is called, particularly highlighting the difference between cached data and cleanup operations. It also includes a conditional block for code that should only run during the actual CET process, excluding background installations. ```cm _/** * Initialize. */ _public void initialize(ExtensionEnv env) { _// __Code that runs both during actual CET process and background install process _if (!runningInInstallAndCloseMode) { _// __Code that runs only during actual CET process _ } } ``` -------------------------------- ### Java Extension Initialization and Start Methods Source: https://support.configura.com/hc/en-us/articles/360054047974 This Java code snippet demonstrates the basic structure of an extension class that extends UltraLazyExtension. It includes the `initialize` and `start` methods, which are crucial for setting up and running the extension's functionality during the CET startup process. The `initialize` method is for initial setup, while the `start` method contains the core logic execution. ```java package custom.myExtension; public class MyExtension extends UltraLazyExtension { /** * Intialize. */ public void initialize(ExtensionEnv env) { //init code } /** * Start. */ public void start(ExtensionEnv env) { //start code } } ``` -------------------------------- ### Gitlab CI Job Definition Example (PowerShell) Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCGnxGtVTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCEH2G_4092e3_ItQ0ktQ29uZmlndXJhdGlvbi1RdWlja3N0YXJ0BjsIVDoJcmFua2kH--b757fd2aa43e2fc10376b86ac553afb426da0767 This example demonstrates defining a CI job named 'Test Bill of Material' in a .gitlab-ci.yml file. It extends a predefined script 'SimpleQuickStartAllStages' and specifies actions to be performed within the 'test' stage. The job utilizes a predefined tool 'cop.exe' for running XML tests, which is available if the setup script is included. ```yaml Test Bill of Material: stage: test extends: SimpleQuickStartAllStages script: - echo "Running tests..." - "ci/cop/cop.exe" -project "MyProject.csproj" -build "csXmlTests" only: - master ``` -------------------------------- ### Gitlab-CI Configuration File Setup (.gitlab-ci.yml) Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCGnxGtVTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCEH2G_4092e3_ItQ0ktQ29uZmlndXJhdGlvbi1RdWlja3N0YXJ0BjsIVDoJcmFua2kH--b757fd2aa43e2fc10376b86ac553afb426da0767 This snippet shows the basic structure of a .gitlab-ci.yml file. It defines stages for CI/CD jobs and includes an external script for environment setup. The stages allow for parallel execution within a stage and sequential execution between stages. Stages are optional if only a single job or fully parallel jobs are needed. ```yaml stages: - build - test include: - project: 'cet/external/ci' file: 'master/generalSimpleQuickStart.yml' Build: stage: build extends: SimpleQuickStartAllStages script: - echo "Starting build..." - msbuild /t:Build "MySolution.sln" only: - merge_requests Test Bill of Material: stage: test extends: SimpleQuickStartAllStages script: - echo "Running tests..." - "ci/cop/cop.exe" -project "MyProject.csproj" -build "csXmlTests" only: - master ``` -------------------------------- ### Open Webpage Example Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCGZB8tRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCDpDY_0fc632_VzLzM2MDA1NDkzMTgxNC1DaGFubmVscwY7CFQ6CXJhbmtpCQ%3D%3D--21c78ab0487870c39ac13d14664cc6e28428c738 This example shows how to open a webpage using a URL. It's a straightforward method for navigating users to external or internal web resources directly from the extension. Ensure the URL is correctly formatted. ```javascript window.open("http://www.example.com", "_blank"); ``` -------------------------------- ### Implement Extension Lifecycle Methods (initialize, start, stop, terminate) Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCDI23NRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCBeUJ_b78bbf_LzM2MDA1MzQ4NzE1NC1leHRlbnNpb24tY20GOwhUOglyYW5raQc%3D--e93a08c9e757f8778c3d8fbbc59c1f04bba53bcf Manage extension behavior during its lifecycle using initialize, start, stop, and terminate methods. The initialize method is suitable for caching data that persists across restarts, while start and stop handle initialization and cleanup. Terminate is for final cleanup. The provided example shows conditional code execution within initialize based on the runningInInstallAndCloseMode flag, which is true during background installs. ```Java _/** * Initialize. */ _public void initialize(ExtensionEnv env) { _// __Code that runs both during actual CET process and background install process _if (!runningInInstallAndCloseMode) { _// __Code that runs only during actual CET process _ } } ``` -------------------------------- ### Start Extension with Initialization Logic Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCBE%2FJdVTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCBd_28051d_RlLWEtRGF0YS1Ecml2ZW4tU25hcHBlcgY7CFQ6CXJhbmtpCQ%3D%3D--8bfc00c1b3742ad90242d621ecb2fdcdc250f47e This snippet shows the `start` method for an extension, which is the entry point when the extension is initialized. It calls `initKtmExtension` to set up necessary components, including catalog registration, before proceeding with the rest of the extension's lifecycle. ```cm /** * Start. Place Init code here. */ public void start(ExtensionEnv env) { initKtmExtension(); super(env); } ``` -------------------------------- ### Example 1: Basic XApi Usage Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCJIvodRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCBcZS_7894b4_VzL2FydGljbGVzLzM2MDA0OTYxODgzNC1YQXBpBjsIVDoJcmFua2kG--b354b75fd4b4137e17344f56598442585246d0f7 Demonstrates a simple implementation of XApi with a single method `myTestOp` and its usage through `xrun`. ```APIDOC ## Example 1: Basic XApi Usage ### Description This example shows a basic implementation of XApi where a subclass `XApiExample` defines an XApi method `myTestOp` and how it can be called polymorphically via `xrun`. ### Method `myTestOp(int a): int` (defined in XApi) `xrun(str k, props: params): Object` (used to call) ### Endpoint N/A ### Parameters - **a** (int) - Input parameter for `myTestOp`. ### Request Example ```java /** * XApi example 1. */ public class XApiExample extends PropObj { /** * X-API. */ public xapi { public int myTestOp(int a); } /** * My test operation. */ extend public int myTestOp(int a) { return a + 1; } } { PropObj ex = XApiExample(); // XApiExample is casted as PropObj. pln(ex.xrun("myTestOp", a=2)); // Able to run methods from // XApiExample as a PropObj. } ``` ### Response #### Success Response (200) - **int** - The result of `myTestOp(2)` which is `2 + 1`. #### Response Example ``` 3 ``` ``` -------------------------------- ### Optional: Launch CET After Silent Installation Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCFYS5tRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCHGJM_d33ce5_5kZWQtU2lsZW50LUluc3RhbGxhdGlvbgY7CFQ6CXJhbmtpBw%3D%3D--f0109ef247e1e5a9c911997c394a1d35fc130802 This command extends the silent installation by adding an option to automatically launch CET Designer once the installation process is complete. This is useful for automated setups where immediate use of the application is intended. ```batch msiexec.exe /i \"CETDesigner.msi\" /qb CET_VERSIONID=64-bit TRANSFORMS=:InstanceId01 LAUNCH_CET_AFTER_INSTALL=1 ``` -------------------------------- ### Declare and Initialize an Index (Sorted Map) - Examples Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCKW3ED9dAToYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCNKhQ_b07302_E2NDY1MDEtSW5kZXgtU29ydGVkLU1hcAY7CFQ6CXJhbmtpCA%3D%3D--9df7d7b853b4fc9d7d57c01bb85a714e06633c9a Provides examples of declaring and initializing an index (sorted map). It covers declaring an index with a specific type, creating an empty index using constructor and assignment, and using the 'init' feature. ```text sorted str->Object index; sorted str->Object index(); sorted str->Object index = new sorted str->Object(); sorted str->Object index; ... init index(); ``` -------------------------------- ### PushProps Execution and Output Example Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCJeB0RMBBDoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCJIvo_1f9fb7_ljbGVzLzQ0MDI2NzM5NzU3MDMtUHVzaFByb3BzBjsIVDoJcmFua2kH--29fb2507f6b2f208a6db23e05b7824c8fa04aeb0 Demonstrates the execution flow of pushProps using Taker and Giver objects, including initial put/get operations and the final pushProps call. The comments show the expected output at each step. ```cmscript Taker toReceive(); Giver toPush(); toReceive.put("seven", Double(8)); //Its any value you want! HA! pln(#toReceive.get("seven")); //toReceive.get("seven")=8 toPush.put("seven", Double(8)); //Hey, that's not seven! pln(#toPush.get("seven")); //toPush.get("seven")=7 pln(); pln("pushProps"); //pushProps toReceive.pushProps(toPush); pln(); pln(#toReceive.get("seven")); //toReceive.get("seven")=7 pln(#toPush.get("seven")); //toPush.get("seven")=7 ``` -------------------------------- ### For Loop with Start and End Keywords Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCAXGY9VTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCJe1x_4d81cd_ljbGVzLzM2MDA2MjM3MTMzMy1Mb29wcwY7CFQ6CXJhbmtpCg%3D%3D--e168fd8a84dd3a2b0c8ec12395f232f1416bfb32 Demonstrates using 'start' and 'end' keywords to control the iteration range within sequences and strings. Examples show iterating from a specific start index, up to a specific end index, and in reverse with both start and end. ```Yewsiing Choong private str txt = "A simple text"; { for (s in txt, start=9) { pln(s); } } /* **Output: **t e x t */ ``` ```Yewsiing Choong private str txt = "A simple text"; { for (s in txt, end=7) { pln(s); } } /* **Output: **A s i m p l e */ ``` ```Yewsiing Choong private str txt = "A simple text"; { for (s in txt, start=2, end=7) { pln(s); } } /* **Output: **s i m p l e */ ``` ```Yewsiing Choong private str txt = "A simple text"; { for (s in txt, start=7, end=2, reverse) { pln(s); } } /* **Output: **e l p m i s */ ``` -------------------------------- ### Gitlab-CI Configuration File (.gitlab-ci.yml) Example Source: https://support.configura.com/hc/en-us/articles/360057598313-Gitlab-CI-Configuration-Quickstart This YAML snippet demonstrates the basic structure of a .gitlab-ci.yml file. It defines stages, includes external CI scripts for setup, and configures jobs with specific parameters like stage, inheritance, script commands, and execution conditions. The `include` directive is crucial for loading predefined scripts. ```yaml include: - project: "cet/external/ci" ref: "master" file: "/generalSimpleQuickStart.yml" stages: - build - test variables: NewCI_Build_Projects: "MySolution.sln" NewCI_Test_Projects: "MySolution.sln" #Example for a build job BuildProject: stage: build script: - echo "Start building..." "extends": - "SimpleQuickStartAllStages" "only": - merge_requests - master #Example for a test job TestBillOfMaterial: stage: test script: - echo "Start testing..." - "cop.exe" -Project "$NewCI_Build_Projects" -target "BuildCentral" -buildItem "Unit Tests" "extends": - "SimpleQuickStartAllStages" "only": - merge_requests - master ``` -------------------------------- ### Handling Initialization and Background Installs (extension.cm) Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCDI23NRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCHkXv_d75d9d_LzM2MDA1MzQ4NzE1NC1leHRlbnNpb24tY20GOwhUOglyYW5raQc%3D--39964e9ab99385938516c83eb95335a16b3697b8 This code snippet illustrates the correct implementation of the initialize method within an extension. It shows how to conditionally execute code based on the `runningInInstallAndCloseMode` flag, differentiating between actual CET process execution and background installation verification. This prevents unintended side effects during background installs. ```Unknown _/** * Initialize. */ _public void initialize(ExtensionEnv env) { _// __Code that runs both during actual CET process and background install process _if (!runningInInstallAndCloseMode) { _// __Code that runs only during actual CET process _ } } ``` -------------------------------- ### For Loop with Start and End Keywords Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCAXGY9VTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCP6dQ_d3d60c_ljbGVzLzM2MDA2MjM3MTMzMy1Mb29wcwY7CFQ6CXJhbmtpCA%3D%3D--9e0154d896ffd3752defbd37ccd5beca26563a65 Demonstrates using 'start' and 'end' keywords to control the iteration range within a string. Examples show iterating from a specific start index, to a specific end index, and combining both, including reverse iteration. ```Support Configuration private str txt = "A simple text"; { for (s in txt, start=9) { pln(s); } } // Output: // t // e // x // t ``` ```Support Configuration private str txt = "A simple text"; { for (s in txt, end=7) { pln(s); } } // Output: // A // // s // i // m // p // l // e ``` ```Support Configuration private str txt = "A simple text"; { for (s in txt, start=2, end=7) { pln(s); } } // Output: // s // i // m // p // l // e ``` ```Support Configuration private str txt = "A simple text"; { for (s in txt, start=7, end=2, reverse) { pln(s); } } // Output: // e // l // p // m // i // s ``` -------------------------------- ### Setup Build Environment with Base Repository and CM Variables (GitLab CI) Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCEH2GtVTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCLFGF_3969f4_RvbWF0aWMtQnVpbGRzLWFuZC1UZXN0cwY7CFQ6CXJhbmtpCQ%3D%3D--92f55c7d4e5688fbccc27e2475d05742f5ac99b8 This script sets up the build environment by cloning the base repository, setting CM environment variables using PowerShell and CMD scripts, and ensuring the base repository is up-to-date. It's crucial for the build process but may fail on slow network connections. ```yaml .SetupBuildEnv: before_script: # Base has to be cloned outside the repo, because of default git clean options - cd .. - if not exist base (git clone https://gitlab-ci-token:%CI_JOB_TOKEN%@git.configura.com/cet/external/base.git) # Set CM environment variables + add custom to cm class_path args - powershell.exe -file "base/bin/createsetenv.ps1" - call setenv.cmd # Setup base branch - cd base - git checkout %BASE_VERSION% - git reset --hard - git clean -fd - git pull ``` -------------------------------- ### Import Statement - Example Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCC4jlNRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCBfJK_939172_M2MDA0ODc2MzY5NC1EZWZpbml0aW9ucwY7CFQ6CXJhbmtpCg%3D%3D--ebf5b92ab6365325ec67adb15609ccd2631ced6e Example of importing public definitions from two different packages, 'cm.runtime' and 'cm.syntax'. ```cm use cm.runtime, cm.syntax; ``` -------------------------------- ### Example Usage of Overridden PropDef Methods Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCP77n9RTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCJIvo_bfc68d_MDA0OTU0MDA5NC1BcHBlbmQtUHJvcERlZnMGOwhUOglyYW5raQY%3D--c3e497d8574966b8e9c3b03346c13ac2bb390c85 Provides an example of instantiating a class with overridden PropDef methods and iterating through its properties to demonstrate the overridden get() and put() functionality. ```Java PropExample exp(); for (k, def in exp.propDefs.defs) { pln(k); pln(def); pln(exp.get(k)); exp.put(k, 89); } ``` -------------------------------- ### For Loop with Start Keyword (String) Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCAXGY9VTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCBcQ7_1926c4_ljbGVzLzM2MDA2MjM3MTMzMy1Mb29wcwY7CFQ6CXJhbmtpBw%3D%3D--8d9fc59515fcf138ed4722b5b7c0d3ccff388cca Illustrates the 'start' keyword in a 'for' loop iterating over a string ('txt'). The loop begins from index 9, printing each character. ```Source { for (s in txt, start=9) { pln(s); } } ``` -------------------------------- ### Registering Custom IFC Export Factory Hooks Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCJJfwdRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCNm5A_6e693e_J0LUV4cG9ydC1DdXN0b21pemF0aW9ucwY7CFQ6CXJhbmtpCQ%3D%3D--3800f26b92ad7a200bac6d3adce8b0f095d03384 This snippet shows how to register a custom IFC export factory hook using the 'registerIfcExportFactoryHook' function. It's typically done in the 'start' method of an extension and involves associating a unique key with a factory function that returns the appropriate IfcExportFactory subclass based on the snapper type. The example demonstrates registering hooks for HVAC components. ```Java _// __PipeExtension class _public void start(ExtensionEnv env) { registerIfcExportFactoryHook("CetIfcHvacExp", function cetHvacExportHook); super(env); } public void registerIfcExportFactoryHook(str key, function(Snapper, IfcExportEnvG2):IfcExportFactory hook) { if (developMode) pln("[IFC] Registered IFC Export Factory Hook: ", #key); _hooks.put(key, hook); } public IfcExportFactory cetHvacExportHook(Snapper s, IfcExportEnvG2 env) { if (s as MechaStraightSnapper) return HvacSegmentIfcExportFactory(s, env); else if (s in MechaJunction) return HvacFittingIfcExportFactory(s, env); return null; } ``` -------------------------------- ### Handle Extension Lifecycle with initialize, start, stop, terminate Source: https://support.configura.com/hc/en-us/articles/360053487154-extension-cm This code demonstrates the extension lifecycle methods: 'initialize', 'start', 'stop', and 'terminate'. 'initialize' runs during background installation and actual process, while conditional code within it can be restricted to the actual process using 'runningInInstallAndCloseMode'. 'start', 'stop', and 'terminate' manage the extension's state during its runtime. ```Groovy /** * Initialize. */ public void initialize(ExtensionEnv env) { // __Code that runs both during actual CET process and background install process if (!runningInInstallAndCloseMode) { // __Code that runs only during actual CET process } } ``` -------------------------------- ### Queue Initialization and Usage Example (CM) Source: https://support.configura.com/hc/en-us/articles/360060265154-Queue Demonstrates the initialization of a queue with a specific size and the process of enqueuing elements. It also shows how to iterate through the queue and print its elements along with their indices. ```CM use cm.util; public queue MyQueue; { MyQueue queue(100); for (x in 0..1000) { queue.put(x); } for (z in queue, index=i) pln(#i; z); } ``` -------------------------------- ### Package Declaration - Example Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCC4jlNRTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCBfJK_939172_M2MDA0ODc2MzY5NC1EZWZpbml0aW9ucwY7CFQ6CXJhbmtpCg%3D%3D--ebf5b92ab6365325ec67adb15609ccd2631ced6e Example of a basic package declaration for the 'cm.lang' package. ```cm package cm.lang; ``` -------------------------------- ### Start Downloader Program (C#) Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCBdjItU3CzoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCPk3A_e4b519_I2OTA3NDE1LUNhdGFsb2d1ZS1Eb3dubG9hZGVyBjsIVDoJcmFua2kH--403fdae4a68e39bda45a1f79e2c0093a41e9f03b Starts the downloader program, with options for debug mode, running tests, and verbose logging. This function is part of the cm.downloader public API and is typically called automatically by other download functions. ```csharp public void startDownloader(bool debug=debugModeToggle, bool runTests=false, bool verbose=false) ``` -------------------------------- ### Conditional Job Execution Example Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCEH2GtVTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCF0WD_af45f3_RvbWF0aWMtQnVpbGRzLWFuZC1UZXN0cwY7CFQ6CXJhbmtpCg%3D%3D--9e67db65be7efad8d5ba5252ba70ac3703d6d1cb Demonstrates how to use the 'only' keyword in GitLab CI to control when a job runs. This example shows how to trigger a job specifically for merge requests targeting the 'version10.0' branch, and provides an alternative using regex to match branches starting with 'version'. ```yaml # Specific branch only: refs: - merge_requests variables: - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "version10.0" # Regex example # only: # variables: # - $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^version*/ ``` -------------------------------- ### Code Change Example: Extending a Class Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCMqeDz9dAToYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCC35J_7546bb_Q2MDItUGxhbi1Zb3VyLU1pZ3JhdGlvbgY7CFQ6CXJhbmtpBg%3D%3D--e86ba2fa972599b74850208e7b2d6fcb96b78113 Demonstrates a code modification required when migrating between versions, specifically changing the parent class of an implementation to resolve compilation errors. This example highlights the need to adapt to new class structures provided in the Migration Guide. ```java // Old (version 11.0) public class ExampleImplementationFrame extends DataSkinFrame { // New (version 11.5) public class ExampleImplementationFrame extends AODataSkinFrame { ``` -------------------------------- ### Get Arguments Excluding Start/End (Java) Source: https://support.configura.com/hc/en-us/articles/1500002010801-Argument-Operators Illustrates how to select arguments that are not at the very beginning or end of the parameter list. This is achieved using ellipsis notation with explicit start and end markers. ```java public void f1(int a, int b) { } public void f2(int a, int b, bool x) { f1(..-); } public void f3(bool x, int a, int b) { f1(-..); } public void f4(bool x, int a, int b, bool y) { f1(-..-); } ``` -------------------------------- ### Run Syntax with Arguments and Compile/Execute Output Source: https://support.configura.com/hc/en-us/articles/360049747554/comments/18355539046295 Demonstrates how to pass different types of arguments (syntax type, variable, string literal) to a syntax and shows the compiled and executed output. ```N/A /** * Run code. */ { synRun(); } /** * Run example syntax. */ public void synRun() { SynClass classy(); argDemo classy int myInt = 68; argDemo myInt argDemo "a String" } /** * Argument demo syntax. */ public statement argDemo @e=expr { pln("Compile: e = ", e; e.type; e.literalStr); SStatement b = block { pln("Execute: e = ", @e); }; return b; } /** * Example class. */ public class SynClass { public constructor() { } } ``` -------------------------------- ### Taker Class Example (Java) Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCJeB0RMBBDoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCLGbW_fada62_ljbGVzLzQ0MDI2NzM5NzU3MDMtUHVzaFByb3BzBjsIVDoJcmFua2kH--d55dd715b4c67bd13ca2f4a94c73eff92a53cbb1 Defines a Taker class that extends PropObj, featuring a 'seven' property with custom put and get methods. The 'seven' prop is configured with the '#allowPush' attribute. ```Java public class Taker extends PropObj { public Double seven = 7; /*********************************************************************** * PropDef Syntax ***********************************************************************/ public props : attributes={#allowPush} { double "seven" { void put(..) { if (v as Double) { that.setSeven(v.v); return; } } Object get(..) { return that.seven; } } } /*********************************************************************** * Setters ***********************************************************************/ extend public void setSeven(double val) { if (val != 7.0) { pln("Its any value you want!"); } seven = val; } } ``` -------------------------------- ### Standard Initialization Example Source: https://support.configura.com/hc/en-us/articles/360052971733-init-Syntax Demonstrates the conventional method of initializing a StrBuf object in Configura HC, showing multiple assignment steps and their resulting output. ```Configura HC { StrBuf buf; pln(#buf); buf = new StrBuf("A"); pln(#buf); buf = StrBuf("B"); pln(#buf); StrBuf foo("C"); pln(#foo); } ``` -------------------------------- ### Sequence Declaration Examples Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCP6dQ9VTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCAXGY_7281ad_VzLzM2MDA2MDI2MzkzNC1TZXF1ZW5jZQY7CFQ6CXJhbmtpBw%3D%3D--944947e47d64195047a2fb6aacbb5d4daace2b45 Demonstrates various ways to declare and initialize sequences (dynamically resized arrays) in the system. This includes declaring an uninitialized sequence, creating an empty one, using the 'new' keyword, initializing with 'init', and specifying initial capacity for performance optimization. ```System { int[] integers; } ``` ```System { int[] integers(); } ``` ```System { int[] integers = new int[]; } ``` ```System { int[] integers; ... init integers(); } ``` ```System { int[] integers(64); integers = new int[](64); init integers(64); } ``` -------------------------------- ### Get Arguments from or After a Specific Point (Java) Source: https://support.configura.com/hc/en-us/articles/1500002010801-Argument-Operators Shows how to select arguments starting from a specified position within the parameter list using ellipsis notation. This is useful for processing a subset of arguments. ```java public void f1(int a, int b) { } public void f2(bool x, bool y|, int a, int b) { f1(|..); } public void f3(int a, int b|, bool x, bool y) { f1(..|); } ``` -------------------------------- ### Start Extension Lifecycle in KTM Source: https://support.configura.com/hc/en-us/related/click_data=BAh7CjobZGVzdGluYXRpb25fYXJ0aWNsZV9pZGwrCBE%2FJdVTADoYcmVmZXJyZXJfYXJ0aWNsZV9pZGwrCJc_bb52af_RlLWEtRGF0YS1Ecml2ZW4tU25hcHBlcgY7CFQ6CXJhbmtpCQ%3D%3D--54bf1e870e4aae9bbfdb1ebb84b739dcaabbe566 Defines the starting point for the extension's lifecycle. It calls the `initKtmExtension` method to perform initialization tasks and then calls the superclass's start method. ```cm /** * Start. Place Init code here. */ public void start(ExtensionEnv env) { initKtmExtension(); super(env); ``` -------------------------------- ### Retrieve Current Time in CET Source: https://support.configura.com/hc/en-us/articles/10213419959319-Tasks Shows how to get the current time since the CET application started using the 'microTime()' function. This is crucial for managing task execution within their allotted time slots. ```csharp double startTime = microTime(); ```