-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/dialog-exercise' into dev-backend
- Loading branch information
Showing
8 changed files
with
292 additions
and
3 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
core/src/main/java/ch/uzh/marugoto/core/data/entity/Character.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package ch.uzh.marugoto.core.data.entity; | ||
|
||
import com.arangodb.springframework.annotation.Document; | ||
|
||
import org.springframework.data.annotation.Id; | ||
|
||
@Document | ||
public class Character { | ||
@Id | ||
private String id; | ||
private Salutation salutation; | ||
private String firstname; | ||
private String lastname; | ||
private String mail; | ||
private ImageResource image; | ||
|
||
public Character() { | ||
super(); | ||
} | ||
|
||
public Character(Salutation salutation, String firstname, String lastname, String mail) { | ||
this(); | ||
this.salutation = salutation; | ||
this.firstname = firstname; | ||
this.lastname = lastname; | ||
this.mail = mail; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public Salutation getSalutation() { | ||
return salutation; | ||
} | ||
|
||
public void setSalutation(Salutation salutation) { | ||
this.salutation = salutation; | ||
} | ||
|
||
public String getFirstname() { | ||
return firstname; | ||
} | ||
|
||
public void setFirstname(String firstname) { | ||
this.firstname = firstname; | ||
} | ||
|
||
public String getLastname() { | ||
return lastname; | ||
} | ||
|
||
public void setLastname(String lastname) { | ||
this.lastname = lastname; | ||
} | ||
|
||
public String getMail() { | ||
return mail; | ||
} | ||
|
||
public void setMail(String mail) { | ||
this.mail = mail; | ||
} | ||
|
||
public ImageResource getImage() { | ||
return image; | ||
} | ||
|
||
public void setImage(ImageResource image) { | ||
this.image = image; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
core/src/main/java/ch/uzh/marugoto/core/data/entity/DialogExercise.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package ch.uzh.marugoto.core.data.entity; | ||
|
||
import com.arangodb.springframework.annotation.Ref; | ||
|
||
/** | ||
* Dialog exercise on page | ||
* If placeholder text is not defined, dialog is shown immediately | ||
* Requires Speaker and DialogSpeech | ||
*/ | ||
public class DialogExercise extends Exercise { | ||
|
||
private String placeholderText; | ||
private boolean showOnPageLoad; | ||
private Character speaker; | ||
@Ref | ||
private DialogSpeech speech; | ||
|
||
public DialogExercise() { | ||
super(); | ||
} | ||
|
||
public DialogExercise(String placeholderText, Character speaker, DialogSpeech dialogSpeech) { | ||
this(); | ||
this.placeholderText = placeholderText; | ||
this.speaker = speaker; | ||
this.speech = dialogSpeech; | ||
} | ||
|
||
public String getPlaceholderText() { | ||
return placeholderText; | ||
} | ||
|
||
public void setPlaceholderText(String placeholderText) { | ||
this.placeholderText = placeholderText; | ||
} | ||
|
||
public boolean isShownOnPageLoad() { | ||
return placeholderText == null; | ||
} | ||
|
||
public Character getSpeaker() { | ||
return speaker; | ||
} | ||
|
||
public void setSpeaker(Character speaker) { | ||
this.speaker = speaker; | ||
} | ||
|
||
public DialogSpeech getSpeech() { | ||
return speech; | ||
} | ||
|
||
public void setSpeech(DialogSpeech speech) { | ||
this.speech = speech; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
core/src/main/java/ch/uzh/marugoto/core/data/entity/DialogResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package ch.uzh.marugoto.core.data.entity; | ||
|
||
|
||
import com.arangodb.springframework.annotation.Edge; | ||
import com.arangodb.springframework.annotation.From; | ||
import com.arangodb.springframework.annotation.Ref; | ||
import com.arangodb.springframework.annotation.To; | ||
|
||
import org.springframework.data.annotation.Id; | ||
|
||
/** | ||
* Answer for DialogSpeech which can point to another speech | ||
* or can trigger page transition | ||
*/ | ||
@Edge | ||
public class DialogResponse { | ||
@Id | ||
private String id; | ||
@From | ||
private DialogSpeech from; | ||
@To | ||
private DialogSpeech to; | ||
@Ref | ||
private PageTransition pageTransition; | ||
|
||
public DialogResponse() { | ||
super(); | ||
} | ||
|
||
public DialogResponse(DialogSpeech from, DialogSpeech to) { | ||
this(); | ||
this.from = from; | ||
this.to = to; | ||
} | ||
|
||
public DialogResponse(DialogSpeech from, DialogSpeech to, PageTransition pageTransition) { | ||
this(from, to); | ||
this.pageTransition = pageTransition; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public DialogSpeech getFrom() { | ||
return from; | ||
} | ||
|
||
public void setFrom(DialogSpeech from) { | ||
this.from = from; | ||
} | ||
|
||
public DialogSpeech getTo() { | ||
return to; | ||
} | ||
|
||
public void setTo(DialogSpeech to) { | ||
this.to = to; | ||
} | ||
|
||
public PageTransition getPageTransition() { | ||
return pageTransition; | ||
} | ||
|
||
public void setPageTransition(PageTransition pageTransition) { | ||
this.pageTransition = pageTransition; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
core/src/main/java/ch/uzh/marugoto/core/data/entity/DialogSpeech.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package ch.uzh.marugoto.core.data.entity; | ||
|
||
import com.arangodb.springframework.annotation.Document; | ||
import com.arangodb.springframework.annotation.Ref; | ||
|
||
import org.springframework.data.annotation.Id; | ||
|
||
/** | ||
* Dialog speech | ||
* Belongs to dialog exercise | ||
*/ | ||
@Document | ||
public class DialogSpeech { | ||
@Id | ||
private String id; | ||
private String markdownContent; | ||
@Ref | ||
private DialogExercise dialogExercise; | ||
|
||
public DialogSpeech() { | ||
super(); | ||
} | ||
|
||
public DialogSpeech(String markdownContent, DialogExercise dialogExercise) { | ||
this(); | ||
this.markdownContent = markdownContent; | ||
this.dialogExercise = dialogExercise; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getMarkdownContent() { | ||
return markdownContent; | ||
} | ||
|
||
public void setMarkdownContent(String markdownContent) { | ||
this.markdownContent = markdownContent; | ||
} | ||
|
||
public DialogExercise getDialogExercise() { | ||
return dialogExercise; | ||
} | ||
|
||
public void setDialogExercise(DialogExercise dialogExercise) { | ||
this.dialogExercise = dialogExercise; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
core/src/main/java/ch/uzh/marugoto/core/data/repository/CharacterRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ch.uzh.marugoto.core.data.repository; | ||
|
||
import com.arangodb.springframework.repository.ArangoRepository; | ||
|
||
import ch.uzh.marugoto.core.data.entity.Character; | ||
|
||
public interface CharacterRepository extends ArangoRepository<Character> { | ||
} |
16 changes: 16 additions & 0 deletions
16
core/src/main/java/ch/uzh/marugoto/core/data/repository/DialogResponseRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ch.uzh.marugoto.core.data.repository; | ||
|
||
import com.arangodb.springframework.annotation.Query; | ||
import com.arangodb.springframework.repository.ArangoRepository; | ||
|
||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
|
||
import ch.uzh.marugoto.core.data.entity.DialogResponse; | ||
|
||
public interface DialogResponseRepository extends ArangoRepository<DialogResponse> { | ||
|
||
@Query("FOR dialogSpeech, dialogResponse IN OUTBOUND @fromDialogSpeechId dialogResponse RETURN dialogResponse") | ||
List<DialogResponse> findByDialogSpeech(@Param("fromDialogSpeechId") String fromDialogSpeech); | ||
} |
8 changes: 8 additions & 0 deletions
8
core/src/main/java/ch/uzh/marugoto/core/data/repository/DialogSpeechRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ch.uzh.marugoto.core.data.repository; | ||
|
||
import com.arangodb.springframework.repository.ArangoRepository; | ||
|
||
import ch.uzh.marugoto.core.data.entity.DialogSpeech; | ||
|
||
public interface DialogSpeechRepository extends ArangoRepository<DialogSpeech> { | ||
} |