Clarity PPM1

Expand all | Collapse all

CA Clarity Tuesday Tip : XOG - controlling the amount of data

  • 1.  CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 06-18-2012 08:34 PM
    When exporting configurations (lookups, objects, attributes, portlets, processes, views, pages, etc) XOG normally uses dependencies ending up with big resulting XML file.

    For eg,
    - If you use XOG in an object and it has an active custom attribute that uses a certain lookup, the XOG will read out the active attribute and the lookup
    - If you read out a portlet with XOG that uses a specific query and has an attribute referencing a certain lookup, the XOG will read out the portlet, the query and the lookup

    Sometimes, there is a need to be able to export some elements isolated, without the dependencies, especially when dealing with stock objects such as the Project object,
    so that we have more control over what's being exported and then imported.

    Two directives come in handy: "no_dependencies" and "singleContentType".

    no_dependencies

    This tells Clarity whether dependencies should be respected or not.

    For eg, you extract the idea object and one of the attributes uses a new lookup; therefore the lookup should also be extracted. That's a dependency.
    It may appear to be a desired functionality but what if you know you have not changed ANY lookups? You still would have to deal with several lookup entries in the
    resulting XML file. To solve this, you can use the no_dependencies argument.

    The format of the argument is as follows

    <args name=“no_dependencies” value=“true/false”/>



    singleContentType

    This exports a specific content type. For eg, you’ve just updated a view and you do not want to export the whole object. So, by using singleContentType,
    you can export just the Views and NOT the whole object with all its attributes, links, actions, etc

    The format for the argument is as follows

    <args name="singleContentType" value="content type">

    where content type can be any of the following supported content types:
    -Job Definitions
    - Lookups
    - Menu Manager
    - Objects
    - Portlet Pages
    - Portlets
    - Processes
    - Queries


    Example: XML Read File for Exporting a Portlet Without Dependencies

    The following example shows an XML read file where portlet data without any dependency data is requested.

    <?xml version="1.0" encoding="UTF-8" ?>
    - <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
    - <Header version="12.0.0.5028" action="read" objectType="contentPack" externalSource="NIKU">
    <!-- Provide following argument with singlecontenttype to retrieve only portlet. -->
    <args name="singleContentType" value="portlet" />
    <!-- May specify following OPTIONAL argument no_dependencies to exclude dependent content. -->
    <args name="no_dependencies" value="true" />
    </Header>
    - <PortletQuery>
    <Filter name="code" criteria="EQUALS">balance</Filter>
    </PortletQuery>
    </NikuDataBus>


  • 2.  RE: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 06-19-2012 06:55 PM
    Thanks for the great tip Yvette! :grin:


  • 3.  RE: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 06-19-2012 08:57 PM
    Thanks, this is very helpful..

    I have a requirement that needs further short list of data to be xogged in at an instance level.

    I mean, if I need to write only Project ID, Project Name, Project Description AND a customer attribute value, I have observed that the XOG write udpates more attributes of the instance than what is specified in the input XML....may be based on the XSD.

    Could you please advise how can we XOG write only those attributes which are specified in the Nikudatabus tags?

    Thanks and regards,

    Mayank


  • 4.  RE: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 06-20-2012 04:47 AM
    Regarding XSD's, my favourite explanation of them to developers/programmers is that they are just like interfaces or contracts. For non-developers, I would describe it in terms of square pegs and round holes, with the XSD acts as the template with the holes in, only allowing pegs of the right shape/size/quantity to pass through any given one.

    That's all the purpose an XSD serves really, to ensure the data being provided is a suitable fit to be processed. So in this case the XSD would not govern which attributes are written, just those that must or may be present in the XML and what those attributes should look like.

    If you are finding more attributes are being written to than expected, chances are this is on the creation of new instance records (projects) and either those attributes have default values that will be assigned even if you do not supply them in the UI or XOG, or the XOG definition itself for the object has its own implied defaults (check the XOG guide for the read/write schema and any defaults it will apply to stock attributes), or else something else is happening such as processes or triggers to automatically make adjustments upon the creation/update of a record.

    Incidentally, these types of business rules / logic can't be encapsulated into an XSD, for example it has no ability to say if attribute 'status' is filled with value 'X' then attribute 'isopen' can only be filled with (or defaulted to) value 'Y', that would be in the domain of the Clarity application code to handle, or some bespoke / 3rd party code in a process or database trigger. You would not be able to control or limit that from happening through XOG.

    If you don't think the scenario you're facing fits any of those, we can probably help to investigate the details behind it and explain why a specific change is occurring through a support issue.


  • 5.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 08-17-2015 10:43 AM

    Thanks !

    Do you know if it's possible to add even more filters on this one? like partition for instance?

    We tried the following code:

    <?xml version="1.0" encoding="UTF-8"?>

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">

      <Header version="8.0" action="read" objectType="contentPack" externalSource="NIKU">

        <!-- the contentType is used to determine which filter goes where -->

        <args contentType="job_definition" name="order_by_1" value="code"/>

        <args contentType="menu" name="order_by_1" value="code"/>

        <args contentType="view" name="order_by_1" value="code"/>

        <args contentType="process" name="order_by_1" value="code"/>

        <args contentType="object" name="order_by_1" value="code"/>

        <args name="singleContentType" value="view" />

        <args name="no_dependencies" value="true" />

      </Header>

      <ViewQuery>

        <Filter name="code" criteria="EQUALS">projectCreate</Filter>

      </ViewQuery>

    </NikuDataBus>

     

    and received still received an exception:

    <XOGOutput xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/status.xsd">

      <Object type="contentPack"/>

      <Status elapsedTime="1.0 hour 11.0 minutes 31.404999999999745 seconds" state="FAILURE"/>

      <Statistics failureRecords="0" insertedRecords="0" totalNumberOfRecords="0" updatedRecords="0"/>

      <ErrorInformation>

        <Severity>FATAL</Severity>

        <Description>Unhandled exception</Description>

        <Exception type="java.lang.OutOfMemoryError">Java heap space</Exception>

      </ErrorInformation>

    </XOGOutput>

     

    Thanks in advance!

     

    Patricio



  • 6.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 08-17-2015 11:23 AM

    The filter criteria inside <ViewQuery> can contain <Filter> elements with names on: code (you are already doing this one), object_code (so you could try to further specify 'project' to be explicit'), and partition_code

     

    So yes, you can add more filters like the partition code to your example.



  • 7.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 08-17-2015 02:50 PM

    Thanks Nick! this was very helpful!!

    I'm finally getting some useful data!!

     

    Kind regards

    Patricio



  • 8.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 08-17-2015 03:32 PM

    hey Nick! one more quick question: Does it make any kind of difference the position (or its existence for that matter) in the xml for those three elements?

    I ran some tests and I have the feeling that using the object_code element the output is everything in the partition for the object and that is not considering the code criteria.

     

    This is what I used:

    <ViewQuery>

        <Filter name="code" criteria="EQUALS">projectCreate</Filter>

        <Filter name="partition_code" criteria="EQUALS">mypartition</Filter>

        <Filter name="object_code" criteria="EQUALS">project</Filter>   

      </ViewQuery> 

    and I was expecting only <property code="projectCreate" ....etc> as an output, and instead I'm getting a lot more, including <property code="projectGeneral"...> that I think is for Project update. 

     

    Kind regards

    Thank you!

    Patricio



  • 9.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 08-19-2015 03:23 PM

    Looking for a way to read (xog out) object views only, the original post says possible using singleContentType, however that did not work in my case. I tried below to read project object views only.

     

    <?xml version="1.0" encoding="UTF-8"?>

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">

      <Header version="8.0" action="read" objectType="contentPack" externalSource="NIKU">

    <args name="singleContentType" value="object"/>

      </Header>

      <ObjectQuery>

        <Filter name="object_code" criteria="EQUALS">project</Filter>

      </ObjectQuery>

    </NikuDataBus>



  • 10.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 08-20-2015 05:00 AM

    If you are using

      <ObjectQuery>

    then you are reading the object and not just views.

    ViewQuery would work better if you can figure out the filters.

    See Nick's last post.



  • 11.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 08-21-2015 04:35 AM

    Thanks Yvette_Essen

    Just wondering again...

    Would it be beneficial to cover also

    <args name="exclude_parent" value="true"/>

    <args name="noparents" value="true" />

    in this thread?

     

    Then if you have read out a portlet and the query and got rid of all the lookups in the system either using the argument filters or manually, say you have one custom lookup which you need in the portlet.

    When you write back your XML should you have <lookups update= "true" or "false"

    before the data of your lookup on the xml file or do they make a difference or have any effect at all.

    My first guess is  that you should have <lookups update= "true">  otherwise your new lookup is not written at all and the existing lookups are left intact with any of those options.



  • 12.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 12-16-2015 12:45 PM

    Can we filter on specific object attribute, i.e. trying to xog out only specific object attribute. Some thing like below. Ideas ?

     

    <?xml version="1.0" encoding="UTF-8"?>

    <NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">

      <Header version="8.0" action="read" objectType="contentPack" externalSource="NIKU">

        <!-- the contentType is used to determine which filter goes where -->

        <args contentType="object" name="order_by_1" value="code"/>

      </Header>

      <ViewQuery>

        <Filter name="object_code" criteria="EQUALS">project</Filter>

        <Filter name="code" criteria="EQUALS">impacted_YY</Filter>

      </ViewQuery>

    </NikuDataBus>



  • 13.  Re: CA Clarity Tuesday Tip : XOG - controlling the amount of data

    Posted 12-16-2015 02:55 PM

    No, if you are using the XOG standard API you get what is in the object schema. See the  documentation.

    With Gel of XOG query API you can do that ( get just the value of one single field plus the overhead of  the XML file).