Class LegacyIdFactory


  • public class LegacyIdFactory
    extends Object
    A factory to create inferred Hash values each of which is a 2.0 ID which acts as a mirror for an object in the legacy (Symphony1.5) space. Many methods take a tenantId which it uses to generate a globally unique ID for each object across all pods. This means that if the same threadId happens to exist in 2 separate pods and we create a 2.0 Sequence to represent those two threads that the 2.0 IDs will not collide in a multi tenant environment. This also means that where the same message goes xpod that events about the same message originating from different pods will have different event IDs. In the comments below where it says "originating pod" it means the pod where the event originates which may be different from the pod where the message originated. Note that where we refer to userId in this class that we expect the "external" userId which already includes the tenantId and is already globally unique. In this case the tenantId is not included again.
    Author:
    Bruce Skingle
    • Constructor Summary

      Constructors 
      Constructor Description
      LegacyIdFactory()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.symphonyoss.s2.common.hash.Hash deleteEventId​(String tenantId, long requesterId, byte[] deleteMessageId)
      Create a 2.0 Hash (ID) for a DeleteEvent.
      org.symphonyoss.s2.common.hash.Hash deleteEventId​(String tenantId, long requesterId, org.symphonyoss.s2.common.immutable.ImmutableByteArray deleteMessageId)
      Create a 2.0 Hash (ID) for a DeleteEvent.
      org.symphonyoss.s2.common.hash.Hash deliveryReceiptId​(String tenantId, long userId, byte[] messageId, byte[] threadId)
      Create a 2.0 Hash (ID) for the delivery receipt of the given messageId for the given userId.
      org.symphonyoss.s2.common.hash.Hash deliveryReceiptId​(String tenantId, long userId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId, org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
      Create a 2.0 Hash (ID) for the delivery receipt of the given messageId for the given userId.
      org.symphonyoss.s2.common.hash.Hash downloadAttachmentEventId​(String tenantId, long downloadedByUserId, byte[] messageId, String fileId)
      Create a 2.0 Hash (ID) for a DownloadAttachmentEvent.
      org.symphonyoss.s2.common.hash.Hash downloadAttachmentEventId​(String tenantId, long downloadedByUserId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId, String fileId)
      Create a 2.0 Hash (ID) for a DownloadAttachmentEvent.
      org.symphonyoss.s2.common.hash.Hash likeEventId​(String tenantId, long liker, byte[] likedMessageId)
      Create a 2.0 Hash (ID) for a LikeEvent.
      org.symphonyoss.s2.common.hash.Hash likeEventId​(String tenantId, long liker, org.symphonyoss.s2.common.immutable.ImmutableByteArray likedMessageId)
      Create a 2.0 Hash (ID) for a LikeEvent.
      org.symphonyoss.s2.common.hash.Hash maestroId​(String tenantId, byte[] messageId, byte[] threadId)
      Create a 2.0 Hash (ID) for a MaestroMessage.
      org.symphonyoss.s2.common.hash.Hash maestroId​(String tenantId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId, org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
      Create a 2.0 Hash (ID) for a MaestroMessage.
      org.symphonyoss.s2.common.hash.Hash messageId​(String tenantId, byte[] messageId)
      Create a 2.0 Hash (ID) for the given messageId.
      org.symphonyoss.s2.common.hash.Hash messageId​(String tenantId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId)
      Create a 2.0 Hash (ID) for the given messageId.
      org.symphonyoss.s2.common.hash.Hash objectStatusId​(String tenantId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId, org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
      Create a 2.0 Hash (ID) for an object status of the given messageId for the given userId.
      org.symphonyoss.s2.common.hash.Hash offlineNoticeId​(String tenantId, long toUserId, byte[] messageId)
      Create a 2.0 Hash (ID) for an offline notification event.
      org.symphonyoss.s2.common.hash.Hash offlineNoticeId​(String tenantId, long toUserId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId)
      Create a 2.0 Hash (ID) for an offline notification event.
      org.symphonyoss.s2.common.hash.Hash presenceChangeId​(String tenantId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId)
      Create a 2.0 Hash (ID) for the given presence change message.
      org.symphonyoss.s2.common.hash.Hash readReceiptId​(String tenantId, long userId, byte[] messageId, byte[] threadId)
      Create a 2.0 Hash (ID) for the read receipt of the given messageId for the given userId.
      org.symphonyoss.s2.common.hash.Hash readReceiptId​(String tenantId, long userId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId, org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
      Create a 2.0 Hash (ID) for the read receipt of the given messageId for the given userId.
      org.symphonyoss.s2.common.hash.Hash signalId​(String tenantId, org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId)
      Create a 2.0 Hash (ID) for the given signal messageId.
      org.symphonyoss.s2.common.hash.Hash threadId​(String tenantId, byte[] threadId)
      Create a 2.0 Hash (ID) for the given threadId.
      org.symphonyoss.s2.common.hash.Hash threadId​(String tenantId, org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
      Create a 2.0 Hash (ID) for the given threadId.
      org.symphonyoss.s2.common.hash.Hash userId​(long userId)
      Create a 2.0 Hash (ID) for the given userId.
    • Constructor Detail

      • LegacyIdFactory

        public LegacyIdFactory()
    • Method Detail

      • userId

        public org.symphonyoss.s2.common.hash.Hash userId​(long userId)
        Create a 2.0 Hash (ID) for the given userId.
        Parameters:
        userId - An external userId
        Returns:
        The 2.0 object ID for the mirror of the given ID.
      • signalId

        public org.symphonyoss.s2.common.hash.Hash signalId​(String tenantId,
                                                            org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId)
        Create a 2.0 Hash (ID) for the given signal messageId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        messageId - A messageId
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • presenceChangeId

        public org.symphonyoss.s2.common.hash.Hash presenceChangeId​(String tenantId,
                                                                    org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId)
        Create a 2.0 Hash (ID) for the given presence change message.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        messageId - A messageId
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • messageId

        public org.symphonyoss.s2.common.hash.Hash messageId​(String tenantId,
                                                             byte[] messageId)
        Create a 2.0 Hash (ID) for the given messageId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        messageId - A messageId
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • messageId

        public org.symphonyoss.s2.common.hash.Hash messageId​(String tenantId,
                                                             org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId)
        Create a 2.0 Hash (ID) for the given messageId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        messageId - A messageId
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • threadId

        public org.symphonyoss.s2.common.hash.Hash threadId​(String tenantId,
                                                            byte[] threadId)
        Create a 2.0 Hash (ID) for the given threadId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        threadId - A threadId
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • threadId

        public org.symphonyoss.s2.common.hash.Hash threadId​(String tenantId,
                                                            org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
        Create a 2.0 Hash (ID) for the given threadId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        threadId - A threadId
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • objectStatusId

        public org.symphonyoss.s2.common.hash.Hash objectStatusId​(String tenantId,
                                                                  org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId,
                                                                  org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
        Create a 2.0 Hash (ID) for an object status of the given messageId for the given userId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        messageId - The id of the message read.
        threadId - The threadId of the message read.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • readReceiptId

        public org.symphonyoss.s2.common.hash.Hash readReceiptId​(String tenantId,
                                                                 long userId,
                                                                 byte[] messageId,
                                                                 byte[] threadId)
        Create a 2.0 Hash (ID) for the read receipt of the given messageId for the given userId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        userId - The external (globally unique) user ID or the user who read the message.
        messageId - The id of the message read.
        threadId - The threadId of the message read.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • readReceiptId

        public org.symphonyoss.s2.common.hash.Hash readReceiptId​(String tenantId,
                                                                 long userId,
                                                                 org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId,
                                                                 org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
        Create a 2.0 Hash (ID) for the read receipt of the given messageId for the given userId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        userId - The external (globally unique) user ID or the user who read the message.
        messageId - The id of the message read.
        threadId - The threadId of the message read.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • deliveryReceiptId

        public org.symphonyoss.s2.common.hash.Hash deliveryReceiptId​(String tenantId,
                                                                     long userId,
                                                                     byte[] messageId,
                                                                     byte[] threadId)
        Create a 2.0 Hash (ID) for the delivery receipt of the given messageId for the given userId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        userId - The external (globally unique) user ID or the user who read the message.
        messageId - The id of the message read.
        threadId - The threadId of the message read.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • deliveryReceiptId

        public org.symphonyoss.s2.common.hash.Hash deliveryReceiptId​(String tenantId,
                                                                     long userId,
                                                                     org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId,
                                                                     org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
        Create a 2.0 Hash (ID) for the delivery receipt of the given messageId for the given userId.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        userId - The external (globally unique) user ID or the user who read the message.
        messageId - The id of the message read.
        threadId - The threadId of the message read.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • maestroId

        public org.symphonyoss.s2.common.hash.Hash maestroId​(String tenantId,
                                                             byte[] messageId,
                                                             @Nullable
                                                             byte[] threadId)
        Create a 2.0 Hash (ID) for a MaestroMessage.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        messageId - The message ID.
        threadId - The thread ID.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • maestroId

        public org.symphonyoss.s2.common.hash.Hash maestroId​(String tenantId,
                                                             org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId,
                                                             @Nullable
                                                             org.symphonyoss.s2.common.immutable.ImmutableByteArray threadId)
        Create a 2.0 Hash (ID) for a MaestroMessage.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        messageId - The message ID.
        threadId - The thread ID.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • offlineNoticeId

        public org.symphonyoss.s2.common.hash.Hash offlineNoticeId​(String tenantId,
                                                                   long toUserId,
                                                                   byte[] messageId)
        Create a 2.0 Hash (ID) for an offline notification event.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated. This event means that a user was offline when a message was delivered and an email was sent to them.
        toUserId - The id of the offline user.
        messageId - The message ID.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • offlineNoticeId

        public org.symphonyoss.s2.common.hash.Hash offlineNoticeId​(String tenantId,
                                                                   long toUserId,
                                                                   org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId)
        Create a 2.0 Hash (ID) for an offline notification event.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated. This event means that a user was offline when a message was delivered and an email was sent to them.
        toUserId - The id of the offline user.
        messageId - The message ID.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • deleteEventId

        public org.symphonyoss.s2.common.hash.Hash deleteEventId​(String tenantId,
                                                                 long requesterId,
                                                                 byte[] deleteMessageId)
        Create a 2.0 Hash (ID) for a DeleteEvent.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        requesterId - The id of the requesting user.
        deleteMessageId - The message ID of the deleted message.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • deleteEventId

        public org.symphonyoss.s2.common.hash.Hash deleteEventId​(String tenantId,
                                                                 long requesterId,
                                                                 org.symphonyoss.s2.common.immutable.ImmutableByteArray deleteMessageId)
        Create a 2.0 Hash (ID) for a DeleteEvent.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        requesterId - The id of the requesting user.
        deleteMessageId - The message ID of the deleted message.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • downloadAttachmentEventId

        public org.symphonyoss.s2.common.hash.Hash downloadAttachmentEventId​(String tenantId,
                                                                             long downloadedByUserId,
                                                                             byte[] messageId,
                                                                             String fileId)
        Create a 2.0 Hash (ID) for a DownloadAttachmentEvent.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        downloadedByUserId - The user ID of the user downloading the attachment.
        messageId - The message ID of the attachment.
        fileId - The file ID of the attachment.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • downloadAttachmentEventId

        public org.symphonyoss.s2.common.hash.Hash downloadAttachmentEventId​(String tenantId,
                                                                             long downloadedByUserId,
                                                                             org.symphonyoss.s2.common.immutable.ImmutableByteArray messageId,
                                                                             String fileId)
        Create a 2.0 Hash (ID) for a DownloadAttachmentEvent.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        downloadedByUserId - The user ID of the user downloading the attachment.
        messageId - The message ID of the attachment.
        fileId - The file ID of the attachment.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • likeEventId

        public org.symphonyoss.s2.common.hash.Hash likeEventId​(String tenantId,
                                                               long liker,
                                                               byte[] likedMessageId)
        Create a 2.0 Hash (ID) for a LikeEvent.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        liker - The user ID of the user sending the like.
        likedMessageId - The message ID of liked message.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.
      • likeEventId

        public org.symphonyoss.s2.common.hash.Hash likeEventId​(String tenantId,
                                                               long liker,
                                                               org.symphonyoss.s2.common.immutable.ImmutableByteArray likedMessageId)
        Create a 2.0 Hash (ID) for a LikeEvent.
        Parameters:
        tenantId - The tenant ID of the pod where this event originated.
        liker - The user ID of the user sending the like.
        likedMessageId - The message ID of liked message.
        Returns:
        The 2.0 object ID for the mirror of the given ID.
        Throws:
        NullPointerException - if any parameter is null.