-
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.
Merge pull request #49 from pastore99/46-fix-correction-of-the-links-…
…of-the-user-pages-with-the-exercise-pages-and-addition-of-the-new-report-page 46 fix correction of the links of the user pages with the exercise pages and addition of the new report page
- Loading branch information
Showing
50 changed files
with
1,151 additions
and
874 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,229 +0,0 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.example</groupId> | ||
<artifactId>TalkAID</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>TalkAID</name> | ||
<packaging>war</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<junit.version>5.10.0</junit.version> | ||
<sonar.organization>panuozzo77</sonar.organization> | ||
<sonar.host.url>https://sonarcloud.io</sonar.host.url> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>central</id> | ||
<name>Maven Repository Switchboard</name> | ||
<url>https://repo1.maven.org/maven2/</url> | ||
<layout>default</layout> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.11.0</version> | ||
</dependency> | ||
|
||
|
||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
<version>2.10.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>8.0.28</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>jakarta.servlet</groupId> | ||
<artifactId>jakarta.servlet-api</artifactId> | ||
<version>6.0.0</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.mindrot</groupId> | ||
<artifactId>jbcrypt</artifactId> | ||
<version>0.4</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.sun.mail</groupId> | ||
<artifactId>jakarta.mail</artifactId> | ||
<version>1.6.5</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.json</groupId> | ||
<artifactId>javax.json-api</artifactId> | ||
<version>1.1.4</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.glassfish</groupId> | ||
<artifactId>javax.json</artifactId> | ||
<version>1.1.4</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>5.3.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
<version>2.10.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.mockrunner</groupId> | ||
<artifactId>mockrunner-servlet</artifactId> | ||
<version>2.0.7</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.mockrunner</groupId> | ||
<artifactId>mockrunner-struts</artifactId> | ||
<version>2.0.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-text</artifactId> | ||
<version>1.3</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<version>3.1.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.microsoft.cognitiveservices.speech</groupId> | ||
<artifactId>client-sdk</artifactId> | ||
<version>1.34.0</version> | ||
</dependency> | ||
|
||
|
||
<dependency> | ||
<groupId>info.debatty</groupId> | ||
<artifactId>java-string-similarity</artifactId> | ||
<version>RELEASE</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.12.1</version> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.2.1</version> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>3.4.0</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.2</version> | ||
<configuration> | ||
<argLine> | ||
-Xmx1024M ${argLine} | ||
</argLine> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>0.8.10</version> | ||
<executions> | ||
<execution> | ||
<id>prepare-agent</id> | ||
<goals> | ||
<goal>prepare-agent</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>jacoco-report</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>report</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>report</id> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>report-aggregate</goal> | ||
</goals> | ||
<configuration> | ||
<dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile> | ||
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory> | ||
<append>false</append> | ||
<formats> | ||
<format>XML</format> | ||
</formats> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>jacoco-check</id> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
<configuration> | ||
<rules> | ||
<rule> | ||
<element>PACKAGE</element> | ||
<limits> | ||
<limit> | ||
<counter>LINE</counter> | ||
<value>COVEREDRATIO</value> | ||
<minimum>0.0</minimum> | ||
</limit> | ||
</limits> | ||
</rule> | ||
</rules> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> | ||
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import model.service.schedule.ScheduleManager; | ||
import model.service.email.EmailManager; | ||
import model.service.encryption.Encryption; | ||
import model.DAO.DAOUser; | ||
|
@@ -8,11 +9,19 @@ | |
|
||
public class Main { | ||
public static void main(String[] args) { | ||
Authenticator auth = new Authenticator(); | ||
Registration r = new Registration(); | ||
//Authenticator auth = new Authenticator(); | ||
//Registration r = new Registration(); | ||
|
||
System.out.println(auth.authenticate("[email protected]", "pwd")); | ||
System.out.println(auth.authenticate("[email protected]", "pwd")); | ||
r.invitePatient(9, "[email protected]", "Raffaele", "Monti"); | ||
//System.out.println(auth.authenticate("[email protected]", "pwd")); | ||
//System.out.println(auth.authenticate("[email protected]", "pwd")); | ||
//r.invitePatient(9, "[email protected]", "Raffaele", "Monti"); | ||
|
||
ScheduleManager manager = new ScheduleManager(); | ||
String date = "2024-02-10"; | ||
String time = "10:00-11:00"; | ||
if(manager.checkData(9, date, time)) { | ||
System.out.println("inif"); | ||
manager.createNewSchedule(9, date, time); //funziona | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,76 +0,0 @@ | ||
package controller; | ||
|
||
import model.service.exercise.ExerciseManager; | ||
import org.apache.commons.io.IOUtils; | ||
|
||
import javax.servlet.RequestDispatcher; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.MultipartConfig; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.*; | ||
import javax.sql.rowset.serial.SerialBlob; | ||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.charset.StandardCharsets; | ||
import java.sql.Blob; | ||
import java.sql.Date; | ||
import java.sql.SQLException; | ||
|
||
@WebServlet("/exerciseLogger") | ||
@MultipartConfig | ||
public class ExerciseLogger extends HttpServlet { | ||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { | ||
String contentType = request.getContentType(); | ||
|
||
if ("application/json".equals(contentType)) { | ||
handleNoAudioExercise(request); | ||
} else { | ||
handleAudioExercise(request); | ||
} | ||
RequestDispatcher d = request.getRequestDispatcher("/exerciseEvaluator"); | ||
d.forward(request, response); | ||
} | ||
|
||
private void handleNoAudioExercise(HttpServletRequest request) throws IOException { | ||
BufferedReader reader = request.getReader(); | ||
StringBuilder stringBuilder = new StringBuilder(); | ||
String line; | ||
while ((line = reader.readLine()) != null) { | ||
stringBuilder.append(line); | ||
} | ||
String execution = stringBuilder.toString(); | ||
|
||
try { | ||
byte[] bytes = execution.getBytes(StandardCharsets.UTF_8); | ||
Blob executionBlob = new SerialBlob(bytes); | ||
saveInDB(request, executionBlob); | ||
|
||
} catch (SQLException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private void handleAudioExercise(HttpServletRequest request) throws ServletException, IOException { | ||
|
||
try { | ||
Part audioPart = request.getPart("audioFile"); | ||
try (InputStream audioInputStream = audioPart.getInputStream()) { | ||
Blob audioBlob = new SerialBlob(IOUtils.toByteArray(audioInputStream)); | ||
saveInDB(request, audioBlob); | ||
} | ||
} catch (SQLException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
private boolean saveInDB(HttpServletRequest request, Blob execution){ | ||
ExerciseManager em = new ExerciseManager(); | ||
HttpSession session = request.getSession(); | ||
int userId = (int) session.getAttribute("id"); | ||
int exerciseId = (int) session.getAttribute("exerciseID"); | ||
Date insertDate = (Date) session.getAttribute("insertDate"); | ||
|
||
return em.saveExecution(userId, exerciseId, insertDate, execution); | ||
} | ||
} | ||
Oops, something went wrong.