com.wm.app.tn.profile
Class LookupStore

java.lang.Object
  extended by com.wm.app.tn.profile.LookupStore

public class LookupStore
extends java.lang.Object

Provides access to lookup (cross-reference) data in the Trading Networks database. The lookup data includes: Contact Types; External ID Types; Binary Types; Field Groups; and Profile Groups.


Constructor Summary
LookupStore()
           
 
Method Summary
static short addContactType(java.lang.String desc)
          Adds a new Contact Type to the TN database.
static short addFieldGroup(java.lang.String desc)
          Adds a new field group to the TN database.
static int addIDType(java.lang.String desc)
          Adds a new ID Type to the TN database.
static java.lang.String addProfileGroup(java.lang.String profileGroupName)
          Adds a new profile group to the database.
static java.lang.String addProfileGroup(java.lang.String profileGroupName, java.lang.String description)
           
static void changeContactType(short id, java.lang.String desc)
          Changes the description of an existing Conttact Type in the TN database.
static void changeFieldGroup(short id, java.lang.String desc)
          Changes the description of an existing field group in the TN database.
static void changeIDType(int id, java.lang.String desc)
          Changes the description of an existing ID Type in the TN database.
static int changeProfileGroup(java.lang.String profileGroupId, java.lang.String profileGroupName)
          Changes the name of an existing profile group in the database.
static int changeProfileGroupDescription(java.lang.String profileGroupId, java.lang.String description)
           
static void clusterSyncForAttrChange(com.wm.data.IData input)
          This method is for cluster sync for any update on the ditable attribute list
static void deleteContactType(short type)
          Deletes an existing Contact Type from the TN database.
static void deleteFieldGroup(short id)
          Deletes an existing field group from the TN database.
static void deleteIDType(int id)
          Deletes an existing ID Type from the TN database.
static int deleteProfileGroup(java.lang.String profileGroupId)
          Deletes an existing Profile Group from the database;
static void deRegisterEDIIDTypeDescriptions()
          Forces the ediIDTypes to null in TN.
static void deregisterEditableAttribute(com.wm.data.IData input)
          Makes an attribute non-editable
static void forceBinaryTypeRefresh()
          Forces a refresh of the BinaryType cache.
static void forceContactTypeRefresh()
          Forces a refresh of the ContactType cache.
static void forceFieldGrpRefresh()
          Forces a refresh of the Field Group cache.
static void forceIDTypeRefresh()
          Forces a refresh of the IDType cache.
static void forceProfileGroupRefresh()
          Forces a refresh of the ProfileGroup cache.
static void forceRefresh()
          Forces a refresh of caches on subsequent access by setting all the caches to null.
static java.lang.Integer getBinaryType(java.sql.Connection conn, java.lang.String desc)
           
static java.lang.Integer getBinaryType(java.lang.String desc)
           
static java.util.Hashtable getBinaryTypes()
           
static java.util.Hashtable getContactTypes()
           
static java.util.List<java.lang.String> getEDIIDTypeDescriptions()
          Gets the EDI IDTypes associated with TN.
static java.util.Hashtable<java.lang.String,EditableDocAttribute> getEditableAttributes()
          Gets the Editable Doc attributes associated with TN.
static java.lang.Integer getExternalIDType(java.lang.String desc)
           
static java.util.Hashtable getExternalIDTypes()
           
static java.util.Hashtable getFieldGroups()
           
static java.util.Hashtable getIDTypeDescriptions()
           
static java.util.HashMap getProfileGroup(java.lang.String groupID)
           
static java.lang.String getProfileGroupId(java.lang.String profileGroupName)
           
static java.lang.String getProfileGroupName(java.lang.String profileGroupId)
           
static java.util.Hashtable getProfileGroups()
           
static java.lang.String[] getProfileGroupsIDs(java.lang.String regexName)
           
static java.util.Hashtable queryProfileGroupByName(java.lang.String profileGroupName)
           
static void registerEDIIDTypeDescriptions(com.wm.data.IData pipeline)
          This method is used by ClusterSync updates for nodes.
static void registerEDIIDTypeDescriptions(java.util.List<java.lang.String> ediIDTypes)
          Forces the ediIDTypes to get registered in TN.
static void registerEditableAttribute(com.wm.data.IData input)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookupStore

public LookupStore()
Method Detail

forceRefresh

public static void forceRefresh()
Forces a refresh of caches on subsequent access by setting all the caches to null. Generally, you will not need to call this method. It is used by the Import feature.


forceProfileGroupRefresh

public static void forceProfileGroupRefresh()
Forces a refresh of the ProfileGroup cache. Used by the cluster synchronization mechanism.


forceContactTypeRefresh

public static void forceContactTypeRefresh()
Forces a refresh of the ContactType cache. Used by the cluster synchronization mechanism.


forceIDTypeRefresh

public static void forceIDTypeRefresh()
Forces a refresh of the IDType cache. Used by the cluster synchronization mechanism.


forceBinaryTypeRefresh

public static void forceBinaryTypeRefresh()
Forces a refresh of the BinaryType cache. Used by the cluster synchronization mechanism.


forceFieldGrpRefresh

public static void forceFieldGrpRefresh()
Forces a refresh of the Field Group cache. Used by the cluster synchronization mechanism.


getExternalIDTypes

public static java.util.Hashtable getExternalIDTypes()
                                              throws LookupStoreException
Returns:
a Hashtable containing the ID types. It is keyed by the IDType descriptions, and the values are the Integer ID type codes.
Throws:
LookupStoreException - if there was a database error

getExternalIDType

public static java.lang.Integer getExternalIDType(java.lang.String desc)
                                           throws LookupStoreException
Parameters:
desc - the description of the requested ID Type
Returns:
an Integer ID type code, or null if the requested type does not exist.
Throws:
LookupStoreException - if there was a database error

getIDTypeDescriptions

public static java.util.Hashtable getIDTypeDescriptions()
                                                 throws LookupStoreException
Returns:
a Hashtable containing the ID types. It is keyed by Integer idTypes, and the values are String idType descriptions.
Throws:
LookupStoreException - if there was a database error

getEDIIDTypeDescriptions

public static java.util.List<java.lang.String> getEDIIDTypeDescriptions()
Gets the EDI IDTypes associated with TN. It is a list of EDI Types descriptions which can be used while adding External ID's

Returns:
a HashTable containing the EDI ID types and IDs associated with it.

registerEDIIDTypeDescriptions

public static void registerEDIIDTypeDescriptions(java.util.List<java.lang.String> ediIDTypes)
Forces the ediIDTypes to get registered in TN. It is a list of EDI Types descriptions which can be used while adding External ID's

Parameters:
ediIDTypes - is a HashTable of EDI IDTypes and the IDs associate with it that need to be registered with TN.

deRegisterEDIIDTypeDescriptions

public static void deRegisterEDIIDTypeDescriptions()
Forces the ediIDTypes to null in TN. This is called by EDI package when wMEDI packge is unloaded


registerEDIIDTypeDescriptions

public static void registerEDIIDTypeDescriptions(com.wm.data.IData pipeline)
This method is used by ClusterSync updates for nodes. Forces the ediIDTypes to get registered in TN. It is a list of EDI Types descriptions which can be used while adding External ID's

Parameters:
ediIDTypes - is a HashTable of EDI IDTypes and the IDs associate with it that need to be registered with TN.

addIDType

public static int addIDType(java.lang.String desc)
                     throws LookupStoreException
Adds a new ID Type to the TN database.

Parameters:
desc - description of the new ID Type
Returns:
the integer identifier that TN generated for the new type
Throws:
LookupStoreException - if there was a database error

changeIDType

public static void changeIDType(int id,
                                java.lang.String desc)
                         throws LookupStoreException
Changes the description of an existing ID Type in the TN database.

Parameters:
id - identifier of an existing id type
desc - new description for an existing id type
Throws:
LookupStoreException - if there was a database error

deleteIDType

public static void deleteIDType(int id)
                         throws LookupStoreException
Deletes an existing ID Type from the TN database.

Parameters:
id - identifier of an existing ID Type
Throws:
LookupStoreException - if there was a database error

getContactTypes

public static java.util.Hashtable getContactTypes()
                                           throws LookupStoreException
Returns:
a Hashtable containing the Contact types. It is keyed by the ContactType descriptions, and the values are the Integer ID type codes.
Throws:
LookupStoreException - if there was a database error

addContactType

public static short addContactType(java.lang.String desc)
                            throws LookupStoreException
Adds a new Contact Type to the TN database.

Parameters:
desc - description of the new Contact Type
Returns:
the short identifier that was generated for the new type
Throws:
LookupStoreException - if there was a database error

changeContactType

public static void changeContactType(short id,
                                     java.lang.String desc)
                              throws LookupStoreException
Changes the description of an existing Conttact Type in the TN database.

Parameters:
id - identifier of an existing contact type
desc - new description for an existing contact type
Throws:
LookupStoreException - if there was a database error

deleteContactType

public static void deleteContactType(short type)
                              throws LookupStoreException
Deletes an existing Contact Type from the TN database.

Parameters:
id - identifier of an existing Contact Type
Throws:
LookupStoreException - if there was a database error

getBinaryTypes

public static java.util.Hashtable getBinaryTypes()
                                          throws LookupStoreException
Returns:
a Hashtable containing the Binary types. It is keyed by the BinaryType descriptions, and the values are the Integer ID type codes.
Throws:
LookupStoreException - if there was a database error

getBinaryType

public static java.lang.Integer getBinaryType(java.lang.String desc)
                                       throws LookupStoreException
Returns:
the Integer type code for the supplied binary type description
Throws:
LookupStoreException - if there was a database error

getBinaryType

public static java.lang.Integer getBinaryType(java.sql.Connection conn,
                                              java.lang.String desc)
                                       throws LookupStoreException
Returns:
the Integer type code for the supplied binary type description
Throws:
LookupStoreException - if there was a database error

getFieldGroups

public static java.util.Hashtable getFieldGroups()
                                          throws LookupStoreException
Returns:
a Hashtable containing the field groups. The hashtable keys are the group descriptions and the values are the group codes (datatype is Short).
Throws:
LookupStoreException - if there was a database error

addFieldGroup

public static short addFieldGroup(java.lang.String desc)
                           throws LookupStoreException
Adds a new field group to the TN database.

Parameters:
desc - description of the new field group
Returns:
the short identifier that was generated for the new field group
Throws:
LookupStoreException - if there was a database error

changeFieldGroup

public static void changeFieldGroup(short id,
                                    java.lang.String desc)
                             throws LookupStoreException
Changes the description of an existing field group in the TN database.

Parameters:
id - identifier of an existing field group
desc - new description for an existing field group
Throws:
LookupStoreException - if there was a database error

deleteFieldGroup

public static void deleteFieldGroup(short id)
                             throws LookupStoreException
Deletes an existing field group from the TN database. If any fields are defined for the group, it cannot be deleted. An exception is thrown in this case.

Parameters:
id - identifier of an existing field group
Throws:
LookupStoreException - if there was a database error

getProfileGroups

public static java.util.Hashtable getProfileGroups()
                                            throws LookupStoreException
Returns:
a Hashtable containing profile groups. It is keyed by profile group names, and the values are the internal group ids.
Throws:
LookupStoreException - if there was a database error

getProfileGroup

public static java.util.HashMap getProfileGroup(java.lang.String groupID)
                                         throws LookupStoreException
Throws:
LookupStoreException

getProfileGroupName

public static java.lang.String getProfileGroupName(java.lang.String profileGroupId)
                                            throws LookupStoreException
Parameters:
profileGroupId - the internal profile group id
Returns:
a Profile Group Name, or null if the group id does not exist.
Throws:
LookupStoreException - if there was a database error

getProfileGroupId

public static java.lang.String getProfileGroupId(java.lang.String profileGroupName)
                                          throws LookupStoreException
Parameters:
profileGroupName - the profile group name
Returns:
an internal profile group id, or null if the group name does not exist. Note group name is trimmed before passed to db select clause.
Throws:
LookupStoreException - if there was a database error

queryProfileGroupByName

public static java.util.Hashtable queryProfileGroupByName(java.lang.String profileGroupName)
                                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

addProfileGroup

public static java.lang.String addProfileGroup(java.lang.String profileGroupName)
                                        throws LookupStoreException
Adds a new profile group to the database.

Parameters:
profileGroupName - the new profile group name
Returns:
the internal identifier that was generated for the new group
Throws:
LookupStoreException - if there was a database error

addProfileGroup

public static java.lang.String addProfileGroup(java.lang.String profileGroupName,
                                               java.lang.String description)
                                        throws LookupStoreException
Throws:
LookupStoreException

changeProfileGroup

public static int changeProfileGroup(java.lang.String profileGroupId,
                                     java.lang.String profileGroupName)
                              throws LookupStoreException
Changes the name of an existing profile group in the database.

Parameters:
profileGroupId - the internal id of an existing profile group
profileGroupName - the new name to change to
Returns:
number of rows updated
Throws:
LookupStoreException - if there was a database error.

changeProfileGroupDescription

public static int changeProfileGroupDescription(java.lang.String profileGroupId,
                                                java.lang.String description)
                                         throws LookupStoreException
Throws:
LookupStoreException

deleteProfileGroup

public static int deleteProfileGroup(java.lang.String profileGroupId)
                              throws LookupStoreException
Deletes an existing Profile Group from the database;

Parameters:
profileGroupId - the internal identifier of an existing profile group
Returns:
rows updated, returns 0 if that group is still in use, i.e. there are still other partners in that group
Throws:
LookupStoreException - thrown if there was a database error

getEditableAttributes

public static java.util.Hashtable<java.lang.String,EditableDocAttribute> getEditableAttributes()
Gets the Editable Doc attributes associated with TN. The hash table conatins the attribute name as the key and the value is the class EditableAttribute with allowed values for the attribute and a package specific handler service that needs to be invoked on change of the attribute value

Returns:

registerEditableAttribute

public static void registerEditableAttribute(com.wm.data.IData input)
Parameters:
input -

clusterSyncForAttrChange

public static void clusterSyncForAttrChange(com.wm.data.IData input)
This method is for cluster sync for any update on the ditable attribute list

Parameters:
input -

deregisterEditableAttribute

public static void deregisterEditableAttribute(com.wm.data.IData input)
Makes an attribute non-editable

Parameters:
attributeName -

getProfileGroupsIDs

public static java.lang.String[] getProfileGroupsIDs(java.lang.String regexName)
                                              throws com.wm.app.b2b.server.ServiceException,
                                                     java.sql.SQLException,
                                                     java.io.IOException
Throws:
com.wm.app.b2b.server.ServiceException
java.sql.SQLException
java.io.IOException