Class DataDictionary

java.lang.Object
javax.swing.AbstractListModel
com.portal.pfc.infranet.datadict.DataDictionary
All Implemented Interfaces:
Serializable, ListModel

public class DataDictionary extends AbstractListModel
This class acts as a model to SCE. It has all the information about the fields and the classes available in the Data Dictionary. 1. It is used to initialize the field browser and as well check/varify if a field or a class is existing in the data base. 2. It is also used to create new custom fields/Storable class by calling the relevent OPCODES This class can be used as a separate class to connect to Portal, just by providing a PortalContext as input to construct the object.
See Also:
  • Field Details

  • Constructor Details

    • DataDictionary

      public DataDictionary(PortalContext context) throws EBufException
      Constructor will load all the fields and classes from the database. Uses command line arguments passed from main()
      Parameters:
      context - the context from which to create this data dictionary.
      Throws:
      EBufException - if there's a problem loading the data dictionary.
    • DataDictionary

      public DataDictionary(PortalContext context, boolean init) throws EBufException
      Constructor Uses command line arguments passed from main()
      Parameters:
      context - the context from which to create this data dictionary.
      init - if true this constructor will load all the fields and classes from the database. If false then load only the fields, in which case many of the methods will not work.
      Throws:
      EBufException - if there's a problem loading the the fields and classes.
  • Method Details

    • getInstance

      public static DataDictionary getInstance(PortalContext context) throws EBufException
      Factory method to return a single instance of a DataDictionary fully initialized. Subsequent calls to this method will return the same DataDictionary instance.
      Parameters:
      A - connection to Portal through which the DataDictionary will be read
      Returns:
      A fully initialized DataDictionary
      Throws:
      EBufException
    • init

      public void init() throws EBufException
      load all the fields and classes from the database.
      Throws:
      EBufException
    • refresh

      public void refresh() throws EBufException
      Refresh the data dictionary
      Throws:
      EBufException
    • loadDDClasses

      public ArrayList loadDDClasses(String className) throws EBufException
      Load the specified class and subclasses from the database.
      Parameters:
      className -
      Returns:
      the specified data dictionary classes
      Throws:
      EBufException
    • close

      public void close() throws EBufException
      Close the connection used to create this data dictionary
      Throws:
      EBufException
    • getDDDatabase

      public DDDatabase getDDDatabase() throws EBufException
      Returns:
      a DDDatabase instance
      Throws:
      EBufException
    • getFListForClass

      public FList getFListForClass(String className) throws EBufException
      Get the data dictionary flist for the specified class.
      Parameters:
      className -
      Returns:
      the data dictionary flist
      Throws:
      EBufException
    • initErrorLog

      protected void initErrorLog()
      Create log
    • initAllFields

      public void initAllFields() throws EBufException
      Extracts all available fields from data-base
      Throws:
      EBufException
    • initAllClasses

      protected void initAllClasses() throws EBufException
      Get all classes from DB, initialize class hash map
      Throws:
      EBufException
    • initFieldsVector

      protected void initFieldsVector(FList outFlist) throws EBufException
      Throws:
      EBufException
    • isFieldIDUsed

      public boolean isFieldIDUsed(int number)
      Varifying if the field ID is existing in the data-base
    • isFieldNameUsed

      public boolean isFieldNameUsed(String fieldName)
      Varifying if the field name is existing in the data-base
    • getSize

      public int getSize()
      Returns:
      the number of fields in the list.
    • getElementAt

      public Object getElementAt(int index)
      Returns the field at the specified index.
      Parameters:
      index - an index into this list.
      Returns:
      the field at the specified index as an instance of DDField.
      Throws:
      ArrayIndexOutOfBoundsException - if the index is negative or not less than the current size of this list.
    • getDDField

      public DDField getDDField(int index)
    • getPoid

      public Poid getPoid(String objectType)
    • getDatabaseNumber

      public long getDatabaseNumber()
    • getTypeIndex

      public int getTypeIndex(int index) throws EBufException
      Throws:
      EBufException
    • getName

      public String getName(int index) throws EBufException
      Throws:
      EBufException
    • getPortalFieldIDsEnabled

      public boolean getPortalFieldIDsEnabled()
      Check if reserved Portal Field IDs are enabled. By default only custom IDs are enabled.
      Returns:
      True if enabled.
    • addClassToDDClassHashtable

      public void addClassToDDClassHashtable(DDClass ddObj) throws EBufException
      Adding the newly created classes to the HashTable which contains all the existing storable class in the data-base
      Parameters:
      ddclassObj - DDClass object that is to be added to Hashtable
      Throws:
      EBufException
    • setDDClassHashtable

      public void setDDClassHashtable(Hashtable hashtable)
    • getDDClass

      public DDClass getDDClass(String className) throws EBufException
      Throws:
      EBufException
    • getDDClasses

      public Vector getDDClasses(String className) throws EBufException
      Get all classes of a type along with its extended classes, i.e., for /service, also get /service/ip, /service/email, /service/wireless/gsm, etc.
      Parameters:
      className - Name of the class that you want to retrieve all its extensions.
      Returns:
      A vector of DDClass objects.
      Throws:
      EBufException
    • commitNewFieldToDD

      public void commitNewFieldToDD(FList inFlist) throws EBufException
      Create a new custom defined field
      Throws:
      EBufException
    • createNewClass

      public void createNewClass(FList inFlist) throws EBufException
      Commiting a new class to data dictionary
      Throws:
      EBufException
    • getBaseClass

      public DDClass getBaseClass(String name) throws EBufException
      Retrieve the name of the base class

      Example of using this method

              ...
            String name = "/service/ip/foo";
            DDClass classObj = null;
            try {
                classObj = dDictionary.getBaseClass(className);
            } catch (EBufException e) {
                your exception handling code goes here
            }
            

      Parameters:
      name - The name of the class for which the base class name will be retrieved. The input string format needs to be "/foo/bar".
      Returns:
      The base class object. null if base class does not exist.
      Throws:
      EBufException
    • getParentClass

      public DDClass getParentClass(String name) throws EBufException
      Retrieve the name of the parent class

      Example of using this method

              ...
            String name = "/service/ip/foo";
            DDClass classObj = null;
            try {
                classObj = dDictionary.getBaseClass(className);
            } catch (EBufException e) {
                your exception handling code goes here
            }
            

      Parameters:
      name - The name of the class for which the parent class name will be retrieved.
      Returns:
      The parent class object. null if parent class does not exist.
      Throws:
      EBufException
    • checkForBaseClassExistence

      public String checkForBaseClassExistence(String name) throws EBufException
      Deprecated.
      Please use getParentClass(String) instead.
      Check if the base class exists or not.
      Parameters:
      name - The name of the class for which the base class existence will be checked.
      Returns:
      null if the base class exists. If the base class does not exist, return its name.
      Throws:
      EBufException
    • checkClassExists

      public boolean checkClassExists(String name)
      Check if the class exists or not.
      Parameters:
      name - The name of the class for which the class existence will be checked.
      Returns:
      true if the class exists. false if the class does not exist.
    • setPortalFieldIDsEnabled

      public void setPortalFieldIDsEnabled(boolean enabled)
      Set if Portal Field IDs are enabled. By default only custom IDs are enabled.
      Parameters:
      True - if enabled.
    • isFieldIDValid

      public boolean isFieldIDValid(int number)
      Verify a field ID is in a range reserved for Custom Fields. 1 - 9,999 Reserved for Portal 10,000 - 999,999 Reserved for Custom Fields 1,000,000 - 9,999,999 Reserved for Portal 10,000,000 - 0xFFFFFF Reserved for Custom Fields
      Parameters:
      id - Field ID to verfiy.
      Returns:
      True if valid.
    • getNextAvailFieldID

      public int getNextAvailFieldID()
      Get the next available ID for customer created fields. Used for the suggested ID for a new field.
      Returns:
      Suggested value for the next customer created field. INVALID_FIELD_ID if all customer field IDs are assigned.
    • getAllClasses

      public Vector getAllClasses() throws EBufException
      Throws:
      EBufException