Class TopicsImportService

java.lang.Object
org.ctan.site.services.catalogue.AbstractImportService<TopicStore>
org.ctan.site.services.catalogue.TopicsImportService

public class TopicsImportService extends AbstractImportService<TopicStore>
This service deals with the topics from a file.

The file encoding is UTF-8.

 <topics>
   <topic name='aaa'>
     <en>
       <title>aaa-en-title</title>
       <description>aaa-en-desc</description>
       <teaser>aaa-en-teaser</teaser>
       <details>aaa-en-details</details>
     </en>
     <de>
       <title>aaa-de-title</title>
       <description>aaa-de-desc</description>
       <teaser>aaa-de-teaser</teaser>
       <details>aaa-de-details</details>
     </de>
   </topic>
   ...
 </topics>
 
  • The root node is topics.
  • The first level contains nodes of type topic.
    • The topic node has a mandatory attribute name.
    • The second level contains nodes of type en or de for the locale.
      • The topic node has a mandatory attribute name.
      • The third level contains nodes for the texts of type title, description, details, or teaser.
  • Constructor Details

    • TopicsImportService

      public TopicsImportService(@NonNull @NonNull File entries, @NonNull @NonNull TopicStore store)
      This is the constructor for TopicsImportService.
      Parameters:
      entries - the entries directory
      store - the topics store
  • Method Details

    • drop

      public void drop(List<Topic> topicsToBeDropped)
      The method drop provides means to drop some topics.
      Parameters:
      topicsToBeDropped - a list of topics to be dropped
    • updateExisting

      public List<Topic> updateExisting() throws IOException
      The method updateExisting provides means to parse an XML file and add the topics found to the database. As a side effect a list of topics is collected which are not in the XML files.
      Returns:
      the topics to be dropped
      Throws:
      IOException - in case of an I/O error