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 12.1
edited by Erik Bakker
on 2022/07/28 09:18
on 2022/07/28 09:18
Change comment:
There is no comment for this version
Summary
-
Page properties (2 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 - 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,54 +9,71 @@ 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. 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 +* In case you need an optional output the "standard service activator" is your friend. So for example, when you want to do some transformation and do a 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 messsages 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 toopentheflowandenter"StartEditing"mode toaddthenecessarycomponent.Forxample,intheleft panel,youcansearch for"Image."Thiswill yieldthefollowing result.38 +Regardless of the component you choose you always need to select the option called "Groovy script" and reference the Groovy resource available on flow level that 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 configuration of the component 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 -Once you have done this, the component configuration is finished, and you can transform your input image to a desired output image format. 45 - 46 46 == 4. Assignment == 47 47 48 - Check whether the solutionwediscussedtoday canbefoundwithin yourproject.49 -This assignment can be completed with inthe (Academy) project you created/used in the previous assignment.59 +Try to implement a component that references a Groovy script and see whether the flow can be tested. 60 +This assignment can be completed with the help of the (Academy) project that you have created/used in the previous assignment. 50 50 51 51 == 5. Key takeaways == 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 64 +* To make some groovy scripts work you need to upload (third-party) Java libraries that are not packaged on default by eMagiz 65 +* To make some groovy scripts work you need to reference Java libraries via a standard header enricher or as a dummy variable 66 +* The store consists of several groovy scripts that might be of use to you 67 +* Groovy scripts should be viewed as an extension that can be used in fringe cases, not as a standard best practice 68 +* When a groovy script becomes so complex that you are programming, you should consider alternatives to the solution 69 +* Groovy scripts can be used in a filter, transformation, and as part of a standard executor 70 +* Groovy scripts should be well documented as they are though to read for most of our community members 71 +* There is no guarantee from eMagiz that Groovy scripts within models keep working in newer versions of the platform 56 56 57 57 == 6. Suggested Additional Readings == 58 58 59 -If you are interested in this topic and want more information, please read the help text provided by eMagiz. 75 +If you are interested in this topic and want more information, please read the help text provided by eMagiz and read the following link: 76 +* https://www.tutorialspoint.com/groovy/index.htm 60 60 61 61 == 7. Silent demonstration video == 62 62