www.regouniversity.com
Clarity Educational Community
Advanced GEL Scripts
Enhanced Functionality and Integration
Presented by: James Gille | Date Prepared: April 13, 2015
Agenda
•
•
•
•
•
SOAP / XOG
File Operations
Integrations Overview
Examples / Exercises
Q&A
2
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
3
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/">
4
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>
5
Clarity Educational Community
XOG – Create XML File
Example:
<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>
6
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>
7
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>
8
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>
9
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
10
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>
11
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>
12
Clarity Educational Community
Integrations
What type of integrations do you have?
Integration Triggers
Integration Methods
• Event Based
• Flat File
• Batch
• Web Services
• Manual
• Database Links
• Third Party Tools
13
Clarity Educational Community
Exercise
Create integration that will pull non-labor actuals from a flat CSV
file and import them into Clarity
14
Clarity Educational Community
Exercise – Steps
1.
2.
3.
4.
5.
6.
Read CSV File
Import into Staging Table
Check Data for Issues
Import Data into Clarity
Log any Issues
Run Additional Jobs to Further Process Data
15
Clarity Educational Community
Questions
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.
Phone
888.813.0444
Email
[email protected]
Website
Thank you for attending
regoUniversity 2015!
www.regouniversity.com
16
Clarity Educational Community
© Copyright 2026 Paperzz