Skip to content

Content Importer Concept

christian-bernet edited this page Oct 30, 2019 · 6 revisions

Run import from command line with:

java -jar shell-1.0-SNAPSHOT.jar --shell.argument.for.doImport.path={{pathToDirectory}} --shell.argument.for.doImport.importerId={{importerIdName}} --shell.argument.for.doImport.delete.playerState=true

Details

  • Folder structure is generated with generate-template-files command
  • Import concept works for single Topic only
  • Each import mode imports the files from the given directory structure
  • For each entity there is one file in json format
  • Files are located in nested folders with order like a relation in the database
  • Resources are in the folder resources and in the entity-file there is the filename of the file
  • delete.playerState=true will delete all game state of all players for this topic! So do not do that on production system!

   

Example for generating folder structure

  • update attached import-config.json file for the specific Topic
  • run command in shell:
         generate-template-files /path/to/import-config.json

Folder structure will be created in the same directory as import-config.json in folder named "generated", like in the image below

Example for inserting a Topic

In the shell write commands like in the example below.

Important: run commands in the same order like in the example

Adding missing relations to the files:

  • topic: update "startPage" in topic.json with the relative path to topic.json file
  • page transitions: update "to" with the relative path to the next page
  • page transitions criteria: update "affectedExercise" or "affectedPage" with the relative path to the affectedExercise or affectedPage
  • run:
    do-import {/path/to/folder} name_of_the_hidden_folder true
  • hidden folder will be created with the provided name
  • entities will be inserted in DB and IDs of them will be written in the related json files in the hidden folder.
  • IMPORTANT: running same command again will trigger update.

At this point all entities should be inserted in the database! After this point:

  • running the same command will trigger UPDATE
  • for OVERRIDE run:
do-import {/path/to/folder} name_of_the_hidden_folder true

Topic-File

  • Title
  • Icon
  • StartPageID
  • ....

Chapter-Files

  • Title
  • Icon
  • ...

Storyline-Files

  • Title
  • Icon
  • ...

Page-Files

A page file contains everything related to the page, except the page transitions

 The file contains:

  • information about the page
  • Components (including Exercise)
  • Chapter ID
  • ...

PageTransition-Files

A pageTransition file contains everything related to the pageTransition

The file contains:

  • fromPage
  • toPage
  • Criteria with PageID or ExerciseID
  • ...