Skip to content
Snippets Groups Projects
Commit 59290cd6 authored by KKlaue's avatar KKlaue
Browse files

Merge branch 'development_master' of https://github.com/juliandehne/fltrail into development_master

parents 93421657 bf53bbf3
No related branches found
No related tags found
No related merge requests found
Showing
with 568 additions and 1 deletion
package unipotsdam.gf.interfaces;
import unipotsdam.gf.modules.communication.model.chat.ChatMessage;
import unipotsdam.gf.modules.communication.model.chat.ChatRoom;
import unipotsdam.gf.modules.communication.model.user.User;
import unipotsdam.gf.modules.communication.model.user.UserCredentials;
import unipotsdam.gf.modules.communication.model.user.UserRegistrationInformation;
import java.util.List;
/**
* Provides connection to rocket chat
*/
public interface ICommunication {
/**
* related endpoint: https://rocket.chat/docs/developer-guides/rest-api/groups/history/
* get last 20 chat messages of specific chatroom
*
* @param roomId ID of room of user
* @return List of Chat Messages
*/
List<ChatMessage> getChatHistory(String roomId);
/**
* endpoint: https://rocket.chat/docs/developer-guides/rest-api/groups/create/
* creates chatroom
*
* @param name chat room name
* @param userIds member of chat by id; can be empty
* @return chat room id
*/
String createChatRoom(String name, List<String> userIds);
/**
* endpoint: https://rocket.chat/docs/developer-guides/rest-api/groups/invite/
*
* @param roomId chat room the user should be add to
* @param userId userID to add
* @return if user was added successfully
*/
boolean addUserToChatRoom(String roomId, String userId);
/**
* endpoint: https://rocket.chat/docs/developer-guides/rest-api/groups/settopic/
*
* @param roomId chat room where topic should be set
* @param topic topic of chat room
* @return true, if topic was set correctly
*/
boolean setChatRoomTopic(String roomId, String topic);
/**
* api: https://rocket.chat/docs/developer-guides/rest-api/groups/info/
* get information about the chat room
*
* @param roomId chat room id
* @return chat room information
*/
ChatRoom getChatRoomInfo(String roomId);
/**
* api: https://rocket.chat/docs/developer-guides/rest-api/authentication/login/
*
* @param userCredentials username and password
* @return information about user, especially authtoken for later use of endpoints
*/
User loginUser(UserCredentials userCredentials);
/**
* registers new user to rocket chat
*
* @param userRegistrationInformation registers user to rocket.chat
* @return user id
*/
String registerUser(UserRegistrationInformation userRegistrationInformation);
}
package unipotsdam.gf.interfaces;
/**
* Interface that defines a review for a students/groups contribution
*
* A review contains a feedback text and several scales which can be rated
* It can also be exported to certain formats.
*/
public interface IContributionReview {
/**
* sets the reviews feedbackText.
*
* @param feedbackText
*/
void setFeedbackText(String feedbackText);
/**
* returns the reviews feedbackText.
*
* @return feedbackText
*/
String getFeedbackText();
/**
* adds a rating scale to the review. The scales name and the maximum value
* that can be selected must be provided. The function returns an ID by
* which the scale can be accessed.
*
* TODO: maybe address scales by their name instead?
*
* @param description
* @param maxValue
* @return scaleID
*/
int addRatingScale(String description, int maxValue);
/**
* removes an existing scale from the review. The scale must be addressed by
* a scaleID that was returned when it was created.
*
* TODO: maybe not necessary anyway?
*
* @param scaleID
*/
void removeRatingScale(int scaleID);
/**
* sets the rating of an existing scale. Will throw an
* IllegalArgumentException if the rating is higher than possible.
*
* @param scaleID
* @param rating
*/
void setRatingForScale(int scaleID, int rating) throws IllegalArgumentException;
/**
* returns the rating of an existing scale, addressed by it's scaleID.
*
* @param scaleID
* @return rating
*/
int getRatingOfScale(int scaleID);
/**
* exports (or rather serializes) the review as an object so that it can be
* used by other applications.
*
* TODO: think of exportTypes
* @param exportType
* @return this object in another format
*/
String exportAs(String exportType);
/**
* override for toString. Might just call .exportAs() internally
* @return this objects String representation. Maybe not necessary, but nice
* for sure.
*/
@Override
String toString();
}
package unipotsdam.gf.interfaces;
import unipotsdam.gf.modules.journal.JournalEntry;
/**
* Interface for learning journal entry
*/
public interface IJournal {
/**
* Enum for visibility
*/
enum Visibility{ALL, STUDENT, DOZENT, NONE}
/**
* Add a new journal entry
*
* @param text text of the entry
* @param visibility visibility of the entry
*/
void addJournal(String text, Visibility visibility);
/**
* Change an existing journal entry
*
* @param newText the new text
*/
void editJournal(String newText);
/**
* Delete a journal entry
*
* @param journaId id of the entry
*/
void deleteJournal(long journaId);
/**
* change visibility of an entry
* @param journaId id of the entry
* @param visibility new visibility
*/
void setVisibility(long journaId, Visibility visibility);
/**
* Get specific journal entry
*
* @param journaId id of the entry
* @return JournalEntry from database
*/
JournalEntry getJournal(long journaId);
/**
* Get all JournalEntry for a project
*
* @param projectId id of project
* @return all JournalEnrys for that project
*/
JournalEntry getAllJournalEntrysProject(long projectId);
}
package unipotsdam.gf.interfaces;
import java.util.ArrayList;
/**
* Interface for Project Description
*/
public interface IProjectDescription {
/**
* Save description to database
* @param description
*/
void saveDescription(String description);
/**
* Add a new link to ProjectDescription
* @param link url of the link
* @param name name to shoe on website
*/
void addLink(String link, String name);
/**
* Delete link
* @param name name of the link
*/
void deleteLink(String name);
/**
* Get name of the project
* @param projectId Id of the project
* @return name of the project
*/
String getName(long projectId);
/**
* Get Description of the project
* @param projectId Id of the project
* @return Desription of the project
*/
String getDescription(long projectId);
/**
* Get Lecturer of the project
* @param projectId Id of the project
* @return Lecturer of the project
*/
long getLecturer(long projectId);
/**
* Get all Students of the project (Group)
* @param projectId Id of the Project
* @return Students of the project
*/
ArrayList<Long> getStudents(long projectId);
/**
* Get all Links of the project
* @param projectId Id of the Project
* @return all links of the project
*/
ArrayList<Long> getLinks(long projectId);
}
package unipotsdam.gf.interfaces;
import java.io.*;
/**
* Created by Johannes Zeiße on 30.05.2018.
......
package unipotsdam.gf.modules.communication.model.chat;
import java.time.Instant;
public class ChatMessage {
String id;
String message;
Instant timestamp;
String username;
public ChatMessage() {}
public ChatMessage(String id, String message, Instant timestamp, String username) {
this.id = id;
this.message = message;
this.timestamp = timestamp;
this.username = username;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Instant getTimestamp() {
return timestamp;
}
public void setTimestamp(Instant timestamp) {
this.timestamp = timestamp;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
package unipotsdam.gf.modules.communication.model.chat;
public class ChatRoom {
String id;
String name;
public ChatRoom() {}
public ChatRoom(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package unipotsdam.gf.modules.communication.model.user;
public class User {
String id;
String authToken;
public User() {}
public User(String id, String authToken) {
this.id = id;
this.authToken = authToken;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAuthToken() {
return authToken;
}
public void setAuthToken(String authToken) {
this.authToken = authToken;
}
}
package unipotsdam.gf.modules.communication.model.user;
public class UserCredentials {
String username;
String password;
public UserCredentials() {}
public UserCredentials(String username, String password) {
this.username = username;
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
package unipotsdam.gf.modules.communication.model.user;
public class UserRegistrationInformation {
private String username;
private String email;
private String pass;
private String name;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package unipotsdam.gf.modules.journal;
import unipotsdam.gf.interfaces.IJournal;
/**
* Prototype of JournalEntry Class
*/
public class JournalEntry {
long id;
long owner;
long project;
long timestamp;
IJournal.Visibility visibility;
String text;
public JournalEntry() {
}
public JournalEntry(long id, long owner, long project, long timestamp, IJournal.Visibility visibility, String text) {
this.id = id;
this.owner = owner;
this.project = project;
this.timestamp = timestamp;
this.visibility = visibility;
this.text = text;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getOwner() {
return owner;
}
public void setOwner(long owner) {
this.owner = owner;
}
public long getProject() {
return project;
}
public void setProject(long project) {
this.project = project;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public IJournal.Visibility getVisibility() {
return visibility;
}
public void setVisibility(IJournal.Visibility visibility) {
this.visibility = visibility;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public String toString() {
return "JournalEntry{" +
"id=" + id +
", owner=" + owner +
", project=" + project +
", timestamp=" + timestamp +
", visibility=" + visibility +
", text='" + text + '\'' +
'}';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment