Class TimesTenHelper

java.lang.Object
co.ecg.alpaca.core.repositories.TimesTenHelper
All Implemented Interfaces:
AutoCloseable

public class TimesTenHelper extends Object implements AutoCloseable
Class to handle the connection between an Alpaca Library and a TimesTen database. This would typically be located on an Application Server. This class needs to replicate the ability from an Application Server login. The expectation is to retrieve Password and Passcode information and be able to then set these same values on through a OCI request.

This is highly dependent on server configuration. Required settings are -- The Library Path for the server must be set at runtime. -Djava.library.path=/usr/local/TimesTen/tt_base/lib

The Class Path for the *SERVER* ttjdbc jar must be set. Although we are compiling with a ttjdbc*.jar, this is not the library used at runtime. -cp /server/timesten/library/ttjdbc*.jar

The TimesTen library needs to be set as an available Library in linux. Example - $ export LD_LIBRARY_PATH=/usr/local/TimesTen/tt_base/lib $ ldconfig

Version:
$Id: $Id
Author:
Matthew Keathley
  • Method Details

    • getTimesTenHelper

      public static TimesTenHelper getTimesTenHelper(BroadWorksProcess broadWorksProcess) throws TimesTenException
      Throws:
      TimesTenException
    • getTimesTenHelper

      public static TimesTenHelper getTimesTenHelper(BroadWorksProcess broadWorksProcess, boolean trySecondaryFirst) throws TimesTenException
      Throws:
      TimesTenException
    • getBroadWorksProcess

      public BroadWorksProcess<?,?> getBroadWorksProcess()
    • close

      public void close() throws SQLException
      Specified by:
      close in interface AutoCloseable
      Throws:
      SQLException
    • getFeatureAttributeRowsForService

      public List<UsrFtrAttr> getFeatureAttributeRowsForService(User user, UserService userService)
      Method to retrieve USR_FTR_ATTR rows related to a User and UserService
      Parameters:
      user - The User to retrieve
      userService - The UserService to filter by
      Returns:
      A list of row data
    • retrieveCommBarrUser

      public CommBarrUser retrieveCommBarrUser(BroadWorksUser user)

      retrieveCommBarrUser.

      Parameters:
      user - a BroadWorksUser object.
      Returns:
      a CommBarrUser object.
    • setCommBarrUser

      public void setCommBarrUser(BroadWorksUser user, CommBarrUser commBarrUser)

      setCommBarrUser.

      Parameters:
      user - a BroadWorksUser object.
      commBarrUser - a CommBarrUser object.
    • setFeatureAttributeRowsForService

      public void setFeatureAttributeRowsForService(User user, UserService userService, List<UsrFtrAttr> ftr_attrs)
      Method to update USR_FTR_ATTR rows related to a User and UserService
      Parameters:
      user - The user to modify
      userService - The UserService to filter by
      ftr_attrs - The map of row information
    • getLoginRowForUser

      public Login getLoginRowForUser(BroadWorksUser user)
      Method to retrieve the LOGIN Row for the given BroadWorksUser.
      Parameters:
      user - The BroadWorksUser to retrieve
      Returns:
      a Login object.
      See Also:
    • getLoginRowForUserId

      public Login getLoginRowForUserId(String userId)
      Method to retrieve the LOGIN Row for the given user id.
      Parameters:
      userId - The user id of the user to retrieve
      Returns:
      a Login object.
      See Also:
    • getPbkdf2LoginRowForUserId

      public Pbkdf2Login getPbkdf2LoginRowForUserId(String userId)
      Method to retrieve the PBKDF2_LOGIN Row for the given user id.
      Parameters:
      userId - The user id of the user to retrieve
      Returns:
      a Login object.
      See Also:
    • setPbkdf2LoginRowForUserId

      public void setPbkdf2LoginRowForUserId(String userId, Pbkdf2Login login)
      Method to set the user id's PBKDF2_LOGIN row data.
      Parameters:
      userId - The user id to modify
      login - The login row data
      See Also:
    • setLoginRowForUser

      public void setLoginRowForUser(BroadWorksUser user, Login login)
      Method to set the BroadWorksUser LOGIN row data.
      Parameters:
      user - The BroadWorksUser to modify
      login - The login row data
      See Also:
    • setLoginRowForUserId

      public void setLoginRowForUserId(String userId, Login login)
      Method to set the user id's LOGIN row data.
      Parameters:
      userId - The user id to modify
      login - The login row data
      See Also:
    • getASUserRowForUser

      public ASUser getASUserRowForUser(BroadWorksUser user)

      getASUserRowForUser.

      Parameters:
      user - a BroadWorksUser object.
      Returns:
      a ASUser object.
    • getASUserRowForUser

      public ASUser getASUserRowForUser(String userId)
      Method to retrieve the AS_USER row for the given BroadWorksUser.
      Parameters:
      userId - The id of the user to retrieve the AS_USER row
      Returns:
      a ASUser object.
      See Also:
    • setASUserRowForUser

      public void setASUserRowForUser(BroadWorksUser user, ASUser asUser)

      setASUserRowForUser.

      Parameters:
      user - a BroadWorksUser object.
      asUser - a ASUser object.
    • setASUserRowForUser

      public void setASUserRowForUser(String userId, ASUser asUser)
      Method to set the BroadWorksUser AS_USER row data
      Parameters:
      userId - The BroadWorksUser to modify
      asUser - The AS_USER row data
      See Also:
    • getTrunkGroupAttrRow

      public TrunkGroupAttr getTrunkGroupAttrRow(Group group, String trunkGroupName)
      Method to retrieve the Authentication Password and Cipher for a Trunk Group.
      Parameters:
      group - The Group that the Trunk Group is in.
      trunkGroupName - The name of the Trunk Group.
      Returns:
      An TrunkGroupAttr containing the password and cipher.
    • setTrunkGroupAttrRow

      public void setTrunkGroupAttrRow(TrunkGroupAttr trunkGroupAttr, Group group, String trunkGroupName)
      Method to set the Authentication Password for a Trunk Group.
      Parameters:
      trunkGroupAttr - The TrunkGroupAttr object that hold the values.
      group - The Group the trunk group belongs to.
      trunkGroupName - The name of the trunk Group.
    • getCustGroupAttr

      public List<CustGroupAttr> getCustGroupAttr(Group group, String... attrName)

      getCustGroupAttr.

      Parameters:
      group - a Group object.
      attrName - a String object.
      Returns:
      a List object.
    • setCustGroupAttr

      public void setCustGroupAttr(Group group, CustGroupAttr custGroupAttr)

      setCustGroupAttr.

      Parameters:
      group - a Group object.
      custGroupAttr - a CustGroupAttr object.
    • getAnnouncementURL

      public String getAnnouncementURL(Group group, String announcementName) throws HelperException
      Method to get the URL for for a Group Announcement file. This file is hashed from the UIDs of the Group and Announcement.
      Parameters:
      group - The Group that the announcement belongs
      announcementName - The name of the announcement file
      Returns:
      a String object.
      Throws:
      HelperException - Thrown if CUST_GROUP_UID attribute does not exist.
      See Also:
    • getAnnouncementURL

      public String getAnnouncementURL(BroadWorksUser user, String announcementName) throws HelperException
      Method to get the URL for for a User Announcement file. This file is hashed from the UIDs of the Group, User, and Announcement.
      Parameters:
      user - The BroadWorksUser that the announcement belongs
      announcementName - The name of the announcement file
      Returns:
      a String object.
      Throws:
      HelperException - Thrown if either the USER_UID or CUST_GROUP_UID attribute does not exist.
      See Also:
    • getServiceProviderAnswerConfirmationAnnouncementURL

      public String getServiceProviderAnswerConfirmationAnnouncementURL(ServiceProvider serviceProvider, String mediaType) throws HelperException
      Method to retrieve the URL for a ServiceProvider Answer Confirmation Announcement
      Parameters:
      serviceProvider - The ServiceProvider to retrieve the URL for.
      mediaType - The type of media that the Announcement is.
      Returns:
      Returns String of the URL of the Announcement.
      Throws:
      HelperException - Thrown if the SVC_PROVIDER_UID attribute does not exist.
    • getServiceProviderVoicePortalBrandingVoicePortalGreetingAnnouncementURL

      public String getServiceProviderVoicePortalBrandingVoicePortalGreetingAnnouncementURL(ServiceProvider serviceProvider, String mediaType) throws HelperException

      getServiceProviderVoicePortalBrandingVoicePortalGreetingAnnouncementURL.

      Parameters:
      serviceProvider - a ServiceProvider object.
      mediaType - a String object.
      Returns:
      a String object.
      Throws:
      HelperException - if any.
    • getServiceProviderVoicePortalBrandingVoiceMessagingGreetingAnnouncementURL

      public String getServiceProviderVoicePortalBrandingVoiceMessagingGreetingAnnouncementURL(ServiceProvider serviceProvider, String mediaType) throws HelperException

      getServiceProviderVoicePortalBrandingVoiceMessagingGreetingAnnouncementURL.

      Parameters:
      serviceProvider - a ServiceProvider object.
      mediaType - a String object.
      Returns:
      a String object.
      Throws:
      HelperException - if any.
    • getServiceProviderUID

      public String getServiceProviderUID(String id)
    • getServiceProviderUID

      public String getServiceProviderUID(ServiceProvider serviceProvider)
    • getGroupUid

      public String getGroupUid(String serviceProviderId, String groupId) throws CannotFindException
      Throws:
      CannotFindException
    • getGroupUid

      public String getGroupUid(Group group) throws CannotFindException
      Throws:
      CannotFindException
    • getEnterprisePreAlertingAnnouncementURL

      public String getEnterprisePreAlertingAnnouncementURL(Enterprise enterprise, String mediaType) throws HelperException
      Method to retrieve the URL for an Enterprise PreAlerting Announcement.
      Parameters:
      enterprise - The enterprise to retrieve the URL for.
      mediaType - The type of media that the Announcement is.
      Returns:
      Returns String of the URL of the Announcement.
      Throws:
      HelperException - Thrown if the SVC_PROVIDER_UID attribute does not exist.
    • getCallCenterReportBrandingURIForEnterprise

      public String getCallCenterReportBrandingURIForEnterprise(Enterprise enterprise) throws CannotFindException
      Throws:
      CannotFindException
    • getCallCenterReportBrandingURIForGroup

      public String getCallCenterReportBrandingURIForGroup(Group group) throws CannotFindException
      Throws:
      CannotFindException
    • getCallCenterReportTemplateFileURIForEnterprise

      public String getCallCenterReportTemplateFileURIForEnterprise(String templateName, Enterprise enterprise) throws CannotFindException
      Throws:
      CannotFindException
    • getCallCenterReportTemplateFileURIForGroup

      public String getCallCenterReportTemplateFileURIForGroup(String templateName, Group group) throws CannotFindException
      Throws:
      CannotFindException
    • getDeviceCredentials

      public AccessDeviceCredentials getDeviceCredentials(AccessDevice accessDevice)
      Method to retrieve the Credentials for the given AccessDevice
      Parameters:
      accessDevice - The AccessDevice to retrieve
      Returns:
      A set of credentials
      See Also:
    • setDeviceCredentials

      public void setDeviceCredentials(AccessDevice accessDevice, AccessDeviceCredentials credentials)

      setDeviceCredentials.

      Parameters:
      accessDevice - a AccessDevice object.
      credentials - a AccessDeviceCredentials object.
    • getSavedVoicemails

      public List<SavedMessageRow> getSavedVoicemails(BroadWorksUser user)
      Method to retrieve the Voice Messaging saved messages for the given BroadWorksUser.
      Parameters:
      user - The BroadWorksUser to retrieve the saved Voicemails
      Returns:
      a List object.
      See Also:
    • getVoiceMessagingGroupMailServerCredentialsForUser

      public VM_MailServer getVoiceMessagingGroupMailServerCredentialsForUser(BroadWorksUser user)
      Retrieves the VoiceMessaging Group MailServer credentials for a given BroadWorksUser
      Parameters:
      user - The BroadWorksUser to retrieve
      Returns:
      the set of credentials if found
    • getVoiceMessagingPersonalMailServerCredentialsForUser

      public VM_MailServer getVoiceMessagingPersonalMailServerCredentialsForUser(BroadWorksUser user)
      Retrieves the VoiceMessaging Personal MailServer credentials for a given BroadWorksUser
      Parameters:
      user - The BroadWorksUser to retrieve
      Returns:
      the set of credentials if found
    • setVoiceMessagingGroupMailServerCredentialsForUser

      public void setVoiceMessagingGroupMailServerCredentialsForUser(BroadWorksUser user, VM_MailServer mailServer) throws HelperException

      setVoiceMessagingGroupMailServerCredentialsForUser.

      Parameters:
      user - a BroadWorksUser object.
      mailServer - a VM_MailServer object.
      Throws:
      HelperException - if any.
    • setVoiceMessagingPersonalMailServerCredentialsForUser

      public void setVoiceMessagingPersonalMailServerCredentialsForUser(BroadWorksUser user, VM_MailServer mailServer) throws HelperException

      setVoiceMessagingPersonalMailServerCredentialsForUser.

      Parameters:
      user - a BroadWorksUser object.
      mailServer - a VM_MailServer object.
      Throws:
      HelperException - if any.
    • getFTPServer

      public FTPClient getFTPServer(AccessDevice accessDevice)
      Method to retrieve information regarding an FTP File Server.
      Parameters:
      accessDevice - The AccessDevice whose files are stored on the FTP Server
      Returns:
      Returns an FTPServer if the device file access protocol is FTp otherwise returns null.
      See Also:
    • getDeviceAccessProtocol

      public String getDeviceAccessProtocol(String deviceType)
      Method to retrieve Device Access Protocols from TimesTen.
      Parameters:
      deviceType - The device type that the protocol will be retrieved for.
      Returns:
      Returns the device access protocol if one is found. \
    • getActivatableFeatures

      public List<ActivatableFeature> getActivatableFeatures()
      Method to retrieve a list of Activatable Features from TimesTen.
      Returns:
      The list of Activatable Features
      See Also:
    • hasActivatableFeature

      public boolean hasActivatableFeature(String featureCode)
      Checks if the provided feature code is activated
      Parameters:
      featureCode - The code to check.
      Returns:
      True if feature is activated, otherwise false
    • setMeetMeConferenceAccess

      public void setMeetMeConferenceAccess(String currentConferenceID, String currentModeratorPin, MeetMeConferenceAccess meetMeConferenceAccess)
      Updates the TimesTen database using the provided MeetMeConferenceAccess object.
      Parameters:
      currentConferenceID - The conferences current conference ID
      currentModeratorPin - The conferences current moderator pin
      meetMeConferenceAccess - The MeetMeConferenceAccess to insert
    • setCollaborateBridgeRoomId

      public void setCollaborateBridgeRoomId(String bridgeId, String userId, String roomName, CollaborateRoomType roomType) throws HelperException
      Updates the TimesTen database to set the BridgeID to the desired value for the provided Collaborate Room
      Parameters:
      bridgeId - The desired bridge ID
      userId - The host user ID of the bridge
      roomName - The room name
      roomType - The room type
      Throws:
      HelperException - Thrown if the parameters are null or the room type is invalid
      See Also:
    • getSVCProviderAuthFtrAttr

      public List<SVCProviderAuthFtrAttr> getSVCProviderAuthFtrAttr(ServiceProvider serviceProvider, String ftr_svc_name, String... attrName)

      getSVCProviderAuthFtrAttr.

      Parameters:
      serviceProvider - a ServiceProvider object.
      ftr_svc_name - a String object.
      attrName - a String object.
      Returns:
      a List object.
    • setSVCProviderAuthFtrAttr

      public void setSVCProviderAuthFtrAttr(ServiceProvider serviceProvider, SVCProviderAuthFtrAttr svcProviderAuthFtrAttr, String ftr_svc_name)

      setSVCProviderAuthFtrAttr.

      Parameters:
      serviceProvider - a ServiceProvider object.
      svcProviderAuthFtrAttr - a SVCProviderAuthFtrAttr object.
      ftr_svc_name - a String object.
    • setGroupMusicOnHoldId

      public void setGroupMusicOnHoldId(String oldId, String newId, boolean isVideo)
      Updates a Music On Hold instance's user_id
      Parameters:
      oldId - The current id in the db
      newId - The id to set to
      isVideo - Whether or not the Music On Hold instance supports video
    • getFileRepositoryPassword

      public String getFileRepositoryPassword(String fileRepositoryName, String userId)
      Method to retrieve the Password of a FileRepositoryUser.
      Parameters:
      fileRepositoryName - The file repository to retrieve the Password for.
      userId - The userId to retrieve the Password for.
      Returns:
      The password of the FileRepositoryUser. Null if not found.
    • getRepositoryUrl

      public URI getRepositoryUrl(AccessDevice device, String fileName)
      Method to retrieve the Repository URL of a device file from TimesTen.
      Parameters:
      device - The device to retrieve the URL for.
      fileName - The name of the file to retrieve the URL for.
      Returns:
      Returns the repository url.
    • getUserCredentialsForFileRepository

      public List<FileRepositoryUser> getUserCredentialsForFileRepository(String fileRepositoryName)

      getUserCredentialsForFileRepository.

      Parameters:
      fileRepositoryName - a String object.
      Returns:
      a List object.
    • setLoginLastModified

      public void setLoginLastModified(String userId, long lastModified)
      Updates the the last modified date of a user's login information using the provided offset in seconds.
      Parameters:
      userId - The user to update.
      lastModified - Timestamp in milliseconds of lastModified date.
    • getDeviceAccessInformation

      public List<DeviceAccess> getDeviceAccessInformation()
    • retrieveFileRepositories

      public List<FileRepository> retrieveFileRepositories()

      retrieveFileRepositories.

      Returns:
      a List object.
    • blfListURIIsInUse

      public boolean blfListURIIsInUse(String uri)
      Checks if the provided BLF URI is currently in use.
      Parameters:
      uri - The uri to check
      Returns:
      TRUE IFF the uri is in use, FALSE otherwise
    • getCustomTagNamesInSystem

      public List<String> getCustomTagNamesInSystem()
      Retrieves a list of Custom Tag Names that are being used within the system.
      Returns:
      The list of tag names.
    • getCustomTagNamesInServiceProvider

      public List<String> getCustomTagNamesInServiceProvider(ServiceProvider serviceProvider)
      Retrieves a list of Custom Tag Names that being used within the Service Provider. Includes tags being used by Group devices.
      Parameters:
      serviceProvider - The ServiceProvider to retrieve tags for.
      Returns:
      The list of tag names.
    • getServiceProviderLevelDeviceTags

      public List<String> getServiceProviderLevelDeviceTags(ServiceProvider serviceProvider)
    • getAllServiceProviderLevelDeviceTags

      public List<String> getAllServiceProviderLevelDeviceTags()
    • getGroupLevelDeviceTagsForAllGroupsInServiceProvider

      public List<String> getGroupLevelDeviceTagsForAllGroupsInServiceProvider(ServiceProvider serviceProvider)
    • getCustomTagNamesInGroup

      public List<String> getCustomTagNamesInGroup(Group group) throws HelperException
      Retrieves a list of Custom Tag Names that being used within the Group.
      Parameters:
      group - The Group to retrieve tags for.
      Returns:
      The list of tag names.
      Throws:
      HelperException
    • getGroupLevelDeviceTags

      public List<String> getGroupLevelDeviceTags(Group group) throws HelperException
      Throws:
      HelperException
    • getAllGroupLevelDeviceTags

      public List<String> getAllGroupLevelDeviceTags() throws HelperException
      Throws:
      HelperException
    • getTagsInTagSets

      public List<String> getTagsInTagSets() throws HelperException
      Throws:
      HelperException
    • getUserIdFromBLFUri

      public String getUserIdFromBLFUri(String uri)
    • getBLFMonitoredUsers

      public List<String> getBLFMonitoredUsers(String userId)
    • getUsersWithBlf

      public List<String> getUsersWithBlf()
    • getUserBLFUri

      public String getUserBLFUri(String userId)
    • getServicePacksAvailableForUse

      public Set<String> getServicePacksAvailableForUse()
    • getUserFromDN

      public DnUserDTO getUserFromDN(String dn)
      Given a DN in the format +15551239876, lookup the corresponding user.
      Parameters:
      dn - The dn to search the database for.
      Returns:
      The associated user, if one is found. NULL otherwise.
    • macAddressInUse

      public boolean macAddressInUse(String mac)
    • countServiceProviders

      public int countServiceProviders()
    • getServiceProvider

      public TTServiceProvider getServiceProvider(String serviceProviderId)
    • getServiceProviders

      public List<TTServiceProvider> getServiceProviders()
    • getGroup

      public TTCustGroup getGroup(String groupUid)
    • getGroups

      public List<TTCustGroup> getGroups(String serviceProviderUid)
    • getUsers

      public List<TTAsUser> getUsers(String groupUid)
    • getAlternateLogins

      public List<String> getAlternateLogins(String userUid)
    • getGroupAccessDevices

      public List<TTAccessDevice> getGroupAccessDevices(String groupUid)
    • getServiceProviderAccessDevices

      public List<TTAccessDevice> getServiceProviderAccessDevices(String serviceProviderUid)
    • getSystemAccessDevices

      public List<TTAccessDevice> getSystemAccessDevices()
    • getSystemAdmins

      public List<TTAsAdmin> getSystemAdmins()
    • getServiceProviderAdmins

      public List<TTAsAdmin> getServiceProviderAdmins(String serviceProviderUid)
    • getGroupAdmins

      public List<TTAsAdmin> getGroupAdmins(String groupUid)
    • getAutoAttendants

      public List<TTAutoAttendant> getAutoAttendants(String groupUid)
    • getCallCenters

      public List<TTCallCenter> getCallCenters(String serviceProviderId, String groupId, String idQuery)
    • getHuntGroups

      public List<TTHuntGroup> getHuntGroups(String groupUid)
    • getMeetMeBridges

      public List<TTMeetMe> getMeetMeBridges(String groupUid)
    • getBroadWorksAnywherePortals

      public List<TTBroadWorksAnywhere> getBroadWorksAnywherePortals(String groupUid)
    • getCollaborateBridges

      public List<TTCollaborateBridge> getCollaborateBridges(String groupUid)
    • getFindMeFollowMeInstances

      public List<TTFindMeFollowMe> getFindMeFollowMeInstances(String groupUid)
    • getPagingGroups

      public List<TTPagingGroup> getPagingGroups(String groupUid)
    • getInstantGroupCallInstances

      public List<TTInstantGroupCall> getInstantGroupCallInstances(String groupUid)
    • getVoiceXmlInstances

      public List<TTVoiceXml> getVoiceXmlInstances(String groupUid)
    • getFlexibleSeatingHosts

      public List<TTFlexibleSeatingHost> getFlexibleSeatingHosts(String groupUid)
    • getTrunkGroups

      public List<TTTrunkGroup> getTrunkGroups(String groupUid)
    • getUsersWithService

      public List<UserServiceRow> getUsersWithService(Group group, String service) throws HelperException
      Throws:
      HelperException
    • getCallCenterAgents

      public List<UserServiceRow> getCallCenterAgents(String serviceProviderId, String groupId, String userIdQuery)
    • getGroupsWithService

      public List<GroupServiceRow> getGroupsWithService(ServiceProvider serviceProvider, String service) throws HelperException
      Throws:
      HelperException
    • getAgentDetailsForUser

      public List<AgentDTO> getAgentDetailsForUser(String userId)
    • getDNISForCluster

      public List<DnisDTO> getDNISForCluster()
    • getDNISForServiceProvider

      public List<DnisDTO> getDNISForServiceProvider(ServiceProvider serviceProvider)
    • getDNISForCallCenter

      public List<DnisDTO> getDNISForCallCenter(String callCenter)
    • isCallCenterSupervisor

      public boolean isCallCenterSupervisor(String userId)
    • getCallCentersForSupervisor

      public List<TTCallCenter> getCallCentersForSupervisor(String userId, String ccQuery)