-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completed the manipolation of the exercise.
TODO: -Dynamic CSS loading based on the exercise -CSS of every exercise
- Loading branch information
Showing
9 changed files
with
211 additions
and
46 deletions.
There are no files selected for viewing
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
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,24 @@ | ||
package controller; | ||
|
||
import model.entity.ExerciseGlossary; | ||
import model.service.exercise.ExerciseManager; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
import org.apache.commons.text.StringEscapeUtils; | ||
|
||
@WebServlet("/exerciseController") | ||
public class ExerciseController extends HttpServlet { | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
ExerciseManager em = new ExerciseManager(); | ||
String id = request.getParameter("exerciseID"); | ||
ExerciseGlossary ex = em.getExercise(Integer.parseInt(id)); | ||
request.getSession().setAttribute("exercise", ex); | ||
response.sendRedirect(request.getContextPath() + "/JSP/exercise.jsp"); | ||
} | ||
} |
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
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
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,21 @@ | ||
package model.service.exercise; | ||
|
||
import model.DAO.DAOExerciseGlossary; | ||
import model.entity.ExerciseGlossary; | ||
|
||
import java.sql.Blob; | ||
|
||
public class ExerciseManager implements ExerciseManagerInterface { | ||
private DAOExerciseGlossary dao = new DAOExerciseGlossary(); | ||
public ExerciseGlossary getExercise(int exerciseID) { | ||
return dao.getExerciseByCode(exerciseID); | ||
} | ||
|
||
public Blob getExecution(int exerciseID, int userID) { | ||
return null; | ||
} | ||
|
||
public void saveExecution(int userID) { | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/model/service/exercise/ExerciseManagerInterface.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,29 @@ | ||
package model.service.exercise; | ||
|
||
import model.entity.ExerciseGlossary; | ||
|
||
import java.sql.Blob; | ||
|
||
public interface ExerciseManagerInterface { | ||
|
||
/** | ||
* Preleva un esercizio dal Database | ||
* @param exerciseID l'id dell'esercizio | ||
* @return l'oggetto esercizio | ||
*/ | ||
ExerciseGlossary getExercise(int exerciseID); | ||
|
||
/** | ||
* Preleva un'esecuzione di un esercizio | ||
* @param exerciseID l'id dell'esercizio | ||
* @param userID l'id dell'utente che ha svolto l'esercizio | ||
* @return un BLOB contenente l'esecuzione dell'esercizio | ||
*/ | ||
Blob getExecution(int exerciseID, int userID); | ||
|
||
/** | ||
* Salva l'esecuzione di un esercizio | ||
* @param userID l'id dell'utente che ha eseguito l'esercizio | ||
*/ | ||
void saveExecution(int userID); | ||
} |
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
Oops, something went wrong.