AnsweredAssumed Answered

Getting an error while xogging the projects

Question asked by MadhuriThakur on May 20, 2013
Latest reply on May 22, 2013 by another_martink
Hi All,

My requirement is to develop the process to populate the parent ID into one attribute through XOG.

say, If one project has more than one parent like A and B.

Then in attribute, we need to show as A,B.

This is working fine, but the thing is xog is failing when it crossing 22000 projects.

Below is the xml.

<gel:script
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"

xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:core="jelly:core"
xmlns:sql="jelly:sql"

xmlns:util="jelly:util"
xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<core:set value="agadmin" var="XOG_USERNAME"/>
<gel:setDataSource dbId="niku" var="DBSOURCE"/>

<core:set value="false" var="ERROR_FLAG1"/>

<core:catch var="c_xogLogin">
<core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="secId"/>
<core:invokeStatic className="com.niku.union.security.UserSessionControllerFactory"

method="getInstance" var="userSessionCtrl"/>
<core:set value="${userSessionCtrl.init(XOG_USERNAME, secId)}" var="secId"/>
<core:set value="${secId.getSessionId()}" var="strSESSION_ID"/>
</core:catch>
<!-- Checking whether a sessionID is returned. If not, it means that Login was not successful. -->
<core:if test="${strSESSION_ID == null}">
<gel:log level="ERROR">**********ERROR User: ${XOG_USERNAME} Cannot login to Clarity XOG </gel:log>
<core:set value="true" var="ERROR_FLAG1"/>
</core:if>
<core:if test="${ERROR_FLAG1 == false}">

<core:catch var="DBException">
<sql:query dataSource="${DBSOURCE}" escapeText="false" var="ParentProject">
<![CDATA[  
    select distinct i.code,i.name,
           to_char(sysdate,'YYYY-MM-DD')||'T'||to_char(sysdate,'HH:MM:SS') updateddate,
           odf.partition_code,

       i.id

  
    from inv_investments i,
     odf_ca_project odf,
     INV_HIERARCHIES IFH
    WHERE IFH.CHILD_ID=i.id
    and i.id=odf.id
    and parent_id is not null

and i.code not in (select i.code from odf_multi_valued_lookups,inv_investments i
    where attribute='exx_parent_project' and i.id=pk_id
    and value is not null)

     
    ]]>
</sql:query>

</core:catch>

<core:if test="${DBException != null}">
<gel:log level="ERROR">**********ERROR in DB Connection</gel:log>
</core:if>

<core:forEach escapeText="0" var="Parentrow" trim="true" items="${ParentProject.rows}">
<gel:parse var="V_XML_ROOT1">
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_project.xsd">
<Header action="write" externalSource="NIKU" objectType="project" version="13.1.0.0248"/>
<Projects>
<Project lastUpdatedBy="${XOG_USERNAME}" lastUpdatedDate="${Parentrow.updateddate}" name="${Parentrow.name}" projectID="${Parentrow.code}">

<CustomInformation>

<ColumnValue name="partition_code">${Parentrow.partition_code}</ColumnValue>

<ColumnValue name="exx_parent_project">

<sql:query dataSource="${DBSOURCE}" escapeText="false" var="Parent">

<![CDATA[  
        select distinct inv.code
        from INV_HIERARCHIES IFH,
             inv_investments inv
        WHERE  parent_id is not null
        and inv.id=IFH.parent_id


and IFH.child_ID=${Parentrow.id}
]]>

</sql:query>

<core:forEach escapeText="0" var="ParentValue" trim="true" items="${Parent.rows}">

<Value>${ParentValue.code}</Value>

</core:forEach>

</ColumnValue>

</CustomInformation>
</Project>
</Projects>

</NikuDataBus>
</gel:parse>



<gel:set var="strXML" select="$V_XML_ROOT1/" asString="true"/>

<gel:log level="INFO">${strXML}</gel:log>
<core:catch var="SoapError">
<soap:invoke endpoint="internal" var="auth">
<soap:message>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${strSESSION_ID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<gel:include select="$V_XML_ROOT1/NikuDataBus"/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
</core:catch>



</core:forEach>





<!-- Set Parent ID through XOG -->


<core:if test="${SoapError != null}">
<gel:log level="ERROR">**********ERROR in SOAP Invoke</gel:log>
</core:if>
<gel:set asString="true" select="$auth/soapenv:Envelope/soapenv:Body/XOGOutput/Status/@state" var="XOGoutcome"/>
<gel:set asString="true" select="$auth/soapenv:Envelope/soapenv:Body/XOGOutput" var="XOGerror"/>
<core:if test="${XOGoutcome.equals('FAILURE')}">
<gel:log level="ERROR">${XOGerror}</gel:log>
</core:if>



<!-- Log out of the XOG -->

<core:catch var="LogoutError">

<soap:invoke endpoint="internal" var="logoutresult">
<soap:message>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">

<soapenv:Header>

<xog:Auth>

<xog:SessionID>${strSESSION_ID}</xog:SessionID>

</xog:Auth>

</soapenv:Header>

<soapenv:Body>
<xog:Logout/>

</soapenv:Body>
</soapenv:Envelope>

</soap:message>

</soap:invoke>

</core:catch>



<core:if test="${LogoutError != null}">

<gel:log level="ERROR">**********ERROR in Logout</gel:log>

</core:if>


</core:if>
</gel:script>

Please help me out.

Thanks

Outcomes