AnsweredAssumed Answered

Xogging date changes onto Ideas

Question asked by Robert Ensinger on Sep 30, 2016
Latest reply on Oct 25, 2016 by Robert Ensinger

We have a requirement to 'kick forward' any ideas lingering in the first stage of our demand management process.

Support for Duration Based Ideas

Slipping & Sliding Ideas.

 

I have a Process/GEL that *almost* works.

 

I'm planning on scheduling the process with the Execute a Process job. Early tests found date changes on Idea Start & Finish would have conflicts with time slicing and Allocation jobs. I've attempted to box those out by setting the following jobs as incompatible. 

 

Unfortunately I'm still experiencing deadlock issues. The process takes minutes to run. I think what's happening is the Execute a Process kicks off the process then terminates in about a second, making all the incompatible jobs listed above irrelevant. Notice how Investment Allocation fires off about a minute into my process run.

 

 

... while the kickout ideas process is running...

 

Is there any way to make execute a process *persistent* with the duration of the process it's running in order for the incompatabilites to do their thing?

 

I'm simply pulling a list of ideas, calculating new starts & finishes then xogging the new dates on blindly in a forEach loop. The deadlock errors and rollbacks are all database level, so nothing errors in XOG. I can imagine an architecture where I build in some try-catch stuff and check the dates for success & keep running until the result is as expected - but this seems a little too brute force for this problem.

 

Is there a different way to architect a solution to 'kicking ideas out 6 months'? Has anyone already developed a solution for something like this they can share?

 

 

<!-- Kick Out Ideas in Intake Due to start within 60 days -->
<gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:core="jelly:core"
  xmlns:util="jelly:util"
  xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
  xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:sql="jelly:sql"
  xmlns:jxml="jelly:xml"
  xmlns:xog="http://www.niku.com/xog"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<gel:parameter default="your_xog_username" var="xogUsername"/>
<gel:parameter default="your_xog_password" secure="true" var="xogPassword"/>

<!-- Get the list of ideas -->
<gel:setDataSource dbId="niku"/>
<sql:query var="data" escapeText="0">
          <![CDATA[SELECT
          I.NAME idea_name
          , I.CODE idea_code
          , (SELECT CONVERT(char(10), DATEADD(mm, DATEDIFF(mm, 0, I.SCHEDULE_START) + 6, 0), 126))+'T00:00:00' idea_start_plus_6
          , (SELECT CONVERT(char(10), DATEADD (dd, -1, DATEADD(mm, DATEDIFF(mm, 0, I.SCHEDULE_FINISH) + 7, 0)), 126))+'T00:00:00' idea_finish_plus_6
          FROM INV_INVESTMENTS I
          WHERE I.ODF_OBJECT_CODE = 'Idea'
          AND I.IS_ACTIVE = 1
          AND I.STAGE_CODE = 'osumc_intake'
          AND I.SCHEDULE_START  < (SELECT DATEADD (dd, -1, DATEADD(mm, DATEDIFF(mm, 0, GETDATE()) + 2, 0)))]]>
</sql:query>

<!--  Get xog URL from application by fpena -->
<core:invokeStatic className="com.niku.union.config.ConfigurationManager" method="getInstance" var="config"/>
   <core:set var="v_IsLocal">0</core:set>
   <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getId()}" var="WebServerid"/>
<core:if test="${WebServerid == 'app'}">
   <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getAddress()}" var="AddressIp"/>
   <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getSslEntryUrl()}" var="EntryURL"/>
   <core:set value="${config.getProperties().getWebServer().getWebServerInstance(0).getSslPort()}" var="Port"/>
  <core:if test="${EntryURL == 'http://localhost' }">
   <gel:log level="info" message="NULL ADDRESS IS LOCAL... "/>
   <core:set var="v_IsLocal">1</core:set>
   <core:set var="AddressIp">${EntryURL}</core:set>
  </core:if>
</core:if>
<core:if test="${WebServerid == 'nsa'}">
   <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getAddress()}" var="AddressIp"/>
   <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getEntryUrl()}" var="EntryURL"/>
   <core:set value="${config.getProperties().getWebServer().getWebServerInstance(1).getPort()}" var="Port"/>
  <core:if test="${EntryURL == 'http://localhost' }">
   <gel:log level="info" message="NULL ADDRESS IS LOCAL... "/>
   <core:set var="v_IsLocal">1</core:set>
   <core:set var="AddressIp">${EntryURL}</core:set>
  </core:if>
</core:if>
<core:if test="${Port != null }">
  <core:set value="${EntryURL}" var="EntryURL"/>
</core:if>
<core:if test="${v_IsLocal == 0 }">
  <core:if test="${AddressIp != '' }">
   <core:set value="http://${AddressIp}" var="EntryURL"/>
  </core:if>
</core:if>
   <core:set value="${config.getProperties().getDirectories().getInstallDir()}" var="NIKUHOME"/>
   <core:set value="${EntryURL}/niku/xog" var="xogURL"/>

<!-- Log into xog and get a session ID -->
<soap:invoke endpoint="${xogURL}" var="auth">
  <soap:message>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
     <soapenv:Header/>
      <soapenv:Body>
       <xog:Login>
        <xog:Username>${xogUsername}</xog:Username>
        <xog:Password>${xogPassword}</xog:Password>
       </xog:Login>
      </soapenv:Body>
   </soapenv:Envelope>
  </soap:message>
</soap:invoke>

<!-- Checking whether a sessionID is returned. If not, it means that login was unsuccessful -->
<gel:set asString="true" select="$auth/SOAP-ENV:Envelope/SOAP-ENV:Body/xog:SessionID/text()" var="sessionID"/>
<core:choose>
   <core:when test="${sessionID == null}">
    <gel:log>Couldn't log in. Please check the hostname/username/password.</gel:log>
   </core:when>
   <core:otherwise>
    <gel:log>Login successful. Session ID is ${sessionID}</gel:log>
   </core:otherwise>
</core:choose>

<core:forEach items="${data.rows}" trim="true" var="row">
<core:set value="${row.get('idea_name')}" var="idea_name"/>
<core:set value="${row.get('idea_code')}" var="idea_code"/>
<core:set value="${row.get('idea_start_plus_6')}" var="idea_start_plus_6"/>
<core:set value="${row.get('idea_finish_plus_6')}" var="idea_finish_plus_6"/>

<!-- Xog in new finish dates on Ideas -->
<soap:invoke endpoint="${xogURL}" var="updateFinish">
<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>${sessionID}</xog:SessionID>
    </xog:Auth>
   </soapenv:Header>
<soapenv:Body>

<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_idea.xsd">
  <Header action="write" externalSource="NIKU" objectType="idea" version="8.0"/>
  <Ideas>
    <Idea name="${idea_name}" objectID="${idea_code}" openForTimeEntry="0" finish="${idea_finish_plus_6}">
    </Idea>
  </Ideas>
</NikuDataBus>

</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>

<!-- Xog in new start dates on Ideas -->
<soap:invoke endpoint="${xogURL}" var="updateStart">
<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>${sessionID}</xog:SessionID>
    </xog:Auth>
   </soapenv:Header>
<soapenv:Body>

<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_idea.xsd">
  <Header action="write" externalSource="NIKU" objectType="idea" version="8.0"/>
  <Ideas>
    <Idea name="${idea_name}" objectID="${idea_code}" openForTimeEntry="0" start="${idea_start_plus_6}">
    </Idea>
  </Ideas>
</NikuDataBus>

</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>

</core:forEach>

<!-- Log out of xog -->
<soap:invoke endpoint="${xogURL}" 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>${sessionID}</xog:SessionID>
    </xog:Auth>
   </soapenv:Header>
  <soapenv:Body>
    <xog:Logout/>
  </soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>

<!-- comment out below log output once in production  -->

<gel:log> ${xogURL}, ${xogUsername}, ${xogPassword}, ${sessionID}</gel:log>
</gel:script>

Outcomes