Class RdeRevision

  • All Implemented Interfaces:
    UnsafeSerializable, java.io.Serializable, java.lang.Cloneable

    @Entity
    public final class RdeRevision
    extends UpdateAutoTimestampEntity
    Entity for tracking RDE revisions.

    This class is used by the RDE staging, upload, and reporting systems to determine the revision that should be used in the generated filename. It also determines whether or not a resend flag is included in the generated XML.

    See Also:
    Serialized Form
    • Method Detail

      • create

        public static RdeRevision create​(java.lang.String tld,
                                         org.joda.time.LocalDate date,
                                         RdeMode mode,
                                         int revision)
      • getRevision

        public int getRevision()
      • getNextRevision

        public static int getNextRevision​(java.lang.String tld,
                                          org.joda.time.DateTime date,
                                          RdeMode mode)
        Returns next revision ID to use when staging a new deposit file for the given triplet.
        Returns:
        0 for first deposit generation and >0 for resends
      • getCurrentRevision

        public static java.util.Optional<java.lang.Integer> getCurrentRevision​(java.lang.String tld,
                                                                               org.joda.time.DateTime date,
                                                                               RdeMode mode)
        Returns the latest revision of the report already generated for the given triplet.
      • saveRevision

        public static void saveRevision​(java.lang.String tld,
                                        org.joda.time.DateTime date,
                                        RdeMode mode,
                                        int revision)
        Sets the revision ID for a given triplet.

        This method verifies that the current revision is revision - 1, or that the object does not exist in the database if revision == 0.

        Throws:
        java.lang.IllegalStateException - if not in a transaction
        com.google.common.base.VerifyException - if the state doesn't meet the above criteria