16
www.regouniversity. com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared: April 13, 2015

Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

Embed Size (px)

Citation preview

Page 1: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

www.regouniversity.comClarity Educational Community

Enhanced Functionality and IntegrationAdvanced GEL Scripts

Presented by: James Gille | Date Prepared: April 13, 2015

Page 2: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

2 Clarity Educational Community

Agenda• SOAP / XOG• File Operations• Integrations Overview• Examples / Exercises• Q&A

Page 3: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

3 Clarity Educational Community

SOAP / XOG• By including the SOAP and XOG namespaces in GEL scripts, you

give GEL the ability to communicate with the XOG web service

• You must package each invocation in a proper SOAP envelope

• The following steps must be used within a GEL script to communicate with the XOG web service:– Include the proper namespaces– Obtain a session ID– Create the XML file to send– Execute the XOG– Parse the Results– Logout

Page 4: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

4 Clarity Educational Community

XOG – Namespaces<gel:script xmlns:core="jelly:core"

xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"xmlns:xog="http://www.niku.com/xog" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary" xmlns:soapenv="http://schemas.xmlsoap.org/soap/

envelope/">

Page 5: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

5 Clarity Educational Community

XOG – Obtain Session ID<!-- Get sessionId by username --><gel:parameter var="username" default="admin"/><core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="secId" /><core:invokeStatic var="userSessionCtrl" className="com.niku.union.security.UserSessionControllerFactory" method="getInstance" /><core:set var="secId" value="${userSessionCtrl.init(username, secId)}"/><core:set var="XOGUsername" value="${secId.getUserName()}"/><core:set var="sessionID" value="${secId.getSessionId()}"/>

<core:choose><core:when test="${sessionID == null}”>

<gel:log level="ERROR"> Unable to obtain a Session ID. </gel:log>

</core:when><core:otherwise>

<!-- Execute XOG --></core:otherwise>

</core:choose>

Page 6: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

6 Clarity Educational Community

XOG – Create XML FileExample:<gel:parse var="userXML"> <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="../xsd/nikuxog_user.xsd"> <Header action="write" externalSource="NIKU" objectType="user"

version="13.2.0.472"/> <Users> <User externalId=" " isLDAP="false"

uiThemeDefaultPartitionCode=" " userLanguage="English" userLocale="en_US” userName="${row.userName}" userStatus="${row.userStatus}" userTimezone="America/Los_Angeles" userType="INTERNAL">

<PersonalInformation emailAddress="${row.email}" firstName="${row.firstName}" lastName="${row.lastName}"/>

<Resource resourceId="${row.resourceId}"/> <Groups/> </User> </Users> </NikuDataBus></gel:parse>

Page 7: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

7 Clarity Educational Community

XOG – Execute XOG<!-- Execute XOG --><soap:invoke endpoint=“internal" var="result"> <soap:message> <soapenv:Envelope> <soapenv:Header> <xog:Auth> <xog:SessionID>${sessionID}</xog:SessionID> </xog:Auth> </soapenv:Header> <soapenv:Body> <gel:include select="$userXML"/> </soapenv:Body> </soapenv:Envelope> </soap:message></soap:invoke>

Page 8: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

8 Clarity Educational Community

XOG – Parse Results<!-- Parse Results --><gel:set asString="true" select="$result//XOGOutput/Status/@state" var="XOGState"/><gel:set asString="true" select="$result//XOGOutput/Statistics" var="xogStats"/> <gel:set asString="true" select="$result//XOGOutput/Statistics/@failureRecords" var="XOGFailures"/>

<core:choose> <!-- Success --> <core:when test="${XOGState == 'SUCCESS' and XOGFailures == 0}"> <gel:log level="INFO">User XOG Stats: ${xogStats} </gel:log> </core:when> <!-- Failure --> <core:otherwise> <gel:log level="INFO">User XOG Stats: ${xogStats} </gel:log> <gel:log level="WARN"><gel:expr select="$userXML/"/></gel:log> <gel:log level="ERROR"><gel:expr select="$result/"/></gel:log> </core:otherwise></core:choose>

Page 9: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

9 Clarity Educational Community

XOG – Logout <!-- Logout XOG--><soap:invoke endpoint=“internal" var="result"> <soap:message> <soapenv:Envelope> <soapenv:Header> <xog:Auth> <xog:SessionID>${sessionID}</xog:SessionID> </xog:Auth> </soapenv:Header> <soapenv:Body> <xog:Logout/> </soapenv:Body> </soapenv:Envelope> </soap:message></soap:invoke>

Page 10: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

10 Clarity Educational Community

File Operations• GEL can

– Open files• GEL can parse nodes and attributes of XML or comma-delimited

files– Read files– Write to a file– Perform FTP operations on files

• GEL cannot– Create a directory to put files in– Move files around– Delete files after it is done with them

Page 11: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

11 Clarity Educational Community

File Operations – Read File<gel:script xmlns:core="jelly:core"

xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:files="jelly:com.niku.union.gel.FileTagLibrary">

<gel:parameter var="vFileName" default="/fs0/clarity1/share/RESOURCES.CSV"/>

<files:readFile fileName="${vFileName}" delimiter="\|" var="vResourceData" embedded="false"/>

<core:forEach items="${vResourceData.rows}" var="row" begin="1" end="10"> <gel:log level="INFO"> Resource Last Name: ${row[0]} </gel:log> <gel:log level="INFO"> Resource First Name: ${row[1]} </gel:log> </core:forEach></gel:script>

Page 12: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

12 Clarity Educational Community

File Operations – Write File<file:writeFile delimiter="," embedded="false" fileName=" Resources.csv "> <sql:query dataSource="${clarityDS}" escapeText="0" var="result"> <![CDATA[ SELECT u.first_name firstName, u.last_name lastName, u.user_name userName FROM cmn_sec_users u WHERE u.user_status_id = 200 ]]> </sql:query> <core:forEach items="${result.rows}" trim="true" var="row"> <file:line> <file:column value="${row.userName}"/> <file:column value="${row.lastName}"/> <file:column value="${row.firstName}"/> </file:line> </core:forEach></file:writeFile>

Page 13: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

13 Clarity Educational Community

•Flat File

•Web Services

•Database Links

•Third Party Tools

•Event Based

•Batch

•Manual

Integration MethodsIntegration Triggers

IntegrationsWhat type of integrations do you have?

Page 14: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

14 Clarity Educational Community

ExerciseCreate integration that will pull non-labor actuals from a flat CSV file and import them into Clarity

Page 15: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

15 Clarity Educational Community

Exercise – Steps1.Read CSV File2.Import into Staging Table3.Check Data for Issues4.Import Data into Clarity5.Log any Issues6.Run Additional Jobs to Further Process Data

Page 16: Www.regouniversity.com Clarity Educational Community Enhanced Functionality and Integration Advanced GEL Scripts Presented by: James Gille | Date Prepared:

16 Clarity Educational Community

Questions

Phone888.813.0444

[email protected]

Websitewww.regouniversity.com

We hope that you found this session informative and worthwhile. Our primary goal was to increase your understanding of the topic and CA PPM in general.

There were many concepts covered during the session, if you would like to contact any presenter with questions, please reach out to us.

Thank you for attending regoUniversity 2015!