Automic Workload Automation

  • 1.  Check in API or JCL to test if an object is currently in use

    Posted Jun 08, 2016 07:40 PM
    I'm currently working on some Java applications to set the isActive or isBreakPoint values on given Jobs or Tasks within JobPlans (we want to restrict editing rights for various user groups but still require an ability to activate/deactivate otherwise essentially read-only objects), but I noticed a behavior where in the call to open an object failed if the object was already in use.  I've been looking through the API documentation and I haven't yet found the method call to test if an object is in use prior to attempting to open it.  I do note that there's a constructor to open an object read-only, so I figure if that option is available the fact that in-use objects cannot be accessed is known.  I'd wager it may be possible within the JCL (prior to calling my java code) in a Job but I haven't had the time to research that angle yet.

    Short version: Does anyone know the proper method for testing if an object is in-use?

    Edit: Additionally, is it possible to determine the user who has the object open so they can be notified?  It may be a rare instance, but there can occasionally be time-sensitive processes and it would be good to have the option.


  • 2.  Check in API or JCL to test if an object is currently in use

    Posted Jun 08, 2016 08:26 PM
    Not sure how I overlooked it but it looks like getUC4Object will do the trick for testing whether an object is in use (it will return null if the object is not available).  Still would like to see if the user using the object can be determined.


  • 3.  Check in API or JCL to test if an object is currently in use

    Posted Jul 12, 2016 11:32 PM
    Hi,

    About checking whether an object is being used:

    you can use the XMLRequest subclass called GetObjectProperties(UC4ObjectName name): it has a method called "getOpenByUser()" which should return the name of the user that has the object open in R/W mode (or nothing otherwise).


    About forcing the API to take over an object that is opened by a User:

    you can use the XMLRequest subclass called ResetOpenFlag(UC4ObjectName name): it will basically ensure that the "edit" flag is taken away from the user editing the object.. You can then use the OpenObject request to open the object in R/W with the API. Note that the user from which the edit flag is removed will get an error message that his/her modifications could not be saved.

    bren



  • 4.  Re: Check in API or JCL to test if an object is currently in use

    Posted Aug 15, 2018 02:45 PM

    Hi,

     

    be carefull with ResetOpenFlag(UC4ObjectName name). First of all the user used in the API needs the Privilege to perform the action. Also it can happen the the two users having opened the objects override the changes of the other.

     

    I would send an email in this case asking the user to close the opbject before the API use the OpenObject calls

     

    Regards

     

    Thomas