Class CCLicenseConnectorServiceImpl

  • All Implemented Interfaces:
    CCLicenseConnectorService, org.springframework.beans.factory.InitializingBean

    public class CCLicenseConnectorServiceImpl
    extends Object
    implements CCLicenseConnectorService, org.springframework.beans.factory.InitializingBean
    Implementation for the Creative commons license connector service. This class is responsible for all the calls to the CC license API and parsing the response
    • Field Detail

      • parser

        protected org.jdom.input.SAXBuilder parser
    • Constructor Detail

      • CCLicenseConnectorServiceImpl

        public CCLicenseConnectorServiceImpl()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        Exception
      • retrieveLicenses

        public Map<String,​CCLicense> retrieveLicenses​(String language)
        Retrieves the CC Licenses for the provided language from the CC License API
        Specified by:
        retrieveLicenses in interface CCLicenseConnectorService
        Parameters:
        language - - the language to retrieve the licenses for
        Returns:
        a map of licenses with the id and the license for the provided language
      • retrieveRightsByQuestion

        public String retrieveRightsByQuestion​(String licenseId,
                                               String language,
                                               Map<String,​String> answerMap)
        Retrieve the CC License URI based on the provided license id, language and answers to the field questions from the CC License API
        Specified by:
        retrieveRightsByQuestion in interface CCLicenseConnectorService
        Parameters:
        licenseId - - the ID of the license
        language - - the language for which to retrieve the full answerMap
        answerMap - - the answers to the different field questions
        Returns:
        the CC License URI
      • retrieveLicenseRDFDoc

        public org.jdom.Document retrieveLicenseRDFDoc​(String licenseURI)
                                                throws IOException
        Retrieve the license RDF document based on the license URI
        Specified by:
        retrieveLicenseRDFDoc in interface CCLicenseConnectorService
        Parameters:
        licenseURI - - The license URI for which to retrieve the license RDF document
        Returns:
        the license RDF document
        Throws:
        IOException
      • retrieveLicenseName

        public String retrieveLicenseName​(org.jdom.Document doc)
        Retrieve the license Name from the license document
        Specified by:
        retrieveLicenseName in interface CCLicenseConnectorService
        Parameters:
        doc - - The license document from which to retrieve the license name
        Returns:
        the license name