com.wm.app.tn.profile
Class ProfileStore

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

public class ProfileStore
extends java.lang.Object

Provides access to Profiles for all partners on the trading network.

The ProfileStore is used to retrieve individual Profiles and lists of ProfileSummaries. It is also used to add new Profiles, and change or delete existing ones.

ProfileStore is a Singleton. A reference to it can be obtained from the static method getProfileStore which will create the single instance the first time it's called, and return a reference to the store. quietGetProfileStore is also available, which will not throw any exceptions.

A list of ProfileSummaries can be retrieved using getProfileSummaryList.

getProfile retrieves the entire profile for a partner. While getProfile can be called with either a partnerID or externalID & idType, using the partnerID is more efficient.

getInternalID will return a partner's internal webMethods ID given an external ID, such as DUNS.

See Also:
Profile, ProfileSummary

Method Summary
static java.util.Vector addAddressess(java.util.Vector addrs, java.lang.String partnerID)
          Adds one or more Addresses to a partner's profile in the profile store.
static java.util.Vector addContacts(java.util.Vector contacts, java.lang.String partnerID)
          Adds one or more Contacts to a partner's profile in the profile store.
static java.util.Vector addDestinations(java.util.Vector dests, java.lang.String partnerID)
          Adds one or more Destinations to a partner's profile in the profile store.
static void addExtendedField(java.lang.String partnerID, ExtendedProfileField ef)
          Adds an extended field to a partner's profile.
static java.util.Vector addIDs(java.util.Vector ids, java.lang.String partnerID)
          Adds one or more external IDs to a partner's profile in the profile store.
static void addPartnerBinary(java.lang.String partnerID, int binaryType, byte[] bytes)
          Adds a binary object to a partner's profile in the profile store.
static boolean addPartnerCertificate(java.lang.String partnerID, java.security.cert.X509Certificate cert)
          Deprecated. starting release 6.2. If sender partnerID, receiver my enterprise's sign certificate is saved in db, and matches supplied cert, returns true.
static java.lang.String addProfile(Profile profile)
          Adds a new profile to the profile store.
static java.lang.String addProfile(Profile profile, boolean validated)
          Adds a new profile to the profile store.
static void addProfileGroup(java.sql.Connection conn, java.lang.String partnerId, java.lang.String profileGroupId)
          Adds a partner to a profile group.
static void addProfileGroup(java.lang.String partnerId, java.lang.String profileGroupId)
          Adds a partner to a profile group.
static void addProfileGroups(java.sql.Connection conn, java.lang.String partnerId, java.lang.String[] profileGroupIds)
          Adds a partner to one or more profile groups.
static void addProfileGroups(java.lang.String partnerId, java.lang.String[] profileGroupIds)
          Adds a partner to one or more profile groups.
static com.wm.app.b2b.client.Context connectToPartner(java.lang.String partnerID, java.lang.String destination, boolean xml)
          Establishes a connection to a partner's B2B server.
static com.wm.app.b2b.client.Context connectToPartner(java.lang.String partnerID, java.lang.String destination, java.lang.String user, java.lang.String password, boolean xml)
          Establishes a connection to a partner's B2B server.
static void deleteAddress(java.lang.String addressID, java.lang.String partnerID)
          Removes a partner's or contact's address from the database.
static void deleteContact(java.lang.String contactID, java.lang.String partnerID)
          Removes a partner's contact from the database.
static void deleteDestination(java.lang.String destID)
          Removes a partner's Destination (a.k.a.
static void deleteID(java.lang.String id)
           
static void deleteProfile(java.lang.String partnerID, boolean remove)
          Mark a partner's profile as deleted in the profile store.
static void deleteProfile(java.lang.String partnerID, boolean delete, boolean remove, java.sql.Connection conn)
          Mark a partner's profile as deleted or undeleted in the profile store.
static void deleteProfileGroup(java.lang.String partnerId, java.lang.String profileGroupId)
          Deletes a partner from a profile group.
static java.lang.String getCurrentID()
          Deprecated. now there can be more than one partner against a User . This method would just return the first mapping PUH
static java.lang.String getCurrentID(java.sql.Connection conn)
          Deprecated. now there can be more than one partner against a User . This method would just return the first mapping PUH
static java.lang.String[] getCurrentIDs()
           
static int getDefaultIDType()
           
static java.util.Enumeration getDestinations(java.lang.String partnerID, java.lang.String protocol)
          Retrieves the known destinations of a particular protocol for a partner.
static java.util.Vector getExtendedFields()
           
static java.util.Vector getExtendedFields(java.lang.String partnerID, int groupID)
           
static java.util.Vector getExtendedFieldsForPartner(java.lang.String partnerID)
           
static ExtendedProfileField[] getExtendedFieldTemplate(int group)
           
static java.lang.String getExternalID(java.lang.String partnerID, int extIDType)
          Gets an external ID for a trading partner.
static java.lang.String getExternalID(java.lang.String partnerID, java.lang.String extIDType)
          Gets an external ID for a trading partner.
static java.lang.String[] getExternalIDs(java.lang.String partnerID, int extIDType)
          Gets external IDs of the specified type for a trading partner.
static java.lang.String getIDForUsername(java.lang.String username)
          Deprecated. now there can be more than one partner against a User . This method would just return the first mapping TO DO depracate this method
static java.lang.String[] getIDsForUsername(java.lang.String username)
           
static int getIDTypeByPartnerIDID(java.lang.String partneridid)
          Gets a trading partner's external IDType from a known PartnerIDID, the primary key for the PartnerID table.
static int getIDTypeByPartnerIDID(java.lang.String partneridid, java.sql.Connection conn)
          Gets a trading partner's external IDType from a known PartnerIDID, the primary key for the PartnerID table.
static java.lang.String getInternalID(java.lang.String extID, int extIDType)
          Gets a trading partner's internal ID from a known external ID.
static java.lang.String getInternalID(java.lang.String extID, int extIDType, java.sql.Connection conn)
          Gets a trading partner's internal ID from a known external ID.
static java.lang.String getInternalIDByDestinationID(java.lang.String destid)
          Gets a trading partner's internal ID from a known DestinationID, the primary key for the Destination table.
static java.lang.String getInternalIDByDestinationID(java.lang.String destid, java.sql.Connection conn)
          Gets a trading partner's internal ID from a known DestinationID, the primary key for the Destination table.
static java.lang.String getInternalIDByPartnerIDID(java.lang.String partneridid)
          Gets a trading partner's internal ID from a known PartnerIDID, the primary key for the PartnerID table.
static java.lang.String getInternalIDByPartnerIDID(java.lang.String partneridid, java.sql.Connection conn)
          Gets a trading partner's internal ID from a known PartnerIDID, the primary key for the PartnerID table.
static java.util.Hashtable getLogos()
          Gets company logos for all partners.
static java.lang.String getMyID()
          Get the internally generated partner ID of the host of this TN server.
static byte[] getPartnerBinary(java.lang.String partnerID, int binaryType)
          Retrieves the binary value of the requested type for a partner.
static byte[] getPartnerBinary(java.lang.String partnerID, java.lang.String binaryType)
          Retrieves the binary value of the requested type for a partner.
static Contact getPartnerContact(java.lang.String partnerID, java.lang.String contactType)
          Deprecated. use the getPatnerContacts instead
static java.util.Vector getPartnerContacts(java.lang.String partnerID, java.lang.String contactType)
          Retrieves a specific type of Contact(s) for a trading partner.
static java.lang.String getPartnerIDForCertificate(java.security.cert.X509Certificate cert)
          Deprecated. starting release 6.2. Given a X509 Certificate, owner/sender the returned partnerID, partner/receiver my enterprise, usage sign. i.e. verfiy certificate for partner to my enterprise. If no match owner/sender found, returns null.
static java.lang.String[] getPartnerIDs(java.lang.String regexForName)
           
static com.wm.app.b2b.server.User getPartnerUser(java.lang.String internalID)
          Deprecated. This method would now returns the first user in the String[]
static java.util.Hashtable getPollingFrequencies()
          Retrieves the polling frequencies for all partners on the network.
static Profile getProfile(java.lang.String partnerID)
          Get the partner profile that matches the supplied ID.
static Profile getProfile(java.lang.String extID, int extIDType)
          Get the partner profile that matches the supplied external ID and ID type.
static java.lang.String[] getProfileGroups(java.lang.String partnerId)
           
static ProfileStore getProfileStore()
          Deprecated. Starting in version 6.5, it is no longer necessary to get an instance of the ProfileStore. All public methods are static.
static ProfileStore getProfileStore(boolean refresh)
          Deprecated. Starting in version 6.5, it is no longer necessary to get an instance of the ProfileStore. All public methods are static. To force a refresh of the ProfileStore caches, call refreshSummaries() and/or refreshIDMap().
static ProfileSummary getProfileSummary(java.lang.String partnerID)
          Get summary information for a partner.
static ProfileSummary getProfileSummary(java.lang.String partnerID, boolean refresh)
          Get summary information for a partner.
static ProfileSummary getProfileSummaryByName(java.lang.String displayName)
          Get summary information for a partner.
static java.util.Vector getProfileSummaryList(boolean deleted, boolean refresh)
          Get summary information for trading partners on the trading network.
static java.lang.String getRequiredExternalID(java.lang.String partnerID)
          Deprecated. It now returns ID of the default Idtype The required Idtype does not exist anymore
static int getRequiredIDType()
          Deprecated. required id type does not hold anymore
static com.wm.data.IData queryProfiles(ProfileQuery query, int pageSize, int maxRowCount, int queryTimeout, int threshold, java.lang.String queryId)
          Executes a query for partner profile information from the TN database.
static ProfileStore quietGetProfileStore()
          Deprecated. Starting in version 6.5, it is no longer necessary to get an instance of the ProfileStore. All public methods are static.
static void refreshIDMap()
          Refreshes the cached map of external-to-internal partnerIDs
static void refreshSummaries()
          Refreshes the cached list of ProfileSummaries from the database
static void updateAddresses(java.util.Vector addrs)
          Changes one or more Addresses for a partner or a partner's contact in the profile store.
static void updateContacts(java.util.Vector contacts)
          Changes one or more Contacts for a partner in the profile store.
static void updateCorporation(Corporation corp)
          Changes the Corporate component of a partner's profile in the profile store.
static java.lang.String updateDeletedProfile(Profile p, java.sql.Connection conn)
          Overwrites a deleted partner's profile in the profile store.
static void updateDestinations(java.util.Vector dests)
          Changes one or more Destinations for a partner in the profile store.
static void updateExtendedFields(java.lang.String partnerID, java.util.Vector flds)
          Updates one or more extended fields in a partner's profile.
static void updateIDs(java.util.Vector ids)
          Changes one or more external IDs for a partner in the profile store.
static void updatePartnerBinary(java.lang.String partnerID, int binaryType, byte[] bytes)
          Changes or removes an existing binary object for a partner.
static void updateProfileGroups(java.lang.String partnerId, java.lang.String[] profileGroupIds)
          Updates the set of profile groups that a partner is a member of.
static void updateRemoteStatus(java.lang.String partnerID, java.lang.String status)
          Deprecated. Starting in version 4.6, there is no Remote Status for a partner profile.
static void updateStatus(java.lang.String partnerID, java.lang.String status)
          Updates a partner's status.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

quietGetProfileStore

public static ProfileStore quietGetProfileStore()
Deprecated. Starting in version 6.5, it is no longer necessary to get an instance of the ProfileStore. All public methods are static.

Provides "quiet" access to the ProfileStore. Call this method to get a reference when you don't want to deal with exceptions. This will eat any exceptions that happen.

Returns:
the ProfileStore

getProfileStore

public static ProfileStore getProfileStore()
                                    throws ProfileStoreException
Deprecated. Starting in version 6.5, it is no longer necessary to get an instance of the ProfileStore. All public methods are static.

Provides access to the ProfileStore.

Returns:
the ProfileStore
Throws:
ProfileStoreException

getProfileStore

public static ProfileStore getProfileStore(boolean refresh)
                                    throws ProfileStoreException
Deprecated. Starting in version 6.5, it is no longer necessary to get an instance of the ProfileStore. All public methods are static. To force a refresh of the ProfileStore caches, call refreshSummaries() and/or refreshIDMap().

Provides access to the ProfileStore.

Parameters:
refresh - should the cache be refreshed from database
Returns:
the ProfileStore
Throws:
ProfileStoreException

refreshSummaries

public static final void refreshSummaries()
                                   throws java.sql.SQLException,
                                          ProfileStoreException
Refreshes the cached list of ProfileSummaries from the database

Throws:
java.sql.SQLException
ProfileStoreException

refreshIDMap

public static final void refreshIDMap()
                               throws java.sql.SQLException,
                                      ProfileStoreException
Refreshes the cached map of external-to-internal partnerIDs

Throws:
java.sql.SQLException
ProfileStoreException

getProfile

public static final Profile getProfile(java.lang.String partnerID)
                                throws ProfileStoreException
Get the partner profile that matches the supplied ID.

Parameters:
partnerID - internally assigned ID of a partner on the trading network
Returns:
a partner's Profile
Throws:
ProfileStoreException - if an error occurred while retrieving the profile from the profile store
See Also:
Profile

getProfile

public static final Profile getProfile(java.lang.String extID,
                                       int extIDType)
                                throws ProfileStoreException
Get the partner profile that matches the supplied external ID and ID type.

Parameters:
extID - an external ID for a partner on the trading network
extIDType - the type of external ID. This value must match one of the types defined in the IDType table
Returns:
the internally assigned ID of a partner on the trading network
Throws:
ProfileStoreException - if an error occurred while retrieving the profile from the profile store
See Also:
Profile, LookupStore.getExternalIDTypes()

getProfileSummaryList

public static final java.util.Vector getProfileSummaryList(boolean deleted,
                                                           boolean refresh)
                                                    throws ProfileStoreException
Get summary information for trading partners on the trading network.

Parameters:
deleted - a boolean indicating whether to retrieve deleted profiles or non-deleted ones. Pass true to get deleted profile summaries.
refresh - a boolean indicating whether to refresh the cache of profile summaries from the database.
Throws:
ProfileStoreException - if unable to retrieve the summaries from the profile store
See Also:
ProfileSummary

getProfileSummaryByName

public static final ProfileSummary getProfileSummaryByName(java.lang.String displayName)
Get summary information for a partner.

Parameters:
displayName - the name of parnter profile, as returned by ProfileSummary.getDisplayName
Returns:
a ProfileSummary
See Also:
ProfileSummary

getProfileSummary

public static final ProfileSummary getProfileSummary(java.lang.String partnerID)
                                              throws ProfileStoreException
Get summary information for a partner.

Parameters:
partnerID - the TN-generated identifier for a partner
Returns:
a ProfileSummary
Throws:
ProfileStoreException
See Also:
ProfileSummary

getProfileSummary

public static final ProfileSummary getProfileSummary(java.lang.String partnerID,
                                                     boolean refresh)
                                              throws ProfileStoreException
Get summary information for a partner.

Parameters:
partnerID - the TN-generated identifier for a partner
refresh - a boolean indicating whether to refresh the cache of profile summaries from the database.
Returns:
a ProfileSummary
Throws:
ProfileStoreException
See Also:
ProfileSummary

getExtendedFieldTemplate

public static final ExtendedProfileField[] getExtendedFieldTemplate(int group)
                                                             throws ProfileStoreException
Returns:
an array of all defined ExtendedProfileFields. The fields have no values and no partnerIDs
Throws:
ProfileStoreException - if unable to retrieve custom fields

getMyID

public static final java.lang.String getMyID()
Get the internally generated partner ID of the host of this TN server.


getCurrentID

public static final java.lang.String getCurrentID()
                                           throws ProfileStoreException
Deprecated. now there can be more than one partner against a User . This method would just return the first mapping PUH

Get the internally generated partner ID of the current user.

Throws:
ProfileStoreException

getCurrentID

public static final java.lang.String getCurrentID(java.sql.Connection conn)
                                           throws ProfileStoreException
Deprecated. now there can be more than one partner against a User . This method would just return the first mapping PUH

Get the internally generated partner ID of the current user, using the supplied Connection.

Parameters:
conn - an open java.sql.Connection to the TN database
Throws:
ProfileStoreException

getCurrentIDs

public static final java.lang.String[] getCurrentIDs()
                                              throws ProfileStoreException
Throws:
ProfileStoreException

getIDForUsername

public static final java.lang.String getIDForUsername(java.lang.String username)
                                               throws ProfileStoreException
Deprecated. now there can be more than one partner against a User . This method would just return the first mapping TO DO depracate this method

Gets the internal partner ID associated with the supplied B2B username.

Parameters:
username - a B2B username
Returns:
internal ID for the TN partner associated with the username
Throws:
ProfileStoreException

getIDsForUsername

public static final java.lang.String[] getIDsForUsername(java.lang.String username)
                                                  throws ProfileStoreException
Throws:
ProfileStoreException

getInternalID

public static final java.lang.String getInternalID(java.lang.String extID,
                                                   int extIDType)
                                            throws ProfileStoreException
Gets a trading partner's internal ID from a known external ID. The external ID must have been previously saved in the Profile Store.

Parameters:
extID - the external ID
extIDType - the type of external ID. Must be one of the external ID types returned by LookupStore.getExternalIDTypes.
Returns:
the partner's partner ID
Throws:
ProfileStoreException - if an error occurred while retrieving the profile ID from the profile store
See Also:
LookupStore.getExternalIDTypes()

getInternalID

public static final java.lang.String getInternalID(java.lang.String extID,
                                                   int extIDType,
                                                   java.sql.Connection conn)
                                            throws ProfileStoreException
Gets a trading partner's internal ID from a known external ID. The external ID must have been previously saved in the Profile Store.

Parameters:
extID - the external ID
extIDType - the type of external ID. Must be one of the external ID types returned by LookupStore.getExternalIDTypes.
conn - an open java.sql.Connection to the TN database
Returns:
the partner's partner ID
Throws:
ProfileStoreException - if an error occurred while retrieving the profile ID from the profile store
See Also:
LookupStore.getExternalIDTypes()

getInternalIDByPartnerIDID

public static final java.lang.String getInternalIDByPartnerIDID(java.lang.String partneridid)
                                                         throws ProfileStoreException
Gets a trading partner's internal ID from a known PartnerIDID, the primary key for the PartnerID table. The PartnerIDID must have been previously saved in the Profile Store.

Parameters:
partneridid - the PartnerIDID
Returns:
the partner's partner ID
Throws:
ProfileStoreException - if an error occurred while retrieving the profile ID from the profile store

getInternalIDByPartnerIDID

public static final java.lang.String getInternalIDByPartnerIDID(java.lang.String partneridid,
                                                                java.sql.Connection conn)
                                                         throws ProfileStoreException
Gets a trading partner's internal ID from a known PartnerIDID, the primary key for the PartnerID table. The PartnerIDID must have been previously saved in the Profile Store.

Parameters:
partneridid - the PartnerIDID
conn - an open java.sql.Connection to the TN database
Returns:
the partner's partner ID
Throws:
ProfileStoreException - if an error occurred while retrieving the profile ID from the profile store

getInternalIDByDestinationID

public static final java.lang.String getInternalIDByDestinationID(java.lang.String destid)
                                                           throws ProfileStoreException
Gets a trading partner's internal ID from a known DestinationID, the primary key for the Destination table. The DestinationID must have been previously saved in the Profile Store.

Parameters:
destid - the DestinationID
Returns:
the partner's partner ID
Throws:
ProfileStoreException - if an error occurred while retrieving the profile ID from the profile store

getInternalIDByDestinationID

public static final java.lang.String getInternalIDByDestinationID(java.lang.String destid,
                                                                  java.sql.Connection conn)
                                                           throws ProfileStoreException
Gets a trading partner's internal ID from a known DestinationID, the primary key for the Destination table. The DestinationID must have been previously saved in the Profile Store.

Parameters:
destid - the DestinationID
conn - an open java.sql.Connection to the TN database
Returns:
the partner's partner ID
Throws:
ProfileStoreException - if an error occurred while retrieving the profile ID from the profile store

getRequiredExternalID

public static final java.lang.String getRequiredExternalID(java.lang.String partnerID)
                                                    throws ProfileStoreException
Deprecated. It now returns ID of the default Idtype The required Idtype does not exist anymore

Gets the required external ID for a trading partner. This is the ID specified by the tn.required.IDType property.

Parameters:
partnerID - a partner's internal ID
Returns:
the required external ID
Throws:
ProfileStoreException - if an error occurred while retrieving the ID from the profile store

getExternalID

public static final java.lang.String getExternalID(java.lang.String partnerID,
                                                   java.lang.String extIDType)
                                            throws ProfileStoreException
Gets an external ID for a trading partner. The external ID must have been previously saved in the Profile Store.

Parameters:
partnerID - a partner's internal ID
extIDType - description of the type of external ID to retrieve. Must be one of the external ID type descriptions returned by LookupStore.getExternalIDTypes.
Returns:
the requested external ID
Throws:
ProfileStoreException - if an error occurred while retrieving the ID from the profile store
See Also:
LookupStore.getExternalIDTypes()

getExternalID

public static final java.lang.String getExternalID(java.lang.String partnerID,
                                                   int extIDType)
                                            throws ProfileStoreException
Gets an external ID for a trading partner. The external ID must have been previously saved in the Profile Store.

Parameters:
partnerID - a partner's internal ID
extIDType - the type of external ID to retrieve. Must be one of the external ID types returned by LookupStore.getExternalIDTypes.
Returns:
the requested external ID
Throws:
ProfileStoreException - if an error occurred while retrieving the ID from the profile store
See Also:
LookupStore.getExternalIDTypes()

getExternalIDs

public static final java.lang.String[] getExternalIDs(java.lang.String partnerID,
                                                      int extIDType)
                                               throws ProfileStoreException
Gets external IDs of the specified type for a trading partner. The external IDs must have been previously saved in the Profile Store.

Parameters:
partnerID - a partner's internal ID
extIDType - the type of external ID to retrieve. Must be one of the external ID types returned by LookupStore.getExternalIDTypes.
Returns:
the requested external IDs
Throws:
ProfileStoreException - if an error occurred while retrieving the ID from the profile store
See Also:
LookupStore.getExternalIDTypes()

getIDTypeByPartnerIDID

public static final int getIDTypeByPartnerIDID(java.lang.String partneridid)
                                        throws ProfileStoreException
Gets a trading partner's external IDType from a known PartnerIDID, the primary key for the PartnerID table. The PartnerIDID must have been previously saved in the Profile Store.

Parameters:
partneridid - the PartnerIDID
Returns:
the partner's external IDType, return -1 if not found
Throws:
ProfileStoreException - if an error occurred while retrieving the profile ID from the profile store

getIDTypeByPartnerIDID

public static final int getIDTypeByPartnerIDID(java.lang.String partneridid,
                                               java.sql.Connection conn)
                                        throws ProfileStoreException
Gets a trading partner's external IDType from a known PartnerIDID, the primary key for the PartnerID table. The PartnerIDID must have been previously saved in the Profile Store.

Parameters:
partneridid - the PartnerIDID
conn - an open java.sql.Connection to the TN database
Returns:
the partner's external IDType, return -1 if not found
Throws:
ProfileStoreException - if an error occurred while retrieving the profile ID from the profile store

getDestinations

public static final java.util.Enumeration getDestinations(java.lang.String partnerID,
                                                          java.lang.String protocol)
                                                   throws ProfileStoreException
Retrieves the known destinations of a particular protocol for a partner.

Parameters:
partnerID - the internal ID for a partner
protocol - http, https or smtp
Returns:
an Enumeration of Destinations
Throws:
ProfileStoreException
See Also:
Destination

updateDeletedProfile

public static final java.lang.String updateDeletedProfile(Profile p,
                                                          java.sql.Connection conn)
                                                   throws ProfileStoreException
Overwrites a deleted partner's profile in the profile store. This method assumes that the profile has been deleted by passing true in the second argument to the deleteProfile method. It updates the profile's corporate component, and inserts the rest.

Parameters:
p - the Profile to be updated
conn - an open Connection to the TN Database. Optional. If none is supplied, the method will acquire it's own connection. If supplied, the Connection's AutoCommit setting remains unchanged and neither commit nor rollback are called. This allows callers to use this method in the context of a larger transaction.
Throws:
ProfileStoreException
See Also:
Profile, deleteProfile(String,boolean)

updateCorporation

public static final void updateCorporation(Corporation corp)
                                    throws ProfileStoreException
Changes the Corporate component of a partner's profile in the profile store.

Parameters:
corp - the Corporation to be changed
Throws:
ProfileStoreException
See Also:
Corporation

updateContacts

public static final void updateContacts(java.util.Vector contacts)
                                 throws ProfileStoreException
Changes one or more Contacts for a partner in the profile store.

Parameters:
contacts - a Vector that contains one or more Contacts to be changed
Throws:
ProfileStoreException
See Also:
Contact

updateAddresses

public static final void updateAddresses(java.util.Vector addrs)
                                  throws ProfileStoreException
Changes one or more Addresses for a partner or a partner's contact in the profile store.

Parameters:
addrs - a Vector that contains one or more Addresses to be changed
Throws:
ProfileStoreException
See Also:
Address

updateDestinations

public static final void updateDestinations(java.util.Vector dests)
                                     throws ProfileStoreException
Changes one or more Destinations for a partner in the profile store.

Parameters:
addrs - a Vector that contains one or more Destinations to be changed
Throws:
ProfileStoreException
See Also:
Destination

updateIDs

public static final void updateIDs(java.util.Vector ids)
                            throws ProfileStoreException
Changes one or more external IDs for a partner in the profile store.

Parameters:
addrs - a Vector that contains one or more external IDs to be changed
Throws:
ProfileStoreException
See Also:
Destination

updatePartnerBinary

public static final void updatePartnerBinary(java.lang.String partnerID,
                                             int binaryType,
                                             byte[] bytes)
                                      throws ProfileStoreException
Changes or removes an existing binary object for a partner.

Parameters:
partnerID - the internal ID of a partner
binaryType - the type of binary to be updated. Must be one of the values returned by LookupStore.getBinaryTypes.
bytes - the binary object, a byte array. If null, it's treated as a delete
Throws:
ProfileStoreException

updateStatus

public static final void updateStatus(java.lang.String partnerID,
                                      java.lang.String status)
                               throws ProfileStoreException
Updates a partner's status.

Parameters:
partnerID - identifier of the partner to be updated
status - new value for the status
Throws:
ProfileStoreException - if the status is not one of the permitted values or if a database error occurred.

updateRemoteStatus

public static final void updateRemoteStatus(java.lang.String partnerID,
                                            java.lang.String status)
                                     throws ProfileStoreException
Deprecated. Starting in version 4.6, there is no Remote Status for a partner profile.

Updates the host's remote status.

Parameters:
partnerID - identifier of the partner whose server this status is on
status - new value for the remote status
Throws:
ProfileStoreException - if unable to update the remote status

addProfile

public static final java.lang.String addProfile(Profile profile)
                                         throws ProfileStoreException
Adds a new profile to the profile store.

Parameters:
profile - A Profile to be added to the store. If successful, all the components of the profile are updated with the internal IDs that were generated for them. The IDs are used when updating or deleting the components.
Returns:
internally generated partner ID
Throws:
ProfileStoreException - if unable to add the profile to the store
See Also:
Profile

addProfile

public static final java.lang.String addProfile(Profile profile,
                                                boolean validated)
                                         throws ProfileStoreException
Adds a new profile to the profile store.

Parameters:
profile - A Profile to be added to the store. If successful, all the components of the profile are updated with the internal IDs that were generated for them. The IDs are used when updating or deleting the components.
validated - a boolean indicated whether the profile has already been validated. If true, no validations are performed before saving the profile.
Returns:
internally generated partner ID
Throws:
ProfileStoreException - if unable to add the profile to the store
See Also:
Profile

addContacts

public static final java.util.Vector addContacts(java.util.Vector contacts,
                                                 java.lang.String partnerID)
                                          throws ProfileStoreException
Adds one or more Contacts to a partner's profile in the profile store. Persists the Contacts to the TN database.

Parameters:
contacts - a Vector of Contacts. If successful, all the Contacts are updated with the internal IDs that were generated for them. The IDs are used when updating or deleting the Contacts.
partnerID - the internal ID of the partner to be updated
Returns:
a Vector of ContactIDs, in the same order as the supplied Contacts in contacts.
Throws:
ProfileStoreException - if there is a database error
See Also:
Contact

addDestinations

public static final java.util.Vector addDestinations(java.util.Vector dests,
                                                     java.lang.String partnerID)
                                              throws ProfileStoreException
Adds one or more Destinations to a partner's profile in the profile store. Persists the Destinations to the TN database.

Parameters:
dests - a Vector of Destinations. If successful, all the Destinations are updated with the internal IDs that were generated for them. The IDs are used when updating or deleting the Destinations.
partnerID - the internal ID of the partner to be updated
Returns:
a Vector of DestinationIDs, in the same order as the supplied Destinations in dests.
Throws:
ProfileStoreException - if there is a database error
See Also:
Destination

addIDs

public static final java.util.Vector addIDs(java.util.Vector ids,
                                            java.lang.String partnerID)
                                     throws ProfileStoreException
Adds one or more external IDs to a partner's profile in the profile store. Persists the IDs to the TN database.

Parameters:
ids - a Vector of external IDs. If successful, all the IDs are updated with the internal identifiers that were generated for them. The identifiers are used when updating or deleting the external IDs.
partnerID - the internal ID of the partner to be updated
Returns:
a Vector of PartnerIDIDs, internally generated identifiers for the external IDs
Throws:
ProfileStoreException - if there is a database error
See Also:
ID

addAddressess

public static final java.util.Vector addAddressess(java.util.Vector addrs,
                                                   java.lang.String partnerID)
                                            throws ProfileStoreException
Adds one or more Addresses to a partner's profile in the profile store. Persists the Addresses to the TN database.

A Profile can accomodate one Address for the Corporation and one Addresse for each Contact. One or more of them may be added at once with this method.

Parameters:
addrs - a Vector of Addresses. If successful, all the Addresses are updated with the internal IDs that were generated for them. The IDs are used when updating or deleting the Addresses.
partnerID - the internal ID of the partner to be updated
Returns:
a Vector of AddressIDs, in the same order as the supplied Addresses in addrs.
Throws:
ProfileStoreException - if there is a database error
See Also:
Address

addPartnerBinary

public static final void addPartnerBinary(java.lang.String partnerID,
                                          int binaryType,
                                          byte[] bytes)
                                   throws ProfileStoreException
Adds a binary object to a partner's profile in the profile store. Persists the binary to the TN database.

Parameters:
partnerID - internal ID of a partner
binaryType - the type of binary to be added. Must be one of the values returned by getBinaryTypes.
bytes - the binary object to be added, an array of bytes
Throws:
ProfileStoreException - if there is a database error

addPartnerCertificate

public static final boolean addPartnerCertificate(java.lang.String partnerID,
                                                  java.security.cert.X509Certificate cert)
                                           throws ProfileStoreException
Deprecated. starting release 6.2. If sender partnerID, receiver my enterprise's sign certificate is saved in db, and matches supplied cert, returns true.

Parameters:
partnerID - internal ID of a partner
cert - an X509Certificate
Throws:
ProfileStoreException - if there is a database error

getPartnerIDForCertificate

public static final java.lang.String getPartnerIDForCertificate(java.security.cert.X509Certificate cert)
                                                         throws ProfileStoreException
Deprecated. starting release 6.2. Given a X509 Certificate, owner/sender the returned partnerID, partner/receiver my enterprise, usage sign. i.e. verfiy certificate for partner to my enterprise. If no match owner/sender found, returns null.

Parameters:
cert - an X509Certificate
Returns:
the internal ID of the partner associated with the supplied X509Certificate
Throws:
ProfileStoreException

getPartnerUser

public static final com.wm.app.b2b.server.User getPartnerUser(java.lang.String internalID)
                                                       throws ProfileStoreException
Deprecated. This method would now returns the first user in the String[]

Given an internal partner ID, return the B2B user associated with that partner

Parameters:
internalID - the ID of the partner
Returns:
the B2B user associated with that partner (null if none)
Throws:
ProfileStoreException

deleteProfile

public static final void deleteProfile(java.lang.String partnerID,
                                       boolean remove)
                                throws ProfileStoreException
Mark a partner's profile as deleted in the profile store. The profile is not physically removed from the database.

Parameters:
partnerID - the ID of a partner on the trading network
Throws:
ProfileStoreException - if an error occured while marking the profile as deleted

deleteProfile

public static final void deleteProfile(java.lang.String partnerID,
                                       boolean delete,
                                       boolean remove,
                                       java.sql.Connection conn)
                                throws ProfileStoreException
Mark a partner's profile as deleted or undeleted in the profile store.

Parameters:
partnerID - the ID of the Profile for a partner on the trading network
delete - boolean indicating whether to delete or undelete the partner's profile
remove - boolean indicating whether to physically remove the partner's profile. If false, the profile is only marked deleted. If true, the profile is physically removed from the database, but the BizDocs and ActivtyLog are retained. The delete argument is ignored if remove is true. updating the profile
Throws:
ProfileStoreException

deleteContact

public static final void deleteContact(java.lang.String contactID,
                                       java.lang.String partnerID)
                                throws ProfileStoreException
Removes a partner's contact from the database. Unlike deleting a profile, the contact is physically deleted, not just marked as deleted.

Parameters:
contactID - the internal ID for Contact to be deleted
partnerID - the internal ID for the partner
Throws:
ProfileStoreException - if there was a database error

deleteAddress

public static final void deleteAddress(java.lang.String addressID,
                                       java.lang.String partnerID)
                                throws ProfileStoreException
Removes a partner's or contact's address from the database. Unlike deleting a profile, the address is physically deleted, not just marked as deleted.

Parameters:
addressID - the internal ID for the address to be deleted
partnerID - the internal ID for the partner
Throws:
ProfileStoreException - if there was a database error

deleteDestination

public static final void deleteDestination(java.lang.String destID)
                                    throws ProfileStoreException
Removes a partner's Destination (a.k.a. Delivery) from the database. Unlike deleting a profile, the Destination is physically deleted, not just marked as deleted.

Parameters:
destination - the Destination to be deleted
partnerID - the internally generated ID for the partner
Throws:
ProfileStoreException - if there was a database error

deleteID

public static final void deleteID(java.lang.String id)
                           throws ProfileStoreException
Throws:
ProfileStoreException

getExtendedFields

public static final java.util.Vector getExtendedFields(java.lang.String partnerID,
                                                       int groupID)
                                                throws ProfileStoreException
Parameters:
partnerID - the internal ID for the partner
groupID - the group of fields to be retrieve. Use one of the GRP* values from com.wm.app.tn.profile.Constants
Returns:
an Enumeration of the extended fields in a specific group for a partner. If a value is defined for a field for the supplied partner, it is included. If not, the field is returned with no value.
Throws:
ProfileStoreException - if there was a database error
See Also:
Constants, ExtendedProfileField

addExtendedField

public static final void addExtendedField(java.lang.String partnerID,
                                          ExtendedProfileField ef)
                                   throws ProfileStoreException
Adds an extended field to a partner's profile. The field is persisted to the profile store.

Parameters:
partnerID - internal ID of the partner to be updated
ef - the extended field to be added
Throws:
ProfileStoreException - if there was a database error

updateExtendedFields

public static final void updateExtendedFields(java.lang.String partnerID,
                                              java.util.Vector flds)
                                       throws ProfileStoreException
Updates one or more extended fields in a partner's profile. The change is persisted to the profile store.

Parameters:
partnerID - internal ID of the partner to be updated
flds - a Vector of the extended fields to be changed
Throws:
ProfileStoreException - if there was a database error

getPartnerContact

public static final Contact getPartnerContact(java.lang.String partnerID,
                                              java.lang.String contactType)
                                       throws ProfileStoreException
Deprecated. use the getPatnerContacts instead

Retrieves a specific type of Contact for a trading partner. If there are multiple contacts of the same type in the Profile Store, the one with the lowest Sequence Number will be returned.

Parameters:
partnerID - internally assigned ID for the trading partner
contactType - the type of contact to retrieve. The value must match the Description column in a row on the ContactType table.
Throws:
ProfileStoreException - if there was a database error

getPartnerContacts

public static final java.util.Vector getPartnerContacts(java.lang.String partnerID,
                                                        java.lang.String contactType)
                                                 throws ProfileStoreException
Retrieves a specific type of Contact(s) for a trading partner.

Parameters:
partnerID - internally assigned ID for the trading partner
contactType - the type of contact to retrieve. The value must match the Description column in a row on the ContactType table.
Throws:
ProfileStoreException - if there was a database error

getPartnerBinary

public static final byte[] getPartnerBinary(java.lang.String partnerID,
                                            int binaryType)
                                     throws ProfileStoreException
Retrieves the binary value of the requested type for a partner.

Parameters:
partnerID - internally generated ID for a trading partner
binaryType - integer code for the type of binary value to retrieve. The value must match the Type column in a row on the BinaryType table.
Returns:
the binary value in a byte array
Throws:
ProfileStoreException - if there was a database error

getPartnerBinary

public static final byte[] getPartnerBinary(java.lang.String partnerID,
                                            java.lang.String binaryType)
                                     throws ProfileStoreException
Retrieves the binary value of the requested type for a partner.

Parameters:
partnerID - internally generated ID for a trading partner
binaryType - description of the type of binary value to retrieve. The value must match the Description column in a row on the BinaryType table.
Returns:
the binary value in a byte array
Throws:
ProfileStoreException - if there was a database error

connectToPartner

public static final com.wm.app.b2b.client.Context connectToPartner(java.lang.String partnerID,
                                                                   java.lang.String destination,
                                                                   boolean xml)
                                                            throws ProfileStoreException
Establishes a connection to a partner's B2B server.

Parameters:
partnerID - internal identifier of the partner to connect to
destination - which destination from the partner's profile to use. Must be one of these values from the RoutingConstants class:
                RoutingConstants.PRIMARY_HTTP
RoutingConstants.PRIMARY_HTTP
RoutingConstants.SECONDARY_HTTPS
RoutingConstants.SECONDARY_HTTPS
If null, the preferred destination from the partner's profile is used. If the preferred protocol is not one of these four values, an exception is thrown.
xml - indicates whether to use XML or Binary encoding. Specify true to use XML, false for Binary.
Returns:
a com.wm.app.b2b.client.Context, or null if unable to connect
Throws:
ProfileStoreException - if there was a database error or a context error

connectToPartner

public static final com.wm.app.b2b.client.Context connectToPartner(java.lang.String partnerID,
                                                                   java.lang.String destination,
                                                                   java.lang.String user,
                                                                   java.lang.String password,
                                                                   boolean xml)
                                                            throws ProfileStoreException
Establishes a connection to a partner's B2B server.

Parameters:
partnerID - internal identifier of the partner to connect to
destination - which destination from the partner's profile to use. Must be one of these values from the RoutingConstants class:
                RoutingConstants.PRIMARY_HTTP
RoutingConstants.PRIMARY_HTTP
RoutingConstants.SECONDARY_HTTPS
RoutingConstants.SECONDARY_HTTPS
If null, the preferred destination from the partner's profile is used. If the preferred protocol is not one of these four values, an exception is thrown.
user - the username to use when connecting to the partner's server. If null, will use the username from the partner's profile
password - the password to use when connecting to the partner's server. If null, will use the password from the partner's profile
xml - indicates whether to use XML or Binary encoding. Specify true to use XML, false for Binary.
Returns:
a com.wm.app.b2b.client.Context, or null if unable to connect
Throws:
ProfileStoreException - if there was a database error or a context error

getPollingFrequencies

public static final java.util.Hashtable getPollingFrequencies()
                                                       throws ProfileStoreException
Retrieves the polling frequencies for all partners on the network.

Returns:
a Hashtable. The keys are partnerIDs and the values are the partners' polling frequencies as Floats.
Throws:
ProfileStoreException - if there was a database error

getLogos

public static final java.util.Hashtable getLogos()
                                          throws ProfileStoreException
Gets company logos for all partners.

Returns:
a Hashtable. The keys are partnerIDs and the values are the partners' logos byte arrays.
Throws:
ProfileStoreException - if there was a database error

getRequiredIDType

public static int getRequiredIDType()
                             throws ProfileStoreException
Deprecated. required id type does not hold anymore

Returns:
the type of external ID that is required for all partners. The integer code representing the ID type is returned.
Throws:
ProfileStoreException - if there was a database error

getDefaultIDType

public static int getDefaultIDType()
                            throws ProfileStoreException
Throws:
ProfileStoreException

addProfileGroup

public static final void addProfileGroup(java.lang.String partnerId,
                                         java.lang.String profileGroupId)
Adds a partner to a profile group.

Parameters:
partnerId - the internal identifier of a partner
profileGroupId - the internal identifier of the profile group.

addProfileGroup

public static final void addProfileGroup(java.sql.Connection conn,
                                         java.lang.String partnerId,
                                         java.lang.String profileGroupId)
Adds a partner to a profile group.

Parameters:
partnerId - the internal identifier of a partner
profileGroupId - the internal identifier of the profile group.

addProfileGroups

public static final void addProfileGroups(java.lang.String partnerId,
                                          java.lang.String[] profileGroupIds)
Adds a partner to one or more profile groups.

Parameters:
partnerId - the internal identifier of a partner
profileGroupIds - an array of internal identifiers of profile groups

addProfileGroups

public static final void addProfileGroups(java.sql.Connection conn,
                                          java.lang.String partnerId,
                                          java.lang.String[] profileGroupIds)
Adds a partner to one or more profile groups.

Parameters:
partnerId - the internal identifier of a partner
profileGroupIds - an array of internal identifiers of profile groups

deleteProfileGroup

public static final void deleteProfileGroup(java.lang.String partnerId,
                                            java.lang.String profileGroupId)
Deletes a partner from a profile group.

Parameters:
partnerId - the internal identifier of a partner
profileGroupId - the internal identifier of the profile group

getProfileGroups

public static final java.lang.String[] getProfileGroups(java.lang.String partnerId)
Parameters:
partnerId - the internal identifier of the partner
Returns:
a list of profile groups that the partner is a member of.

updateProfileGroups

public static final void updateProfileGroups(java.lang.String partnerId,
                                             java.lang.String[] profileGroupIds)
Updates the set of profile groups that a partner is a member of. Deletes the partner from all profile groups if profileGroupIds is null or empty.

Parameters:
partnerId - the internal identifier of a partner
profileGroupIds - an array of internal identifiers of profile groups

queryProfiles

public static com.wm.data.IData queryProfiles(ProfileQuery query,
                                              int pageSize,
                                              int maxRowCount,
                                              int queryTimeout,
                                              int threshold,
                                              java.lang.String queryId)
                                       throws ProfileStoreException,
                                              java.io.IOException,
                                              com.wm.app.repo.RepositoryException,
                                              com.wm.app.b2b.server.ServiceException
Executes a query for partner profile information from the TN database.

Parameters:
query - the query to execute
pageSize - the number of rows per page; specify -1 to disable paging
maxRowCount - the maximum number of rows to return. Excess rows will be silently dropped. 0 means unlimited
queryTimeout - the maximum number of seconds to wait for the query to return. 0 means unlimited.
threshold - the number of rows to be stored in the session object; this allows you to override the tn.query.threshold system property. In a cluster, this should be disabled by setting it to -1. If set to -1, the value of the tn.query.threshold system property is used.
queryId - specifies the unique identifier to store the paged query results. This is applicable only when the results are paged. If this value is not set, an Id is automatically generated
Returns:
an IData of partner profiles satisfying the query (may be empty)
Throws:
ProfileStoreException - if a database exception prevents getting the query results
java.io.IOException
com.wm.app.repo.RepositoryException
com.wm.app.b2b.server.ServiceException

getPartnerIDs

public static java.lang.String[] getPartnerIDs(java.lang.String regexForName)

getExtendedFieldsForPartner

public static java.util.Vector getExtendedFieldsForPartner(java.lang.String partnerID)

getExtendedFields

public static java.util.Vector getExtendedFields()
                                          throws ProfileStoreException,
                                                 java.sql.SQLException
Throws:
ProfileStoreException
java.sql.SQLException