Skip to content
Snippets Groups Projects
Commit ebc72112 authored by Julian Dehne's avatar Julian Dehne
Browse files

Merge branch 'development_master' of...

Merge branch 'development_master' of https://gitup.uni-potsdam.de/dehne/fltrail into development_master
parents 609b0162 504f8cbc
No related branches found
No related tags found
No related merge requests found
Showing
with 195 additions and 31 deletions
......@@ -11,4 +11,18 @@ Go to `Administration -> Allgemeines -> REST API -> Enable Personal Access Token
### Manual Personal Access Token
1. Click on your profile picture -> `Mein Konto` -> `Personal Access Token`
1. add a new personal access token
1. add it to configuration class `GFRocketChatConfig`
\ No newline at end of file
1. add it to configuration class `GFRocketChatConfig`
### Enable iframe integration
Dont mix up with General/Allegemeines->IFRAME INTEGRATION
Accounts/Konten->IFRAME:
1. click on enable
1. FOR API URL: http://141.89.53.195:8080/gemeinsamforschen/rest/chat/sso
localhost:8080/gemeinsamforschen/rest/chat/sso
1. FOR IFRAME URL: http://141.89.53.195:8080/gemeinsamforschen/rest/chat/login
localhost:8080/gemeinsamforschen/rest/chat/login
......@@ -69,6 +69,13 @@
<version>5.1.6</version>
</dependency>
<!-- converting html to java pojo -->
<!-- <dependency>
<groupId>fr.whimtrip</groupId>
<artifactId>whimtrip-ext-htmltopojo</artifactId>
<version>1.0.2</version>
</dependency>-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......
......@@ -3,11 +3,11 @@ package unipotsdam.gf.config;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
import unipotsdam.gf.interfaces.*;
import unipotsdam.gf.modules.annotation.controller.AnnotationController;
import unipotsdam.gf.modules.annotation.controller.FeedbackImpl;
import unipotsdam.gf.modules.assessment.controller.service.AssessmentDBCommunication;
import unipotsdam.gf.modules.assessment.controller.service.PeerAssessment;
import unipotsdam.gf.modules.communication.service.CommunicationService;
import unipotsdam.gf.modules.communication.service.UnirestService;
import unipotsdam.gf.modules.feedback.FeedbackImpl;
import unipotsdam.gf.modules.group.GroupDAO;
import unipotsdam.gf.modules.group.GroupfindingImpl;
import unipotsdam.gf.modules.journal.service.IJournalImpl;
......@@ -27,6 +27,7 @@ import unipotsdam.gf.process.ProjectCreationProcess;
import unipotsdam.gf.process.constraints.ConstraintsImpl;
import unipotsdam.gf.process.phases.PhasesImpl;
import unipotsdam.gf.process.tasks.TaskDAO;
import unipotsdam.gf.session.GFContext;
import unipotsdam.gf.session.GFContexts;
public class GFApplicationBinder extends AbstractBinder {
......@@ -40,6 +41,7 @@ public class GFApplicationBinder extends AbstractBinder {
bind(ManagementImpl.class).to(Management.class);
bind(PeerAssessment.class).to(IPeerAssessment.class);
bind(PhasesImpl.class).to(IPhases.class);
bind(GFContext.class).to(GFContext.class);
bind(ManagementImpl.class).to(Management.class);
bind(DummyResearchReportManagement.class).to(ResearchReportManagement.class);
bind(IJournalImpl.class).to(IJournal.class);
......
package unipotsdam.gf.config;
import unipotsdam.gf.modules.communication.model.RocketChatUser;
import unipotsdam.gf.modules.user.User;
/**
* ROCKET CHAT NEEDS TO KNOW THE ENDPOINT FOR THE SSO CONFIGURE LIKE IN README
*
* 1. FOR API URL: http://141.89.53.195:8080/gemeinsamforschen/rest/chat/sso
* localhost:8080/gemeinsamforschen/rest/chat/sso
*
* 1. FOR IFRAME URL: http://141.89.53.195:8080/gemeinsamforschen/rest/chat/login
* localhost:8080/gemeinsamforschen/rest/chat/login
*/
public class GFRocketChatConfig {
//private static final String ROCKET_CHAT_LINK = "http://rocketchat.westeurope.cloudapp.azure.com/";
// public static final String ROCKET_CHAT_LINK_0 = "https://rocket.farm-test.rz.uni-potsdam.de";
// public static final String ROCKET_CHAT_LINK = "https://rocket.farm-test.rz.uni-potsdam.de/";
private static final String ROCKET_CHAT_LINK = "https://rocket.farm-test.rz.uni-potsdam.de/";
// or https://rocket.farm.uni-potsdam.de/
// https://rocket.farm-test.rz.uni-potsdam.de/home
public static final String ROCKET_CHAT_LINK_0 = "http://fleckenroller.cs.uni-potsdam.de:3000";
public static final String ROCKET_CHAT_LINK = "http://fleckenroller.cs.uni-potsdam.de:3000/";
/**
* username: fltrailadmin pw: GEbCM1Rso6TUGGMKtGmg6c5EydMQEu61K9zdD10F
......@@ -20,14 +30,14 @@ public class GFRocketChatConfig {
public static final String ROCKET_CHAT_API_LINK = ROCKET_CHAT_LINK + "api/v1/";
public static final User TEST_USER = new User("test", "passwort",
"test@stuff.com", "test", "rocketChatAuthToken",
"rocketChatPersonalAccessToken", "LExqp3P3t6oQHhauH", false);
public static final RocketChatUser TEST_USER = new RocketChatUser("student1", "egal",
"student1@yolo.com", "student1", "",
"", "6ofqfp8J9ynfvspBJ", false);
/* public static final User ADMIN_USER = new User("admin nachname", "passwort",
"email", "rocketChatUsername", "rocketChatAuthToken",
"rocketChatPersonalAccessToken", "rocketChatUserId", false);*/
public static final User ADMIN_USER = new User("fltrailadmin", "GEbCM1Rso6TUGGMKtGmg6c5EydMQEu61K9zdD10F",
public static final RocketChatUser ADMIN_USER = new RocketChatUser("fltrailadmin", "GEbCM1Rso6TUGGMKtGmg6c5EydMQEu61K9zdD10F",
"julian.dehne@uni-potsdam.de", "rocketChatUsername", "rocketChatAuthToken",
"rocketChatPersonalAccessToken", "SuFbpF3P9aYEo634W", false);
......
package unipotsdam.gf.exceptions;
public class MysqlDownException {
}
package unipotsdam.gf.exceptions;
public class RocketChatDownException extends Exception {
}
package unipotsdam.gf.exceptions;
public class UserDoesNotExistInMysqlException extends Exception {
}
package unipotsdam.gf.exceptions;
public class UserDoesNotExistInRocketChatException extends Exception {
}
package unipotsdam.gf.exceptions;
public class UserExistsInMysqlException extends Exception {
@Override
public String getMessage() {
return "Tried to create User but exists in mysql";
}
}
package unipotsdam.gf.exceptions;
public class UserExistsInRocketChatException extends Exception {
@Override
public String getMessage() {
return "Tried to create User but exists in RocketChat";
}
}
package unipotsdam.gf.interfaces;
import unipotsdam.gf.modules.project.Project;
import unipotsdam.gf.modules.user.User;
import unipotsdam.gf.process.progress.HasProgress;
import unipotsdam.gf.modules.researchreport.ResearchReport;
import unipotsdam.gf.process.tasks.Task;
import java.util.List;
/**
......@@ -19,8 +21,9 @@ public interface Feedback {
/**
* TODO implement: Assigns each student in a project a feedback target
* @param tasks
*/
void assignFeedbackTasks(Project project);
void specifyFeedbackTasks(List<Task> tasks);
/**
* TODO implement: Get the research report you have to give feedback to
......
......@@ -3,7 +3,7 @@ package unipotsdam.gf.interfaces;
import unipotsdam.gf.modules.annotation.model.Annotation;
import unipotsdam.gf.modules.annotation.model.AnnotationPatchRequest;
import unipotsdam.gf.modules.annotation.model.AnnotationPostRequest;
import unipotsdam.gf.modules.feedback.Category;
import unipotsdam.gf.modules.annotation.model.Category;
import java.util.ArrayList;
......
package unipotsdam.gf.interfaces;
import unipotsdam.gf.exceptions.RocketChatDownException;
import unipotsdam.gf.exceptions.UserDoesNotExistInRocketChatException;
import unipotsdam.gf.exceptions.UserExistsInRocketChatException;
import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier;
import unipotsdam.gf.modules.communication.model.EMailMessage;
import unipotsdam.gf.modules.communication.model.RocketChatUser;
import unipotsdam.gf.modules.communication.model.chat.ChatMessage;
import unipotsdam.gf.modules.group.Group;
import unipotsdam.gf.modules.project.Project;
......@@ -37,7 +41,8 @@ public interface ICommunication {
* @param name chat room name
* @return chat room id
*/
String createChatRoom(String name, boolean readOnly, List<User> users);
String createChatRoom(String name, boolean readOnly, List<User> users)
throws RocketChatDownException, UserDoesNotExistInRocketChatException;
/**
* creates chatRoom with name "group.projectId - group.id" and set chatRoomId for group
......@@ -45,11 +50,17 @@ public interface ICommunication {
* @param group Object for information
* @return true if chatRoom was created, otherwise false
*/
boolean createChatRoom(Group group, boolean readOnly);
boolean createChatRoom(Group group, boolean readOnly)
throws RocketChatDownException, UserDoesNotExistInRocketChatException;
String createEmptyChatRoom(String name, boolean readOnly);
String createEmptyChatRoom(String name, boolean readOnly)
throws RocketChatDownException, UserDoesNotExistInRocketChatException;
boolean deleteChatRoom(String roomId);
void deleteChatRoom(Group group) throws RocketChatDownException, UserDoesNotExistInRocketChatException;
void deleteChatRoom(Project project) throws RocketChatDownException, UserDoesNotExistInRocketChatException;
boolean deleteChatRoom(String roomId) throws RocketChatDownException, UserDoesNotExistInRocketChatException;
/**
* endpoint: https://rocket.chat/docs/developer-guides/rest-api/groups/invite/
......@@ -58,9 +69,11 @@ public interface ICommunication {
* @param user information about user
* @return if user was added successfully
*/
boolean addUserToChatRoom(User user, String roomId);
boolean addUserToChatRoom(User user, String roomId)
throws RocketChatDownException, UserDoesNotExistInRocketChatException;
boolean removeUserFromChatRoom(User user, String roomId);
boolean removeUserFromChatRoom(User user, String roomId)
throws RocketChatDownException, UserDoesNotExistInRocketChatException;
/**
* endpoint: https://rocket.chat/docs/developer-guides/rest-api/groups/settopic/
......@@ -80,9 +93,9 @@ public interface ICommunication {
* @param roomId chat room id
* @return chat room information
*/
String getChatRoomName(String roomId);
String getChatRoomName(String roomId) throws RocketChatDownException, UserDoesNotExistInRocketChatException;
boolean exists(String roomId);
boolean exists(String roomId) throws RocketChatDownException, UserDoesNotExistInRocketChatException;
/**
* api: https://rocket.chat/docs/developer-guides/rest-api/authentication/login/
......@@ -90,7 +103,8 @@ public interface ICommunication {
* @param user username and password
* @return information about user, especially authtoken for later use of endpoints
*/
boolean loginUser(User user);
RocketChatUser loginUser(User user)
throws RocketChatDownException, UserDoesNotExistInRocketChatException;
/**
* api 1: https://rocket.chat/docs/developer-guides/rest-api/users/register/
......@@ -102,9 +116,13 @@ public interface ICommunication {
* @param user registers user to rocket.chat
* @return user id
*/
boolean registerUser(User user);
boolean registerUser(User user)
throws RocketChatDownException, UserExistsInRocketChatException;
String getChatRoomLink(String userEmail, String projectId)
throws RocketChatDownException, UserDoesNotExistInRocketChatException;
String getChatRoomLink(String userToken, String projectId);
String getProjectChatRoomLink(String projectName);
// TODO implement as Email or whatever
boolean sendSingleMessage(EMailMessage EMailMessage, User user);
......@@ -113,4 +131,8 @@ public interface ICommunication {
boolean informAboutMissingTasks(Map<StudentIdentifier, ConstraintsMessages> tasks, Project project);
boolean sendMessageToUsers(Project project, EMailMessage eMailMessage);
public void delete(User user) throws RocketChatDownException, UserDoesNotExistInRocketChatException;
}
package unipotsdam.gf.interfaces;
import unipotsdam.gf.exceptions.RocketChatDownException;
import unipotsdam.gf.exceptions.UserDoesNotExistInRocketChatException;
import unipotsdam.gf.modules.group.Group;
import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier;
import unipotsdam.gf.modules.project.Project;
......@@ -7,6 +9,7 @@ import unipotsdam.gf.modules.group.GroupFormationMechanism;
import unipotsdam.gf.modules.group.GroupfindingCriteria;
import java.util.ArrayList;
import java.util.List;
public interface IGroupFinding {
......@@ -18,6 +21,8 @@ public interface IGroupFinding {
void selectGroupfindingCriteria(
GroupfindingCriteria groupfindingCriteria, Project project);
GroupFormationMechanism getGFM(Project project);
/**
* Persist the selected manual groups
* @param groupComposition
......@@ -45,4 +50,13 @@ public interface IGroupFinding {
ArrayList<String> getStudentsInSameGroup(StudentIdentifier student);
int getMinNumberOfStudentsNeeded(Project project);
void deleteGroups(Project project);
List<Group> createRandomGroups(Project project);
/**
* finish the groups in the db
*/
void finalizeGroups(Project project) throws RocketChatDownException, UserDoesNotExistInRocketChatException;
}
package unipotsdam.gf.interfaces;
import unipotsdam.gf.exceptions.RocketChatDownException;
import unipotsdam.gf.exceptions.UserDoesNotExistInRocketChatException;
import unipotsdam.gf.modules.project.Project;
import unipotsdam.gf.process.phases.Phase;
......@@ -9,7 +11,7 @@ public interface IPhases {
* @param phase the phase to end
* @param project the project to end the phase in
*/
void endPhase(Phase phase, Project project);
void endPhase(Phase phase, Project project) throws RocketChatDownException, UserDoesNotExistInRocketChatException;
}
package unipotsdam.gf.interfaces;
import unipotsdam.gf.modules.feedback.Category;
import unipotsdam.gf.modules.annotation.model.Category;
import unipotsdam.gf.modules.submission.model.FullSubmission;
import unipotsdam.gf.modules.submission.model.FullSubmissionPostRequest;
import unipotsdam.gf.modules.submission.model.SubmissionPart;
......
......@@ -3,11 +3,13 @@ package unipotsdam.gf.modules.annotation.controller;
import unipotsdam.gf.mysql.MysqlConnect;
import unipotsdam.gf.mysql.VereinfachtesResultSet;
import unipotsdam.gf.interfaces.IAnnotation;
import unipotsdam.gf.process.DossierCreationProcess;
import unipotsdam.gf.process.tasks.Task;
import unipotsdam.gf.modules.annotation.model.Annotation;
import unipotsdam.gf.modules.annotation.model.AnnotationBody;
import unipotsdam.gf.modules.annotation.model.AnnotationPatchRequest;
import unipotsdam.gf.modules.annotation.model.AnnotationPostRequest;
import unipotsdam.gf.modules.feedback.Category;
import unipotsdam.gf.modules.annotation.model.Category;
import javax.inject.Inject;
import java.util.ArrayList;
......@@ -164,6 +166,15 @@ public class AnnotationController implements IAnnotation {
}
public void endFeedback(Task task){
connection.connect();
String query = "UPDATE tasks set progress = ? where userEmail = ? AND projectName = ? AND taskName = ?";
connection.issueUpdateStatement(
query, task.getProgress().name(), task.getUserEmail(), task.getProjectName(), task.getTaskName());
connection.close();
}
/**
* Build an annotation object from a given result set
*
......
package unipotsdam.gf.modules.annotation.controller;
import unipotsdam.gf.interfaces.Feedback;
import unipotsdam.gf.modules.project.Project;
import unipotsdam.gf.modules.researchreport.ResearchReport;
import unipotsdam.gf.modules.user.User;
import unipotsdam.gf.mysql.MysqlConnect;
import unipotsdam.gf.process.tasks.Task;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
public class FeedbackImpl implements Feedback {
@Inject
MysqlConnect connection;
@Override
public void assigningMissingFeedbackTasks(Project project) {
}
@Override
public void specifyFeedbackTasks(List<Task> tasks) {
for (Task task : tasks) {
List<String> studentsToFeedback = studentsToFeedback(tasks, task, 1);
for (String userEmail : studentsToFeedback) {
connection.connect();
String request = "UPDATE `fullsubmissions` SET `feedbackUser`=? WHERE user=? AND projectName=?";
connection.issueInsertOrDeleteStatement(request, userEmail, task.getUserEmail(), task.getProjectName());
connection.close();
}
}
}
private List<String> studentsToFeedback(List<Task> tasks, Task task, int howMany) {
List<String> result = new ArrayList<>();
int position = tasks.indexOf(task);
for (int i = 1; i <= howMany; i++) {
result.add(tasks.get((i + position) % tasks.size()).getUserEmail()); //modulo builds a circle in users
}
return result;
}
@Override
public ResearchReport getFeedbackTask(User student) {
return null;
}
}
package unipotsdam.gf.modules.annotation.model;
import unipotsdam.gf.modules.feedback.Category;
/**
* @author Sven Kästle
* skaestle@uni-potsdam.de
......
package unipotsdam.gf.modules.annotation.model;
import unipotsdam.gf.modules.feedback.Category;
public class AnnotationMessage {
// variables
private String from;
......
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