Package wt.eff

Class EffHelper

java.lang.Object
wt.eff.EffHelper
All Implemented Interfaces:
Externalizable, Serializable, wt.services.applicationcontext.ApplicationContextChild

public class EffHelper extends Object implements wt.services.applicationcontext.ApplicationContextChild, Externalizable
This helper is used to access an implementation of EffService via the static reference EffHelper.service. Other functionality is provided by EffConfigSpecAssistant and EffGroupAssistant.

Supported API: true

Extendable: false
See Also:
  • Field Details

    • service

      public static final EffService service
      Gets the implemented wt.eff.EffService instance.

      Supported API: true
  • Method Details

    • getValidEffs

      @Deprecated public static Class[] getValidEffs(EffContext context)
      Deprecated.
      Returns all Eff classes that are valid in the given context. If context is null, returns only effs that are optional (have a 0..1 cardinality). The ValidEffsDelegate is used to process this.

      Supported API: true
      Parameters:
      context -
      Returns:
      Class[]
    • getValidEffs

      @Deprecated public static Class[] getValidEffs(Class parentType, EffContext context)
      Returns all EffRecord classes that are valid in the given context and of the specified parent type. If context is null, returns only eff record types that are optional (have a 0..1 cardinality). The ValidEffsDelegate is used to process this.

      Supported API: true
      Parameters:
      parentType -
      context -
      Returns:
      Class[]
    • getEffRange

      public static Class getEffRange(Class effClass)
      For a given Eff class, returns the valid EffRange class. For first time call of given input effClass, Gets Effectivity Range from Range property on the mode and puts it into range cache which is class level concurrent hash map. subsequent calls for given input effClass will get it from range cache.

      Supported API: true
      Parameters:
      effClass -
      Returns:
      Class
    • getEffRangeType

      public static Class getEffRangeType(Class rangeClass)
      For a given EffRange class, returns the datatype for start/end.

      Supported API: true
      Parameters:
      rangeClass -
      Returns:
      Class
    • isContextRequired

      public static boolean isContextRequired(Class effClass)
      Returns true if the Eff class requires a context (has cardinality 1).

      Supported API: true
      Parameters:
      effClass -
      Returns:
      boolean
    • isCurrent

      public static boolean isCurrent(Eff eff)
      Returns true if and only if the argument Eff object is current (i.e., it has not been factually deleted and thus relegated to effectivity history).

      Supported API: true
      Parameters:
      eff - Eff object whose status as current or historical is to be determined -- may not be null
      Returns:
      boolean
    • isLegacy

      public static boolean isLegacy(Eff eff)
      Returns true if and only if the argument Eff object is legacy (i.e., it does not reference a valid creation EffChangeAudit object).

      Supported API: true
      Parameters:
      eff - Eff object whose status as legacy is to be determined -- may not be null
      Returns:
      boolean
    • equals

      public static boolean equals(Eff e1, Eff e2)
      Returns true if and only if the argument Eff objects are equal (that is, their respective range values are equal).

      Supported API: true
      Parameters:
      e1 - Eff object to be compared to the other Eff argument for equality -- may not be null
      e2 - Eff object to be compared to the other Eff argument for equality -- may not be null
      Returns:
      boolean
    • isValidEffTarget

      public static boolean isValidEffTarget(Changeable2 changeable)
      Returns true if the changeable passed in is a valid effectivity target, and false otherwise. If the changeable implements EffManagedVersion, the method will delegate to the overloaded method taking an EffManagedVersion. Returns false otherwise.



      Supported API: true

      Parameters:
      changeable - Changeable2 participating in change-related association
      Returns:
      boolean
    • isValidEffTarget

      public static boolean isValidEffTarget(EffManagedVersion effManagedVersion)
      Returns true if the object passed in is a valid effectivity target. For parts with its nonEffective attribute set to true, the method returns false.



      Supported API: true

      Parameters:
      effManagedVersion - Some EffManagedVersion object.
      Returns:
      boolean
    • isValidEffTarget

      public static boolean isValidEffTarget(String target)
      Returns true if the object passed in is a valid effectivity target.



      Supported API: true

      Parameters:
      String - target - Fully qualified class name eg. WTPart.class.getName()
      Returns:
      boolean
    • getValidEffForms

      @Deprecated public static Class<? extends EffForm>[] getValidEffForms(EffContext effContext)
      Deprecated.
      Returns array of valid EffForm classes for the passed in EffContext. If the context is not null, a call to the ValidEffsDelegate will be made to obtain the valid forms for the context. The default delegate bases the result on the trace code of WTPartMaster contexts, and returns a default set for other contexts. If the context is null, a set of valid forms for non-contextual effectivity forms is returned.



      Supported API: true

      Parameters:
      effContext - effectivity context; may be null
      Returns:
      Class<?extends EffForm>[]
    • getValidEffectivities

      public static Class[] getValidEffectivities(EffContext context)
      Returns all Eff classes that are valid in the given context. If context is null, returns only effs that are optional (have a 0..1 cardinality). The ValidEffsDelegate is used to process this.

      Supported API: true
      Parameters:
      context -
      Returns:
      Class[]
    • getValidEffectivities

      public static Class[] getValidEffectivities(Class parentType, EffContext context)
      Returns all EffRecord classes that are valid in the given context and of the specified parent type. If context is null, returns only eff record types that are optional (have a 0..1 cardinality). The ValidEffsDelegate is used to process this.

      Supported API: true
      Parameters:
      parentType -
      context -
      Returns:
      Class[]
    • getValidEffectivityForms

      public static Class<? extends EffForm>[] getValidEffectivityForms(EffContext effContext)
      Returns array of valid EffForm classes for the passed in EffContext. If the context is not null, a call to the ValidEffsDelegate will be made to obtain the valid forms for the context. The Standard Delegate bases the result on the trace code of WTPartMaster contexts and valid trace codes defined on the form and returns a default set for other contexts. If the context is null, a set of valid forms for non-contextual effectivity forms is returned as defined on the form.



      Supported API: true

      Parameters:
      effContext - effectivity context; may be null
      Returns:
      Class<?extends EffForm>[]
    • getEffTypeForForm

      public static EffType getEffTypeForForm(Class<? extends EffForm> effFormClass) throws IllegalArgumentException
      Given an Effectivity form class, this method determines EffType form using Delegate registered for the Form as selector. If the delegate is not registered with form class as selector, this method returns null.

      Validates: a. If input interface is not null b. Input class is interface and child of EffForm. c. return type of invoked method is Boolean. If any validation fails then returns null.

      Parameters:
      effFormClass -
      Returns:
      EffType Supported API: true
      Throws:
      IllegalArgumentException
    • isEffContextNullable

      public static Boolean isEffContextNullable(Class<? extends EffForm> effFormClass) throws IllegalArgumentException
      Given an Effectivity form class, this method determines if effectivity context is nullable/optional for form using Delegate registered for the Form as selector. If the delegate is not registered with form class as selector, this method returns null.

      Validates: a. If input interface is not null b. Input class is interface and child of EffForm. If any validation fails then returns null.

      Parameters:
      effFormClass -
      Returns:
      Boolean Supported API: true
      Throws:
      IllegalArgumentException
    • isEffContextValidForEffForm

      public static Boolean isEffContextValidForEffForm(Class<? extends EffForm> effFormClass, EffContext effContext) throws IllegalArgumentException
      Given an Effectivity form class and effecitivity context, this method determines if context is valid for form using Delegate registered for the Form as selector. If the delegate is not registered with form class as selector, this method returns null.

      Validates: a. If input interface and context are not null b. Input class is interface and child of EffForm. If any validation fails then throws exception.

      Parameters:
      effFormClass -
      effContext -
      Returns:
      Boolean
      Throws:
      IllegalArgumentException - Supported API: true
    • getValidTraceCodesForEffForm

      public static Set<TraceCode> getValidTraceCodesForEffForm(Class<? extends EffForm> effFormClass) throws IllegalArgumentException
      Given an Effectivity form class, this method finds out valid traces codes using Delegate registered for the Form as selector. If the delegate is not registered with form class as selector, this method returns null.

      Validates: a. If input interface is not null b. Input class is interface and child of EffForm. If any validation fails then throws exception.

      Parameters:
      effFormClass -
      Returns:
      Set of valid trace codes for this form
      Throws:
      IllegalArgumentException - Supported API: true
    • getFormDisplayName

      public static String getFormDisplayName(Class<? extends EffForm> effFormClass) throws IllegalArgumentException
      Given an Effectivity form class, this method finds out EffType using Delegate registered for the Form as selector and then gets the display name from the EffType short description from appropriate EffTypeRb.rbinfo for user session locale. If the delegate is not registered with form class as selector, empty string will be returned as display name.

      Validates: a. If input interface is not null b. Input class is interface and child of EffForm. If any validation fails then throws exception.

      If there is error retrieving locale, returns the display name for default locale if found. Supported API: true

      Parameters:
      effFormClass -
      Returns:
      String
      Throws:
      IllegalArgumentException
    • getEffFormClassForEffType

      public static Class<? extends EffForm> getEffFormClassForEffType(EffType effType) throws IllegalArgumentException
      Given an EffType, this method determines Effectivity Form class using Delegate registered for the EffType as selector. If the delegate is not registered with EffType as selector, this method returns null.

      Validates: a. If input interface is not null b. Input class is interface and child of EffForm. c. return type of invoked method is Boolean. If any validation fails then returns null.

      Parameters:
      effFormClass -
      Returns:
      EffType Supported API: true
      Throws:
      IllegalArgumentException
    • validateIfEffContextIsValidForEffForm

      public static boolean validateIfEffContextIsValidForEffForm(Class effFormClass, EffContext effContext)
      This method checks whether the "effContext" is valid for the "effFormClass".
      Parameters:
      effFormClass -
      effContext -
      Returns:
      boolean True or False Supported API: true
    • isOrganizationAdministrator

      public static boolean isOrganizationAdministrator(WTPrincipal user)
      returns a boolean value representing whether or not the user is an administrator for the current organization

      Supported API: true
      Parameters:
      WTPrincipal - user
      Returns:
      boolean
    • isContainerAdministrator

      public static boolean isContainerAdministrator(WTPrincipal user, WTContainerRef container)
      returns a boolean value representing whether or not the user is an administrator for the current container

      Supported API: true
      Parameters:
      WTPrincipal - user
      Returns:
      boolean