Class PollMessageExternalKeyConverter

java.lang.Object
google.registry.model.poll.PollMessageExternalKeyConverter

public final class PollMessageExternalKeyConverter extends Object
A converter between external key strings for PollMessages (i.e. what registrars use to identify and ACK them) and VKeys to the resource.

The format of the key string is A-B as follows:

   A = PollMessage.id (decimal)
   B = PollMessage.eventTime (decimal, year only)
 

A typical poll message ID might thus look like: 10072612074-2018

  • Method Details

    • makePollMessageExternalId

      public static String makePollMessageExternalId(PollMessage pollMessage)
      Returns an external poll message ID for the given poll message.
    • parsePollMessageExternalId

      public static VKey<PollMessage> parsePollMessageExternalId(String externalKey)
      Returns a VKey to a PollMessage corresponding with the external ID.

      Note that the year field that is included at the end of the poll message isn't actually used for anything; it exists solely to create unique externally visible IDs for autorenews. We thus ignore it (for now) for backwards compatibility reasons, so that registrars can still ACK existing poll message IDs they may have lying around.

      Throws:
      PollMessageExternalKeyConverter.PollMessageExternalKeyParseException - if the external key has an invalid format.