Package com.portal.pfc.infranet.datadict
Class DataDictionary
java.lang.Object
javax.swing.AbstractListModel
com.portal.pfc.infranet.datadict.DataDictionary
- All Implemented Interfaces:
Serializable
,ListModel
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final Integer
static final int
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
Constructor Summary
ConstructorsConstructorDescriptionDataDictionary
(PortalContext context) Constructor will load all the fields and classes from the database.DataDictionary
(PortalContext context, boolean init) Constructor Uses command line arguments passed from main() -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adding the newly created classes to the HashTable which contains all the existing storable class in the data-baseboolean
checkClassExists
(String name) Check if the class exists or not.Deprecated.void
close()
Close the connection used to create this data dictionaryvoid
commitNewFieldToDD
(FList inFlist) Create a new custom defined fieldvoid
createNewClass
(FList inFlist) Commiting a new class to data dictionarygetBaseClass
(String name) Retrieve the name of the base classlong
getDDClass
(String className) getDDClasses
(String className) 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.getDDField
(int index) getElementAt
(int index) Returns the field at the specified index.getFListForClass
(String className) Get the data dictionary flist for the specified class.static DataDictionary
getInstance
(PortalContext context) Factory method to return a single instance of a DataDictionary fully initialized.getName
(int index) int
Get the next available ID for customer created fields.getParentClass
(String name) Retrieve the name of the parent classboolean
Check if reserved Portal Field IDs are enabled.int
getSize()
int
getTypeIndex
(int index) void
init()
load all the fields and classes from the database.protected void
Get all classes from DB, initialize class hash mapvoid
Extracts all available fields from data-baseprotected void
Create logprotected void
initFieldsVector
(FList outFlist) boolean
isFieldIDUsed
(int number) Varifying if the field ID is existing in the data-baseboolean
isFieldIDValid
(int number) Verify a field ID is in a range reserved for Custom Fields.boolean
isFieldNameUsed
(String fieldName) Varifying if the field name is existing in the data-baseloadDDClasses
(String className) Load the specified class and subclasses from the database.void
refresh()
Refresh the data dictionaryvoid
setDDClassHashtable
(Hashtable hashtable) void
setPortalFieldIDsEnabled
(boolean enabled) Set if Portal Field IDs are enabled.Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
Field Details
-
MIN_FIELD_ID
public static final int MIN_FIELD_ID- See Also:
-
MAX_FIELD_ID
public static final int MAX_FIELD_ID- See Also:
-
FIELD_ID_RANGE1_END
public static final int FIELD_ID_RANGE1_END- See Also:
-
FIELD_ID_RANGE2_START
public static final int FIELD_ID_RANGE2_START- See Also:
-
MAX_FIELD_INTEGER
-
INVALID_FIELD_ID
public static final int INVALID_FIELD_ID- See Also:
-
-
Constructor Details
-
DataDictionary
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
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
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
load all the fields and classes from the database.- Throws:
EBufException
-
refresh
Refresh the data dictionary- Throws:
EBufException
-
loadDDClasses
Load the specified class and subclasses from the database.- Parameters:
className
-- Returns:
- the specified data dictionary classes
- Throws:
EBufException
-
close
Close the connection used to create this data dictionary- Throws:
EBufException
-
getDDDatabase
- Returns:
- a DDDatabase instance
- Throws:
EBufException
-
getFListForClass
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
Extracts all available fields from data-base- Throws:
EBufException
-
initAllClasses
Get all classes from DB, initialize class hash map- Throws:
EBufException
-
initFieldsVector
- Throws:
EBufException
-
isFieldIDUsed
public boolean isFieldIDUsed(int number) Varifying if the field ID is existing in the data-base -
isFieldNameUsed
Varifying if the field name is existing in the data-base -
getSize
public int getSize()- Returns:
- the number of fields in the list.
-
getElementAt
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
-
getPoid
-
getDatabaseNumber
public long getDatabaseNumber() -
getTypeIndex
- Throws:
EBufException
-
getName
- 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
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
-
getDDClass
- Throws:
EBufException
-
getDDClasses
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
Create a new custom defined field- Throws:
EBufException
-
createNewClass
Commiting a new class to data dictionary- Throws:
EBufException
-
getBaseClass
Retrieve the name of the base classExample 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
Retrieve the name of the parent classExample 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
Deprecated.Please usegetParentClass(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
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
- Throws:
EBufException
-
getParentClass(String)
instead.