Automic Workload Automation

  • 1.  How to list all preconditions and postconditions using the API

    Posted Feb 03, 2015 02:27 PM
    Hi,

       I'm trying to use the API with java to list all preconditions and postconditions that jopplan's tasks can have, but I'm stuck :-(  I can list all task in a workflow and I know if a task has pre or post conditions, but I can't list them. Can someone help me on this?

    JFA


  • 2.  How to list all preconditions and postconditions using the API

    Posted Feb 03, 2015 05:00 PM
    I believe precondition and postcondition details are stored in the JPOV table, but each rule is split into multiple parts that are stored in multiple rows of this table.

    This query doesn't solve your issue, but should point you in the right direction of understanding how this data is stored;

    select
    CASE CONVERT(VARCHAR,JPOV_Location)
    WHEN 1 THEN 'PreCondition'
    WHEN 2 THEN 'PostCondition'
    END "Source",
    a.OH_Name, oh_client,
    'task#' + convert(varchar,b.jpov_jpp_lnr) + ' line#' + convert(varchar,b.jpov_jppo_lnr) "Line_Number",
    b.jpov_value "Script_Content"
    from OH a
    inner join JPOV b on a.OH_IDNR=b.JPOV_OH_IDNR
    where a.OH_DELETEFLAG=0 and oh_client = &$client#
    and a.OH_REFIDNR=0
    and b.jpov_oh_idnr = 1197020  -- ID of desired workflow
    and b.jpov_jpp_lnr = 3        -- ID of desired task


  • 3.  How to list all preconditions and postconditions using the API
    Best Answer

    Posted Feb 04, 2015 01:42 AM
    are you looking for the conditions the task can have or acutally does have?

    A JobPlanTask object in Java API does have two methods postconditions() and preconditions() which sends you back a ConditionSet object. You can now iterate over those ConditionOrAction items and use the methods implemented with the ConditionOrAction object class. But, as I implementend some methods setting postconditions automaticly, it's not very handy to get the information displayed in th UI.


  • 4.  How to list all preconditions and postconditions using the API

    Posted Feb 04, 2015 07:54 AM
    I'm looking for the conditions a task does have. My goal here is to create a .csv file that will list all the conditions of all the tasks in every workflow... In my code, I'm using the ConditionSet object to cycle through the conditions, but I'm not able to "list" the content of the conditions


  • 5.  How to list all preconditions and postconditions using the API

    Posted Feb 12, 2015 01:53 PM
    I finally figured it out. Once I have the ConditionOrAction object, I have to cast it to the action's type... ;-)



  • 6.  How to list all preconditions and postconditions using the API

    Posted Jun 02, 2016 04:16 AM
    Hi,
    i must read all executable Objects from the ConditionOrAction list.
    Now a small part of my coding.

     ConditionsSet       jplposc  = uc4jpObjekt.postConditions();
     if(jplposc.size() > 0)
     {
              Iterator<ConditionOrAction> posctab = jplposc.iterator();
              while(posctab.hasNext())
              {
                 ConditionOrAction poscEnt  = (ConditionOrAction)posctab.next();
                 if(poscEnt.isAction() == true)
                 {    
                    ----------------
                   ----------------
                 }                                     
    }

    How can i access to the class ExecuteObjectAction().

    Regards
    Rudolf


  • 7.  How to list all preconditions and postconditions using the API

    Posted Jun 14, 2016 04:53 AM
    Hi Rudolf!

    Unfortunately there is no function provided by the class ConditionOrAction to check what specific class you get.
    But you can use Java functionality to convert to ExecuteObjectAction and catch ClassCastException using asSubclass method of the Class object.

    best regards,
    Iris


  • 8.  How to list all preconditions and postconditions using the API

    Posted Jun 14, 2016 06:21 AM
    In other words:

    ExecuteObjectAction is a subclass of  ConditionOrAction so for each  ConditionOrAction object you get in your while loop you have to check if the returned object is an instance of the class ExecuteObjectAction. There are several possible ways to do that, one of which is to use the asSubclass method of java.lang.Class. 
    This is a basic functionality of the Java object oriented concept and is not related to our product directly.