### Perform REST Call (GET Example) Source: https://www.naumen.ru/docs/sd/Content/applications/JSAPI_metods.htm Executes a REST request to the SMP server. This example demonstrates a GET request and parsing the JSON response. ```javascript const subjectUuid = jsApi.extractSubjectUuid(); const contentCode = jsApi.findContentCode(); const url = `exec/?func=modules.testModule.testMethod¶ms='${subjectUuid}', '${contentCode}'`; jsApi.restCall(url, {}) .then(stringifiedResponse => { const response = JSON.parse(stringifiedResponse); console.log(response); return void 0; }).catch(error => { console.error(error); }); ``` -------------------------------- ### Initialize and Configure Showcase Parameters Source: https://www.naumen.ru/docs/sd/Content/services2/services20_params_pr.htm This example demonstrates how to initialize `SettingsProvider`, add an `OpenLinkButton` to `ObjectHolder`, and configure `ShowcaseParams`. It sets up main block parameters, including how cards are displayed and retrieved, and card parameters for the `OpenLinkButton`. ```java /**  * Предоставляет доступ к текущим настройкам ВП  */ @InjectApi class SettingsProvider { /**     * Пример инициализации кнопки в классе SettingsProvider     */ SettingsProvider() { ObjectHolder.openLinkButtonMap.put('linkButton1', new OpenLinkButton(             code: 'linkButton1',             title: 'Открыть Гугл',             icon: utils.get('system_icons', ['code': 'createIssue'])?.icon.find()?.UUID,             color: '#6253C6',             description: 'Открыть Гугл в браузере',             link: 'https://www.google.com/?hl=ru'         )) } final ShowcaseParams params = new ShowcaseParams()             .setMainBlockParams([                 new MainBlockParams(                             title: { IUUIDIdentifiable user -> return 'Открыть Гугл в браузере'},                             withBuiltBreadcrumbs: { IUUIDIdentifiable user -> return true},                             isSlider: { IUUIDIdentifiable user ->                                 return false                             },                             /**                             * Пример добавления кнопки в блок в параметре getCardsStrategy                             */                             getCardsStrategy: { IUUIDIdentifiable user ->                                 List result = []                                 result.add(ObjectHolder.getOpenLinkButton('linkButton1'))                                 return result                             }                 )             ])             .setCardParams([                 /**                 * Пример настройки карточки, которая реализует переход на произвольную ссылку                 */                 new CardParams(                     code: 'OpenLinkButton',                     getDisplayMode: { IUUIDIdentifiable user, Object object, List contextItems ->                         return DisplayMode.COMPACT                     },                     isVisibleInBreadCrumbs: { IUUIDIdentifiable user, Object object, List contextItems ->                         return false                     },                     isAutoSelectionEnabled: { IUUIDIdentifiable user, Object object, List contextItems ->                         return false                     },                     isNeedParent: { IUUIDIdentifiable user, Object object, List contextItems ->                         return false                     },                     isNeedChild: { IUUIDIdentifiable user, Object object, List contextItems ->                         return false                     },                     matchingCondition: { IUUIDIdentifiable user, Object object ->                         return object in OpenLinkButton                     },                     getTitle: { IUUIDIdentifiable user, Object object ->                         return 'Название ссылки'                     },                     getIcon: { IUUIDIdentifiable user, Object object ->                         return object.icon                     },                     getColor: { IUUIDIdentifiable user, Object object ->                         return object.color                     },                     getDescription: { IUUIDIdentifiable user, Object object ->                         return object.description                     },                     getStringByObject: { IUUIDIdentifiable user, Object object ->                         return object.code                     },                     getObjectByString: { IUUIDIdentifiable user, String stringValue ->                     //Здесь из мапы openLinkButtonMap достаем объект класса OpenLinkButton с заданными параметрами                         return ObjectHolder.openLinkButtonMap.get(stringValue)                     },                     getChildBlocks: { IUUIDIdentifiable user, Object object, List contextItems ->                         return []                     }             )             ]) } ``` -------------------------------- ### Get Meta-Class Title Example Source: https://www.naumen.ru/docs/sd/nsmp/Content/script/api_meta.htm?TocPath=%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0+SMP%7C%D0%A1%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%BE%D0%B2%D1%8B%D0%B5+%D1%81%D1%86%D0%B5%D0%BD%D0%B0%D1%80%D0%B8%D0%B8%7C%D0%9C%D0%B5%D1%82%D0%BE%D0%B4%D1%8B+API.+SMP%7C_____26 Example demonstrating how to get the title of a meta-class attribute. ```APIDOC ## Example: Meta-Class Attribute Title ### Description This example shows how to retrieve the title of a meta-class attribute using its code. ### Code ```javascript api.metainfo.getMetaClass(subject).getAttribute(attrCode).title ``` ``` -------------------------------- ### Создание объекта типа 'ou$example' в скриптовом модуле Source: https://www.naumen.ru/docs/sd/Content/script/modul.htm Определяет функцию 'createExample', которая использует api.utils.create для создания объекта указанного типа с заданным названием. Требует наличия 'api.utils' в окружении. ```groovy def createExample(def title) { api.utils.create('ou$example', ['title' : title]) } ``` -------------------------------- ### Copy and Reload Tomcat Systemd Service Source: https://www.naumen.ru/docs/sd/Content/admin/nix-app-tomcat.htm Copies the Tomcat service file to the systemd directory and reloads the systemd daemon to recognize the new service. This setup assumes the application is installed according to the guide. ```bash sudo cp /opt/naumen/deploy/$(date +'%F')/update/tomcat.service /etc/systemd/system/tomcat.service sudo systemctl daemon-reload ``` -------------------------------- ### Initialize and Configure Showcase Button Source: https://www.naumen.ru/docs/sd/nsmp/Content/services2/services20_params_pr.htm?TocPath=%D0%92%D1%81%D1%82%D1%80%D0%BE%D0%B5%D0%BD%D0%BD%D1%8B%D0%B5+%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F%7C%D0%92%D0%B8%D1%82%D1%80%D0%B8%D0%BD%D0%B0+%D1%83%D1%81%D0%BB%D1%83%D0%B3+2.0%7C%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0+%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D0%BE%D0%B2+%D0%92%D0%9F%7C_____1 This example demonstrates initializing a SettingsProvider, which in turn creates and configures an 'OpenLinkButton' instance. It then sets up showcase parameters, including defining how cards are displayed and retrieved, to integrate the button into the service showcase. ```Groovy /**  * Предоставляет доступ к текущим настройкам ВП  */ @InjectApi class SettingsProvider { /**     * Пример инициализации кнопки в классе SettingsProvider    */ SettingsProvider() { ObjectHolder.openLinkButtonMap.put('linkButton1', new OpenLinkButton( code: 'linkButton1', title: 'Открыть Гугл', icon: utils.get('system_icons', ['code': 'createIssue'])?.icon.find()?.UUID, color: '#6253C6', description: 'Открыть Гугл в браузере', link: 'https://www.google.com/?hl=ru' )) } final ShowcaseParams params = new ShowcaseParams() .setMainBlockParams([ new MainBlockParams( title: { IUUIDIdentifiable user -> return 'Открыть Гугл в браузере'}, withBuiltBreadcrumbs: { IUUIDIdentifiable user -> return true}, isSlider: { IUUIDIdentifiable user -> return false }, /**                             * Пример добавления кнопки в блок в параметре getCardsStrategy                             */ getCardsStrategy: { IUUIDIdentifiable user -> List result = [] result.add(ObjectHolder.getOpenLinkButton('linkButton1')) return result } ) ]) .setCardParams([ /**                             * Пример настройки карточки, которая реализует переход на произвольную ссылку                             */ new CardParams( code: 'OpenLinkButton', getDisplayMode: { IUUIDIdentifiable user, Object object, List contextItems -> return DisplayMode.COMPACT }, isVisibleInBreadCrumbs: { IUUIDIdentifiable user, Object object, List contextItems -> return false }, isAutoSelectionEnabled: { IUUIDIdentifiable user, Object object, List contextItems -> return false }, isNeedParent: { IUUIDIdentifiable user, Object object, List contextItems -> return false }, isNeedChild: { IUUIDIdentifiable user, Object object, List contextItems -> return false }, matchingCondition: { IUUIDIdentifiable user, Object object -> return object in OpenLinkButton }, getTitle: { IUUIDIdentifiable user, Object object -> return 'Название ссылки' }, getIcon: { IUUIDIdentifiable user, Object object -> return object.icon }, getColor: { IUUIDIdentifiable user, Object object -> return object.color }, getDescription: { IUUIDIdentifiable user, Object object -> return object.description }, getStringByObject: { IUUIDIdentifiable user, Object object -> return object.code }, getObjectByString: { IUUIDIdentifiable user, String stringValue -> //Здесь из мапы openLinkButtonMap достаем объект класса OpenLinkButton с заданными параметрами return ObjectHolder.openLinkButtonMap.get(stringValue) }, getChildBlocks: { IUUIDIdentifiable user, Object object, List contextItems -> return [] }, ) ]) } ``` -------------------------------- ### Get Active Imports Source: https://www.naumen.ru/docs/sd/Content/script/api_import.htm Retrieves the UUIDs of all currently active import configurations. An active configuration is one in the 'started' status. This method is designed to return a single UUID as imports are processed sequentially, but can return multiple UUIDs in clustered installations. ```APIDOC ## api.advimport.getActiveImports() ### Description Retrieves the UUIDs of all active import configurations. ### Request Example ```javascript api.advimport.getActiveImports() ``` ### Response Returns a single UUID or 0 if no imports are active. In clustered environments, it may return multiple UUIDs. ``` -------------------------------- ### Example kafka-settings.xml Configuration Source: https://www.naumen.ru/docs/sd/Content/integration/kafka.htm An example of a complete kafka-settings.xml file demonstrating various configuration options for Kafka integration. ```xml true conn module 127.0.0.1 9092 test true false func customizeProducerProps customizeConsumerProps org.apache.kafka.common.serialization.IntegerSerializer org.apache.kafka.common.serialization.StringSerializer ``` -------------------------------- ### Basic Import Configuration Example Source: https://www.naumen.ru/docs/sd/Content/import/all_config_file.htm?TocPath=%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0+SMP%7C%D0%98%D0%BC%D0%BF%D0%BE%D1%80%D1%82+%D0%B8+%D1%81%D0%B8%D0%BD%D1%85%D1%80%D0%BE%D0%BD%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F%7C_____3 This is a basic example of an import configuration, setting a description, log saving, thread count, and workflow skipping. ```xml ``` -------------------------------- ### Perform REST Call as JSON (GET Example) Source: https://www.naumen.ru/docs/sd/Content/applications/JSAPI_metods.htm Executes a REST request to the SMP server and expects a JSON response. This example demonstrates a GET request. ```javascript const subjectUuid = jsApi.extractSubjectUuid(); const contentCode = jsApi.findContentCode(); const url = `exec/?func=modules.testModule.testMethod¶ms='${subjectUuid}', '${contentCode}'`; ``` -------------------------------- ### Install ARR Source: https://www.naumen.ru/docs/sd/Content/admin/win-reverse-proxy.htm?TocPath=%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%BD%D0%BE%D0%B5+%D0%B0%D0%B4%D0%BC%D0%B8%D0%BD%D0%B8%D1%81%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5%7C%D0%98%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%86%D0%B8%D0%B8+%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%BD%D0%BE%D0%B3%D0%BE+%D0%B0%D0%B4%D0%BC%D0%B8%D0%BD%D0%B8%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%BE%D1%80%D0%B0%7C%D0%A3%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BA%D0%B0+%D0%B8+%D0%BE%D0%B1%D0%BD%D0%BE%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5%7C%D0%98%D0%BD%D1%81%D1%82%D1%80%D1%83%D0%BA%D1%86%D0%B8%D0%B8+%D0%B4%D0%BB%D1%8F+Windows%7C_____6 Starts the installation process for the downloaded ARR MSI package. ```powershell Start-Process "d:\naumen\deploy\$(Get-Date -format "yyyy-MM-dd")\update\requestRouter_amd64.msi" ``` -------------------------------- ### Define and Use Properties Variables Source: https://www.naumen.ru/docs/sd/ndap/Content/admin_dap/log4j2Properties.htm Demonstrates how to define variables using the 'property.' prefix and reference them in configuration parameters using the ${VARIABLE_NAME} syntax. ```properties property.%ИМЯ ПЕРЕМЕННОЙ%=%ЗНАЧЕНИЕ ПЕРЕМЕННОЙ% ... %ПАРАМЕТР%=${%ИМЯ ПЕРЕМЕННОЙ%} ``` -------------------------------- ### Start InfluxDB 2.x Service Source: https://www.naumen.ru/docs/sd/ndap/Content/admin_dap/migration.htm?TocPath=%D0%90%D0%B4%D0%BC%D0%B8%D0%BD%D0%B8%D1%81%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5+DAP%7C_____6 Start the InfluxDB 2.x database service after installation and configuration. ```bash sudo systemctl start influxdb.service ``` -------------------------------- ### Example: Configure Buffering for Slow Consumer Import Source: https://www.naumen.ru/docs/sd/Content/admin_instal/config_faile_dbaccess_properties.htm?TocPath=%D0%A1%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%BD%D0%BE%D0%B5+%D0%B0%D0%B4%D0%BC%D0%B8%D0%BD%D0%B8%D1%81%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5%7C%D0%94%D0%BE%D0%BF%D0%BE%D0%BB%D0%BD%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5+%D0%BC%D0%B0%D1%82%D0%B5%D1%80%D0%B8%D0%B0%D0%BB%D1%8B%7C%D0%9D%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0+%D0%BA%D0%BE%D0%BD%D1%84%D0%B8%D0%B3%D1%83%D1%80%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D1%85+%D1%84%D0%B0%D0%B9%D0%BB%D0%BE%D0%B2%7C_____1 An example demonstrating how to configure buffering on the consumer side for slow import scenarios by disabling buffering for specific queues and enabling separate connection factories. ```properties ru.naumen.jms.artemis.slow.consumers.queues=Queue.AdvImport ru.naumen.jms.artemis.separated.connectionFactory.queue=true ``` -------------------------------- ### SOAP Get Response - Integer Value Example Source: https://www.naumen.ru/docs/sd/Content/integration/SOAP_decription.htm?TocPath=%D0%94%D0%BE%D0%BF.+%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D0%B8.+%D0%98%D0%BD%D1%82%D0%B5%D0%B3%D1%80%D0%B0%D1%86%D0%B8%D0%B8%7C_____5 Example of the 'value' tag for integer attributes. ```xml 7 ``` -------------------------------- ### Example Theme Template Configuration Source: https://www.naumen.ru/docs/sd/Content/setting_user/interface_theme_template.htm Demonstrates a basic configuration for accent color within a theme template. ```properties accentColor=#FF6720 ``` -------------------------------- ### Start Import Configuration Without Parameters Source: https://www.naumen.ru/docs/sd/Content/script/api.htm Initiates an import configuration using its UUID. This example demonstrates starting an import when no specific runtime parameters are required. ```javascript api.advimport.start('f0e05190-145d-0247-0000-00007388e0bf', [:]); ``` -------------------------------- ### Install Application Request Routing (ARR) Source: https://www.naumen.ru/docs/sd/Content/admin/win-reverse-proxy.htm Starts the installation process for ARR using the downloaded MSI file. The installer will launch and require user interaction. ```powershell Start-Process "d:\naumen\deploy\$(Get-Date -format "yyyy-MM-dd")\update\requestRouter_amd64.msi" ``` -------------------------------- ### Start Artemis Service Source: https://www.naumen.ru/docs/sd/Content/admin/ops_win_artemis.htm Use this command to manually start the Artemis broker service. The service typically starts automatically on server boot if installed as recommended. ```powershell Start-Service Artemis ``` -------------------------------- ### Basic Tag Example Source: https://www.naumen.ru/docs/sd/Content/import/config_file_config.htm This example shows the basic structure of the tag with common parameters like description, schema location, log saving, thread number, and workflow skipping. ```xml ``` -------------------------------- ### SOAP Get Response - License Value Example Source: https://www.naumen.ru/docs/sd/Content/integration/SOAP_decription.htm?TocPath=%D0%94%D0%BE%D0%BF.+%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D0%B8.+%D0%98%D0%BD%D1%82%D0%B5%D0%B3%D1%80%D0%B0%D1%86%D0%B8%D0%B8%7C_____5 Example of the 'value' tag for attributes representing license types. ```xml concurrent ``` -------------------------------- ### Creating an Object with Catalog Element (Correct) Source: https://www.naumen.ru/docs/sd/Content/script/default_value.htm This example demonstrates the correct way to create an object by first retrieving the catalog element using 'utils.get' and then passing the object. ```groovy * Вариант 2 (работающий) */ def cat = utils.get('catalogCode', ['code':'catalogElementCode']) utils.create('ou$OU', ['title':'test2', 'catalogAttr':cat]) ``` -------------------------------- ### Start an import with parameters Source: https://www.naumen.ru/docs/sd/Content/script/api.htm Starts a specific import configuration with provided launch parameters. This method allows for dynamic configuration of import jobs. ```APIDOC ## api.advimport.start(advimportConfig, parameters) ### Description Starts a specific import configuration with its launch parameters. ### Method `api.advimport.start` ### Parameters #### Path Parameters - **advimportConfig** (string) - Required - The identifier of the import configuration to start. - **parameters** (Map) - Optional - Launch parameters for the import. Can accept STRING, byte[], or InputStream types for data source content or string values. ### Request Example ```javascript // Starting without parameters api.advimport.start('f0e05190-145d-0247-0000-00007388e0bf', [:]); // Starting with file UUID and string parameter api.advimport.start('f0e05190-145d-0247-0000-00007388e0bf', [ 'fileForProcess' : 'file$1234', 'defaultValue' : 'defaultString' ]); // Starting with attachment data (byte[]) api.advimport.start('f0e05190-145d-0247-0000-00007388e0bf', [ 'fileForProcess' : message.getAttachments()[0].getData() ]); ``` ### Response - **Success**: Import configuration started. ``` -------------------------------- ### SOAP Get Response - Date Value Example Source: https://www.naumen.ru/docs/sd/Content/integration/SOAP_decription.htm?TocPath=%D0%94%D0%BE%D0%BF.+%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D0%B8.+%D0%98%D0%BD%D1%82%D0%B5%D0%B3%D1%80%D0%B0%D1%86%D0%B8%D0%B8%7C_____5 Example of the 'value' tag for attributes storing a specific date. ```xml 2014.10.14 00:00:00 ``` -------------------------------- ### Sorting Examples Source: https://www.naumen.ru/docs/sd/nsmp/Content/script/api_criteria_orderClause.htm Examples demonstrating how to apply sorting using `api.orderClause`. ```APIDOC ## Examples ### Example 1. Sorting the 'title' column in ascending order: ``` criteria.addOrder(api.orderClause.asc(s.alias('title'))) ``` ### Example 2. Sorting by multiple columns (descending 'order', then ascending 'title'): ``` criteria.addOrder(api.orderClause.desc(s.property('order'))) .addOrder(api.orderClause.asc(s.property('title'))) ``` ``` -------------------------------- ### Find Team Example Source: https://www.naumen.ru/docs/sd/Content/RESTful/REST_API_method.htm Example of a GET request to find a team, specifying the metaClass and returning the 'response' attribute. ```HTTP /services/rest/find/team/{%22metaClass%22:%22ATTeamCase%22}?accessKey=&Attr=response ``` -------------------------------- ### SOAP Get Response - Object Type Value Example Source: https://www.naumen.ru/docs/sd/Content/integration/SOAP_decription.htm?TocPath=%D0%94%D0%BE%D0%BF.+%D0%BC%D0%BE%D0%B4%D1%83%D0%BB%D0%B8.+%D0%98%D0%BD%D1%82%D0%B5%D0%B3%D1%80%D0%B0%D1%86%D0%B8%D0%B8%7C_____5 Example of the 'value' tag for attributes specifying the type of an object. ```xml ou$OUType ``` -------------------------------- ### Start Import Source: https://www.naumen.ru/docs/sd/Content/script/api_import.htm Starts a specified import configuration with provided launch parameters. This method allows for dynamic configuration of import processes. ```APIDOC ## api.advimport.start(advimportConfig, parameters) ### Description Starts a specified import configuration with its launch parameters. ### Parameters #### Path Parameters - **advimportConfig** (string) - Required - The identifier of the import configuration to start. - **parameters** (Map) - Optional - Launch parameters for the import. Can accept STRING, byte[], or InputStream types for data source content or string values. ### Request Example ```javascript // Example 1: Starting import without parameters api.advimport.start('f0e05190-145d-0247-0000-00007388e0bf', [:]); // Example 2: Starting import with a file UUID and a string parameter api.advimport.start('f0e05190-145d-0247-0000-00007388e0bf', [ 'fileForProcess' : 'file$1234', 'defaultValue' : 'defaultString' ]); // Example 3: Starting import with attachment data (byte[]) api.advimport.start('f0e05190-145d-0247-0000-00007388e0bf', [ 'fileForProcess' : message.getAttachments()[0].getData() ]); ``` ### Response Indicates the successful launch of the import configuration. ```