Class ESIEffectivityHandlerImpl

java.lang.Object
com.ptc.windchill.esi.rnd.ESIEffectivityHandlerImpl
All Implemented Interfaces:
ESIEffectivityHandler

public class ESIEffectivityHandlerImpl extends Object implements ESIEffectivityHandler
The default implementation of ESI effectivity handler.

Supported API: true

Extendable: true
  • Method Details

    • getTransactionUtility

      protected ESITransactionUtility getTransactionUtility()
      Gets the value of the attribute: transactionUtility; A reference to an ESITransactionUtility. Use lazy-initializing getter method to access this attribute.

      Supported API: true
      Returns:
      ESITransactionUtility
    • getLatestEffectivity

      public Eff getLatestEffectivity(EffManagedVersion part) throws WTException
      Deprecated.
      Use getLatestEffectivity(EffManagedVersion, int) instead of this API
      Note: Effectivties are not returned for a checked-out version of EffManagedVersion object.

      Supported API: true
      Returns the latest non-product-specific Date Effectivity that is associated with an object.
      Specified by:
      getLatestEffectivity in interface ESIEffectivityHandler
      Parameters:
      part - The part whose effectivity is to be obtained
      Returns:
      Eff
      Throws:
      WTException
    • getLatestEffectivity

      public Eff getLatestEffectivity(EffManagedVersion emv, int type) throws WTException
      Returns the latest Effectivity of a given type that is associated with a given object. The method tries to fetch the required information from cache to start with, failing which it invokes EffHelper.service.getEffs(). The PersistInfo associated with each Eff instance is looked up to determine the latest among the multiple Eff instances (of the given type) that getEffs() may return. The latest Eff instance thus fetched is then cached, so it may be fetched conveniently from the cache during a subsequent call, without having to hit the database.
      Note: Effectivties are not returned for a checked-out version of EffManagedVersion object.

      Supported API: true
      Specified by:
      getLatestEffectivity in interface ESIEffectivityHandler
      Parameters:
      emv - object iteration (of type EffManagedVersion) whose effectivity needs to be returned.
      type - This is either ESIEffectivityHandler.DATE_EFFECTIVITY_TYPE, ESIEffectivityHandler.SERIAL_NUMBER_EFFECTIVITY_TYPE or ESIEffectivityHandler.LOT_NUMBER_EFFECTIVITY_TYPE, according as the latest Date, Serial Number or Lot Number effectivity associated with the given object is to be fetched respectively.
      Returns:
      Eff
      Throws:
      WTException
    • isReleased

      public boolean isReleased(ESITargetAssociation assn)
      Checks if the latest date effectivity associated with the given object (of type EffManagedVersion) is also the date effectivity that was last exported to the given distribution target OR if the given object does not have any date effectivity assigned to it. The object and the distribution target are worked out from the passed ESITargetAssociation instance. If the input object is a process plan, it performs the above said checks for serial and lot effectivity as well. The method returns a true if all the performed checks succeed; it returns a false otherwise.

      Supported API: true
      Specified by:
      isReleased in interface ESIEffectivityHandler
      Parameters:
      assn - The ESITargetAssociation instance from which to work out the EffManagedVersion and ESITarget instances.
      Returns:
      boolean
    • isReleased

      public boolean isReleased(EffManagedVersion emv, ESITarget target, int type)
      Returns a true, if the latest effectivity of the passed type associated with the given object (of type EffManagedVersion) is also the effectivity (of the same type) that was last exported to the given distribution target OR if the given object does not have any effectivity of the given type assigned to it.

      Supported API: true
      Specified by:
      isReleased in interface ESIEffectivityHandler
      Parameters:
      emv - Object iteration of type EffManagedVersion for which to determine if the effectivity has been released to the given distribution target or not.
      target - The given distribution target.
      type - Specifies the type of effectivity in question - it takes any of the named constants defined in the interface ESIEffectivityHandler for its value.
      Returns:
      boolean
    • getClassForEffectivityType

      public Class getClassForEffectivityType(int type)
      Returns the Class instance corresponding to the type of effectivity that is passed to it.

      Supported API: true
      Specified by:
      getClassForEffectivityType in interface ESIEffectivityHandler
      Parameters:
      type - Specifies the type of effectivity - this could take any of the named constants defined in interface ESIEffectivityHandler for its value.
      Returns:
      Class
    • getLastExportedEffectivity

      protected Eff getLastExportedEffectivity(WTPart part, ESITarget target) throws WTException
      Returns the last released Eff object for associated with a WTPart and an ESITarget. Delegates the work to ESITransactionUtility.latestEffExport().

      Supported API: true
      Parameters:
      part - The part of interest.
      target - The ESITarget where the part is to be released.
      Returns:
      Eff
      Throws:
      WTException
    • getLastExportedEffectivity

      protected Eff getLastExportedEffectivity(EffManagedVersion emv, ESITarget target, int type) throws WTException
      Returns an Eff instance of the passed type that was last exported to the given distribution target for the given object (of type EffManagedVersion). The method tries to fetch the required information from cache to start with, failing which it invokes ESITransactionUtility.latestEffExport(EffManagedVersion emv, ESITarget target, int type), an overloaded version that takes the additional argument type.

      Supported API: true
      Parameters:
      emv - object iteration of type EffManagedVersion for which to determine the last exported effectivity.
      target - Given distribution target.
      type - Specifies the type of effectivity - takes any of the named constants defined in the interface ESIEffectivityHandler for its value.
      Returns:
      Eff
      Throws:
      WTException
    • isCompEffReleased

      public boolean isCompEffReleased(WTPart part, Collection<WTPart> componentParts, ESITargetAssociation assn, WTPart root, NavigationCriteria navCriteria) throws ESIRendererException
      Lets the caller know if the latest serial or lot effectivity associated with any of the components in the passed BOM is already published. Delegates the actual work of determining this information to a lower level API.

      Supported API: true
      Specified by:
      isCompEffReleased in interface ESIEffectivityHandler
      Parameters:
      part - WTPart instance representing the given BOM header
      componentParts - WTPart that are components/children of the part.
      assn - ESITargetAssociation object that represents the association between the part and the distribution target (that the part is exported to).
      root - WTPart instance representing the top-level assembly part.
      navCriteria - NavigationCriteria object to pass in to the ESIPartUtility API that fetches part iterations for a given collection of masters.
      Returns:
      false, if the serial/lot effectivity assigned to any of the components in the BOM is not published yet; true, otherwise.
      Throws:
      ESIRendererException - If any of the invoked methods throws this exception, or if the serial/lot effectivity associated with any of the components in the BOM is found to be invalid.
    • validateUnitEffOnChangeable

      public int validateUnitEffOnChangeable(WTPart part, Map<Releasable,String> changeables, Map<WTPart,String> contextIterations, NavigationCriteria navCriteria) throws WTException
      Lets the caller know if the latest unit effectivity associated with the input part is valid.

      Supported API: true
      Specified by:
      validateUnitEffOnChangeable in interface ESIEffectivityHandler
      Parameters:
      part - WTPart instance whose unit effectivity is to be validated.
      changeables - Map of Releasables and multilevel flag values; the keys are typically resulting objects associated with an ECN.
      contextIterations - If the preference "Include Effectivity Context" has a value "Yes" and the relevant effectivity context iteration does not already figure in changeables, the iteration is added to this Hashtable.
      navCriteria - NavigationCriteria object to use for performing the validation.
      Returns:
      UNIT_EFF_NO_ERROR, if the latest unit effectivity associated with the input part is valid, or if there is no unit effectivity assigned to it; some other value, if the unit effectivity associated with the part is found to be invalid.
      Throws:
      WTException - If an error occurred while performing the required validation.
      See Also:
      • invalid reference
        ESIEffectivityHandlerImpl#validateUnitEffOnChangeable(Eff, WTPart, Map, Map, NavigationCriteria)
    • setBuilder

      public void setBuilder(VdbBuilder builder)
      Sets the attribute that holds a reference to the VdbBuilder instance.

      Supported API: true
      Specified by:
      setBuilder in interface ESIEffectivityHandler
      Parameters:
      builder - Reference to the VdbBuilder instance that the attribute is to be set to.
    • getLatestEffectivities

      public Eff[] getLatestEffectivities(EffManagedVersion emv) throws ESIRendererException
      Fetches the latest date, serial number and lot number effectivities associated with a given object (of type EffManagedVersion), stores them in an array of Eff instances and returns the array to the caller. Some of the elements in the output array could be null, depending on whether or not the given object has the given type of effectivity associated with it.

      Supported API: true
      Specified by:
      getLatestEffectivities in interface ESIEffectivityHandler
      Parameters:
      emv - EffManagedVersion instance for which to fetch the latest date, serial number and lot number effectivities.
      Returns:
      Eff[]
      Throws:
      ESIRendererException
    • getLatestEffectivities

      public List<Eff>[] getLatestEffectivities(EffManagedVersion emv, String type) throws ESIRendererException
      Fetches the latest date, serial number and lot number effectivities associated with a given object (of type EffManagedVersion), stores them in an array of Eff instances and returns the array to the caller. Some of the elements in the output array could be null, depending on whether or not the given object has the given type of effectivity associated with it.

      Supported API: true
      Specified by:
      getLatestEffectivities in interface ESIEffectivityHandler
      Parameters:
      emv - EffManagedVersion instance for which to fetch the latest date, serial number and lot number effectivities.
      type -
      Returns:
      Eff[]
      Throws:
      ESIRendererException
    • getLatestEffectivity

      public List<Eff> getLatestEffectivity(EffManagedVersion emv, int type, String efType) throws WTException
      Returns the latest Effectivity of a given type that is associated with a given object. The method tries to fetch the required information from cache to start with, failing which it invokes EffHelper.service.getEffs(). The PersistInfo associated with each Eff instance is looked up to determine the latest among the multiple Eff instances (of the given type) that getEffs() may return. The latest Eff instance thus fetched is then cached, so it may be fetched conveniently from the cache during a subsequent call, without having to hit the database.
      Note: Effectivties are not returned for a checked-out version of EffManagedVersion object.

      Supported API: true
      Specified by:
      getLatestEffectivity in interface ESIEffectivityHandler
      Parameters:
      emv - object iteration (of type EffManagedVersion) whose effectivity needs to be returned.
      type - This is either ESIEffectivityHandler.DATE_EFFECTIVITY_TYPE, ESIEffectivityHandler.SERIAL_NUMBER_EFFECTIVITY_TYPE or ESIEffectivityHandler.LOT_NUMBER_EFFECTIVITY_TYPE, according as the latest Date, Serial Number or Lot Number effectivity associated with the given object is to be fetched respectively.
      efType - This is currently not used. The parameter merely serves to distinguish this method from the other overloaded versions.
      Returns:
      List of Eff objects of the input type associated with the input object.
      Throws:
      WTException
    • getLastExportedEffectivity

      protected List<Eff> getLastExportedEffectivity(EffManagedVersion emv, ESITarget target, int type, String efType) throws WTException
      Returns an Eff instance of the passed type that was last exported to the given distribution target for the given object (of type EffManagedVersion). The method tries to fetch the required information from cache to start with, failing which it invokes ESITransactionUtility.latestEffExport(EffManagedVersion emv, ESITarget target, int type), an overloaded version that takes the additional argument type.

      Supported API: true
      Parameters:
      emv - object iteration of type EffManagedVersion for which to determine the last exported effectivity.
      target - Given distribution target.
      type - Specifies the type of effectivity - takes any of the named constants defined in the interface ESIEffectivityHandler for its value.
      Returns:
      Eff
      Throws:
      WTException