Changes for page Groovy Script
Last modified by Erik Bakker on 2024/09/05 13:53
From version 10.1
edited by Erik Bakker
on 2022/07/26 13:17
on 2022/07/26 13:17
Change comment:
There is no comment for this version
To version 17.1
edited by Carlijn Kokkeler
on 2024/09/03 11:06
on 2024/09/03 11:06
Change comment:
There is no comment for this version
Summary
-
Page properties (4 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - expert-securing-data-traffic-api-gw-security-external-idp1 +Groovy Script - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. ebakker1 +XWiki.CarlijnKokkeler - Default language
-
... ... @@ -1,1 +1,0 @@ 1 -en - Content
-
... ... @@ -1,5 +1,5 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 -In the crashcourse ontheAPI Gateway wediscussedthevarious options availableto[[secure>>doc:Main.eMagiz Academy.Microlearnings.CrashCourse.CrashCourseAPIGateway.crashcourse-api-gateway-security.WebHome||target="blank"]]yourAPI Gatewayproperly. In this microlearning, we willexpandour knowledgeon thattopicbylookingataspecialcaseofsecuring your API Gateway.Thatcaseisspecial as youusean externalidentityprovider(IDP)togoverntheroles and usersthathaverightson yourAPI Gateway.2 +In a low-code platform like eMagiz, you want to prevent using custom scripting as much as possible. However, sometimes in practice, you encounter situations that cannot be realized with the standard toolbox provided within the platform. As a result, we offer the option to use a Groovy script in these situations to achieve the desired solution. In this microlearning, we will look at where you can use a Groovy script and discuss the key considerations when implementing a Groovy script within your model. 3 3 4 4 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]]. 5 5 ... ... @@ -9,55 +9,68 @@ 9 9 10 10 == 2. Key concepts == 11 11 12 -This microlearning focuses on p erformingimage transformationsin eMagiz.12 +This microlearning focuses on groovy scripts. A groovy script is a piece of code written in the groovy language that allows you to extend the platform's functionality beyond the mere use of the components supplied via the flow designer. 13 13 14 -By image transformation, we mean transforming the raw data that represents an image into another image format. 14 +* Groovy scripts should be viewed as an extension that can be used in fringe cases, not as a standard best practice 15 +* When a groovy script becomes so complex that you are programming, you should consider alternatives to the solution 16 +* Groovy scripts can be used in a filter, transformation, and as part of a standard executor 17 +* Groovy scripts should be well documented as they are though to read for most of our community members 18 +* There is no guarantee from eMagiz that Groovy scripts within models keep working in newer versions of the platform 15 15 16 -* Read the help text of the component to understand which formats are supported 17 -* Ensure the input image is supplied in the correct format 18 -* Ensure you wrap the output image in something if you want to do additional transformations on the data further downstream 20 +== 3. Groovy script == 19 19 20 - ==3.ImageTransformation==22 +In a low-code platform like eMagiz, you want to prevent using custom scripting as much as possible. However, sometimes in practice, you encounter situations that cannot be realized with the standard toolbox provided within the platform. As a result, we offer the option to use a Groovy script in these situations to achieve the desired solution. In this microlearning, we will look at where you can use a Groovy script and discuss the key considerations when implementing a Groovy script within your model. 21 21 22 - Inmostcases, you will transform XML messages to other XML messages, or you will transform JSON or EDIessages in another of these formats. However, sometimes you want toperforman imagetransformation. With this imagetransformation,you can convertimages inspecific formats to another format(i.e.,png). This can come in handy when you want to standardize the image format before using it further downstream in your business application(s).24 +=== 3.1 Implementation in Create === 23 23 24 -Before we dive into the specifics of how to configure this, let us first consider the following: 26 +To implement a groovy script in Create, you first need to consider what your Groovy script should do. Then, within the flow designer, there are five components available that can handle a Groovy script. 27 + 28 +* In case you want the Groovy script to filter out messages, you should implement the Groovy script in a "standard filter" component. 29 +* If you want your Groovy script to always transform your message from a certain format into another format, you should consider using a "standard transformer" component. 30 +* The "standard service activator" is your friend if you need an optional output. So, for example, when you want to do some transformation and check whether a message can continue, you can use the "standard service activator" and have an optional output. 31 +* When you want to split your message based on a Groovy script, you should use the "standard splitter." 32 +* If you want to route messages based on a Groovy script, you should use the "standard router." 25 25 26 -* Read the help text of the component to understand which formats are supported 27 -* Ensure the input image is supplied in the correct format 28 -* Ensure you wrap the output image in something if you want to do additional transformations on the data further downstream 34 +{{warning}}Note that in practice, we mainly see use cases for the "standard service activator" and the "standard transformation." {{/warning}} 29 29 30 - {{warning}} Thismicrolearningfocuseson the imagetransformer component. Ensuringthatthe input is valid andthe output fits the remainderf the processis highly dependenton the use caseand willtherefore not bediscussed inhismicrolearning{{/warning}}36 +[[image:Main.Images.Microlearning.WebHome@expert-data-handling-groovy-script-available-components.png]] 31 31 32 - When turningto theCreatephase ofeMagiz,weneed toopentheflow and enter"StartEditing"modeto addthenecessarycomponent.Forxample,in theleftpanel,youcansearch for"Image."Thiswill yieldthefollowing result.38 +Regardless of the component you choose, you always need to select the "Groovy script" option and reference the Groovy resource available on the flow level you want to use within the component. 33 33 34 -[[image:Main.Images.Microlearning.WebHome@expert- create-your-transformations-image-transformation-image-transformation-component.png]]40 +[[image:Main.Images.Microlearning.WebHome@expert-data-handling-groovy-script-groovy-configuration.png]] 35 35 36 - Afterdraggingthecomponentontothe canvas, you must definethe channelsfirst.42 +{{info}}As you can see in the help text when selecting the "resource" attribute, you need to make sure that the Groovy script is uploaded within the context of your flow.{{/info}} 37 37 38 - [[image:Main.Images.Microlearning.WebHome@expert-create-your-transformations-image-transformation-image-transformation-component-help.png]]44 +After you have the component in such a way that the correct Groovy script is called, you are done with the component's configuration and can test the flow using flow testing. 39 39 40 - Secondly,we must select the desired image format we want to transform.Finally, thefield indicates all valid valuesyoucan choose. Pleasenote that 'PNG' isthedefaultselection.46 +=== 3.2 Key considerations === 41 41 42 -[[image:Main.Images.Microlearning.WebHome@expert-create-your-transformations-image-transformation-image-transformation-component-image-options.png]] 48 +* To make some groovy scripts work, you need to upload (third-party) Java libraries that are not packaged on default by eMagiz 49 +* To make some groovy scripts work, you need to reference Java libraries via a standard header enricher or as a dummy variable 50 +* The store consists of several groovy scripts that might be of use to you 51 +* Groovy scripts should be viewed as an extension that can be used in fringe cases, not as a standard best practice 52 +* When a groovy script becomes so complex that you are programming, you should consider alternatives to the solution 53 +* Groovy scripts can be used in a filter, transformation, and as part of a standard executor 54 +* Groovy scripts should be well documented as they are though to read for most of our community members 55 +* There is no guarantee from eMagiz that Groovy scripts within models keep working in newer versions of the platform 43 43 44 - Onceyouhavedonethis, the component configuration is finished,and you can transformyour input image to a desiredoutput image format.57 +== 4. Key takeaways == 45 45 46 -== 4. Assignment == 59 +* To make some groovy scripts work, you need to upload (third-party) Java libraries that are not packaged on default by eMagiz 60 +* To make some groovy scripts work, you need to reference Java libraries via a standard header enricher or as a dummy variable 61 +* The store consists of several groovy scripts that might be of use to you 62 +* Groovy scripts should be viewed as an extension that can be used in fringe cases, not as a standard best practice 63 +* When a groovy script becomes so complex that you are programming, you should consider alternatives to the solution 64 +* Groovy scripts can be used in a filter, transformation, and as part of a standard executor 65 +* Groovy scripts should be well documented as they are though to read for most of our community members 66 +* There is no guarantee from eMagiz that Groovy scripts within models keep working in newer versions of the platform 47 47 48 -Check whether the solution we discussed today can be found within your project. 49 -This assignment can be completed within the (Academy) project you created/used in the previous assignment. 68 +== 5. Suggested Additional Readings == 50 50 51 -== 5. Key takeaways == 70 +* [[Groovy - Explained>>https://www.emagiz.com/features-of-the-platform/||target="blank"]] 71 +* [[RCA Knowledge Base (Menu)>>doc:Main.eMagiz Support.RCA Knowledge Base.WebHome||target="blank"]] 72 +** [[Configuration Issues (Navigation)>>doc:Main.eMagiz Support.RCA Knowledge Base.rca-knowledgebase-configuration-issues.WebHome||target="blank"]] 73 +*** [[Incorrect Groovy Configuration (Explanation)>>doc:Main.eMagiz Support.RCA Knowledge Base.rca-knowledgebase-configuration-issues.rca-knowledgebase-incorrect-groovy-configuration.WebHome||target="blank"]] 52 52 53 -* Read the help text of the component to understand which formats are supported 54 -* Ensure the input image is supplied in the correct format 55 -* Ensure you wrap the output image in something if you want to do additional transformations on the data further downstream 56 56 57 -== 6. Suggested Additional Readings == 58 - 59 -If you are interested in this topic and want more information, please read the help text provided by eMagiz. 60 - 61 -== 7. Silent demonstration video == 62 - 63 -As this is more of theoretical microlearning, there is no video accompanying the microlearning.)))((({{toc/}}))){{/container}}{{/container}} 76 +)))((({{toc/}}))){{/container}}{{/container}}