Package Thor.API.Base

Class tcBaseUtility

java.lang.Object
Thor.API.Base.tcBaseUtility
All Implemented Interfaces:
com.thortech.xl.dataobj.tcErrorReceiver, com.thortech.xl.orb.api.operations._tcUtilityIntfOperations, com.thortech.xl.server.tcOrbServerObject, tcUtilityOperationsIntf
Direct Known Subclasses:
tcExportOperationsBean, tcImportOperationsBean

public abstract class tcBaseUtility extends Object implements com.thortech.xl.orb.api.operations._tcUtilityIntfOperations, tcUtilityOperationsIntf, com.thortech.xl.server.tcOrbServerObject, com.thortech.xl.dataobj.tcErrorReceiver
Base utility server-side class. All server-side Utility/API classes must extend from this class. It provides all the base functionality necessary for a server-side object.
Author:
Felix Lipov
  • Field Details

  • Constructor Details

    • tcBaseUtility

      public tcBaseUtility()
      Constructor. Necessary for client-side instantiation.
    • tcBaseUtility

      public tcBaseUtility(String psName)
      Base Utility class. Provides basic functionality for all utility classes.
      Parameters:
      psName - A descriptive name.
  • Method Details

    • ejbActivate

      public void ejbActivate() throws javax.ejb.EJBException, RemoteException
      The ejbActivate() method as required by the EJB specification.
      The activate method is called when the instance is activated from its passive" state. The instance should acquire any resource that it has released earlier in the ejbPassivate() method.
      This method is called with no transaction context.
      Throws:
      javax.ejb.EJBException - Thrown if the instance could not perform the function requested by the container because of an system-level error.
      RemoteException
    • ejbPassivate

      public void ejbPassivate() throws javax.ejb.EJBException, RemoteException
      The ejbPassivate() method as required by the EJB specification.
      The activate method is called when the instance is activated from its "passive" state. The instance should acquire any resource that it has released earlier in the ejbActivate() method.
      This method is called with no transaction context.
      Throws:
      javax.ejb.EJBException - Thrown if the instance could not perform the function requested by the container because of an system-level error.
      RemoteException
    • ejbRemove

      public void ejbRemove() throws javax.ejb.EJBException, RemoteException
      The ejbRemove() method as required by the EJB specification.
      A container invokes this method before it ends the life of the session object. This happens as a result of a client's invoking a remove operation, or when a container decides to terminate the session object after a timeout.
      This method is called with no transaction context.
      Throws:
      javax.ejb.EJBException - Thrown if the instance could not perform the function requested by the container because of an system-level error.
      RemoteException
    • setSessionContext

      public void setSessionContext(javax.ejb.SessionContext newContext) throws javax.ejb.EJBException
      Set the associated session context. The container calls this method after the instance creation.
      The enterprise bean instance should store the reference to the context object in an instance variable.
      This method is called with no transaction context.
      Parameters:
      newContext -
      Throws:
      javax.ejb.EJBException - Thrown if the instance could not perform the function requested by the container because of an system-level error.
    • getSessionContext

      public javax.ejb.SessionContext getSessionContext()
      Get the associated session context
      Returns:
      SessionContext
    • getEJBContext

      public javax.ejb.EJBContext getEJBContext()
      Returns:
      EJBContext
    • getDataBase

      public com.thortech.xl.dataaccess.tcDataProvider getDataBase()
      Returns the database. Wraps the method call to retrieve the database in tcObjectManager.
      Specified by:
      getDataBase in interface com.thortech.xl.server.tcOrbServerObject
      Returns:
      The database.
    • close

      public void close()
      This method will clean up all resources associated with this object. Called when it will no longer be used.
      Specified by:
      close in interface tcUtilityOperationsIntf
    • removeInstance

      public void removeInstance()
      Releases the object resources.
      Specified by:
      removeInstance in interface com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
      Specified by:
      removeInstance in interface com.thortech.xl.server.tcOrbServerObject
    • getName

      public String getName()
      Returns the name of the client.
      Specified by:
      getName in interface com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
      Specified by:
      getName in interface tcUtilityOperationsIntf
      Returns:
      The name of the client.
    • setLanguage

      public void setLanguage(String psLanguage)
      Sets the language. Used in defining the locality that this utility class represents. Only to be called by tcUtilityIntf.
      Specified by:
      setLanguage in interface com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
      Specified by:
      setLanguage in interface tcUtilityOperationsIntf
      Parameters:
      psLanguage - The language.
    • setCountry

      public void setCountry(String psCountry)
      Sets the country. Used in defining the locality that this utility class represents. Only to be called by tcUtilityIntf.
      Specified by:
      setCountry in interface com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
      Specified by:
      setCountry in interface tcUtilityOperationsIntf
      Parameters:
      psCountry - The country.
    • setVariant

      public void setVariant(String psVariant)
      Sets the variant. Used in defining the locality that this utility class represents. Only to be called by tcUtilityIntf.
      Specified by:
      setVariant in interface com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
      Specified by:
      setVariant in interface tcUtilityOperationsIntf
      Parameters:
      psVariant - The locality variant.
    • addError

      public void addError(com.thortech.xl.orb.dataaccess.tcError poError)
      Adds the error to this object's error list, and sets the state to ERROR.
      Specified by:
      addError in interface com.thortech.xl.dataobj.tcErrorReceiver
      Parameters:
      poError - The error to add.
    • addReject

      public void addReject(com.thortech.xl.orb.dataaccess.tcError poReject)
      Adds the rejection to this object's rejection list.
      Specified by:
      addReject in interface com.thortech.xl.dataobj.tcErrorReceiver
      Parameters:
      poReject - The rejection to add.
    • addErrorReceiver

      public void addErrorReceiver(com.thortech.xl.dataobj.tcErrorReceiver poErrorReceiver)
      Adds another error receiver to the object's error list. Any time an error is added to this object's error list, the error message will also be added to the error receiver specified.
      Specified by:
      addErrorReceiver in interface com.thortech.xl.dataobj.tcErrorReceiver
      Parameters:
      poErrorReceiver - The error receiver to add.
    • removeErrorReceiver

      public void removeErrorReceiver(com.thortech.xl.dataobj.tcErrorReceiver poErrorReceiver)
      Removes the error receiver from the object's error list. Any new errors added to this object will be not be passed along to the specified error receiver.
      Specified by:
      removeErrorReceiver in interface com.thortech.xl.dataobj.tcErrorReceiver
      Parameters:
      poErrorReceiver - The error receiver to remove.
    • getErrors

      public com.thortech.xl.orb.dataaccess.tcError[] getErrors()
      Returns errors that occurred over the course of usage of the class.
      Specified by:
      getErrors in interface com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
      Returns:
      An array of errors.
    • getRejections

      public com.thortech.xl.orb.dataaccess.tcError[] getRejections()
      Returns rejections that occurred over the course of usage of the class.
      Specified by:
      getRejections in interface com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
      Returns:
      An array of rejections.
    • clearErrors

      public void clearErrors()
      Clears all errors and exceptions that are stored in the utility class.
      Specified by:
      clearErrors in interface com.thortech.xl.orb.api.operations._tcUtilityIntfOperations
    • getMap

      public static Map<String,Object> getMap(com.thortech.xl.orb.api.tcMapping[] paoMapping)
      Creates a Map object from the provided array of tcMapping objects. Useful for the utility classes in executing queries where they need to provide qualifiers.
      Parameters:
      paoMapping - An array of tcMapping objects, each of which represents a name-value pair.
      Returns:
      A Map object containing all the name-value pairs.
    • getMapping

      public static com.thortech.xl.orb.api.tcMapping[] getMapping(Map<String,Object> poMap)
      Creates a tcMapping array from the provided Map. Useful for the utility classes in executing queries where they need to provide qualifiers.
      Parameters:
      poMap - An array of tcMapping objects, each of which represents a name-value pair.
      Returns:
      A Map object containing all the name-value pairs.
    • getQueryFilter

      public String getQueryFilter(Map<String,Object> moAttributeMap, Vector<String> prepStmtParams) throws tcAPIException
      Throws:
      tcAPIException
    • getDefaultLocaleCode

      public static String getDefaultLocaleCode() throws Exception
      This method will return default locale stored in DB as <user.language>_<user.region>
      Returns:
      Throws:
      Exception
    • getUnAuthorizedTargetFieldSet

      public Set<String> getUnAuthorizedTargetFieldSet(Map attributeMap, Set<String> retColumnSet) throws tcAPIException
      Parameters:
      attributeMap - identifies A map containing a search criteria pertianing to User
      retColumnSet - identifies a set of db columns that are required in select clause of API and need to check if they are authorized
      Returns:
      A set of unauthorized db columns as per Authorization policy
      Throws:
      tcAPIException