Class SisCoreHelper

java.lang.Object
com.ptc.arbortext.windchill.siscore.SisCoreHelper

public class SisCoreHelper extends Object
Class containing utility methods.

Supported API: true

Extendable: false
  • Method Details

    • getContentFromHolders

      public static WTKeyedMap getContentFromHolders(WTCollection holders)
      A multi object api version of getContentFromHolder to reduce number of jdbc calls.

      Supported API: true

      Parameters:
      holders - A WTCollection of content holders.
      Returns:
      WTKeyedMap containing the contentholder to content mappings
      Throws:
      WTException -

      Supported API: true
    • setAttributesOnPersistables

      public static void setAttributesOnPersistables(WTKeyedMap updateTargets, boolean persist, boolean checkout) throws WTException
      Sets the specified attributes with the specified values on the collection of specified objects assuming all target objects are checked in.
      Parameters:
      updateTargets - A map of persistable keys mapped to a map containing attribute name and attribute value pairs
      persist - boolean to specify if the updated persistables should be persisted once the update has been processed
      Throws:
      WTException -

      Supported API: true
    • modify

      public static WTCollection modify(WTCollection a_objects) throws WTException
      Updates the specified Persistable objects in the datastore. The modify method ensures that the operation is valid before updating the Persistable objects in the datastore.

      The target for this operations dispatched event is the specified Persistable object for a single object event listener (the listener is called once for each object in the collection) and a WTCollection containing the specified Persistable object for a multiple object event listener.

      The modify method performs the following operations.

      1. Dispatches a PersistenceManagerEvent.PRE_MODIFY event.
      2. Ensures that each Persistable object is persistent.
      3. Ensures that attributes are valid (by invoking Persistable.checkAttributes() for each object).
      4. Uses Access Control to determine if the user is allowed to modify each business object.
      5. Updates the Persistable objects in the database, ensuring that the objects have not gone stale (that is, someone else has already modified this object in the database). Note that any attributes derived from values that exist in other tables are not updated in the database.
      6. Sets new values in the persistent information attributes, such as update count and modify timestamp.
      7. Dispatches a PersistenceManagerEvent.UPDATE event.
      8. Dispatches a PersistenceManagerEvent.POST_MODIFY event.
      9. Returns the collection of Persistable objects to the caller.



      Supported API: true
      Parameters:
      a_objects - The objects to be modified in the datastore
      Returns:
      WTCollection
      Throws:
      WTException
    • checkout

      Checks out a WTCollection of Workable objects to the specified folder. A multi-object PRE_CHECKOUT WorkInProgressServiceEvent is emitted within a transaction before the collection of objects is checked out, and a multi-object POST_CHECKOUT WorkInProgressServiceEvent is emitted within the same transaction after the objects have been checked out. The provided note is used as the comment for the checkout operation.

      Supported API: true
      Parameters:
      paramWTCollection - The WTCollection of objects to be checked out.
      paramFolder - The Folder the objects are to be checked out to.
      paramString - The comment for the checkout operation.
      Returns:
      WTCollection - The collection returned contains the set of CheckoutLink objects resulting from the operation.
      Throws:
      NonLatestCheckoutException
      WorkInProgressException
      WTPropertyVetoException
      PersistenceException
      WTException
    • save

      public static WTCollection save(WTCollection objects) throws WTException
      Invokes the modify method on the objects that are already persisted, otherwise invokes the store method.

      Supported API: true
      Parameters:
      objects - The persistable objects to be saved
      Returns:
      WTCollection
      Throws:
      WTException
    • save

      public static WTPart save(WTPart object) throws WTException
      Invokes the modify method on the object that is already persisted, otherwise invokes the store method.

      Supported API: true
      Parameters:
      object - The persistable object to be saved
      Returns:
      WTPart
      Throws:
      WTException
    • delete

      public static WTSet delete(WTSet paramWTSet) throws WTException
      Removes the specified persistable objects from the datastore. If a given Persistable object in the set participates as either a role A or role B member, then referential integrity processing will occur as specified for that role. The delete method ensures that the operation is valid before removing the Persistable objects from the datastore.

      The target for this operations dispatched event is the specified Persistable object for a single object event listener (the listener is called once for each object in the collection) and a WTCollection containing the specified Persistable object for a multiple object event listener. Note that the PRE_REMOVE event is not supported for a single object event listener.

      The delete performs the following operations.

      1. Dispatches a PersistenceManagerEvent.PRE_DELETE event.
      2. Ensures that this Persistable objects are persistent.
      3. Ensures that attributes are valid (by invoking Persistable.checkAttributes() for each object).
      4. Uses Access Control to determine if the user is allowed to delete the business objects.
      5. Deletes associated BinaryLink objects that are owned by the role objects that are being deleted.
      6. Dispatches a PersistenceManagerEvent.CLEANUP_LINK event.
      7. Dispatches a PersistenceManagerEvent.PRE_REMOVE event.
      8. Deletes the Persistable objects in the datastore, ensuring that the objects have not gone stale (that is, someone else has already modified this object in the datastore).
      9. Sets new values in the persistent information attributes to indicate that this objects have been deleted.
      10. Dispatches a PersistenceManagerEvent.REMOVE event.
      11. For any objects that are of type BinaryLink, cascaded role objects are deleted.
      12. Dispatches a PersistenceManagerEvent.POST_DELETE event.
      13. Returns the collection of Persistable objects to the caller.

      Before the commit of the transaction that this delete operation occurs in, the persistence service verifies that no BinaryLink objects exist that reference any of the removed objects.



      Supported API: true
      Parameters:
      a_objects - The objects to be deleted from the datastore.
      Returns:
      WTSet
      Throws:
      WTException
      See Also:
    • getAttributesFromPersistables

      public static WTKeyedMap getAttributesFromPersistables(WTKeyedMap objToattrNames) throws WTException
      * Retrieves the list of attribute values from passed in persistables
      Parameters:
      objToattrNames - Map wtih key as the persistable object to retrieve the values from and values as the list of attributes to attempt to retrieve the value for
      Returns:
      A map containing the attribute and the attribute value retrieved from each passed in persistable
      Throws:
      WTException -

      Supported API: true
    • getConfigSpecFor

      public static List<ConfigSpec> getConfigSpecFor(NavCriteriaContext context) throws WTException
      Lookup the GetConfigSpecForDelegate2 delegate and use its methods to get a list of ConfigSpecs.



      Supported API: true

      Parameters:
      context - Holds the parameters used to lookup the delegate and used by the delegate to create the list of ConfigSpecs.
      Returns:
      The list of ConfigSpec as returned by the delegate.
      Throws:
      WTException - On error.
    • getUsesWTParts

      public static QueryResult getUsesWTParts(WTPart paramWTPart, ConfigSpec paramConfigSpec) throws WTException
      Applies the configSpec to the result of navigating the WTPartUsageLink along the uses role; returns a QueryResult of Persistable[], in which the WTPartUsageLinks are at the 0th position and the corresponding iterations (or master if there is no corresponding iteration) in the 1th position. This API does not support filtering.

      Supported API: true
      Parameters:
      part - The WTPart to navigate.
      configSpec - The ConfigSpec to use to specify the iterations for the masters used.
      Returns:
      QueryResult
      Throws:
      WTException
      See Also:
    • modify

      public static Persistable modify(Persistable paramPersistable) throws WTException
      Updates the given Persistable object in the datastore. The modify method ensures that the operation is valid before updating the Persistable object in the datastore.

      The target for this operations dispatched event is the specified Persistable object for a single object event listener and a WTCollection containing the specified Persistable object for a multiple object event listener.

      The modify method performs the following operations.

      1. Dispatches a PersistenceManagerEvent.PRE_MODIFY event.
      2. Ensures that this Persistable object is persistent.
      3. Ensures that attributes are valid (by invoking Persistable.checkAttributes()).
      4. Uses Access Control to determine if the user is allowed to modify this business object.
      5. Updates this Persistable object in the database, ensuring that the object has not gone stale (that is, someone else has already modified this object in the database). Note that any attributes derived from values that exist in other tables are not updated in the database.
      6. Sets new values in the persistent information attributes, such as update count and modify timestamp.
      7. Dispatches a PersistenceManagerEvent.UPDATE event.
      8. Dispatches a PersistenceManagerEvent.POST_MODIFY event.
      9. Returns the Persistable object to the caller.



      Supported API: true
      Parameters:
      obj - The object to be modified in the datastore
      Returns:
      Persistable
      Throws:
      WTException
    • refresh

      public static Persistable refresh(Persistable paramPersistable) throws ObjectNoLongerExistsException, WTException
      Retrieves the given Persistable object from the database to restore its state. Object references for the target object are not refreshed and the object is not refreshed in place.

      Supported API: true
      Parameters:
      obj - The persistable object to be refreshed
      Returns:
      Persistable
      Throws:
      WTException
      ObjectNoLongerExistsException
    • getContainerByPath

      public static WTContainerRef getContainerByPath(String path) throws WTException
      Finds a container based on a path. The path is of the form:
       path                    ::= path_element (path_element)*
       path_element     ::= '/' class_name '=' container_name
       class_name        ::= the fully qualified name of a container class
       container_name :: = the name of a container instance
       


      Supported API: true
      Parameters:
      path -
      Returns:
      WTContainerRef
      Throws:
      WTException
    • checkout

      Checkout a workable object. A PRE_CHECKOUT WorkInProgressServiceEvent is emitted within a transaction before the object is checked out, and a POST_CHECKOUT WorkInProgressServiceEvent is emitted within the same transaction after the object has been checked out.

      Supported API: true
      Parameters:
      object -
      folder -
      note -
      Returns:
      CheckoutLink
      Throws:
      WTException
      WorkInProgressException
      NonLatestCheckoutException
      WTPropertyVetoException
      PersistenceException
    • setAuthentication

      public static void setAuthentication(Object auth)
      Set the authentication object associated with the Method context.

      Supported API: true
    • getCabinetBasedToFolderMap

      public static WTValuedMap getCabinetBasedToFolderMap(WTCollection foldereds) throws WTException
      Get the parent folders for the given collection of CabinetBased objects. If any of the objects are Cabinets, then they are mapped to null.

      If any of the objects are Foldered, then the implementation will first check to see if their FolderingInfos contain a cached reference to their parent folder, and use the cached instance as the return value. So in some cases this API will not require a trip to the server.

      Supported API: true

      Parameters:
      objects - The CabinetBased objects to find folders for
      Returns:
      A mapping of the objects to their parent folders
      Throws:
      FolderNotFoundException
      WTException
    • setAccessEnforced

      public static boolean setAccessEnforced(boolean b)
      Suspends or resumes all access invalid input: '&' authorization enforcement. If the argument is false then access/authorization enforcement is suspended; otherwise it is resumed. The method returns true if the access/authorization checks are being enforced or false otherwise.

      This method can be used to temporarily suspend access/authorization enforcement using a try/finally block, in which the enforcement is suspended in the try block and restored in the finally block. The return value can be used to restore the value to whatever it was before the enforcement was suspended.

      Supported API: true

      Parameters:
      enforce -
      Returns:
      boolean
    • refresh

      public static Persistable refresh(Persistable obj, boolean fullRefresh, boolean inPlace, boolean lock) throws WTException, ObjectNoLongerExistsException
      Retrieves the given Persistable object from the database to restore its state.

      Supported API: true
      Parameters:
      obj - The persistable object to be refreshed
      fullRefresh - Set to true if the object references for the target object should be refreshed as well.
      inPlace - Set to true if the target object should be refreshed in place.
      lock - Specifies whether the object should be locked as part of the refresh. This value should only be true when the call is within the context of a server-side transaction.
      Returns:
      Persistable
      Throws:
      WTException
      ObjectNoLongerExistsException
      See Also:
    • getContents

      public static ContentHolder getContents(ContentHolder holder) throws WTException, PropertyVetoException
      Set the cookie in an ContentHolder object to contain all ContentItems associated with it. This need to be called only once and refreshing can be done as needed.

      Supported API: true
      Parameters:
      holder -
      Returns:
      ContentHolder
      Throws:
      WTException
      PropertyVetoException