diff --git a/03_basics/01_exchange_rates_app/08_exchange_rates_datasource_connection/omquser.qconn.yaml b/03_basics/01_exchange_rates_app/08_exchange_rates_datasource_connection/omquser.qconn.yaml index 0249525275d08dfa8bb7340262017d5464da51f3..bc9894ace685ff78068be4f6d73938e781412c2a 100644 --- a/03_basics/01_exchange_rates_app/08_exchange_rates_datasource_connection/omquser.qconn.yaml +++ b/03_basics/01_exchange_rates_app/08_exchange_rates_datasource_connection/omquser.qconn.yaml @@ -1,4 +1,4 @@ type: connection name: omquser desc: omquser datasource connection, -url: db://pgsql:postgres/omq@postgres(utf8)%pg \ No newline at end of file +url: db://pgsql:omquser/omquser@omquser \ No newline at end of file diff --git a/03_basics/01_exchange_rates_app/10_exchange_currency_workflow_with_mapper/qore/BASICS-EXCHANGE-CURRENCY-WORKFLOW-JAVA-1.0.yaml b/03_basics/01_exchange_rates_app/10_exchange_currency_workflow_with_mapper/qore/BASICS-EXCHANGE-CURRENCY-WORKFLOW-JAVA-1.0.yaml deleted file mode 100644 index 1abd441d8c0d74e8537867adf29af837447577f1..0000000000000000000000000000000000000000 --- a/03_basics/01_exchange_rates_app/10_exchange_currency_workflow_with_mapper/qore/BASICS-EXCHANGE-CURRENCY-WORKFLOW-JAVA-1.0.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# This is a generated file, don't edit! -type: workflow -name: BASICS-EXCHANGE-CURRENCY-WORKFLOW -desc: "Exchange currency workflow with mapper" -author: - - Qore Technologies, s.r.o. -groups: - - BASIC-TRAINING-EXCHANGE-APP -keylist: - - id -mappers: - - basics-exchange-currency-orders:1.0 -steps: - [ - "BasicsExchangeRatesInsertToOrdersTable:1.0" - ] -version: "1.0" -autostart: 1 diff --git a/03_basics/01_exchange_rates_app/10_exchange_currency_workflow_with_mapper/qore/BasicsExchangeRatesInsertToOrdersTable-1.0.qstep b/03_basics/01_exchange_rates_app/10_exchange_currency_workflow_with_mapper/qore/BasicsExchangeRatesInsertToOrdersTable-1.0.qstep index b60063d9b93a1d0d218ea07c7819c875c9d875f9..0cac3b2311892dcfd83bf0f0a8acf250607448e5 100644 --- a/03_basics/01_exchange_rates_app/10_exchange_currency_workflow_with_mapper/qore/BasicsExchangeRatesInsertToOrdersTable-1.0.qstep +++ b/03_basics/01_exchange_rates_app/10_exchange_currency_workflow_with_mapper/qore/BasicsExchangeRatesInsertToOrdersTable-1.0.qstep @@ -5,12 +5,12 @@ class BasicsExchangeRatesInsertToOrdersTable inherits QorusNormalStep { primary() { - InboundTableMapper mapper = getMapper("basics-exchange-currency-orders"); + auto mapper = getMapper("basics-exchange-currency-orders"); on_error mapper.rollback(); on_success mapper.commit(); list> orders = getStaticData("orders"); log(LL_DEBUG_1, "inserting data: %N", orders); - mapper.queueData(orders); + mapper.mapAll(orders); } } diff --git a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/exchange-currency-api-mapper-1.0.qmapper.yaml b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/exchange-currency-api-mapper-1.0.qmapper.yaml index 6056bb7fb6aec5ebcfd4a71752e817a10d0b8097..fecde31a8fe1ad24c7211a5e548dc6d8ff88ac81 100644 --- a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/exchange-currency-api-mapper-1.0.qmapper.yaml +++ b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/exchange-currency-api-mapper-1.0.qmapper.yaml @@ -238,7 +238,7 @@ options: types_returned: - hash name: qoretechnologies - path: /building-blocks/create-order/request + path: /qorus-api/workflows/create-order/request type: type mappertype: Mapper version: "1.0" diff --git a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/java/BasicsExchangeCurrencyApiServiceJava.java b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/java/BasicsExchangeCurrencyApiServiceJava.java index c5ce80677bf9e967801c04e91fb0211ab86554a0..23e6649eb57bb4f396964fb7baae3f40fc91ec6f 100644 --- a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/java/BasicsExchangeCurrencyApiServiceJava.java +++ b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/java/BasicsExchangeCurrencyApiServiceJava.java @@ -39,7 +39,7 @@ class ClassConnections_BasicsExchangeCurrencyApiServiceJava { Object callClassWithPrefixMethod(final String prefixedClass, final String methodName, Object params) throws Throwable { - UserApi.logInfo("ClassConnections_BasicsExchangeCurrencyApiServiceJava: callClassWithPrefixMethod: method: %s, class: %y", methodName, prefixedClass); + UserApi.logDebug("ClassConnections_BasicsExchangeCurrencyApiServiceJava: callClassWithPrefixMethod: method: %s, class: %y", methodName, prefixedClass); final Object object = classMap.get(prefixedClass); if (object instanceof QoreObject) { @@ -51,15 +51,14 @@ class ClassConnections_BasicsExchangeCurrencyApiServiceJava { } } - @SuppressWarnings("unchecked") public Object Connection_1(Object params) throws Throwable { Mapper mapper; - UserApi.logInfo("Connection_1 called with data: %y", params); + UserApi.logDebug("Connection_1 called with data: %y", params); mapper = UserApi.getMapper("exchange-currency-api-mapper"); params = mapper.mapAuto(params); - UserApi.logInfo("calling createOrder: %y", params); + UserApi.logDebug("calling createOrder: %y", params); return callClassWithPrefixMethod("BBM_CreateOrder", "createWorkflowOrderConnector", params); } } diff --git a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/java/basics-exchange-currency-api-service-java-1.0.qsd.yaml b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/java/basics-exchange-currency-api-service-java-1.0.qsd.yaml index 07bfc0e7e8d29ddd946a3256c7fe6da2f7586462..4ac276a77b0c73e3d3b445a43af6f1c455480258 100644 --- a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/java/basics-exchange-currency-api-service-java-1.0.qsd.yaml +++ b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/java/basics-exchange-currency-api-service-java-1.0.qsd.yaml @@ -28,6 +28,8 @@ config-items: interface-name: BBM_CreateOrder interface-version: "1.0" - name: create-workflow-name + value: + "BASICS-EXCHANGE-CURRENCY-WORKFLOW" parent: interface-type: class interface-name: BBM_CreateOrder diff --git a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/qore/basics-exchange-currency-api-service-1.0.qsd b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/qore/basics-exchange-currency-api-service-1.0.qsd index 77fd64ff33f3e51850557bb94427cf32fca5f826..1c74028746a13dfc6832e8382b6ac7ddee01e725 100644 --- a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/qore/basics-exchange-currency-api-service-1.0.qsd +++ b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/qore/basics-exchange-currency-api-service-1.0.qsd @@ -6,18 +6,12 @@ class BasicsExchangeCurrencyApiService inherits QorusService { private { ####### GENERATED SECTION! DON'T EDIT! ######## - ClassConnections_BasicsExchangeCurrencyApiService class_connections; - ############ GENERATED SECTION END ############ - } - - constructor() { - ####### GENERATED SECTION! DON'T EDIT! ######## - class_connections = new ClassConnections_BasicsExchangeCurrencyApiService(); + ClassConnections_BasicsExchangeCurrencyApiService class_connections(); ############ GENERATED SECTION END ############ } ####### GENERATED SECTION! DON'T EDIT! ######## - auto exchange(*hash params) { + auto exchange(auto params) { return class_connections.Connection_1(params); } ############ GENERATED SECTION END ############ @@ -41,12 +35,12 @@ class ClassConnections_BasicsExchangeCurrencyApiService { return call_object_method_args(class_map{prefixed_class}, method, argv); } - auto Connection_1(*hash params) { + auto Connection_1(auto params) { auto mapper; UserApi::logDebug("Connection_1 called with data: %y", params); mapper = UserApi::getMapper("exchange-currency-api-mapper"); - params = mapper.mapData(params); + params = mapper.mapAuto(params); UserApi::logDebug("calling createOrder: %y", params); return callClassWithPrefixMethod("BBM_CreateOrder", "createWorkflowOrderConnector", params); diff --git a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/qore/basics-exchange-currency-api-service-1.0.qsd.yaml b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/qore/basics-exchange-currency-api-service-1.0.qsd.yaml index a587c546893778a6c61383c8a6bd67312002317b..513665b9f945115b56b93efbde26065c63fc1a19 100644 --- a/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/qore/basics-exchange-currency-api-service-1.0.qsd.yaml +++ b/03_basics/01_exchange_rates_app/11_exchange_currency_api_service/qore/basics-exchange-currency-api-service-1.0.qsd.yaml @@ -1,7 +1,7 @@ # This is a generated file, don't edit! type: service name: basics-exchange-currency-api-service -desc: "Exchange currency API service" +desc: Exchange currency API service author: - Qore Technologies, s.r.o. base-class-name: QorusService @@ -30,6 +30,8 @@ config-items: interface-name: BBM_CreateOrder interface-version: "1.0" - name: create-workflow-name + value: + "BASICS-EXCHANGE-CURRENCY-WORKFLOW-JAVA" parent: interface-type: class interface-name: BBM_CreateOrder diff --git a/03_basics/01_exchange_rates_app/12_process_orders_workflow/qore/lib/BasicsChangeOrderStatus-1.0.qclass b/03_basics/01_exchange_rates_app/12_process_orders_workflow/qore/lib/BasicsChangeOrderStatus-1.0.qclass index e4364f604d7fc0b0de9af4c9a9ffc4910b3bb2f8..4747f1bd5575a462b6ae70269ed73bc037f093aa 100644 --- a/03_basics/01_exchange_rates_app/12_process_orders_workflow/qore/lib/BasicsChangeOrderStatus-1.0.qclass +++ b/03_basics/01_exchange_rates_app/12_process_orders_workflow/qore/lib/BasicsChangeOrderStatus-1.0.qclass @@ -7,7 +7,7 @@ class BasicsChangeOrderStatus { static changeStatus(DatasourcePool ds, string status) { - list> orders = getStaticData("orders"); + list> orders = WorkflowApi::getStaticData("orders"); AbstractTable orders_table = UserApi::getSqlTable(ds, "exchange_orders"); foreach hash order in (orders) { diff --git a/03_basics/01_exchange_rates_app/13_process_orders_job/basics-process-orders-job-mapper-1.0.qmapper.yaml b/03_basics/01_exchange_rates_app/13_process_orders_job/basics-process-orders-job-mapper-1.0.qmapper.yaml index f8c52ac2b45171dc10651c915134fd13369822c0..de7be769c438a6e75ea4fa8a26422e20bc87faa9 100644 --- a/03_basics/01_exchange_rates_app/13_process_orders_job/basics-process-orders-job-mapper-1.0.qmapper.yaml +++ b/03_basics/01_exchange_rates_app/13_process_orders_job/basics-process-orders-job-mapper-1.0.qmapper.yaml @@ -138,7 +138,7 @@ options: types_returned: - hash name: qoretechnologies - path: /building-blocks/create-order/request + path: /qorus-api/workflows/create-order/request type: type mappertype: Mapper version: "1.0" diff --git a/03_basics/01_exchange_rates_app/13_process_orders_job/qore/basics-process-orders-job-1.0.qjob b/03_basics/01_exchange_rates_app/13_process_orders_job/qore/basics-process-orders-job-1.0.qjob index 974dcd38d6d60c6d54a07429521327694495cbd6..8938f591e40c9790843e06af64d683ec5d55f602 100644 --- a/03_basics/01_exchange_rates_app/13_process_orders_job/qore/basics-process-orders-job-1.0.qjob +++ b/03_basics/01_exchange_rates_app/13_process_orders_job/qore/basics-process-orders-job-1.0.qjob @@ -6,13 +6,7 @@ class BasicsProcessOrdersJob inherits QorusJob { private { ####### GENERATED SECTION! DON'T EDIT! ######## - ClassConnections_BasicsProcessOrdersJob class_connections; - ############ GENERATED SECTION END ############ - } - - constructor() { - ####### GENERATED SECTION! DON'T EDIT! ######## - class_connections = new ClassConnections_BasicsProcessOrdersJob(); + ClassConnections_BasicsProcessOrdersJob class_connections(); ############ GENERATED SECTION END ############ } @@ -42,20 +36,15 @@ class ClassConnections_BasicsProcessOrdersJob { return call_object_method_args(class_map{prefixed_class}, method, argv); } - auto Connection_1(*hash params) { + auto Connection_1(auto params) { auto mapper; UserApi::logDebug("Connection_1 called with data: %y", params); UserApi::logDebug("calling BasicsProcessOrdersClass1: %y", params); params = callClassWithPrefixMethod("BasicsProcessOrdersClass", "getParams", params); - if (!params) { - UserApi::logDebug("no data - skip wf order creation"); - return; - } - mapper = UserApi::getMapper("basics-process-orders-job-mapper"); - params = mapper.mapData(params); + params = mapper.mapAuto(params); UserApi::logDebug("calling createOrder: %y", params); return callClassWithPrefixMethod("BBM_CreateOrder", "createWorkflowOrderConnector", params); diff --git a/03_basics/01_exchange_rates_app/13_process_orders_job/qore/basics-process-orders-job-1.0.qjob.yaml b/03_basics/01_exchange_rates_app/13_process_orders_job/qore/basics-process-orders-job-1.0.qjob.yaml index fde4ca612ede21ad8b461ff46ddeaed11016aa54..b4da0cf3ff84bf6b819c9348a29631311c89a5d3 100644 --- a/03_basics/01_exchange_rates_app/13_process_orders_job/qore/basics-process-orders-job-1.0.qjob.yaml +++ b/03_basics/01_exchange_rates_app/13_process_orders_job/qore/basics-process-orders-job-1.0.qjob.yaml @@ -1,7 +1,7 @@ # This is a generated file, don't edit! type: job name: basics-process-orders-job -desc: "Creates BASICS-PROCESS-ORDERS-WORKFLOW orders" +desc: Creates BASICS-PROCESS-ORDERS-WORKFLOW orders author: - Qore Technologies, s.r.o. base-class-name: QorusJob @@ -64,6 +64,8 @@ config-items: interface-name: BBM_CreateOrder interface-version: "1.0" - name: user_email + value: + "francois.dziedzinl@qoretechnologies.com" config_group: Default - description: "User email where the email notification will be sent" + description: User email where the email notification will be sent strictly_local: true diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BASICS-PROCESS-ORDERS-SUBWORKFLOW-v1.0.qwf b/04_advanced_examples/00_extend_exchange_rates_app/BASICS-PROCESS-ORDERS-SUBWORKFLOW-v1.0.qwf deleted file mode 100644 index 557ac98602d70953b801fe00a8027b669f538bac..0000000000000000000000000000000000000000 --- a/04_advanced_examples/00_extend_exchange_rates_app/BASICS-PROCESS-ORDERS-SUBWORKFLOW-v1.0.qwf +++ /dev/null @@ -1,31 +0,0 @@ -# -*- mode: qore; indent-tabs-mode: nil -*- -# -# Qorus Integration Engine - -%new-style -%strict-args -%require-types -%enable-all-warnings - -our string format_version = "2.6"; - -our hash groups."BASIC-TRAINING-EXCHANGE-APP".desc = "Basic training exchange application objects"; - -const steps = ( - "class:BasicsChangeOrderStatusToInProgress:1.0", - "class:BasicsSendMoneyToBank:2.0", - "class:BasicsSendMoneyToUser:2.0", - "class:BasicsSendEmailToUser:2.0", - "class:BasicsChangeOrderStatusToCompleted:1.0", -); - -our hash workflows."BASICS-PROCESS-ORDERS-SUBWORKFLOW"."1.0" = { - "desc" : "Processes given orders", - "author" : "Alzhan Turlybekov (Qore Technologies)", - "steps" : steps, - "keylist" : ("id",), - "classes" : ("BasicsChangeOrderStatus",), - "constants" : ("exchange_rates_app_constants",), - "groups" : ("BASIC-TRAINING-EXCHANGE-APP",), - "autostart" : 1, -}; diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BASICS-PROCESS-ORDERS-WORKFLOW-v2.0.qwf b/04_advanced_examples/00_extend_exchange_rates_app/BASICS-PROCESS-ORDERS-WORKFLOW-v2.0.qwf deleted file mode 100644 index e6b69adca6b0d7d82c81dbcee41ca7999c9a276e..0000000000000000000000000000000000000000 --- a/04_advanced_examples/00_extend_exchange_rates_app/BASICS-PROCESS-ORDERS-WORKFLOW-v2.0.qwf +++ /dev/null @@ -1,33 +0,0 @@ -# -*- mode: qore; indent-tabs-mode: nil -*- -# -# Qorus Integration Engine - -%new-style -%strict-args -%require-types -%enable-all-warnings - -our string format_version = "2.6"; - -our hash groups."BASIC-TRAINING-EXCHANGE-APP".desc = "Basic training exchange application objects"; - -const start_subworkflow_for_each_order = { - "name": "basics_start_subworkflow_for_each_order:1.0", - "classname": "BasicsStartSubworkflowForEachOrderStep:1.0", - "arraytype" : "SERIES", - "subworkflow" : True, -}; - -const steps = ( - start_subworkflow_for_each_order, -); - -our hash workflows."BASICS-PROCESS-ORDERS-WORKFLOW"."2.0" = { - "desc" : "Processes given orders", - "author" : "Alzhan Turlybekov (Qore Technologies)", - "steps" : steps, - "keylist" : ("ids",), - "functions" : (), - "groups" : ("BASIC-TRAINING-EXCHANGE-APP",), - "autostart" : 1, -}; diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatusToCompleted-v1.0.qclass b/04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatusToCompleted-v1.0.qclass deleted file mode 100644 index 77b47c2988c05cbdf50820f3f9c031634f7c5061..0000000000000000000000000000000000000000 --- a/04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatusToCompleted-v1.0.qclass +++ /dev/null @@ -1,20 +0,0 @@ -# name: BasicsChangeOrderStatusToCompleted -# version: 1.0 -# desc: Changes the status of orders to completed -# author: Alzhan Turlybekov (Qore Technologies) - -%strict-args -%require-types -%new-style -%enable-all-warnings - -class BasicsChangeOrderStatusToCompleted inherits QorusNormalStep { - primary() { - DatasourcePool omquser_ds = getDatasourcePool("omquser"); - on_success omquser_ds.commit(); - on_error omquser_ds.rollback(); - - BasicsChangeOrderStatus::changeStatus(omquser_ds, "completed"); - } -} -# END diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BasicsSendMoneyToUser-v2.0.qclass b/04_advanced_examples/00_extend_exchange_rates_app/BasicsSendMoneyToUser-v2.0.qclass deleted file mode 100644 index 57c16af956dd7ec1575d387e30fcd1bffd2ad7d8..0000000000000000000000000000000000000000 --- a/04_advanced_examples/00_extend_exchange_rates_app/BasicsSendMoneyToUser-v2.0.qclass +++ /dev/null @@ -1,19 +0,0 @@ -# name: BasicsSendMoneyToUser -# version: 2.0 -# desc: Sends money to user -# author: Alzhan Turlybekov (Qore Technologies) - -%strict-args -%require-types -%new-style -%enable-all-warnings - -%requires SqlUtil - -class BasicsSendMoneyToUser inherits QorusNormalStep { - primary() { - hash order = getStaticData("order"); - log(LL_DEBUG_1, "Money sent to user: %d %s", order.amount, order.currency_to_buy); - } -} -# END diff --git a/04_advanced_examples/00_extend_exchange_rates_app/exchange_rates_app_constants-v1.0.qconst b/04_advanced_examples/00_extend_exchange_rates_app/exchange_rates_app_constants-v1.0.qconst deleted file mode 100644 index 37c20ed96aed6753c4a342bcf389215d37945a7b..0000000000000000000000000000000000000000 --- a/04_advanced_examples/00_extend_exchange_rates_app/exchange_rates_app_constants-v1.0.qconst +++ /dev/null @@ -1,17 +0,0 @@ -# -*- mode: qore; indent-tabs-mode nil -*- - -# name: exchange_rates_app_constants -# version: 1.0 -# desc: Defines constants for exchange rates application -# author: Alzhan Turlybekov (Qore Technologies) - -%new-style -%require-types -%strict-args -%enable-all-warnings - -namespace ExchangeRates { - # Commission is used to calculate the amount that will be sent to the bank - const COMMISSION = 0.05; -} -# END \ No newline at end of file diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BASICS-PROCESS-ORDERS-SUBWORKFLOW-1.0.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BASICS-PROCESS-ORDERS-SUBWORKFLOW-1.0.yaml new file mode 100644 index 0000000000000000000000000000000000000000..141644d30d824ce291295bf267c9156d77368db4 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BASICS-PROCESS-ORDERS-SUBWORKFLOW-1.0.yaml @@ -0,0 +1,22 @@ +# This is a generated file, don't edit! +type: workflow +name: BASICS-PROCESS-ORDERS-SUBWORKFLOW +desc: Processes given orders +author: + - Qore Technologies, s.r.o. +classes: + - BasicsChangeOrderStatus +groups: + - BASIC-TRAINING-EXCHANGE-APP +keylist: + - id +steps: + [ + "BasicsChangeOrderStatusToInProgress:1.0", + "BasicsSendMoneyToBank:2.0", + "BasicsSendMoneyToUser:2.0", + "BasicsSendEmailToUser:2.0", + "BasicsChangeOrderStatusToCompleted:1.0" + ] +version: "1.0" +autostart: 1 diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BASICS-PROCESS-ORDERS-WORKFLOW-2.0.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BASICS-PROCESS-ORDERS-WORKFLOW-2.0.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c7be129fd5dd488b7837171fbe9e1f46643b6176 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BASICS-PROCESS-ORDERS-WORKFLOW-2.0.yaml @@ -0,0 +1,16 @@ +# This is a generated file, don't edit! +type: workflow +name: BASICS-PROCESS-ORDERS-WORKFLOW +desc: Processes given orders +author: + - Qore Technologies, s.r.o. +groups: + - BASIC-TRAINING-EXCHANGE-APP +keylist: + - ids +steps: + [ + "BasicsStartSubworkflowForEachOrderStep:1.0" + ] +version: "2.0" +autostart: 1 diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatus-v2.0.qclass b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatus-2.0.qclass similarity index 55% rename from 04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatus-v2.0.qclass rename to 04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatus-2.0.qclass index 8d6504208a7135e3625b32f2fe0cd05dd82cd03d..5d5db1e0d042657fbe744f4a0c7861be0852427e 100644 --- a/04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatus-v2.0.qclass +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatus-2.0.qclass @@ -1,18 +1,12 @@ -# name: BasicsChangeOrderStatus -# version: 2.0 -# desc: Changes the status of the order -# author: Alzhan Turlybekov (Qore Technologies) - +%new-style %strict-args %require-types -%new-style %enable-all-warnings -class BasicsChangeOrderStatus inherits WorkflowApi { +class BasicsChangeOrderStatus { static changeStatus(DatasourcePool omquser_ds, string status) { - hash order = getStaticData("order"); + hash order = WorkflowApi::getStaticData("order"); SqlUtil::AbstractTable orders_table = UserApi::getSqlTable(omquser_ds, "exchange_orders"); orders_table.update({"status": status}, {"id": order.id}); } } -# END diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatus-2.0.qclass.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatus-2.0.qclass.yaml new file mode 100644 index 0000000000000000000000000000000000000000..02b55cb1ab98b8a19a7ce615f862ddb158d76999 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatus-2.0.qclass.yaml @@ -0,0 +1,9 @@ +# This is a generated file, don't edit! +type: class +name: BasicsChangeOrderStatus +desc: "Changes the status of orders" +author: + - Qore Technologies, s.r.o. +lang: qore +version: "2.0" +code: BasicsChangeOrderStatus-2.0.qclass diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToCompleted-1.0.qstep b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToCompleted-1.0.qstep new file mode 100644 index 0000000000000000000000000000000000000000..25293708b6c6e753a3b300381efebbcd0bc72fb9 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToCompleted-1.0.qstep @@ -0,0 +1,14 @@ +%new-style +%strict-args +%require-types +%enable-all-warnings + +class BasicsChangeOrderStatusToCompleted inherits QorusNormalStep { + primary() { + DatasourcePool ds = getDatasourcePool("omquser"); + on_success ds.commit(); + on_error ds.rollback(); + + BasicsChangeOrderStatus::changeStatus(ds, "completed"); + } +} diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToCompleted-1.0.qstep.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToCompleted-1.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1555a11e278916cfcb2fb8758a5e90695489a1aa --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToCompleted-1.0.qstep.yaml @@ -0,0 +1,12 @@ +# This is a generated file, don't edit! +type: step +name: BasicsChangeOrderStatusToCompleted +desc: "Changes the status of orders to completed" +author: + - Qore Technologies, s.r.o. +base-class-name: QorusNormalStep +class-name: BasicsChangeOrderStatusToCompleted +lang: qore +version: "1.0" +steptype: NORMAL +code: BasicsChangeOrderStatusToCompleted-1.0.qstep diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatusToInProgress-v1.0.qclass b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToInProgress-1.0.qstep similarity index 69% rename from 04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatusToInProgress-v1.0.qclass rename to 04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToInProgress-1.0.qstep index 7f98ed839cdd6ce4ea9c7a4218b24c7d6aa209ed..d95f76fccd08305365e419fb1b39beb98e3adae0 100644 --- a/04_advanced_examples/00_extend_exchange_rates_app/BasicsChangeOrderStatusToInProgress-v1.0.qclass +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToInProgress-1.0.qstep @@ -1,11 +1,6 @@ -# name: BasicsChangeOrderStatusToInProgress -# version: 1.0 -# desc: Changes the status of orders to in progress -# author: Alzhan Turlybekov (Qore Technologies) - +%new-style %strict-args %require-types -%new-style %enable-all-warnings class BasicsChangeOrderStatusToInProgress inherits QorusNormalStep { @@ -17,4 +12,3 @@ class BasicsChangeOrderStatusToInProgress inherits QorusNormalStep { BasicsChangeOrderStatus::changeStatus(omquser_ds, "in progress"); } } -# END diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToInProgress-1.0.qstep.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToInProgress-1.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..25fe16ae8253a0174568ffeecc3b3eebf877a0b7 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsChangeOrderStatusToInProgress-1.0.qstep.yaml @@ -0,0 +1,12 @@ +# This is a generated file, don't edit! +type: step +name: BasicsChangeOrderStatusToInProgress +desc: "Changes the status of orders to in progress" +author: + - Qore Technologies, s.r.o. +base-class-name: QorusNormalStep +class-name: BasicsChangeOrderStatusToInProgress +lang: qore +version: "1.0" +steptype: NORMAL +code: BasicsChangeOrderStatusToInProgress-1.0.qstep diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BasicsSendEmailToUser-v2.0.qclass b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendEmailToUser-2.0.qstep similarity index 74% rename from 04_advanced_examples/00_extend_exchange_rates_app/BasicsSendEmailToUser-v2.0.qclass rename to 04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendEmailToUser-2.0.qstep index 8e10de5b0777d422291c381d93d98472bf3b8d9c..33bbccf692c9c6e6ae9d2f2bf4885e856910eeee 100644 --- a/04_advanced_examples/00_extend_exchange_rates_app/BasicsSendEmailToUser-v2.0.qclass +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendEmailToUser-2.0.qstep @@ -1,11 +1,6 @@ -# name: BasicsSendEmailToUser -# version: 2.0 -# desc: Sends email to user -# author: Alzhan Turlybekov (Qore Technologies) - +%new-style %strict-args %require-types -%new-style %enable-all-warnings %requires SmtpClient @@ -17,7 +12,7 @@ class BasicsSendEmailToUser inherits QorusNormalStep { SmtpClient smtp = getUserConnection("smtp-email"); - log(LL_DEBUG_1, "Sending email to %s", order.user_email); + logInfo("Sending email to %s", order.user_email); MailMessage::Message message("test.qorus@gmail.com", "Order details"); string text = sprintf("You have received %d %s", order.amount, order.currency_to_buy); @@ -26,4 +21,3 @@ class BasicsSendEmailToUser inherits QorusNormalStep { smtp.sendMessage(message); } } -# END diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendEmailToUser-2.0.qstep.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendEmailToUser-2.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..20a9e205c4c0b1628e615ee9a443fb343329d440 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendEmailToUser-2.0.qstep.yaml @@ -0,0 +1,12 @@ +# This is a generated file, don't edit! +type: step +name: BasicsSendEmailToUser +desc: "Sends email to user" +author: + - Qore Technologies, s.r.o. +base-class-name: QorusNormalStep +class-name: BasicsSendEmailToUser +lang: qore +version: "2.0" +steptype: NORMAL +code: BasicsSendEmailToUser-2.0.qstep diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BasicsSendMoneyToBank-v2.0.qclass b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToBank-2.0.qstep similarity index 70% rename from 04_advanced_examples/00_extend_exchange_rates_app/BasicsSendMoneyToBank-v2.0.qclass rename to 04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToBank-2.0.qstep index 3ce70738b2cc0c8b853905baba46a3ab19436258..9a49d0f646236d122fde20707f448633a98700ac 100644 --- a/04_advanced_examples/00_extend_exchange_rates_app/BasicsSendMoneyToBank-v2.0.qclass +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToBank-2.0.qstep @@ -1,11 +1,6 @@ -# name: BasicsSendMoneyToBank -# version: 2.0 -# desc: Sends money to bank -# author: Alzhan Turlybekov (Qore Technologies) - +%new-style %strict-args %require-types -%new-style %enable-all-warnings class BasicsSendMoneyToBank inherits QorusNormalStep { @@ -23,11 +18,10 @@ class BasicsSendMoneyToBank inherits QorusNormalStep { } float rate = exchange_rates{order.currency_to_buy}; - log(LL_DEBUG_1, "rate: %y", rate); + logInfo("rate: %y", rate); float amount_to_send = (order.amount / rate) * exchange_rates{order.currency_to_sell}; - amount_to_send += amount_to_send * ExchangeRates::COMMISSION; - log(LL_DEBUG_1, "Money sent to bank: %f %s", amount_to_send, order.currency_to_sell); + amount_to_send += amount_to_send * getConfigItemValue("bank-commission"); + logInfo("Money sent to bank: %f %s", amount_to_send, order.currency_to_sell); } } -# END diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToBank-2.0.qstep.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToBank-2.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..71042a140fcfede28610622b70dac555fa35545c --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToBank-2.0.qstep.yaml @@ -0,0 +1,19 @@ +# This is a generated file, don't edit! +type: step +name: BasicsSendMoneyToBank +desc: Sends money to bank +author: + - Qore Technologies, s.r.o. +base-class-name: QorusNormalStep +class-name: BasicsSendMoneyToBank +lang: qore +version: "2.0" +steptype: NORMAL +code: BasicsSendMoneyToBank-2.0.qstep +config-items: + - name: bank-commission + default_value: + 0.02 + config_group: Default + description: Bank commission + type: float diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToUser-2.0.qstep b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToUser-2.0.qstep new file mode 100644 index 0000000000000000000000000000000000000000..022a48aedd051e0a4317c1409705f0dcc07e6d85 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToUser-2.0.qstep @@ -0,0 +1,11 @@ +%new-style +%strict-args +%require-types +%enable-all-warnings + +class BasicsSendMoneyToUser inherits QorusNormalStep { + primary() { + hash order = getStaticData("order"); + logInfo("Money sent to user: %d %s", order.amount, order.currency_to_buy); + } +} diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToUser-2.0.qstep.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToUser-2.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..edd6ade5ab562e88edf3520d83f494e08d8344eb --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsSendMoneyToUser-2.0.qstep.yaml @@ -0,0 +1,12 @@ +# This is a generated file, don't edit! +type: step +name: BasicsSendMoneyToUser +desc: '"Sends money to user"' +author: + - Qore Technologies, s.r.o. +base-class-name: QorusNormalStep +class-name: BasicsSendMoneyToUser +lang: qore +version: "2.0" +steptype: NORMAL +code: BasicsSendMoneyToUser-2.0.qstep diff --git a/04_advanced_examples/00_extend_exchange_rates_app/BasicsStartSubworkflowForEachOrderStep-v1.0.qclass b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsStartSubworkflowForEachOrderStep-1.0.qstep similarity index 83% rename from 04_advanced_examples/00_extend_exchange_rates_app/BasicsStartSubworkflowForEachOrderStep-v1.0.qclass rename to 04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsStartSubworkflowForEachOrderStep-1.0.qstep index 02a6dae2ecca7aa80e87725bc7ba5dc1600a10d3..4faab53a9f958405815fc52b656d6b5a306ee50c 100644 --- a/04_advanced_examples/00_extend_exchange_rates_app/BasicsStartSubworkflowForEachOrderStep-v1.0.qclass +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsStartSubworkflowForEachOrderStep-1.0.qstep @@ -1,11 +1,6 @@ -# name: BasicsStartSubworkflowForEachOrderStep -# version: 1.0 -# desc: Sends money and notifications executing a subworkflow -# author: Alzhan Turlybekov (Qore Technologies) - +%new-style %strict-args %require-types -%new-style %enable-all-warnings class BasicsStartSubworkflowForEachOrderStep inherits QorusSubworkflowArrayStep { @@ -34,4 +29,3 @@ class BasicsStartSubworkflowForEachOrderStep inherits QorusSubworkflowArrayStep return orders; } } -# END diff --git a/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsStartSubworkflowForEachOrderStep-1.0.qstep.yaml b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsStartSubworkflowForEachOrderStep-1.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..fc76b11acca041779138fa4f418f224853f150e9 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/qore/BasicsStartSubworkflowForEachOrderStep-1.0.qstep.yaml @@ -0,0 +1,13 @@ +# This is a generated file, don't edit! +type: step +name: BasicsStartSubworkflowForEachOrderStep +desc: Sends money and notifications executing a subworkflow +author: + - Qore Technologies, s.r.o. +base-class-name: QorusSubworkflowArrayStep +class-name: BasicsStartSubworkflowForEachOrderStep +lang: qore +version: "1.0" +steptype: SUBWORKFLOW +arraytype: SERIES +code: BasicsStartSubworkflowForEachOrderStep-1.0.qstep diff --git a/04_advanced_examples/00_extend_exchange_rates_app/smtp-email.qconn b/04_advanced_examples/00_extend_exchange_rates_app/smtp-email.qconn deleted file mode 100644 index 5b2b7daf8d48b58154b3b6a24d369726019c059e..0000000000000000000000000000000000000000 --- a/04_advanced_examples/00_extend_exchange_rates_app/smtp-email.qconn +++ /dev/null @@ -1,4 +0,0 @@ -smtp-email = ( - desc = "SMTP email connection", - url = esmtptls://test.qorus:Atb12345@smtp.gmail.com, -) \ No newline at end of file diff --git a/04_advanced_examples/00_extend_exchange_rates_app/smtp-email.qconn.yaml b/04_advanced_examples/00_extend_exchange_rates_app/smtp-email.qconn.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e186f8cfad0c2035fc6c19e7031ae42aa5ba02e6 --- /dev/null +++ b/04_advanced_examples/00_extend_exchange_rates_app/smtp-email.qconn.yaml @@ -0,0 +1,4 @@ +type: connection +name: smtp-email +desc: SMTP email connection +url: esmtptls://test.qorus:QQQ1234qqq!!!@smtp.gmail.com \ No newline at end of file diff --git a/04_advanced_examples/01_asynchronious_step/ADV-EXAMPLES-ASYNC-STEP-v1.0.qwf b/04_advanced_examples/01_asynchronious_step/ADV-EXAMPLES-ASYNC-STEP-v1.0.qwf deleted file mode 100644 index b8592feb557b4cb7420305468d5e39d997a58834..0000000000000000000000000000000000000000 --- a/04_advanced_examples/01_asynchronious_step/ADV-EXAMPLES-ASYNC-STEP-v1.0.qwf +++ /dev/null @@ -1,33 +0,0 @@ -# -*- mode: qore; indent-tabs-mode: nil -*- -# -# Qorus Integration Engine - -%new-style -%strict-args -%require-types -%enable-all-warnings - -our string format_version = "2.6"; - -our hash groups."ADVANCED-EXAMPLES".desc = "Qorus advanced examples"; - -our hash queues."adv_examples_queue" = {"desc": "asynchronous queue for advanced examples"}; - -const async_step = { - "name": "adv_examples_async_step:1.0", - "classname": "AdvExamplesAsyncStep:1.0", - "queue": "adv_examples_queue", -}; - -const steps = ( - async_step, - "class:AdvExamplesAsyncStepSaveDataToCsvFile:1.0" -); - -our hash workflows."ADV-EXAMPLES-ASYNC_STEP"."1.0" = { - "desc" : "Example of asynchronous steps", - "author" : "Alzhan Turlybekov (Qore Technologies)", - "steps" : steps, - "groups" : ("ADVANCED-EXAMPLES",), - "autostart" : 1, -}; diff --git a/04_advanced_examples/01_asynchronious_step/ADVANCED-EXAMPLES.qgroup.yaml b/04_advanced_examples/01_asynchronious_step/ADVANCED-EXAMPLES.qgroup.yaml new file mode 100644 index 0000000000000000000000000000000000000000..98532c3f94ebad994ba134719eb604ae1fed03e6 --- /dev/null +++ b/04_advanced_examples/01_asynchronious_step/ADVANCED-EXAMPLES.qgroup.yaml @@ -0,0 +1,4 @@ +# This is a generated file, don't edit! +type: group +name: ADVANCED-EXAMPLES +desc: "Basic training exchange application objects" diff --git a/04_advanced_examples/01_asynchronious_step/adv-examples-test-sftp.qconn b/04_advanced_examples/01_asynchronious_step/adv-examples-test-sftp.qconn deleted file mode 100644 index 0ea84603d0c65e141e4e90c85470d4c2a52e1b74..0000000000000000000000000000000000000000 --- a/04_advanced_examples/01_asynchronious_step/adv-examples-test-sftp.qconn +++ /dev/null @@ -1,4 +0,0 @@ -adv-examples-test-sftp = ( - desc = Test SFTP for advanced examples, - url = file://tmp, -) \ No newline at end of file diff --git a/04_advanced_examples/01_asynchronious_step/adv-examples-test-sftp.qconn.yaml b/04_advanced_examples/01_asynchronious_step/adv-examples-test-sftp.qconn.yaml new file mode 100644 index 0000000000000000000000000000000000000000..31c6a469c8c9747d9d33ec33b791f9de47a238ac --- /dev/null +++ b/04_advanced_examples/01_asynchronious_step/adv-examples-test-sftp.qconn.yaml @@ -0,0 +1,4 @@ +type: connection +name: adv-examples-test-sftp +desc: Test SFTP for advanced examples +url: file://tmp \ No newline at end of file diff --git a/04_advanced_examples/01_asynchronious_step/adv_examples_queue.qqueue.yaml b/04_advanced_examples/01_asynchronious_step/adv_examples_queue.qqueue.yaml new file mode 100644 index 0000000000000000000000000000000000000000..18c7b1b5eab1b8caaadda220bfbebb2ea2bf3331 --- /dev/null +++ b/04_advanced_examples/01_asynchronious_step/adv_examples_queue.qqueue.yaml @@ -0,0 +1,4 @@ +# This is a generated file, don't edit! +type: queue +name: adv_examples_queue +desc: asynchronous queue for advanced examples diff --git a/04_advanced_examples/01_asynchronious_step/qore/ADV-EXAMPLES-ASYNC-STEP-1.0.yaml b/04_advanced_examples/01_asynchronious_step/qore/ADV-EXAMPLES-ASYNC-STEP-1.0.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6961288fe31f35294caa3719199f814f8376e361 --- /dev/null +++ b/04_advanced_examples/01_asynchronious_step/qore/ADV-EXAMPLES-ASYNC-STEP-1.0.yaml @@ -0,0 +1,15 @@ +# This is a generated file, don't edit! +type: workflow +name: ADV-EXAMPLES-ASYNC-STEP +desc: Example of asynchronous steps +author: + - Qore Technologies, s.r.o. +groups: + - ADVANCED-EXAMPLES +steps: + [ + "AdvExamplesAsyncStep:1.0", + "AdvExamplesAsyncStepSaveDataToCsvFile:1.0" + ] +version: "1.0" +autostart: 1 diff --git a/04_advanced_examples/01_asynchronious_step/AdvExamplesAsyncStep-v1.0.qclass b/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStep-1.0.qstep similarity index 59% rename from 04_advanced_examples/01_asynchronious_step/AdvExamplesAsyncStep-v1.0.qclass rename to 04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStep-1.0.qstep index d22248ccabcb997632f3bb1484c2d977ec29886e..8eaf03b456a7379a814c2b57ba3b028645bf3f8d 100644 --- a/04_advanced_examples/01_asynchronious_step/AdvExamplesAsyncStep-v1.0.qclass +++ b/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStep-1.0.qstep @@ -1,23 +1,17 @@ -# name: AdvExamplesAsyncStep -# version: 1.0 -# desc: Creates the asynchronous WF that must wait for the completion of processing enriched data in DB -# author: Alzhan Turlybekov (Qore Technologies) -# TAG: advanced-training: true - %new-style -%require-types %strict-args +%require-types %enable-all-warnings class AdvExamplesAsyncStep inherits QorusAsyncStep { primary() { - log (LL_INFO, "Check data completion"); + logInfo("Check data completion"); submitAsyncKey(generateUniqueKey()); } string validation(*string id) { - log (LL_INFO, "Check data completion for id %y", id); + logInfo("Check data completion for id %y", id); DatasourcePool ds = getDatasourcePool("omquser"); on_success ds.commit(); @@ -32,7 +26,6 @@ class AdvExamplesAsyncStep inherits QorusAsyncStep { } end(hash data) { - log(LL_INFO, "All data have been enriched"); + logInfo("All data have been enriched"); } } -# END diff --git a/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStep-1.0.qstep.yaml b/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStep-1.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..eacf1fe4ba7530b69ffe7726323289aa90d452bc --- /dev/null +++ b/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStep-1.0.qstep.yaml @@ -0,0 +1,15 @@ +# This is a generated file, don't edit! +type: step +name: AdvExamplesAsyncStep +desc: >- + Creates the asynchronous WF that must wait for the completion of processing + enriched data in DB +author: + - Qore Technologies, s.r.o. +base-class-name: QorusAsyncStep +class-name: AdvExamplesAsyncStep +lang: qore +queue: adv_examples_queue +version: "1.0" +steptype: ASYNC +code: AdvExamplesAsyncStep-1.0.qstep diff --git a/04_advanced_examples/01_asynchronious_step/AdvExamplesAsyncStepSaveDataToCsvFile-v1.0.qclass b/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStepSaveDataToCsvFile-1.0.qstep similarity index 51% rename from 04_advanced_examples/01_asynchronious_step/AdvExamplesAsyncStepSaveDataToCsvFile-v1.0.qclass rename to 04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStepSaveDataToCsvFile-1.0.qstep index 209e05d76a93c2118760f463c949002da352fa3e..e0cad69b2f26e6dbf59766b73f4f25d3b8c5a4be 100644 --- a/04_advanced_examples/01_asynchronious_step/AdvExamplesAsyncStepSaveDataToCsvFile-v1.0.qclass +++ b/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStepSaveDataToCsvFile-1.0.qstep @@ -1,32 +1,11 @@ -# name: AdvExamplesAsyncStepSaveDataToCsvFile -# version: 1.0 -# desc: Saves data from the DB to csv file -# author: Alzhan Turlybekov (Qore Technologies) -# TAG: advanced-training: true - %new-style -%require-types %strict-args +%require-types %enable-all-warnings %requires CsvUtil class AdvExamplesAsyncStepSaveDataToCsvFile inherits QorusNormalStep { - private:internal { - const FIELDS = { - "id": {"type": "int"}, - "creation_date": {"type": "date", "format": "YYYY-MM-DDTHH:mm:ss"}, - "msg": {"type": "string"}, - }; - - const CSV_OPTS = { - "separator": ",", - "eol": "\r\n", - "fields": FIELDS, - "write_headers": True - }; - } - primary() { DatasourcePool ds = getDatasourcePool("omquser"); on_success ds.commit(); @@ -35,10 +14,10 @@ class AdvExamplesAsyncStepSaveDataToCsvFile inherits QorusNormalStep { SqlUtil::AbstractTable table = UserApi::getSqlTable(ds, "advanced_examples_test"); string path = getUserConnection("adv-examples-test-sftp").path(); - CsvUtil::CsvFileWriter csv(path + Qore::DirSep + "data.csv", CSV_OPTS); + logInfo("%N", getConfigItemValue("CSV_OPTS")); + CsvUtil::CsvFileWriter csv(path + Qore::DirSep + "data.csv", getConfigItemValue("CSV_OPTS")); SQLStatement statement = table.getRowIterator(); csv.write(statement); } } -# END diff --git a/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStepSaveDataToCsvFile-1.0.qstep.yaml b/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStepSaveDataToCsvFile-1.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b2bf91fb9bc97bdfa0e8b55e8fdab35ac9cec371 --- /dev/null +++ b/04_advanced_examples/01_asynchronious_step/qore/AdvExamplesAsyncStepSaveDataToCsvFile-1.0.qstep.yaml @@ -0,0 +1,30 @@ +# This is a generated file, don't edit! +type: step +name: AdvExamplesAsyncStepSaveDataToCsvFile +desc: Saves data from the DB to csv file +author: + - Qore Technologies, s.r.o. +base-class-name: QorusNormalStep +class-name: AdvExamplesAsyncStepSaveDataToCsvFile +lang: qore +version: "1.0" +steptype: NORMAL +code: AdvExamplesAsyncStepSaveDataToCsvFile-1.0.qstep +config-items: + - name: CSV_OPTS + default_value: + separator: ',' + eol: "\r\n" + fields: + id: + type: int + creation_date: + type: date + format: 'YYYY-MM-DDTHH:mm:ss' + message: + type: string + write_headers: true + config_group: Default + description: CSV_OPTS + strictly_local: true + type: hash diff --git a/04_advanced_examples/02_subworkflow_step/ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE-v1.0.qwf b/04_advanced_examples/02_subworkflow_step/ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE-v1.0.qwf deleted file mode 100644 index 869244f741ff5852f361b1d45118e13fc3de5056..0000000000000000000000000000000000000000 --- a/04_advanced_examples/02_subworkflow_step/ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE-v1.0.qwf +++ /dev/null @@ -1,30 +0,0 @@ -# -*- mode: qore; indent-tabs-mode: nil -*- -# -# Qorus Integration Engine - -%new-style -%strict-args -%require-types -%enable-all-warnings - -our string format_version = "2.6"; - -our hash groups."ADVANCED-EXAMPLES".desc = "Qorus advanced examples"; - -const step_next_subwf = {"name": "adv_examples_subwf_step_next_subwf:1.0", - "classname": "AdvExamplesSubwfStepNextSubwf:1.0", - "subworkflow": True}; - -const steps = ( - "class:AdvExamplesSubwfStepActionCreateFile:1.0", - step_next_subwf, -); - -our hash workflows."ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE"."1.0" = ( - "desc" : "Creates file in the filesystem and calls next subworkflow", - "author" : "Alzhan Turlybekov (Qore Technologies)", - "steps" : steps, - "groups" : ("ADVANCED-EXAMPLES",), - "keylist" : ("filename",), - "autostart" : 1, -); diff --git a/04_advanced_examples/02_subworkflow_step/ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE-v1.0.qwf b/04_advanced_examples/02_subworkflow_step/ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE-v1.0.qwf deleted file mode 100644 index 8edc15310bec1c9e97db2c820e6fc9db407e6f64..0000000000000000000000000000000000000000 --- a/04_advanced_examples/02_subworkflow_step/ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE-v1.0.qwf +++ /dev/null @@ -1,30 +0,0 @@ -# -*- mode: qore; indent-tabs-mode: nil -*- -# -# Qorus Integration Engine - -%new-style -%strict-args -%require-types -%enable-all-warnings - -our string format_version = "2.6"; - -our hash groups."ADVANCED-EXAMPLES".desc = "Qorus advanced examples"; - -const step_next_subwf = {"name": "adv_examples_subwf_step_next_subwf:1.0", - "classname": "AdvExamplesSubwfStepNextSubwf:1.0", - "subworkflow": True}; - -const steps = ( - "class:AdvExamplesSubwfStepActionDeleteFile:1.0", - step_next_subwf, -); - -our hash workflows."ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE"."1.0" = { - "desc" : "Deletes file in the filesystem and calls next subworkflow", - "author" : "Alzhan Turlybekov (Qore Technologies)", - "steps" : steps, - "groups" : ("ADVANCED-EXAMPLES",), - "keylist" : ("filename",), - "autostart" : 1, -}; diff --git a/04_advanced_examples/02_subworkflow_step/adv-examples-test-sftp.qconn b/04_advanced_examples/02_subworkflow_step/adv-examples-test-sftp.qconn deleted file mode 100644 index 0ea84603d0c65e141e4e90c85470d4c2a52e1b74..0000000000000000000000000000000000000000 --- a/04_advanced_examples/02_subworkflow_step/adv-examples-test-sftp.qconn +++ /dev/null @@ -1,4 +0,0 @@ -adv-examples-test-sftp = ( - desc = Test SFTP for advanced examples, - url = file://tmp, -) \ No newline at end of file diff --git a/04_advanced_examples/02_subworkflow_step/adv-examples-test-sftp.qconn.yaml b/04_advanced_examples/02_subworkflow_step/adv-examples-test-sftp.qconn.yaml new file mode 100644 index 0000000000000000000000000000000000000000..31c6a469c8c9747d9d33ec33b791f9de47a238ac --- /dev/null +++ b/04_advanced_examples/02_subworkflow_step/adv-examples-test-sftp.qconn.yaml @@ -0,0 +1,4 @@ +type: connection +name: adv-examples-test-sftp +desc: Test SFTP for advanced examples +url: file://tmp \ No newline at end of file diff --git a/04_advanced_examples/02_subworkflow_step/qore/ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE-1.0.qwf.yaml b/04_advanced_examples/02_subworkflow_step/qore/ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE-1.0.qwf.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e2f864ab0dcd27e0ef935197ddc2242a056ce4d7 --- /dev/null +++ b/04_advanced_examples/02_subworkflow_step/qore/ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE-1.0.qwf.yaml @@ -0,0 +1,17 @@ +# This is a generated file, don't edit! +type: workflow +name: ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE +desc: Creates file in the filesystem and calls next subworkflow +author: + - Qore Technologies, s.r.o. +groups: + - ADVANCED-EXAMPLES +keylist: + - filename +steps: + [ + "AdvExamplesSubwfStepActionCreateFile:1.0", + "AdvExamplesSubwfStepNextSubwf:1.0" + ] +version: "1.0" +autostart: 1 diff --git a/04_advanced_examples/02_subworkflow_step/qore/ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE-1.0.qwf.yaml b/04_advanced_examples/02_subworkflow_step/qore/ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE-1.0.qwf.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d7ef8cf876b703c67b5b9f5817f4fefe6d08e478 --- /dev/null +++ b/04_advanced_examples/02_subworkflow_step/qore/ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE-1.0.qwf.yaml @@ -0,0 +1,17 @@ +# This is a generated file, don't edit! +type: workflow +name: ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE +desc: Deletes file in the filesystem and calls next subworkflow +author: + - Qore Technologies, s.r.o. +groups: + - ADVANCED-EXAMPLES +keylist: + - filename +steps: + [ + "AdvExamplesSubwfStepActionDeleteFile:1.0", + "AdvExamplesSubwfStepNextSubwf:1.0" + ] +version: "1.0" +autostart: 1 diff --git a/04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepActionCreateFile-v1.0.qclass b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionCreateFile-1.0.qstep similarity index 66% rename from 04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepActionCreateFile-v1.0.qclass rename to 04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionCreateFile-1.0.qstep index d73fe7744b67699581c4adf4520eaa85200fdf60..7c14e730aa2a0675495eae7d7a20b5b6a736e464 100644 --- a/04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepActionCreateFile-v1.0.qclass +++ b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionCreateFile-1.0.qstep @@ -1,11 +1,6 @@ -# name: AdvExamplesSubwfStepActionCreateFile -# version: 1.0 -# desc: creates file with given name and content -# author: Alzhan Turlybekov (Qore Technologies) - -%require-types -%strict-args %new-style +%strict-args +%require-types %enable-all-warnings class AdvExamplesSubwfStepActionCreateFile inherits QorusNormalStep { @@ -13,7 +8,7 @@ class AdvExamplesSubwfStepActionCreateFile inherits QorusNormalStep { hash sd = getStaticData(); hash action = sd.action; - log(LL_INFO, "CREATE file: %n", action); + logInfo("CREATE file: %n", action); string base_path = getUserConnection("adv-examples-test-sftp").path(); @@ -21,14 +16,13 @@ class AdvExamplesSubwfStepActionCreateFile inherits QorusNormalStep { dir.chdir(base_path + Qore::DirSep + action.directory); if (!dir.exists()) { dir.create(0755); - log(LL_DEBUG_3, "Created directory: %y", dir.path()); + logDebug("Created directory: %y", dir.path()); } File file = dir.openFile(action.file_name, O_CREAT|O_WRONLY, 0644, "utf-8"); file.write(parse_base64_string_to_string(action.file_content, "utf-8")); - log(LL_DEBUG_3, "File was successfully created and data were written"); + logDebug("File was successfully created and data were written"); setOrderKeys({"filename": action.file_name}); } } -# END diff --git a/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionCreateFile-1.0.qstep.yaml b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionCreateFile-1.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..19edd1742ae0403cd312214d6198fef0ddb696bd --- /dev/null +++ b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionCreateFile-1.0.qstep.yaml @@ -0,0 +1,12 @@ +# This is a generated file, don't edit! +type: step +name: AdvExamplesSubwfStepActionCreateFile +desc: creates file with given name and content +author: + - Qore Technologies, s.r.o. +base-class-name: QorusNormalStep +class-name: AdvExamplesSubwfStepActionCreateFile +lang: qore +version: "1.0" +steptype: NORMAL +code: AdvExamplesSubwfStepActionCreateFile-1.0.qstep diff --git a/04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepActionDeleteFile-v1.0.qclass b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionDeleteFile-1.0.qstep similarity index 66% rename from 04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepActionDeleteFile-v1.0.qclass rename to 04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionDeleteFile-1.0.qstep index 5c43a021ffce2f4017846c3df8906547b80cd1d9..36e436568a3f93ec0d69fbf83c38a15926d1472d 100644 --- a/04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepActionDeleteFile-v1.0.qclass +++ b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionDeleteFile-1.0.qstep @@ -1,11 +1,6 @@ -# name: AdvExamplesSubwfStepActionDeleteFile -# version: 1.0 -# desc: deletes file with given name -# author: Alzhan Turlybekov (Qore Technologies) - -%require-types -%strict-args %new-style +%strict-args +%require-types %enable-all-warnings class AdvExamplesSubwfStepActionDeleteFile inherits QorusNormalStep { @@ -13,16 +8,15 @@ class AdvExamplesSubwfStepActionDeleteFile inherits QorusNormalStep { hash sd = getStaticData(); hash action = sd.action; - log(LL_INFO, "DELETE file: %n", action); + logInfo("DELETE file: %n", action); string base_path = getUserConnection("adv-examples-test-sftp").path(); Dir dir("utf-8"); dir.chdir(base_path + Qore::DirSep + action.directory); dir.removeFile(action.file_name); - log(LL_DEBUG_3, "File was successfully deleted"); + logDebug("File was successfully deleted"); setOrderKeys({"filename": action.file_name}); } } -# END diff --git a/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionDeleteFile-1.0.qstep.yaml b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionDeleteFile-1.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6365737b1d09093b355c5bea3adee49cbad50b12 --- /dev/null +++ b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepActionDeleteFile-1.0.qstep.yaml @@ -0,0 +1,12 @@ +# This is a generated file, don't edit! +type: step +name: AdvExamplesSubwfStepActionDeleteFile +desc: deletes file with given name +author: + - Qore Technologies, s.r.o. +base-class-name: QorusNormalStep +class-name: AdvExamplesSubwfStepActionDeleteFile +lang: qore +version: "1.0" +steptype: NORMAL +code: AdvExamplesSubwfStepActionDeleteFile-1.0.qstep diff --git a/04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepNextSubwf-v1.0.qclass b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepNextSubwf-1.0.qstep similarity index 54% rename from 04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepNextSubwf-v1.0.qclass rename to 04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepNextSubwf-1.0.qstep index daf47dc67c9c998cf2b29dc05dac724bda75075c..d9a398f5d312b39b7cc6fb9a92665c02dac7bb48 100644 --- a/04_advanced_examples/02_subworkflow_step/AdvExamplesSubwfStepNextSubwf-v1.0.qclass +++ b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepNextSubwf-1.0.qstep @@ -1,26 +1,14 @@ -# name: AdvExamplesSubwfStepNextSubwf -# version: 1.0 -# desc: create next action for further processing -# author: Alzhan Turlybekov (Qore Technologies) - -%require-types -%strict-args %new-style +%strict-args +%require-types %enable-all-warnings class AdvExamplesSubwfStepNextSubwf inherits QorusSubworkflowStep { - private:internal { - const ACTIONS = { - "CREATE": "ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE", - "DELETE": "ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE" - }; - } - primary() { hash sd = getStaticData(); if (!sd.next_actions) { - log(LL_INFO, "no more action to process. Ending the WF chain."); + logInfo("no more action to process. Ending the WF chain."); skipSubworkflow(); return; } @@ -34,8 +22,7 @@ class AdvExamplesSubwfStepNextSubwf inherits QorusSubworkflowStep { }, }; - string wfname = ACTIONS{next_action.action}; + string wfname = getConfigItemValue("ACTIONS"){next_action.action}; bindSubworkflow({"name": wfname}, order); } } -# END diff --git a/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepNextSubwf-1.0.qstep.yaml b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepNextSubwf-1.0.qstep.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7a96f5809c8c2c529e8c39984729c90e1d3a6a82 --- /dev/null +++ b/04_advanced_examples/02_subworkflow_step/qore/AdvExamplesSubwfStepNextSubwf-1.0.qstep.yaml @@ -0,0 +1,20 @@ +# This is a generated file, don't edit! +type: step +name: AdvExamplesSubwfStepNextSubwf +desc: create next action for further processing +author: + - Qore Technologies, s.r.o. +base-class-name: QorusSubworkflowStep +class-name: AdvExamplesSubwfStepNextSubwf +lang: qore +version: "1.0" +steptype: SUBWORKFLOW +code: AdvExamplesSubwfStepNextSubwf-1.0.qstep +config-items: + - name: ACTIONS + default_value: + CREATE: ADV-EXAMPLES-SUBWF-STEP-CREATE-FILE + DELETE: ADV-EXAMPLES-SUBWF-STEP-DELETE-FILE + config_group: Default + description: ACTIONS + type: hash diff --git a/04_advanced_examples/03_rest_server_service/AdvExamplesRestServer-v1.0.qsd b/04_advanced_examples/03_rest_server_service/qore/AdvExamplesRestServer-1.0.qsd old mode 100755 new mode 100644 similarity index 51% rename from 04_advanced_examples/03_rest_server_service/AdvExamplesRestServer-v1.0.qsd rename to 04_advanced_examples/03_rest_server_service/qore/AdvExamplesRestServer-1.0.qsd index 6936cd15ad8879e0036620a7241123255a8d2a46..da6177637f5205771998366982f8ef86a197e59e --- a/04_advanced_examples/03_rest_server_service/AdvExamplesRestServer-v1.0.qsd +++ b/04_advanced_examples/03_rest_server_service/qore/AdvExamplesRestServer-1.0.qsd @@ -1,15 +1,3 @@ -# -*- mode: qore; indent-tabs-mode: nil -*- - -# service: adv-example-rest-server -# serviceversion: 1.0 -# servicedesc: Creates REST server service -# serviceauthor: Alzhan Turlybekov (Qore Technologies) -# autostart: true -# define-group: ADVANCED-EXAMPLES: Qorus advanced examples -# groups: ADVANCED-EXAMPLES -# class-name: AdvExamplesRestServer -# ENDSERVICE - %new-style %strict-args %require-types @@ -21,7 +9,7 @@ class HelloRestClass inherits AbstractRestClass { } hash get(hash cx, *hash ah) { - log(LL_DEBUG_1, "Got GET request, cx: %y, ah: %y", cx, ah); + UserApi::logDebug("Got GET request, cx: %y, ah: %y", cx, ah); return RestHandler::makeResponse(200, "Hello " + cx.hdr.name + "!"); } } @@ -29,16 +17,13 @@ class HelloRestClass inherits AbstractRestClass { class AdvExamplesRestHandler inherits AbstractServiceRestHandler { constructor() : AbstractServiceRestHandler("adv_examples") { - log(LL_DEBUG_1, "AdvExamplesRestHandler constructor"); + UserApi::logDebug("AdvExamplesRestHandler constructor"); addClass(new HelloRestClass()); } } class AdvExamplesRestServer inherits QorusService { - # name: init - # desc: initializes the service init() { bindHttp(new AdvExamplesRestHandler()); } } -# END diff --git a/04_advanced_examples/03_rest_server_service/qore/AdvExamplesRestServer-1.0.qsd.yaml b/04_advanced_examples/03_rest_server_service/qore/AdvExamplesRestServer-1.0.qsd.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f35ef57f338b48ae91de454930eed200f765bd95 --- /dev/null +++ b/04_advanced_examples/03_rest_server_service/qore/AdvExamplesRestServer-1.0.qsd.yaml @@ -0,0 +1,18 @@ +# This is a generated file, don't edit! +type: service +name: AdvExamplesRestServer +desc: Creates REST server service +author: + - Qore Technologies, s.r.o. +base-class-name: QorusService +class-name: AdvExamplesRestServer +groups: + - ADVANCED-EXAMPLES +lang: qore +autostart: true +version: "1.0" +servicetype: USER +code: AdvExamplesRestServer-1.0.qsd +methods: + - name: init + desc: initializes the service diff --git a/04_advanced_examples/04_rest_server_service_with_swagger/AdvExampleRestServer-v1.0.qsd b/04_advanced_examples/04_rest_server_service_with_swagger/qore/AdvExampleRestServer-1.0.qsd old mode 100755 new mode 100644 similarity index 50% rename from 04_advanced_examples/04_rest_server_service_with_swagger/AdvExampleRestServer-v1.0.qsd rename to 04_advanced_examples/04_rest_server_service_with_swagger/qore/AdvExampleRestServer-1.0.qsd index fafc0d2bb1831437cac8ba62ffbb2f8992d60b71..d993581b61f6f0b1ebe4f5cbce2441fc9dbef5ef --- a/04_advanced_examples/04_rest_server_service_with_swagger/AdvExampleRestServer-v1.0.qsd +++ b/04_advanced_examples/04_rest_server_service_with_swagger/qore/AdvExampleRestServer-1.0.qsd @@ -1,31 +1,17 @@ -# -*- mode: qore; indent-tabs-mode: nil -*- - -# service: adv-example-rest-server -# serviceversion: 1.0 -# servicedesc: Creates REST server service with Swagger schema validation -# serviceauthor: Alzhan Turlybekov (Qore Technologies) -# autostart: true -# define-group: ADVANCED-EXAMPLES: Qorus advanced examples -# groups: ADVANCED-EXAMPLES -# resource: example.yaml -# class-name: AdvExamplesRestServer -# ENDSERVICE - -# import the Swagger module for Swagger 2.0 REST schema validation -%requires Swagger - %new-style %strict-args %require-types %enable-all-warnings +%requires Swagger + class HelloRestClass inherits AbstractRestClass { string name() { return "hello"; } hash get(hash cx, *hash ah) { - log(LL_DEBUG_1, "Got GET request, cx: %y, ah: %y", cx, ah); + UserApi::logDebug("Got GET request, cx: %y, ah: %y", cx, ah); return RestHandler::makeResponse(200, "Hello " + cx.hdr.name + "!"); } } @@ -35,16 +21,13 @@ class AdvExampleRestHandler inherits AbstractServiceRestHandler { SwaggerLoader::fromString( svc_get_resource_data("example.yaml").toString(), False)) { - log(LL_DEBUG_1, "AdvExampleRestHandler constructor"); + UserApi::logDebug("AdvExampleRestHandler constructor"); addClass(new HelloRestClass()); } } -class AdvExamplesRestServer inherits QorusService { - # name: init - # desc: initializes the service +class AdvExampleRestServer inherits QorusService { init() { bindHttp(new AdvExampleRestHandler()); } } -# END diff --git a/04_advanced_examples/04_rest_server_service_with_swagger/qore/AdvExampleRestServer-1.0.qsd.yaml b/04_advanced_examples/04_rest_server_service_with_swagger/qore/AdvExampleRestServer-1.0.qsd.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ee24b75b24a2c3faf5f931fe1ea39f0ede57f897 --- /dev/null +++ b/04_advanced_examples/04_rest_server_service_with_swagger/qore/AdvExampleRestServer-1.0.qsd.yaml @@ -0,0 +1,18 @@ +# This is a generated file, don't edit! +type: service +name: AdvExampleRestServer +desc: Creates REST server service +author: + - Qore Technologies, s.r.o. +base-class-name: QorusService +class-name: AdvExampleRestServer +lang: qore +resource: + - ../example.yaml +autostart: true +version: "1.0" +servicetype: USER +code: AdvExampleRestServer-1.0.qsd +methods: + - name: init + desc: initializes the service diff --git a/04_advanced_examples/qorusproject.json b/04_advanced_examples/qorusproject.json new file mode 100644 index 0000000000000000000000000000000000000000..4cda861480b591ab130e1788710992072f14d5e3 --- /dev/null +++ b/04_advanced_examples/qorusproject.json @@ -0,0 +1,19 @@ +{ + "qorus_instances": { + "local": [ + { + "name": "main local Qorus instance", + "url": "https://localhost:8011", + "custom_urls": [] + }, + { + "name": "another local Qorus instance", + "url": "http://localhost:8011", + "custom_urls": [] + } + ] + }, + "source_directories": [ + "." + ] +}