Class LicenseAgreement


  • public class LicenseAgreement
    extends java.lang.Object
    Class to hold a license agreement in various languages.
    Author:
    Christopher Mindus
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static LicenseAgreementcreateLicenseAgreement​(java.lang.String name, java.lang.String languageCode, java.lang.String description, java.lang.String text)
      Creates a new license agreement, possibly replacing an old one with this one for the defined texts.
      java.lang.StringgetAgreementText()
      Gets the text of the agreement and loads it from the database if not yet done.
      booleanisNotApplicable()
      Checks if this agreement is of "not-applicable" type.
      static voidmain​(java.lang.String[] args)
      Add one or several license agreements.
      java.lang.StringtoString()
      Returns the debug string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • isNotApplicable

        public boolean isNotApplicable()
        Checks if this agreement is of "not-applicable" type.
        Returns:
        true if name is "n/a", false otherwise.
      • getAgreementText

        public java.lang.String getAgreementText()
        Gets the text of the agreement and loads it from the database if not yet done.
        Returns:
        The Agreement text or "Failed loading agreement" in case of error from database.
      • toString

        public java.lang.String toString()
        Returns the debug string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The debug string.
      • createLicenseAgreement

        public static LicenseAgreement createLicenseAgreement​(java.lang.String name,
                                                              java.lang.String languageCode,
                                                              java.lang.String description,
                                                              java.lang.String text)
                                                       throws java.sql.SQLException,
                                                              NotFoundException
        Creates a new license agreement, possibly replacing an old one with this one for the defined texts.
        Parameters:
        name - The agreement short name.
        languageCode - The language code (made lower case with '_' replaced with '-'.
        description - Short description of the agreement.
        text - The license agreement text, (with LF, CR/LF is replaced with just LF's).
        Returns:
        The newly created agreement.
        Throws:
        NotFoundException - If none is found (shouldn't happen).
        java.sql.SQLException - For SQL exceptions.
      • main

        public static void main​(java.lang.String[] args)
        Add one or several license agreements.
        Parameters:
        args - The arguments:
        1. name
        2. description
        3. languageCode (e.g. "en", "fr" or "en-uk".
        4. fileName (the file name of agreement).
        5. languageCode (etc)
        6. fileName (etc)).