Class BusinessParams

java.lang.Object
com.portal.common.InfranetCachedData
com.portal.common.BusinessParams

public class BusinessParams extends InfranetCachedData
This utility class supports access to information for all of the business logic parameters stored in the /config/business_params configuration object. Since this is a relatively heavy weight object (calls Portal to read the configuration objects) you must call the getInstance() method to get a global copy of this object. At present this class does not have a dynamic mechanism to refresh the cache but the cache can be explicitly refreshed calling the getInstance() method with rebuild set to "true".
Version:
$Id: BusinessParams.java /cgbubrm_main.clients/1 2011/06/13 07:49:45 mchellam Exp $
Author:
Jon Sorensen
  • Field Details

  • Constructor Details

    • BusinessParams

      protected BusinessParams(PortalContext connection)
      Construct a "business parameters" object. Read the business parameters for all of the "parameter groups" from Portal and construct the appropreiate lookup tables.
      Parameters:
      connection - An active connection to Portal.
  • Method Details

    • getInstance

      public static BusinessParams getInstance(PortalContext connection)
      Get the one and only instance of this class. If the instance has not been created then create one.
      Parameters:
      connection - An active connection to Portal.
      Returns:
      The one and only instance of this class.
    • getInstance

      public static BusinessParams getInstance(PortalContext connection, boolean rebuild)
      Get the one and only instance of this class. If the instance has not been created then create one.
      Parameters:
      connection - An active connection to Portal.
      rebuild - If this flag is TRUE then the reference to the existing instance will be set to null and a new instance will be created. This will cause the data to be refreshed.
      Returns:
      The one and only instance of this class.
    • doesParamExist

      public boolean doesParamExist(String groupName, String paramName)
      Determine if the specified parameter exists. Parameters:
      Parameters:
      groupName - The name of the group ("billing", "rating", "vse_ipt", etc.) to retrieve the parameter from.
      paramName - The name of the configuration parameter to retrieve the value for.
      Returns:
      Return true if the parameter exists, otherwise return false.
    • getInt

      public Integer getInt(String groupName, String paramName) throws BusParamException
      Get the specified parameter as an integer value from a "global" configuration object. Parameters:
      Parameters:
      groupName - The name of the group ("billing", "rating", "vse_ipt", etc.) to retrieve the parameter from.
      paramName - The name of the configuration parameter to retrieve the value for.
      Returns:
      The integer representation of the value associated with the specified parameter.
      Throws:
      BusParamException
    • getString

      public String getString(String groupName, String paramName) throws BusParamException
      Get the specified parameter as a string value from a "global" configuration object. Parameters:
      Parameters:
      groupName - The name of the group ("billing", "rating", "vse_ipt", etc.) to retrieve the parameter from.
      paramName - The name of the configuration parameter to retrieve the value for.
      Returns:
      The integer representation of the value associated with the specified parameter.
      Throws:
      BusParamException
    • getDecimal

      public BigDecimal getDecimal(String groupName, String paramName) throws BusParamException
      Get the specified parameter as a "big decimal" value from a "global" configuration object. Parameters:
      Parameters:
      groupName - The name of the group ("billing", "rating", "vse_ipt", etc.) to retrieve the parameter from.
      paramName - The name of the configuration parameter to retrieve the value for.
      Returns:
      The integer representation of the value associated with the specified parameter.
      Throws:
      BusParamException
    • roundTo12AMApplyHourOffset

      public Date roundTo12AMApplyHourOffset(Date time)
      Adjust the time value to 12 AM and then apply the billing cycle offset (which is in hours). If the billing cycle offset is greater than the hour in the specified time then roll back to the previous day.

      Parameters:
      time - the time value to adjust
      Returns:
      the specified time with the hour offset applied to it. Here are some examples:
      • time = 01/05/2001;9:59:67, hourOffset = 10, return 01/04/2001;10:00:00
      • time = 01/05/2001;10:59:21, hourOffset = 10, return 01/05/2001;10:00:00
    • searchForConfigObjects

      protected FList searchForConfigObjects()
      Call Portal to search for the specified configuration objects.
      Returns:
      Return an FList containing the data for the specified configuration object if successful otherwise null.
    • opcode

      protected FList opcode(int op, int flags, FList in) throws EBufException
      Hack method used to support a JavaServerConnection. This is a hack because the JavaCommon package does not know anything about a Java Server connection. This method is used to execute an op-code. The default implementation will use a Portal Context.
      Parameters:
      op - Opcode to perform.
      flags - Control Flags for opcode.
      in - Opcode parameter FList.
      Returns:
      Return the FList returned from the op-code that was executed.
      Throws:
      EBufException - is trhown if an error occurs.
    • getCurrentDB

      public long getCurrentDB()
      Hack method used to support a JavaServerConnection. This is a hack because the JavaCommon package does not know anything about a Java Server connection. This method is used to return the database number for the connection affiliated with an instance of this class. The default implementation will use a Portal Context.
      Returns:
      The database number currently connected to.