Skip to content

Commit

Permalink
Merge pull request #1 from pstlab/moving-to-war
Browse files Browse the repository at this point in the history
Moving to war
  • Loading branch information
riccardodebenedictis authored Apr 9, 2018
2 parents 5a63ee7 + d682d57 commit f4fb9c8
Show file tree
Hide file tree
Showing 153 changed files with 6,895 additions and 6,050 deletions.
7 changes: 0 additions & 7 deletions .gitignore
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.
26 changes: 26 additions & 0 deletions LECTurE-API/pom.xml
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 LECTurE-API/src/main/java/it/cnr/istc/lecture/api/Credentials.java
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;
}
}
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;
}
}
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 LECTurE-API/src/main/java/it/cnr/istc/lecture/api/Lesson.java
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
}
}
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);
}
}
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;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 sydde
* 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
Expand All @@ -14,12 +14,16 @@
* 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.ale.api;
package it.cnr.istc.lecture.api;

import java.util.Map;

/**
*
* @author Riccardo De Benedictis
*/
public enum LessonState {
Running, Paused, Stopped
public class Parameter {

public String name;
public Map<String, String> properties;
}
Loading

0 comments on commit f4fb9c8

Please sign in to comment.