-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from pstlab/moving-to-war
Moving to war
- Loading branch information
Showing
153 changed files
with
6,895 additions
and
6,050 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,7 +0,0 @@ | ||
/server/target/ | ||
/client/target/ | ||
/ale-api/target/ | ||
/server/derby.log | ||
/server/activemq-data/ | ||
/server/db/ | ||
/server/nbproject/ | ||
File renamed without changes.
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,26 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>it.cnr.istc</groupId> | ||
<artifactId>LECTurE-API</artifactId> | ||
<version>1.0</version> | ||
<packaging>jar</packaging> | ||
<dependencies> | ||
<dependency> | ||
<groupId>javax.json.bind</groupId> | ||
<artifactId>javax.json.bind-api</artifactId> | ||
<version>1.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.json</groupId> | ||
<artifactId>javax.json-api</artifactId> | ||
<version>1.1</version> | ||
<type>jar</type> | ||
</dependency> | ||
</dependencies> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
</project> |
35 changes: 35 additions & 0 deletions
35
LECTurE-API/src/main/java/it/cnr/istc/lecture/api/Credentials.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,35 @@ | ||
/* | ||
* Copyright (C) 2018 Riccardo De Benedictis | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package it.cnr.istc.lecture.api; | ||
|
||
/** | ||
* | ||
* @author Riccardo De Benedictis | ||
*/ | ||
public class Credentials { | ||
|
||
public String email; | ||
public String password; | ||
|
||
public Credentials() { | ||
} | ||
|
||
public Credentials(String email, String password) { | ||
this.email = email; | ||
this.password = password; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
LECTurE-API/src/main/java/it/cnr/istc/lecture/api/EventListAdapter.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,53 @@ | ||
/* | ||
* Copyright (C) 2018 Riccardo De Benedictis | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package it.cnr.istc.lecture.api; | ||
|
||
import it.cnr.istc.lecture.api.messages.Event; | ||
import it.cnr.istc.lecture.api.messages.EventAdapter; | ||
import java.util.ArrayList; | ||
import javax.json.Json; | ||
import javax.json.JsonArray; | ||
import javax.json.JsonArrayBuilder; | ||
import javax.json.JsonValue; | ||
import javax.json.bind.adapter.JsonbAdapter; | ||
|
||
/** | ||
* | ||
* @author Riccardo De Benedictis | ||
*/ | ||
public class EventListAdapter implements JsonbAdapter<ArrayList<Event>, JsonArray> { | ||
|
||
private static final EventAdapter EVENT_ADAPTER = new EventAdapter(); | ||
|
||
@Override | ||
public JsonArray adaptToJson(ArrayList<Event> obj) throws Exception { | ||
JsonArrayBuilder es_builder = Json.createArrayBuilder(); | ||
for (Event event : obj) { | ||
es_builder.add(Json.createObjectBuilder(EVENT_ADAPTER.adaptToJson(event))); | ||
} | ||
return es_builder.build(); | ||
} | ||
|
||
@Override | ||
public ArrayList<Event> adaptFromJson(JsonArray obj) throws Exception { | ||
ArrayList<Event> es = new ArrayList<>(obj.size()); | ||
for (JsonValue e_value : obj) { | ||
es.add(EVENT_ADAPTER.adaptFromJson(e_value.asJsonObject())); | ||
} | ||
return es; | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
LECTurE-API/src/main/java/it/cnr/istc/lecture/api/InitResponse.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,62 @@ | ||
/* | ||
* Copyright (C) 2018 Riccardo De Benedictis | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package it.cnr.istc.lecture.api; | ||
|
||
import it.cnr.istc.lecture.api.model.LessonModel; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
/** | ||
* | ||
* @author Riccardo De Benedictis | ||
*/ | ||
public class InitResponse { | ||
|
||
public User user; | ||
/** | ||
* The lessons followed as a student. | ||
*/ | ||
public ArrayList<Lesson> following_lessons; | ||
/** | ||
* The followed teachers. | ||
*/ | ||
public ArrayList<User> teachers; | ||
/** | ||
* The associated lesson models. | ||
*/ | ||
public ArrayList<LessonModel> models; | ||
/** | ||
* The lessons followed as a teacher. | ||
*/ | ||
public ArrayList<Lesson> teaching_lessons; | ||
/** | ||
* The followed students. | ||
*/ | ||
public ArrayList<User> students; | ||
|
||
public InitResponse() { | ||
} | ||
|
||
public InitResponse(User user, Collection<Lesson> following_lessons, Collection<User> teachers, Collection<LessonModel> models, Collection<Lesson> teaching_lessons, Collection<User> students) { | ||
this.user = user; | ||
this.following_lessons = new ArrayList<>(following_lessons); | ||
this.teachers = new ArrayList<>(teachers); | ||
this.models = new ArrayList<>(models); | ||
this.teaching_lessons = new ArrayList<>(teaching_lessons); | ||
this.students = new ArrayList<>(students); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
LECTurE-API/src/main/java/it/cnr/istc/lecture/api/Lesson.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,66 @@ | ||
/* | ||
* Copyright (C) 2018 Riccardo De Benedictis | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package it.cnr.istc.lecture.api; | ||
|
||
import it.cnr.istc.lecture.api.messages.Event; | ||
import it.cnr.istc.lecture.api.messages.Token; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import javax.json.bind.annotation.JsonbTypeAdapter; | ||
|
||
/** | ||
* | ||
* @author Riccardo De Benedictis | ||
*/ | ||
public class Lesson { | ||
|
||
public long id; | ||
public long teacher_id; | ||
public String name; | ||
public LessonState state; | ||
public long time; | ||
public Long model; | ||
public HashMap<String, Long> roles; | ||
@JsonbTypeAdapter(EventListAdapter.class) | ||
public ArrayList<Event> events; | ||
public ArrayList<Token> tokens; | ||
|
||
public Lesson() { | ||
} | ||
|
||
public Lesson(long id, long teacher_id, String name, LessonState state, long time, Long model, Map<String, Long> roles, Collection<Event> events, Collection<Token> tokens) { | ||
this.id = id; | ||
this.teacher_id = teacher_id; | ||
this.name = name; | ||
this.state = state; | ||
this.time = time; | ||
this.model = model; | ||
this.roles = new HashMap<>(roles); | ||
if (events != null) { | ||
this.events = new ArrayList<>(events); | ||
} | ||
if (tokens != null) { | ||
this.tokens = new ArrayList<>(tokens); | ||
} | ||
} | ||
|
||
public enum LessonState { | ||
Running, Paused, Stopped | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
LECTurE-API/src/main/java/it/cnr/istc/lecture/api/NewLessonRequest.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,51 @@ | ||
/* | ||
* Copyright (C) 2018 Riccardo De Benedictis | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package it.cnr.istc.lecture.api; | ||
|
||
import it.cnr.istc.lecture.api.model.LessonModel; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* | ||
* @author Riccardo De Benedictis | ||
*/ | ||
public class NewLessonRequest { | ||
|
||
public long teacher_id; | ||
public String lesson_name; | ||
public Long lesson_model_id; | ||
public LessonModel model; | ||
public HashMap<String, Long> roles; | ||
|
||
public NewLessonRequest() { | ||
} | ||
|
||
public NewLessonRequest(long teacher_id, String lesson_name, Long lesson_model_id, Map<String, Long> roles) { | ||
this.teacher_id = teacher_id; | ||
this.lesson_name = lesson_name; | ||
this.lesson_model_id = lesson_model_id; | ||
this.roles = new HashMap<>(roles); | ||
} | ||
|
||
public NewLessonRequest(long teacher_id, String lesson_name, LessonModel model, Map<String, Long> roles) { | ||
this.teacher_id = teacher_id; | ||
this.lesson_name = lesson_name; | ||
this.model = model; | ||
this.roles = new HashMap<>(roles); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
LECTurE-API/src/main/java/it/cnr/istc/lecture/api/NewUserRequest.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,39 @@ | ||
/* | ||
* Copyright (C) 2018 Riccardo De Benedictis | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package it.cnr.istc.lecture.api; | ||
|
||
/** | ||
* | ||
* @author Riccardo De Benedictis | ||
*/ | ||
public class NewUserRequest { | ||
|
||
public String email; | ||
public String password; | ||
public String first_name; | ||
public String last_name; | ||
|
||
public NewUserRequest() { | ||
} | ||
|
||
public NewUserRequest(String email, String password, String first_name, String last_name) { | ||
this.email = email; | ||
this.password = password; | ||
this.first_name = first_name; | ||
this.last_name = last_name; | ||
} | ||
} |
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.