diff --git a/pom.xml b/pom.xml
index 9e667959..6ecb274a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -113,6 +113,11 @@
httpclient
4.5.6
+
+ commons-beanutils
+ commons-beanutils
+ 1.9.3
+
org.springframework.boot
diff --git a/src/main/java/edu/mit/cci/pogs/model/dao/user/impl/UserDaoImpl.java b/src/main/java/edu/mit/cci/pogs/model/dao/user/impl/UserDaoImpl.java
index 6e416f99..2f2b0675 100644
--- a/src/main/java/edu/mit/cci/pogs/model/dao/user/impl/UserDaoImpl.java
+++ b/src/main/java/edu/mit/cci/pogs/model/dao/user/impl/UserDaoImpl.java
@@ -9,6 +9,7 @@
import org.jooq.Record;
import org.jooq.SelectQuery;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.stereotype.Repository;
import java.util.List;
@@ -28,9 +29,16 @@ public UserDaoImpl(DSLContext dslContext) {
}
public AuthUser get(String emailAddress) {
- return dslContext.selectFrom(AUTH_USER)
- .where(AUTH_USER.EMAIL_ADDRESS.eq(emailAddress))
- .fetchOne().into(AuthUser.class);
+
+ try
+ {
+ return dslContext.selectFrom(AUTH_USER)
+ .where(AUTH_USER.EMAIL_ADDRESS.eq(emailAddress))
+ .fetchOne().into(AuthUser.class);
+ }
+ catch (Exception e){
+ return null;
+ }
}
public List list(){
diff --git a/src/main/java/edu/mit/cci/pogs/service/ChatScriptService.java b/src/main/java/edu/mit/cci/pogs/service/ChatScriptService.java
index 37bb3132..2789dbfa 100644
--- a/src/main/java/edu/mit/cci/pogs/service/ChatScriptService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/ChatScriptService.java
@@ -5,6 +5,8 @@
import edu.mit.cci.pogs.model.dao.chatscripthasresearchgroup.ChatScriptHasResearchGroupDao;
import edu.mit.cci.pogs.model.jooq.tables.pojos.ChatScriptHasResearchGroup;
import edu.mit.cci.pogs.model.jooq.tables.pojos.ChatScript;
+import edu.mit.cci.pogs.service.base.ServiceBase;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import edu.mit.cci.pogs.view.chatscript.beans.ChatScriptBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -13,9 +15,11 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
@Service
-public class ChatScriptService {
+public class ChatScriptService extends ServiceBase {
private ChatEntryDao chatEntryDao;
private ChatScriptDao chatScriptDao;
@@ -63,45 +67,33 @@ private void createOrUpdateUserGroups(ChatScriptBean chatScriptBean) {
if (chatScriptBean.getResearchGroupRelationshipBean() == null && chatScriptBean.getResearchGroupRelationshipBean().getSelectedValues() == null) {
return;
}
- List toCreate = new ArrayList<>();
- List toDelete = new ArrayList<>();
+ List toCreate = new ArrayList<>();
+ List toDelete = new ArrayList<>();
List currentlySelected = listChatScriptHasResearchGroupByChatScript(chatScriptBean.getId());
- for (ChatScriptHasResearchGroup rghau : currentlySelected) {
- boolean foundRGH = false;
- for (String researchGroupId : chatScriptBean.getResearchGroupRelationshipBean().getSelectedValues()) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- foundRGH = true;
- }
- }
- if (!foundRGH) {
- toDelete.add(rghau);
- }
+ List currentResearchGroups = currentlySelected
+ .stream()
+ .map(ChatScriptHasResearchGroup::getResearchGroupId)
+ .collect(Collectors.toList());
- }
+ String[] newSelectedValues = chatScriptBean.getResearchGroupRelationshipBean().getSelectedValues();
+ UpdateResearchGroups(toCreate, toDelete, currentResearchGroups, newSelectedValues);
- for (String researchGroupId : chatScriptBean.getResearchGroupRelationshipBean().getSelectedValues()) {
+ for (Long toCre : toCreate) {
+ ChatScriptHasResearchGroup rghau = new ChatScriptHasResearchGroup();
+ rghau.setChatScriptId(chatScriptBean.getId());
+ rghau.setResearchGroupId(toCre);
+ chatScriptHasResearchGroupDao.create(rghau);
+ }
+ for (Long toDel : toDelete) {
- boolean selectedAlreadyIn = false;
- for (ChatScriptHasResearchGroup rghau : currentlySelected) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- selectedAlreadyIn = true;
- }
- }
- if (!selectedAlreadyIn) {
- ChatScriptHasResearchGroup rghau = new ChatScriptHasResearchGroup();
- rghau.setChatScriptId(chatScriptBean.getId());
- rghau.setResearchGroupId(new Long(researchGroupId));
- toCreate.add(rghau);
- }
+ ChatScriptHasResearchGroup rghau = currentlySelected
+ .stream()
+ .filter(a -> (a.getChatScriptId() == chatScriptBean.getId() && a.getResearchGroupId() == toDel))
+ .findFirst().get();
- }
- for (ChatScriptHasResearchGroup toCre : toCreate) {
- chatScriptHasResearchGroupDao.create(toCre);
- }
- for (ChatScriptHasResearchGroup toDel : toDelete) {
- chatScriptHasResearchGroupDao.delete(toDel);
+ chatScriptHasResearchGroupDao.delete(rghau);
}
}
@@ -109,8 +101,8 @@ private void createOrUpdateUserGroups(ChatScriptBean chatScriptBean) {
public ChatScript createOrUpdate(ChatScriptBean chatScriptBean) {
ChatScript chatScript = new ChatScript();
- chatScript.setId(chatScriptBean.getId());
- chatScript.setChatScriptName(chatScriptBean.getChatScriptName());
+
+ ObjectUtils.Copy(chatScript, chatScriptBean);
if (chatScript.getId() == null) {
chatScript = chatScriptDao.create(chatScript);
diff --git a/src/main/java/edu/mit/cci/pogs/service/DictionaryService.java b/src/main/java/edu/mit/cci/pogs/service/DictionaryService.java
index 80466270..b1cce50a 100644
--- a/src/main/java/edu/mit/cci/pogs/service/DictionaryService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/DictionaryService.java
@@ -4,6 +4,8 @@
import edu.mit.cci.pogs.model.jooq.tables.pojos.Dictionary;
import edu.mit.cci.pogs.model.jooq.tables.pojos.DictionaryHasResearchGroup;
import edu.mit.cci.pogs.model.jooq.tables.pojos.StudyHasResearchGroup;
+import edu.mit.cci.pogs.service.base.ServiceBase;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import edu.mit.cci.pogs.view.dictionary.beans.DictionaryBean;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -19,6 +21,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
@@ -37,7 +40,7 @@
import edu.mit.cci.pogs.view.dictionary.beans.DictionaryEntriesBean;
@Service
-public class DictionaryService {
+public class DictionaryService extends ServiceBase {
private final DictionaryDao dictionaryDao;
private final DictionaryEntryDao dictionaryEntryDao;
@@ -102,56 +105,44 @@ private void createOrUpdateUserGroups(DictionaryBean dictionaryBean) {
if (dictionaryBean.getResearchGroupRelationshipBean() == null && dictionaryBean.getResearchGroupRelationshipBean().getSelectedValues() == null) {
return;
}
- List toCreate = new ArrayList<>();
- List toDelete = new ArrayList<>();
+
+ List toCreate = new ArrayList<>();
+ List toDelete = new ArrayList<>();
List currentlySelected = listDictionaryHasResearchGroupByDictionaryId(dictionaryBean.getId());
-
- for (DictionaryHasResearchGroup rghau : currentlySelected) {
- boolean foundRGH = false;
- for (String researchGroupId : dictionaryBean.getResearchGroupRelationshipBean().getSelectedValues()) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- foundRGH = true;
- }
- }
- if (!foundRGH) {
- toDelete.add(rghau);
- }
-
- }
-
-
- for (String researchGroupId : dictionaryBean.getResearchGroupRelationshipBean().getSelectedValues()) {
-
- boolean selectedAlreadyIn = false;
- for (DictionaryHasResearchGroup rghau : currentlySelected) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- selectedAlreadyIn = true;
- }
- }
- if (!selectedAlreadyIn) {
- DictionaryHasResearchGroup rghau = new DictionaryHasResearchGroup();
- rghau.setDictionaryId(dictionaryBean.getId());
- rghau.setResearchGroupId(new Long(researchGroupId));
- toCreate.add(rghau);
- }
-
- }
- for (DictionaryHasResearchGroup toCre : toCreate) {
- dictionaryHasResearchGroupDao.create(toCre);
+
+ List currentResearchGroups = currentlySelected
+ .stream()
+ .map(DictionaryHasResearchGroup::getResearchGroupId)
+ .collect(Collectors.toList());
+
+ String[] newSelectedValues = dictionaryBean.getResearchGroupRelationshipBean().getSelectedValues();
+
+ UpdateResearchGroups(toCreate, toDelete, currentResearchGroups, newSelectedValues);
+
+
+ for (Long toCre : toCreate) {
+ DictionaryHasResearchGroup rghau = new DictionaryHasResearchGroup();
+ rghau.setDictionaryId(dictionaryBean.getId());
+ rghau.setResearchGroupId(toCre);
+ dictionaryHasResearchGroupDao.create(rghau);
}
- for (DictionaryHasResearchGroup toDel : toDelete) {
- dictionaryHasResearchGroupDao.delete(toDel);
+ for (Long toDel : toDelete) {
+
+ DictionaryHasResearchGroup rghau = currentlySelected
+ .stream()
+ .filter(a -> (a.getDictionaryId() == dictionaryBean.getId() && a.getResearchGroupId() == toDel))
+ .findFirst().get();
+
+ dictionaryHasResearchGroupDao.delete(rghau);
}
-
}
public Dictionary createOrUpdate(DictionaryBean dictionaryBean) {
Dictionary dictionary = new Dictionary();
- dictionary.setId(dictionaryBean.getId());
- dictionary.setDictionaryName(dictionaryBean.getDictionaryName());
- dictionary.setHasGroundTruth(dictionaryBean.getHasGroundTruth() == null ? false : dictionaryBean.getHasGroundTruth());
-
+
+ ObjectUtils.Copy(dictionary, dictionaryBean);
+
if (dictionary.getId() == null) {
dictionary = dictionaryDao.create(dictionary);
dictionaryBean.setId(dictionary.getId());
diff --git a/src/main/java/edu/mit/cci/pogs/service/ExecutableScriptService.java b/src/main/java/edu/mit/cci/pogs/service/ExecutableScriptService.java
index d387704a..c8883726 100644
--- a/src/main/java/edu/mit/cci/pogs/service/ExecutableScriptService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/ExecutableScriptService.java
@@ -5,15 +5,18 @@
import edu.mit.cci.pogs.model.dao.executablescripthasresearchgroup.ExecutableScriptHasResearchGroupDao;
import edu.mit.cci.pogs.model.jooq.tables.pojos.ExecutableScript;
import edu.mit.cci.pogs.model.jooq.tables.pojos.ExecutableScriptHasResearchGroup;
+import edu.mit.cci.pogs.service.base.ServiceBase;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import edu.mit.cci.pogs.view.executablescript.beans.ExecutableScriptBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
@Service
-public class ExecutableScriptService {
+public class ExecutableScriptService extends ServiceBase {
private final ExecutableScriptHasResearchGroupDao executableScriptHasResearchGroupDao;
private final ExecutableScriptDao executableScriptDao;
@@ -35,45 +38,34 @@ private void createOrUpdateUserGroups(ExecutableScriptBean executableScriptBean)
if (executableScriptBean.getResearchGroupRelationshipBean() == null && executableScriptBean.getResearchGroupRelationshipBean().getSelectedValues() == null) {
return;
}
- List toCreate = new ArrayList<>();
- List toDelete = new ArrayList<>();
+
+ List toCreate = new ArrayList<>();
+ List toDelete = new ArrayList<>();
List currentlySelected = listExecutableScriptHasResearchGroupByDictionaryId(executableScriptBean.getId());
- for (ExecutableScriptHasResearchGroup rghau : currentlySelected) {
- boolean foundRGH = false;
- for (String researchGroupId : executableScriptBean.getResearchGroupRelationshipBean().getSelectedValues()) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- foundRGH = true;
- }
- }
- if (!foundRGH) {
- toDelete.add(rghau);
- }
+ List currentResearchGroups = currentlySelected
+ .stream()
+ .map(ExecutableScriptHasResearchGroup::getResearchGroupId)
+ .collect(Collectors.toList());
- }
+ String[] newSelectedValues = executableScriptBean.getResearchGroupRelationshipBean().getSelectedValues();
+ UpdateResearchGroups(toCreate, toDelete, currentResearchGroups, newSelectedValues);
- for (String researchGroupId : executableScriptBean.getResearchGroupRelationshipBean().getSelectedValues()) {
+ for (Long toCre : toCreate) {
+ ExecutableScriptHasResearchGroup rghau = new ExecutableScriptHasResearchGroup();
+ rghau.setExecutableScriptId(executableScriptBean.getId());
+ rghau.setResearchGroupId(toCre);
+ executableScriptHasResearchGroupDao.create(rghau);
+ }
+ for (Long toDel : toDelete) {
- boolean selectedAlreadyIn = false;
- for (ExecutableScriptHasResearchGroup rghau : currentlySelected) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- selectedAlreadyIn = true;
- }
- }
- if (!selectedAlreadyIn) {
- ExecutableScriptHasResearchGroup rghau = new ExecutableScriptHasResearchGroup();
- rghau.setExecutableScriptId(executableScriptBean.getId());
- rghau.setResearchGroupId(new Long(researchGroupId));
- toCreate.add(rghau);
- }
+ ExecutableScriptHasResearchGroup rghau = currentlySelected
+ .stream()
+ .filter(a -> (a.getExecutableScriptId() == executableScriptBean.getId() && a.getResearchGroupId() == toDel))
+ .findFirst().get();
- }
- for (ExecutableScriptHasResearchGroup toCre : toCreate) {
- executableScriptHasResearchGroupDao.create(toCre);
- }
- for (ExecutableScriptHasResearchGroup toDel : toDelete) {
- executableScriptHasResearchGroupDao.delete(toDel);
+ executableScriptHasResearchGroupDao.delete(rghau);
}
}
@@ -82,10 +74,8 @@ private void createOrUpdateUserGroups(ExecutableScriptBean executableScriptBean)
public ExecutableScript createOrUpdate(ExecutableScriptBean executableScriptBean) {
ExecutableScript executableScript = new ExecutableScript();
- executableScript.setId(executableScriptBean.getId());
- executableScript.setScriptContent(executableScriptBean.getScriptContent());
- executableScript.setScriptName(executableScriptBean.getScriptName());
- executableScript.setScriptType(executableScriptBean.getScriptType());
+
+ ObjectUtils.Copy(executableScript, executableScriptBean);
if (executableScript.getId() == null) {
executableScript = executableScriptDao.create(executableScript);
diff --git a/src/main/java/edu/mit/cci/pogs/service/SessionService.java b/src/main/java/edu/mit/cci/pogs/service/SessionService.java
index be1bec3b..74a03b5c 100644
--- a/src/main/java/edu/mit/cci/pogs/service/SessionService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/SessionService.java
@@ -18,6 +18,7 @@
import edu.mit.cci.pogs.runner.SessionRunner;
import edu.mit.cci.pogs.runner.SessionRunnerManager;
import edu.mit.cci.pogs.utils.DateUtils;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import edu.mit.cci.pogs.view.session.beans.SessionBean;
import edu.mit.cci.pogs.view.session.beans.SubjectBean;
import edu.mit.cci.pogs.view.session.beans.SubjectsBean;
@@ -148,76 +149,12 @@ public List getSessionsToBeInitialized() {
public Session createOrUpdate(SessionBean sessionBean) {
Session session = new Session();
- session.setId(sessionBean.getId());
- session.setSessionSuffix(sessionBean.getSessionSuffix());
- session.setSessionStartDate(sessionBean.getSessionStartDate());
- session.setStudyId(sessionBean.getStudyId());
- session.setStatus(sessionBean.getStatus());
- session.setWaitingRoomTime(sessionBean.getWaitingRoomTime());
- session.setIntroPageEnabled(sessionBean.getIntroPageEnabled());
- session.setIntroText(sessionBean.getIntroText());
- session.setIntroTime(sessionBean.getIntroTime());
- session.setDisplayNameChangePageEnabled(sessionBean.getDisplayNameChangePageEnabled());
- session.setDisplayNameChangeTime(sessionBean.getDisplayNameChangeTime());
- session.setRosterPageEnabled(sessionBean.getRosterPageEnabled());
- session.setRosterTime(sessionBean.getRosterTime());
- session.setDonePageEnabled(sessionBean.getDonePageEnabled());
- session.setDonePageText(sessionBean.getDonePageText());
- session.setDonePageTime(sessionBean.getDonePageTime());
- session.setDoneRedirectUrl(sessionBean.getDoneRedirectUrl());
- session.setCouldNotAssignToTeamMessage(sessionBean.getCouldNotAssignToTeamMessage());
- session.setTaskExecutionType(sessionBean.getTaskExecutionType());
- session.setRoundsEnabled(sessionBean.getRoundsEnabled());
- session.setNumberOfRounds(sessionBean.getNumberOfRounds());
- session.setCommunicationType(sessionBean.getCommunicationType());
- session.setChatBotName(sessionBean.getChatBotName());
- session.setScoreboardEnabled(sessionBean.getScoreboardEnabled());
- session.setScoreboardDisplayType(sessionBean.getScoreboardDisplayType());
- session.setScoreboardUseDisplayNames(sessionBean.getScoreboardUseDisplayNames());
- session.setCollaborationTodoListEnabled(sessionBean.getCollaborationTodoListEnabled());
- session.setCollaborationFeedbackWidgetEnabled(sessionBean.getCollaborationFeedbackWidgetEnabled());
- session.setCollaborationVotingWidgetEnabled(sessionBean.getCollaborationVotingWidgetEnabled());
- session.setTeamCreationMoment(sessionBean.getTeamCreationMoment());
- session.setTeamCreationType(sessionBean.getTeamCreationType());
- session.setTeamMinSize(sessionBean.getTeamMinSize());
- session.setTeamMaxSize(sessionBean.getTeamMaxSize());
- session.setTeamCreationMethod(sessionBean.getTeamCreationMethod());
- session.setTeamCreationMatrix(sessionBean.getTeamCreationMatrix());
- session.setFixedInteractionTime(sessionBean.getFixedInteractionTime());
-
- session.setSessionScheduleType(sessionBean.getSessionScheduleType());
- session.setPerpetualStartDate(sessionBean.getPerpetualStartDate());
- session.setPerpetualEndDate(sessionBean.getPerpetualEndDate());
- session.setPerpetualSubjectsNumber(sessionBean.getPerpetualSubjectsNumber());
- session.setPerpetualSubjectsPrefix(sessionBean.getPerpetualSubjectsPrefix());
- session.setDoneUrlParameter(sessionBean.getDoneUrlParameter());
- session.setScheduleConditionType(sessionBean.getScheduleConditionType());
- session.setExecutableScriptId(sessionBean.getExecutableScriptId());
- session.setSessionWideScriptId(sessionBean.getSessionWideScriptId());
- session.setDisplayNameGenerationEnabled(sessionBean.getDisplayNameGenerationEnabled());
+
+ ObjectUtils.Copy(session, sessionBean);
Study study = studyDao.get(sessionBean.getStudyId());
session.setFullSessionName(study.getStudySessionPrefix() + sessionBean.getSessionSuffix());
- if (session.getRosterTime() == null) {
- session.setRosterTime(0);
- }
- if (session.getIntroTime() == null) {
- session.setIntroTime(0);
- }
- if (session.getDonePageTime() == null) {
- session.setDonePageTime(0);
- }
- if (session.getWaitingRoomTime() == null) {
- session.setWaitingRoomTime(0);
- }
- if (session.getFixedInteractionTime() == null) {
- session.setFixedInteractionTime(0);
- }
- if (session.getDisplayNameChangeTime() == null) {
- session.setDisplayNameChangeTime(0);
- }
-
if(sessionBean.getSessionScheduleType().equals(SessionScheduleType.SCHEDULED_DATE.getId())){
session.setPerpetualStartDate(null);
session.setPerpetualEndDate(null);
@@ -294,17 +231,17 @@ public Session clonePerpetualSession(Session session) {
return clonedNonPerpetualSession;
}
- private void createOrUpdateSessionHasTaskGroups(SessionBean studyBean) {
- if (studyBean.getSessionHasTaskGroupRelationshipBean() == null && studyBean.getSessionHasTaskGroupRelationshipBean().getSelectedValues() == null) {
+ private void createOrUpdateSessionHasTaskGroups(SessionBean sessionBean) {
+ if (sessionBean.getSessionHasTaskGroupRelationshipBean() == null && sessionBean.getSessionHasTaskGroupRelationshipBean().getSelectedValues() == null) {
return;
}
List toCreate = new ArrayList<>();
List toDelete = new ArrayList<>();
- List currentlySelected = listSessionHasTaskGroupBySessionId(studyBean.getId());
+ List currentlySelected = listSessionHasTaskGroupBySessionId(sessionBean.getId());
for (SessionHasTaskGroup rghau : currentlySelected) {
boolean foundRGH = false;
- for (String researchGroupId : studyBean.getSessionHasTaskGroupRelationshipBean().getSelectedValues()) {
+ for (String researchGroupId : sessionBean.getSessionHasTaskGroupRelationshipBean().getSelectedValues()) {
if (rghau.getTaskGroupId().longValue() == new Long(researchGroupId).longValue()) {
foundRGH = true;
}
@@ -315,7 +252,7 @@ private void createOrUpdateSessionHasTaskGroups(SessionBean studyBean) {
}
- for (String taskGroupId : studyBean.getSessionHasTaskGroupRelationshipBean().getSelectedValues()) {
+ for (String taskGroupId : sessionBean.getSessionHasTaskGroupRelationshipBean().getSelectedValues()) {
boolean selectedAlreadyIn = false;
for (SessionHasTaskGroup rghau : currentlySelected) {
@@ -325,7 +262,7 @@ private void createOrUpdateSessionHasTaskGroups(SessionBean studyBean) {
}
if (!selectedAlreadyIn) {
SessionHasTaskGroup rghau = new SessionHasTaskGroup();
- rghau.setSessionId(studyBean.getId());
+ rghau.setSessionId(sessionBean.getId());
rghau.setTaskGroupId(new Long(taskGroupId));
toCreate.add(rghau);
}
diff --git a/src/main/java/edu/mit/cci/pogs/service/StudyService.java b/src/main/java/edu/mit/cci/pogs/service/StudyService.java
index 91a7e46a..31c1960c 100644
--- a/src/main/java/edu/mit/cci/pogs/service/StudyService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/StudyService.java
@@ -1,5 +1,7 @@
package edu.mit.cci.pogs.service;
+import edu.mit.cci.pogs.service.base.ServiceBase;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -7,6 +9,7 @@
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.stream.Collectors;
import edu.mit.cci.pogs.model.dao.session.SessionDao;
import edu.mit.cci.pogs.model.dao.study.StudyDao;
@@ -18,7 +21,7 @@
import edu.mit.cci.pogs.view.study.beans.StudyBean;
@Service
-public class StudyService {
+public class StudyService extends ServiceBase {
private final StudyDao studyDao;
@@ -44,10 +47,8 @@ public List listStudyHasResearchGroupByStudyId(Long study
public Study createOrUpdate(StudyBean studyBean) {
Study study = new Study();
- study.setId(studyBean.getId());
- study.setStudyDescription(studyBean.getStudyDescription());
- study.setStudyName(studyBean.getStudyName());
- study.setStudySessionPrefix(studyBean.getStudySessionPrefix());
+
+ ObjectUtils.Copy(study, studyBean);
if (study.getId() == null) {
study = studyDao.create(study);
@@ -65,46 +66,35 @@ private void createOrUpdateUserGroups(StudyBean studyBean) {
if (studyBean.getResearchGroupRelationshipBean() == null && studyBean.getResearchGroupRelationshipBean().getSelectedValues() == null) {
return;
}
- List toCreate = new ArrayList<>();
- List toDelete = new ArrayList<>();
- List currentlySelected = listStudyHasResearchGroupByStudy(studyBean.getId());
- for (StudyHasResearchGroup rghau : currentlySelected) {
- boolean foundRGH = false;
- for (String researchGroupId : studyBean.getResearchGroupRelationshipBean().getSelectedValues()) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- foundRGH = true;
- }
- }
- if (!foundRGH) {
- toDelete.add(rghau);
- }
+ List toCreate = new ArrayList<>();
+ List toDelete = new ArrayList<>();
+ List currentlySelected = listStudyHasResearchGroupByStudy(studyBean.getId());
- }
+ List currentResearchGroups = currentlySelected
+ .stream()
+ .map(StudyHasResearchGroup::getResearchGroupId)
+ .collect(Collectors.toList());
- for (String researchGroupId : studyBean.getResearchGroupRelationshipBean().getSelectedValues()) {
+ String[] newSelectedValues = studyBean.getResearchGroupRelationshipBean().getSelectedValues();
- boolean selectedAlreadyIn = false;
- for (StudyHasResearchGroup rghau : currentlySelected) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- selectedAlreadyIn = true;
- }
- }
- if (!selectedAlreadyIn) {
- StudyHasResearchGroup rghau = new StudyHasResearchGroup();
- rghau.setStudyId(studyBean.getId());
- rghau.setResearchGroupId(new Long(researchGroupId));
- toCreate.add(rghau);
- }
+ UpdateResearchGroups(toCreate, toDelete, currentResearchGroups, newSelectedValues);
+ for (Long toCre : toCreate) {
+ StudyHasResearchGroup rghau = new StudyHasResearchGroup();
+ rghau.setStudyId(studyBean.getId());
+ rghau.setResearchGroupId(toCre);
+ studyHasResearchGroupDao.create(rghau);
}
- for (StudyHasResearchGroup toCre : toCreate) {
- studyHasResearchGroupDao.create(toCre);
- }
- for (StudyHasResearchGroup toDel : toDelete) {
- studyHasResearchGroupDao.delete(toDel);
- }
+ for (Long toDel : toDelete) {
+
+ StudyHasResearchGroup rghau = currentlySelected
+ .stream()
+ .filter(a -> (a.getStudyId() == studyBean.getId() && a.getResearchGroupId() == toDel))
+ .findFirst().get();
+ studyHasResearchGroupDao.delete(rghau);
+ }
}
private List listStudyHasResearchGroupByStudy(Long studyId) {
diff --git a/src/main/java/edu/mit/cci/pogs/service/TaskConfigurationService.java b/src/main/java/edu/mit/cci/pogs/service/TaskConfigurationService.java
index 679765e6..f9b84b38 100644
--- a/src/main/java/edu/mit/cci/pogs/service/TaskConfigurationService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/TaskConfigurationService.java
@@ -7,16 +7,19 @@
import edu.mit.cci.pogs.model.jooq.tables.pojos.TaskConfigurationHasResearchGroup;
import edu.mit.cci.pogs.model.jooq.tables.pojos.TaskConfiguration;
import edu.mit.cci.pogs.model.jooq.tables.pojos.TaskExecutionAttribute;
+import edu.mit.cci.pogs.service.base.ServiceBase;
import edu.mit.cci.pogs.utils.MessageUtils;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import edu.mit.cci.pogs.view.taskplugin.beans.TaskPluginConfigBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
@Service
-public class TaskConfigurationService {
+public class TaskConfigurationService extends ServiceBase {
@Autowired
private TaskExecutionAttributeDao taskExecutionAttributeDao;
@@ -43,45 +46,34 @@ private void createOrUpdateUserGroups(TaskPluginConfigBean taskPluginConfigurati
if (taskPluginConfigurationBean.getResearchGroupRelationshipBean() == null && taskPluginConfigurationBean.getResearchGroupRelationshipBean().getSelectedValues() == null) {
return;
}
- List toCreate = new ArrayList<>();
- List toDelete = new ArrayList<>();
+
+ List toCreate = new ArrayList<>();
+ List toDelete = new ArrayList<>();
List currentlySelected = listTaskConfigurationyHasResearchGroupByTaskConfigurationId(taskPluginConfigurationBean.getId());
- for (TaskConfigurationHasResearchGroup rghau : currentlySelected) {
- boolean foundRGH = false;
- for (String researchGroupId : taskPluginConfigurationBean.getResearchGroupRelationshipBean().getSelectedValues()) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- foundRGH = true;
- }
- }
- if (!foundRGH) {
- toDelete.add(rghau);
- }
+ List currentResearchGroups = currentlySelected
+ .stream()
+ .map(TaskConfigurationHasResearchGroup::getResearchGroupId)
+ .collect(Collectors.toList());
- }
+ String[] newSelectedValues = taskPluginConfigurationBean.getResearchGroupRelationshipBean().getSelectedValues();
+ UpdateResearchGroups(toCreate, toDelete, currentResearchGroups, newSelectedValues);
- for (String researchGroupId : taskPluginConfigurationBean.getResearchGroupRelationshipBean().getSelectedValues()) {
+ for (Long toCre : toCreate) {
+ TaskConfigurationHasResearchGroup rghau = new TaskConfigurationHasResearchGroup();
+ rghau.setTaskConfigurationId(taskPluginConfigurationBean.getId());
+ rghau.setResearchGroupId(toCre);
+ taskConfigurationHasResearchGroupDao.create(rghau);
+ }
+ for (Long toDel : toDelete) {
- boolean selectedAlreadyIn = false;
- for (TaskConfigurationHasResearchGroup rghau : currentlySelected) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- selectedAlreadyIn = true;
- }
- }
- if (!selectedAlreadyIn) {
- TaskConfigurationHasResearchGroup rghau = new TaskConfigurationHasResearchGroup();
- rghau.setTaskConfigurationId(taskPluginConfigurationBean.getId());
- rghau.setResearchGroupId(new Long(researchGroupId));
- toCreate.add(rghau);
- }
+ TaskConfigurationHasResearchGroup rghau = currentlySelected
+ .stream()
+ .filter(a -> (a.getTaskConfigurationId() == taskPluginConfigurationBean.getId() && a.getResearchGroupId() == toDel))
+ .findFirst().get();
- }
- for (TaskConfigurationHasResearchGroup toCre : toCreate) {
- taskConfigurationHasResearchGroupDao.create(toCre);
- }
- for (TaskConfigurationHasResearchGroup toDel : toDelete) {
- taskConfigurationHasResearchGroupDao.delete(toDel);
+ taskConfigurationHasResearchGroupDao.delete(rghau);
}
}
@@ -89,13 +81,8 @@ private void createOrUpdateUserGroups(TaskPluginConfigBean taskPluginConfigurati
public TaskConfiguration createOrUpdate(TaskPluginConfigBean taskPluginConfigurationBean) {
TaskConfiguration taskPluginConfiguration = new TaskConfiguration();
- taskPluginConfiguration.setId(taskPluginConfigurationBean.getId());
- taskPluginConfiguration.setConfigurationName(taskPluginConfigurationBean.getConfigurationName());
- taskPluginConfiguration.setScoreScriptId(taskPluginConfigurationBean.getScoreScriptId());
- taskPluginConfiguration.setAfterWorkScriptId(taskPluginConfigurationBean.getAfterWorkScriptId());
- taskPluginConfiguration.setBeforeWorkScriptId(taskPluginConfigurationBean.getBeforeWorkScriptId());
- taskPluginConfiguration.setDictionaryId(taskPluginConfigurationBean.getDictionaryId());
- taskPluginConfiguration.setTaskPluginName(taskPluginConfigurationBean.getTaskPluginName());
+
+ ObjectUtils.Copy(taskPluginConfiguration, taskPluginConfigurationBean);
if (taskPluginConfiguration.getId() == null) {
taskPluginConfiguration = taskConfigurationDao.create(taskPluginConfiguration);
diff --git a/src/main/java/edu/mit/cci/pogs/service/TaskGroupService.java b/src/main/java/edu/mit/cci/pogs/service/TaskGroupService.java
index adee424c..864e1770 100644
--- a/src/main/java/edu/mit/cci/pogs/service/TaskGroupService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/TaskGroupService.java
@@ -2,11 +2,14 @@
import edu.mit.cci.pogs.model.dao.taskgrouphasresearchgroup.TaskGroupHasResearchGroupDao;
import edu.mit.cci.pogs.model.jooq.tables.pojos.TaskGroupHasResearchGroup;
+import edu.mit.cci.pogs.service.base.ServiceBase;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
import edu.mit.cci.pogs.model.dao.taskgroup.TaskGroupDao;
import edu.mit.cci.pogs.model.dao.taskgrouphastask.TaskGroupHasTaskDao;
@@ -15,7 +18,7 @@
import edu.mit.cci.pogs.view.taskgroup.bean.TaskGroupBean;
@Service
-public class TaskGroupService {
+public class TaskGroupService extends ServiceBase {
private final TaskGroupDao taskGroupDao;
@@ -38,9 +41,8 @@ public List listTaskGroupHasResearchGroupByTaskGroup(
public TaskGroup createOrUpdate(TaskGroupBean taskGroupBean) {
TaskGroup tg = new TaskGroup();
- tg.setId(taskGroupBean.getId());
- tg.setTaskGroupName(taskGroupBean.getTaskGroupName());
+ ObjectUtils.Copy(tg, taskGroupBean);
if (tg.getId() == null) {
tg = taskGroupDao.create(tg);
@@ -58,44 +60,34 @@ private void createOrUpdateUserGroups(TaskGroupBean taskGroupBean) {
if (taskGroupBean.getResearchGroupRelationshipBean() == null && taskGroupBean.getResearchGroupRelationshipBean().getSelectedValues() == null) {
return;
}
- List toCreate = new ArrayList<>();
- List toDelete = new ArrayList<>();
- List currentlySelected = listTaskGroupHasResearchGroupByTaskGroup(taskGroupBean.getId());
- for (TaskGroupHasResearchGroup rghau : currentlySelected) {
- boolean foundRGH = false;
- for (String researchGroupId : taskGroupBean.getResearchGroupRelationshipBean().getSelectedValues()) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- foundRGH = true;
- }
- }
- if (!foundRGH) {
- toDelete.add(rghau);
- }
+ List toCreate = new ArrayList<>();
+ List toDelete = new ArrayList<>();
+ List currentlySelected = listTaskGroupHasResearchGroupByTaskGroup(taskGroupBean.getId());
- }
+ List currentResearchGroups = currentlySelected
+ .stream()
+ .map(TaskGroupHasResearchGroup::getResearchGroupId)
+ .collect(Collectors.toList());
- for (String researchGroupId : taskGroupBean.getResearchGroupRelationshipBean().getSelectedValues()) {
+ String[] newSelectedValues = taskGroupBean.getResearchGroupRelationshipBean().getSelectedValues();
- boolean selectedAlreadyIn = false;
- for (TaskGroupHasResearchGroup rghau : currentlySelected) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- selectedAlreadyIn = true;
- }
- }
- if (!selectedAlreadyIn) {
- TaskGroupHasResearchGroup rghau = new TaskGroupHasResearchGroup();
- rghau.setTaskGroupId(taskGroupBean.getId());
- rghau.setResearchGroupId(new Long(researchGroupId));
- toCreate.add(rghau);
- }
+ UpdateResearchGroups(toCreate, toDelete, currentResearchGroups, newSelectedValues);
+ for (Long toCre : toCreate) {
+ TaskGroupHasResearchGroup rghau = new TaskGroupHasResearchGroup();
+ rghau.setTaskGroupId(taskGroupBean.getId());
+ rghau.setResearchGroupId(toCre);
+ taskGroupHasResearchGroupDao.create(rghau);
}
- for (TaskGroupHasResearchGroup toCre : toCreate) {
- taskGroupHasResearchGroupDao.create(toCre);
- }
- for (TaskGroupHasResearchGroup toDel : toDelete) {
- taskGroupHasResearchGroupDao.delete(toDel);
+ for (Long toDel : toDelete) {
+
+ TaskGroupHasResearchGroup rghau = currentlySelected
+ .stream()
+ .filter(a -> (a.getTaskGroupId() == taskGroupBean.getId() && a.getResearchGroupId() == toDel))
+ .findFirst().get();
+
+ taskGroupHasResearchGroupDao.delete(rghau);
}
}
diff --git a/src/main/java/edu/mit/cci/pogs/service/TaskService.java b/src/main/java/edu/mit/cci/pogs/service/TaskService.java
index 8f2aa162..72135ecc 100644
--- a/src/main/java/edu/mit/cci/pogs/service/TaskService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/TaskService.java
@@ -1,5 +1,7 @@
package edu.mit.cci.pogs.service;
+import edu.mit.cci.pogs.service.base.ServiceBase;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import org.jooq.tools.json.JSONArray;
import org.jooq.tools.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@@ -9,6 +11,7 @@
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import edu.mit.cci.pogs.model.dao.task.TaskDao;
import edu.mit.cci.pogs.model.dao.taskconfiguration.TaskConfigurationDao;
@@ -22,7 +25,7 @@
import edu.mit.cci.pogs.view.task.bean.TaskBean;
@Service
-public class TaskService {
+public class TaskService extends ServiceBase {
private final TaskDao taskDao;
private final TaskHasResearchGroupDao taskHasResearchGroupDao;
@@ -72,40 +75,8 @@ private static void updateVideoPrimerUrl(Task tk) {
public TaskBean createOrUpdate(TaskBean value) {
Task tk = new Task();
- tk.setId(value.getId());
- tk.setTaskName(value.getTaskName());
- tk.setTaskPluginType(value.getTaskPluginType());
- tk.setSoloTask(value.getSoloTask());
- tk.setInteractionTime(value.getInteractionTime());
- tk.setIntroPageEnabled(value.getIntroPageEnabled());
- tk.setIntroText(value.getIntroText());
- tk.setIntroTime(value.getIntroTime());
- tk.setPrimerPageEnabled(value.getPrimerPageEnabled());
- tk.setPrimerText(value.getPrimerText());
- tk.setPrimerTime(value.getPrimerTime());
- tk.setInteractionWidgetEnabled(value.getInteractionWidgetEnabled());
- tk.setInteractionText(value.getInteractionText());
- tk.setCommunicationType(value.getCommunicationType());
- tk.setCollaborationTodoListEnabled(value.getCollaborationTodoListEnabled());
- tk.setCollaborationFeedbackWidgetEnabled(value.getCollaborationFeedbackWidgetEnabled());
- tk.setCollaborationVotingWidgetEnabled(value.getCollaborationVotingWidgetEnabled());
- tk.setScoringType(value.getScoringType());
- tk.setSubjectCommunicationId(value.getSubjectCommunicationId());
- tk.setChatScriptId(value.getChatScriptId());
- tk.setPrimerVideoAutoplayMute(value.getPrimerVideoAutoplayMute());
- tk.setShouldScore(value.getShouldScore());
- if (tk.getShouldScore() == null) {
- tk.setShouldScore(false);
- }
- if (tk.getInteractionTime() == null) {
- tk.setInteractionTime(0);
- }
- if (tk.getIntroTime() == null) {
- tk.setIntroTime(0);
- }
- if (tk.getPrimerTime() == null) {
- tk.setPrimerTime(0);
- }
+ ObjectUtils.Copy(tk, value);
+
updateVideoPrimerUrl(tk);
if (tk.getId() == null) {
tk = taskDao.create(tk);
@@ -141,44 +112,34 @@ private void createOrUpdateUserGroups(TaskBean taskBean) {
if (taskBean.getResearchGroupRelationshipBean() == null && taskBean.getResearchGroupRelationshipBean().getSelectedValues() == null) {
return;
}
- List toCreate = new ArrayList<>();
- List toDelete = new ArrayList<>();
- List currentlySelected = listTaskHasResearchGroupByTaskId(taskBean.getId());
- for (TaskHasResearchGroup rghau : currentlySelected) {
- boolean foundRGH = false;
- for (String researchGroupId : taskBean.getResearchGroupRelationshipBean().getSelectedValues()) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- foundRGH = true;
- }
- }
- if (!foundRGH) {
- toDelete.add(rghau);
- }
+ List toCreate = new ArrayList<>();
+ List toDelete = new ArrayList<>();
+ List currentlySelected = listTaskHasResearchGroupByTaskId(taskBean.getId());
- }
+ List currentResearchGroups = currentlySelected
+ .stream()
+ .map(TaskHasResearchGroup::getResearchGroupId)
+ .collect(Collectors.toList());
- for (String researchGroupId : taskBean.getResearchGroupRelationshipBean().getSelectedValues()) {
+ String[] newSelectedValues = taskBean.getResearchGroupRelationshipBean().getSelectedValues();
- boolean selectedAlreadyIn = false;
- for (TaskHasResearchGroup rghau : currentlySelected) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- selectedAlreadyIn = true;
- }
- }
- if (!selectedAlreadyIn) {
- TaskHasResearchGroup rghau = new TaskHasResearchGroup();
- rghau.setTaskId(taskBean.getId());
- rghau.setResearchGroupId(new Long(researchGroupId));
- toCreate.add(rghau);
- }
+ UpdateResearchGroups(toCreate, toDelete, currentResearchGroups, newSelectedValues);
+ for (Long toCre : toCreate) {
+ TaskHasResearchGroup rghau = new TaskHasResearchGroup();
+ rghau.setTaskId(taskBean.getId());
+ rghau.setResearchGroupId(toCre);
+ taskHasResearchGroupDao.create(rghau);
}
- for (TaskHasResearchGroup toCre : toCreate) {
- taskHasResearchGroupDao.create(toCre);
- }
- for (TaskHasResearchGroup toDel : toDelete) {
- taskHasResearchGroupDao.delete(toDel);
+ for (Long toDel : toDelete) {
+
+ TaskHasResearchGroup rghau = currentlySelected
+ .stream()
+ .filter(a -> (a.getTaskId() == taskBean.getId() && a.getResearchGroupId() == toDel))
+ .findFirst().get();
+
+ taskHasResearchGroupDao.delete(rghau);
}
}
diff --git a/src/main/java/edu/mit/cci/pogs/service/UserService.java b/src/main/java/edu/mit/cci/pogs/service/UserService.java
index c87179ff..d8a4200b 100644
--- a/src/main/java/edu/mit/cci/pogs/service/UserService.java
+++ b/src/main/java/edu/mit/cci/pogs/service/UserService.java
@@ -5,8 +5,10 @@
import edu.mit.cci.pogs.model.jooq.tables.pojos.AuthUser;
import edu.mit.cci.pogs.model.jooq.tables.pojos.ResearchGroupHasAuthUser;
+import edu.mit.cci.pogs.service.base.ServiceBase;
+import edu.mit.cci.pogs.utils.ObjectUtils;
import edu.mit.cci.pogs.view.auth.beans.RegisterBean;
-import edu.mit.cci.pogs.view.authuser.AuthUserBean;
+import edu.mit.cci.pogs.view.authuser.beans.AuthUserBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
@@ -14,9 +16,10 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
@Service
-public class UserService {
+public class UserService extends ServiceBase {
private UserDao userDao;
private PasswordEncoder passwordEncoder;
@@ -32,23 +35,25 @@ public UserService(UserDao userDao, PasswordEncoder passwordEncoder, ResearchGro
public AuthUser createUser(RegisterBean registerBean) {
AuthUser authUser = new AuthUser();
+
authUser.setEmailAddress(registerBean.getEmailAddress());
authUser.setPassword(passwordEncoder.encode(registerBean.getPassword()));
authUser.setFirstName(registerBean.getFirstName());
authUser.setLastName(registerBean.getLastName());
authUser.setIsAdmin(false);
+
+ if(userDao.get(authUser.getEmailAddress())!= null){
+ return null;
+ }
return userDao.create(authUser);
}
public AuthUser adminCreateOrUpdateUser(AuthUserBean authUserBean) {
AuthUser authUser = new AuthUser();
- authUser.setEmailAddress(authUserBean.getEmailAddress());
- authUser.setFirstName(authUserBean.getFirstName());
- authUser.setLastName(authUserBean.getLastName());
- authUser.setIsAdmin(authUserBean.getAdmin());
- authUser.setId(authUserBean.getId());
+
+ ObjectUtils.Copy(authUser, authUserBean);
if (authUser.getId() == null) {
@@ -71,44 +76,34 @@ private void createOrUpdateUserGroups(AuthUserBean authUserBean) {
if (authUserBean.getResearchGroupRelationshipBean() == null && authUserBean.getResearchGroupRelationshipBean().getSelectedValues() == null) {
return;
}
- List toCreate = new ArrayList<>();
- List toDelete = new ArrayList<>();
+
+ List toCreate = new ArrayList<>();
+ List toDelete = new ArrayList<>();
List currentlySelected = listResearchGroupHasAuthUserByAuthUser(authUserBean.getId());
- for (ResearchGroupHasAuthUser rghau : currentlySelected) {
- boolean foundRGH = false;
- for (String researchGroupId : authUserBean.getResearchGroupRelationshipBean().getSelectedValues()) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- foundRGH = true;
- }
- }
- if(!foundRGH){
- toDelete.add(rghau);
- }
+ List currentResearchGroups = currentlySelected
+ .stream()
+ .map(ResearchGroupHasAuthUser::getResearchGroupId)
+ .collect(Collectors.toList());
- }
+ String[] newSelectedValues = authUserBean.getResearchGroupRelationshipBean().getSelectedValues();
- for (String researchGroupId : authUserBean.getResearchGroupRelationshipBean().getSelectedValues()) {
-
- boolean selectedAlreadyIn = false;
- for (ResearchGroupHasAuthUser rghau : currentlySelected) {
- if (rghau.getResearchGroupId().longValue() == new Long(researchGroupId).longValue()) {
- selectedAlreadyIn = true;
- }
- }
- if(!selectedAlreadyIn){
- ResearchGroupHasAuthUser rghau = new ResearchGroupHasAuthUser();
- rghau.setAuthUserId(authUserBean.getId());
- rghau.setResearchGroupId(new Long(researchGroupId));
- toCreate.add(rghau);
- }
+ UpdateResearchGroups(toCreate, toDelete, currentResearchGroups, newSelectedValues);
+ for (Long toCre : toCreate) {
+ ResearchGroupHasAuthUser rghau = new ResearchGroupHasAuthUser();
+ rghau.setAuthUserId(authUserBean.getId());
+ rghau.setResearchGroupId(toCre);
+ researchGroupHasAuthUserDao.create(rghau);
}
- for(ResearchGroupHasAuthUser toCre: toCreate){
- researchGroupHasAuthUserDao.create(toCre);
- }
- for(ResearchGroupHasAuthUser toDel: toDelete){
- researchGroupHasAuthUserDao.delete(toDel);
+ for (Long toDel : toDelete) {
+
+ ResearchGroupHasAuthUser rghau = currentlySelected
+ .stream()
+ .filter(a -> (a.getAuthUserId() == authUserBean.getId() && a.getResearchGroupId() == toDel))
+ .findFirst().get();
+
+ researchGroupHasAuthUserDao.delete(rghau);
}
}
diff --git a/src/main/java/edu/mit/cci/pogs/service/base/ServiceBase.java b/src/main/java/edu/mit/cci/pogs/service/base/ServiceBase.java
new file mode 100644
index 00000000..64f834d7
--- /dev/null
+++ b/src/main/java/edu/mit/cci/pogs/service/base/ServiceBase.java
@@ -0,0 +1,39 @@
+package edu.mit.cci.pogs.service.base;
+
+import java.util.List;
+
+public class ServiceBase {
+
+ public void UpdateResearchGroups(List toCreate, List toDelete, List currentResearchGroups, String[] newSelectedValues){
+
+ for (Long rghau : currentResearchGroups) {
+ boolean foundRGH = false;
+ for (String researchGroupId : newSelectedValues) {
+ if (rghau == new Long(researchGroupId).longValue()) {
+ foundRGH = true;
+ }
+ }
+ if (!foundRGH) {
+ toDelete.add(rghau);
+ }
+
+ }
+
+
+
+ for (String researchGroupId : newSelectedValues) {
+
+ boolean selectedAlreadyIn = false;
+ for (Long rghau : currentResearchGroups) {
+ if (rghau == new Long(researchGroupId).longValue()) {
+ selectedAlreadyIn = true;
+ }
+ }
+ if (!selectedAlreadyIn) {
+ toCreate.add(new Long(researchGroupId));
+ }
+
+ }
+
+ }
+}
diff --git a/src/main/java/edu/mit/cci/pogs/utils/ObjectUtils.java b/src/main/java/edu/mit/cci/pogs/utils/ObjectUtils.java
new file mode 100644
index 00000000..15850326
--- /dev/null
+++ b/src/main/java/edu/mit/cci/pogs/utils/ObjectUtils.java
@@ -0,0 +1,15 @@
+package edu.mit.cci.pogs.utils;
+
+import org.apache.commons.beanutils.PropertyUtilsBean;
+
+public class ObjectUtils {
+ public static void Copy(Object destination, Object source){
+ PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
+ try {
+ propertyUtilsBean.copyProperties(destination, source);
+ }
+ catch (Exception e){
+ System.out.println("Properties mismatch in Beans");
+ }
+ }
+}
diff --git a/src/main/java/edu/mit/cci/pogs/view/auth/LoginController.java b/src/main/java/edu/mit/cci/pogs/view/auth/LoginController.java
index dc054e2e..97a8d4cb 100644
--- a/src/main/java/edu/mit/cci/pogs/view/auth/LoginController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/auth/LoginController.java
@@ -1,13 +1,27 @@
package edu.mit.cci.pogs.view.auth;
import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
@Controller
public class LoginController {
@GetMapping("/login")
- public String showLoginForm() {
+ public String showLoginForm(HttpServletRequest request, Model model, @RequestParam(value = "error", required = false) String error) {
+
+ if(error != null)
+ {
+ model.addAttribute("status", "Invalid credentials. Please try again.");
+ }
+ else
+ {
+ model.addAttribute("status", "");
+ }
+
return "auth/login";
}
}
diff --git a/src/main/java/edu/mit/cci/pogs/view/auth/RegisterController.java b/src/main/java/edu/mit/cci/pogs/view/auth/RegisterController.java
index bfe230a8..2415fa75 100644
--- a/src/main/java/edu/mit/cci/pogs/view/auth/RegisterController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/auth/RegisterController.java
@@ -1,12 +1,17 @@
package edu.mit.cci.pogs.view.auth;
import edu.mit.cci.pogs.service.UserService;
+import edu.mit.cci.pogs.utils.MessageUtils;
import edu.mit.cci.pogs.view.auth.beans.RegisterBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
+import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.validation.Valid;
@Controller
public class RegisterController {
@@ -29,9 +34,18 @@ public String showRegisterForm() {
}
@PostMapping("/register")
- public String register(@ModelAttribute RegisterBean registerBean) {
+ public String register(@ModelAttribute @Valid RegisterBean registerBean, BindingResult bindingResult, RedirectAttributes redirectAttributes) {
+
+ if (bindingResult.hasErrors()) {
+ return "auth/register";
+ }
+
+ if (userService.createUser(registerBean) == null) {
+ MessageUtils.addErrorMessage("User failed to create", redirectAttributes);
+ return "redirect:/register";
+ }
- userService.createUser(registerBean);
+ MessageUtils.addSuccessMessage("User created successfully!", redirectAttributes);
return "redirect:/admin";
}
}
diff --git a/src/main/java/edu/mit/cci/pogs/view/auth/beans/RegisterBean.java b/src/main/java/edu/mit/cci/pogs/view/auth/beans/RegisterBean.java
index c047eea7..d707fe30 100644
--- a/src/main/java/edu/mit/cci/pogs/view/auth/beans/RegisterBean.java
+++ b/src/main/java/edu/mit/cci/pogs/view/auth/beans/RegisterBean.java
@@ -2,13 +2,26 @@
import org.apache.commons.lang3.builder.ToStringBuilder;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
import java.util.Objects;
public class RegisterBean {
+ @NotNull
+ @NotEmpty
private String emailAddress;
+
+ @NotNull
+ @NotEmpty
private String firstName;
+
+ @NotNull
+ @NotEmpty
private String lastName;
+
+ @NotNull
+ @NotEmpty
private String password;
public String getEmailAddress() {
diff --git a/src/main/java/edu/mit/cci/pogs/view/authuser/AuthUserBean.java b/src/main/java/edu/mit/cci/pogs/view/authuser/AuthUserBean.java
deleted file mode 100644
index 5be6a3bb..00000000
--- a/src/main/java/edu/mit/cci/pogs/view/authuser/AuthUserBean.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package edu.mit.cci.pogs.view.authuser;
-
-import edu.mit.cci.pogs.model.jooq.tables.pojos.AuthUser;
-import edu.mit.cci.pogs.view.researchgroup.beans.ResearchGroupRelationshipBean;
-
-public class AuthUserBean {
-
- private Long id;
- private String emailAddress;
- private String firstName;
- private String lastName;
- private String password;
- private Boolean isAdmin;
-
-
- private ResearchGroupRelationshipBean researchGroupRelationshipBean;
-
- public AuthUserBean() {
-
- }
-
- public AuthUserBean(AuthUser pojo) {
- this.id = pojo.getId();
- this.emailAddress = pojo.getEmailAddress();
- this.firstName = pojo.getFirstName();
- this.lastName = pojo.getLastName();
- this.password = pojo.getPassword();
- this.isAdmin = pojo.getIsAdmin();
- }
-
- public AuthUser getAuthUser() {
- AuthUser ret = new AuthUser();
- ret.setId(id);
- ret.setEmailAddress(emailAddress);
- ret.setFirstName(firstName);
- ret.setLastName(lastName);
- ret.setPassword(password);
- ret.setIsAdmin(getAdmin());
- return ret;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getEmailAddress() {
- return emailAddress;
- }
-
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public Boolean getAdmin() {
- return isAdmin;
- }
-
- public void setAdmin(Boolean admin) {
- isAdmin = admin;
- }
-
- public ResearchGroupRelationshipBean getResearchGroupRelationshipBean() {
- return researchGroupRelationshipBean;
- }
-
- public void setResearchGroupRelationshipBean(ResearchGroupRelationshipBean researchGroupRelationshipBean) {
- this.researchGroupRelationshipBean = researchGroupRelationshipBean;
- }
-}
diff --git a/src/main/java/edu/mit/cci/pogs/view/authuser/AuthUserController.java b/src/main/java/edu/mit/cci/pogs/view/authuser/AuthUserController.java
index 394cb1ef..211a1e2e 100644
--- a/src/main/java/edu/mit/cci/pogs/view/authuser/AuthUserController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/authuser/AuthUserController.java
@@ -1,5 +1,6 @@
package edu.mit.cci.pogs.view.authuser;
+import edu.mit.cci.pogs.view.authuser.beans.AuthUserBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -65,7 +66,7 @@ public String createAuthUser(Model model) {
@GetMapping("{id}/edit")
public String createAuthUser(@PathVariable("id") Long id, Model model) {
AuthUserBean aub = new AuthUserBean(authUserDao.get(id));
- aub.setAdmin(false);
+ aub.setIsAdmin(false);
aub.setResearchGroupRelationshipBean(
new ResearchGroupRelationshipBean());
aub.getResearchGroupRelationshipBean()
diff --git a/src/main/java/edu/mit/cci/pogs/view/authuser/beans/AuthUserBean.java b/src/main/java/edu/mit/cci/pogs/view/authuser/beans/AuthUserBean.java
new file mode 100644
index 00000000..96afe966
--- /dev/null
+++ b/src/main/java/edu/mit/cci/pogs/view/authuser/beans/AuthUserBean.java
@@ -0,0 +1,25 @@
+package edu.mit.cci.pogs.view.authuser.beans;
+
+import edu.mit.cci.pogs.model.jooq.tables.pojos.AuthUser;
+import edu.mit.cci.pogs.view.researchgroup.beans.ResearchGroupRelationshipBean;
+
+public class AuthUserBean extends AuthUser{
+
+ private ResearchGroupRelationshipBean researchGroupRelationshipBean;
+
+ public AuthUserBean() {
+
+ }
+
+ public AuthUserBean(AuthUser pojo) {
+ super(pojo);
+ }
+
+ public ResearchGroupRelationshipBean getResearchGroupRelationshipBean() {
+ return researchGroupRelationshipBean;
+ }
+
+ public void setResearchGroupRelationshipBean(ResearchGroupRelationshipBean researchGroupRelationshipBean) {
+ this.researchGroupRelationshipBean = researchGroupRelationshipBean;
+ }
+}
diff --git a/src/main/java/edu/mit/cci/pogs/view/chatscript/ChatScriptController.java b/src/main/java/edu/mit/cci/pogs/view/chatscript/ChatScriptController.java
index a7d85d14..d84d2f56 100644
--- a/src/main/java/edu/mit/cci/pogs/view/chatscript/ChatScriptController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/chatscript/ChatScriptController.java
@@ -79,7 +79,7 @@ public String editChatScript(@PathVariable("chatscriptId") Long chatscriptId, Mo
ChatScriptBean chatScriptBean = new ChatScriptBean(chatScriptDao.get(chatscriptId));
chatScriptBean.setResearchGroupRelationshipBean(new ResearchGroupRelationshipBean());
List test = chatScriptService.listChatScriptHasResearchGroupByChatScriptId(chatscriptId);
- chatScriptBean.getResearchGroupRelationshipBean().setChatScriptHasResearchSelectedValues(chatScriptService.listChatScriptHasResearchGroupByChatScriptId(chatscriptId));
+ chatScriptBean.getResearchGroupRelationshipBean().setObjectHasResearchSelectedValues(chatScriptService.listChatScriptHasResearchGroupByChatScriptId(chatscriptId));
chatScriptBean.setId(chatscriptId);
model.addAttribute("chatscript", chatScriptBean);
return "chatscript/chatscript-edit";
diff --git a/src/main/java/edu/mit/cci/pogs/view/chatscript/beans/ChatEntriesBean.java b/src/main/java/edu/mit/cci/pogs/view/chatscript/beans/ChatEntriesBean.java
index e972a0b2..812cd9db 100644
--- a/src/main/java/edu/mit/cci/pogs/view/chatscript/beans/ChatEntriesBean.java
+++ b/src/main/java/edu/mit/cci/pogs/view/chatscript/beans/ChatEntriesBean.java
@@ -4,7 +4,7 @@
import java.util.List;
-public class ChatEntriesBean {
+public class ChatEntriesBean{
List chatEntryList;
diff --git a/src/main/java/edu/mit/cci/pogs/view/dictionary/DictionaryController.java b/src/main/java/edu/mit/cci/pogs/view/dictionary/DictionaryController.java
index c28c7cb7..b665a3d7 100644
--- a/src/main/java/edu/mit/cci/pogs/view/dictionary/DictionaryController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/dictionary/DictionaryController.java
@@ -131,11 +131,8 @@ public String createDictionary(Model model) {
public String editDictionary(@PathVariable("dictionaryId") Long dictionaryId, Model model) {
DictionaryBean dictionaryBean = new DictionaryBean(dictionaryDao.get(dictionaryId));
- dictionaryBean.setResearchGroupRelationshipBean(
- new ResearchGroupRelationshipBean());
- dictionaryBean.getResearchGroupRelationshipBean()
- .setDictionaryHasResearchSelectedValues(
- dictionaryService.listDictionaryHasResearchGroupByDictionaryId(dictionaryId));
+ dictionaryBean.setResearchGroupRelationshipBean(new ResearchGroupRelationshipBean());
+ dictionaryBean.getResearchGroupRelationshipBean().setObjectHasResearchSelectedValues(dictionaryService.listDictionaryHasResearchGroupByDictionaryId(dictionaryId));
model.addAttribute("dictionary", dictionaryBean);
return "dictionary/dictionary-edit";
diff --git a/src/main/java/edu/mit/cci/pogs/view/executablescript/ExecutableScriptController.java b/src/main/java/edu/mit/cci/pogs/view/executablescript/ExecutableScriptController.java
index 6d6ee5d7..c6c98289 100644
--- a/src/main/java/edu/mit/cci/pogs/view/executablescript/ExecutableScriptController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/executablescript/ExecutableScriptController.java
@@ -78,7 +78,7 @@ public String editExecutableScript(@PathVariable("chatscriptId") Long chatscript
executableScriptBean.setResearchGroupRelationshipBean(
new ResearchGroupRelationshipBean());
executableScriptBean.getResearchGroupRelationshipBean()
- .setExecutableScriptHasResearchSelectedValues(
+ .setObjectHasResearchSelectedValues(
executableScriptService.listExecutableScriptHasResearchGroupByDictionaryId(chatscriptId));
diff --git a/src/main/java/edu/mit/cci/pogs/view/researchgroup/beans/ResearchGroupRelationshipBean.java b/src/main/java/edu/mit/cci/pogs/view/researchgroup/beans/ResearchGroupRelationshipBean.java
index 76c6d061..d1bdb5a8 100644
--- a/src/main/java/edu/mit/cci/pogs/view/researchgroup/beans/ResearchGroupRelationshipBean.java
+++ b/src/main/java/edu/mit/cci/pogs/view/researchgroup/beans/ResearchGroupRelationshipBean.java
@@ -1,5 +1,6 @@
package edu.mit.cci.pogs.view.researchgroup.beans;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
@@ -20,69 +21,25 @@ public void setResearchGroupHasAuthUsersSelectedValues(List studyHasResearchGroup){
- if(studyHasResearchGroup!=null && !studyHasResearchGroup.isEmpty()){
- List selectedValues = new ArrayList<>();
- for(StudyHasResearchGroup rghau: studyHasResearchGroup){
- selectedValues.add(rghau.getResearchGroupId().toString());
- }
- this.selectedValues = selectedValues.toArray( new String[0]);
- }
- }
- public void setTaskyHasResearchSelectedValues(List taskHasResearchGroup){
- if(taskHasResearchGroup!=null && !taskHasResearchGroup.isEmpty()){
- List selectedValues = new ArrayList<>();
- for(TaskHasResearchGroup rghau: taskHasResearchGroup){
- selectedValues.add(rghau.getResearchGroupId().toString());
- }
- this.selectedValues = selectedValues.toArray( new String[0]);
- }
- }
- public void setTaskGroupHasResearchSelectedValues(List taskGroupHasResearchGroup){
- if(taskGroupHasResearchGroup!=null && !taskGroupHasResearchGroup.isEmpty()){
+ public void setObjectHasResearchSelectedValues(List objectHasResearchGroup){
+ if(objectHasResearchGroup!=null && !objectHasResearchGroup.isEmpty()){
List selectedValues = new ArrayList<>();
- for(TaskGroupHasResearchGroup rghau: taskGroupHasResearchGroup){
- selectedValues.add(rghau.getResearchGroupId().toString());
- }
- this.selectedValues = selectedValues.toArray( new String[0]);
- }
- }
+ for(T rghau: objectHasResearchGroup){
+ for (Method declaredMethod : rghau.getClass().getDeclaredMethods()) {
+ if (declaredMethod.getName().equalsIgnoreCase("getResearchGroupId") == true){
+ try {
+ String researchGroupId = declaredMethod.invoke(rghau).toString();
+ selectedValues.add(researchGroupId);
+ }
+ catch (Exception e){
+ System.out.println("Incorrect paremter type for Research Group selection");
+ }
+ }
- public void setChatScriptHasResearchSelectedValues(List dictionaryHasResearchGroup){
- if(dictionaryHasResearchGroup!=null && !dictionaryHasResearchGroup.isEmpty()){
- List selectedValues = new ArrayList<>();
- for(ChatScriptHasResearchGroup rghau: dictionaryHasResearchGroup){
- selectedValues.add(rghau.getResearchGroupId().toString());
- }
- this.selectedValues = selectedValues.toArray( new String[0]);
- }
- }
- public void setDictionaryHasResearchSelectedValues(List dictionaryHasResearchGroup){
- if(dictionaryHasResearchGroup!=null && !dictionaryHasResearchGroup.isEmpty()){
- List selectedValues = new ArrayList<>();
- for(DictionaryHasResearchGroup rghau: dictionaryHasResearchGroup){
- selectedValues.add(rghau.getResearchGroupId().toString());
- }
- this.selectedValues = selectedValues.toArray( new String[0]);
- }
- }
- public void setTaskConfigurationHasResearchSelectedValues(List taskConfigurationHasResearchGroup){
- if(taskConfigurationHasResearchGroup!=null && !taskConfigurationHasResearchGroup.isEmpty()){
- List selectedValues = new ArrayList<>();
- for(TaskConfigurationHasResearchGroup rghau: taskConfigurationHasResearchGroup){
- selectedValues.add(rghau.getResearchGroupId().toString());
- }
- this.selectedValues = selectedValues.toArray( new String[0]);
- }
- }
+ }
- public void setExecutableScriptHasResearchSelectedValues(List executableScriptHasResearchGroup){
- if(executableScriptHasResearchGroup!=null && !executableScriptHasResearchGroup.isEmpty()){
- List selectedValues = new ArrayList<>();
- for(ExecutableScriptHasResearchGroup rghau: executableScriptHasResearchGroup){
- selectedValues.add(rghau.getResearchGroupId().toString());
}
this.selectedValues = selectedValues.toArray( new String[0]);
}
diff --git a/src/main/java/edu/mit/cci/pogs/view/session/beans/SessionBean.java b/src/main/java/edu/mit/cci/pogs/view/session/beans/SessionBean.java
index 44b3372a..60409405 100644
--- a/src/main/java/edu/mit/cci/pogs/view/session/beans/SessionBean.java
+++ b/src/main/java/edu/mit/cci/pogs/view/session/beans/SessionBean.java
@@ -6,449 +6,16 @@
import edu.mit.cci.pogs.model.dao.session.SessionStatus;
import edu.mit.cci.pogs.model.jooq.tables.pojos.Session;
-public class SessionBean {
-
- private Long id;
- private String sessionSuffix;
- private Timestamp sessionStartDate;
- private Long studyId;
- private String status;
- private Integer waitingRoomTime;
- private Boolean introPageEnabled;
- private String introText;
- private Integer introTime;
- private Boolean displayNameChangePageEnabled;
- private Integer displayNameChangeTime;
- private Boolean rosterPageEnabled;
- private Integer rosterTime;
- private Boolean donePageEnabled;
- private String donePageText;
- private Integer donePageTime;
- private String doneRedirectUrl;
- private String couldNotAssignToTeamMessage;
- private String taskExecutionType;
- private Boolean roundsEnabled;
- private Integer numberOfRounds;
- private String communicationType;
- private String chatBotName;
- private Boolean scoreboardEnabled;
- private String scoreboardDisplayType;
- private Boolean scoreboardUseDisplayNames;
- private Boolean collaborationTodoListEnabled;
- private Boolean collaborationFeedbackWidgetEnabled;
- private Boolean collaborationVotingWidgetEnabled;
- private String teamCreationMoment;
- private String teamCreationType;
- private Integer teamMinSize;
- private Integer teamMaxSize;
- private String teamCreationMethod;
- private String teamCreationMatrix;
-
- private String sessionScheduleType;
- private Timestamp perpetualStartDate;
- private Timestamp perpetualEndDate;
- private Integer perpetualSubjectsNumber;
- private String perpetualSubjectsPrefix;
-
- private Integer fixedInteractionTime;
-
- private Boolean doneUrlParameter;
-
- private String scheduleConditionType;
- private Long executableScriptId;
+public class SessionBean extends Session{
private SessionHasTaskGroupRelationshipBean sessionHasTaskGroupRelationshipBean;
- private Long sessionWideScriptId;
-
- private Boolean displayNameGenerationEnabled;
-
-
-
public SessionBean() {
}
public SessionBean(Session value) {
- this.id = value.getId();
- this.sessionSuffix = value.getSessionSuffix();
- this.sessionStartDate = value.getSessionStartDate();
- this.studyId = value.getStudyId();
- this.status = value.getStatus();
- this.waitingRoomTime = value.getWaitingRoomTime();
- this.introPageEnabled = value.getIntroPageEnabled();
- this.introText = value.getIntroText();
- this.introTime = value.getIntroTime();
- this.displayNameChangePageEnabled = value.getDisplayNameChangePageEnabled();
- this.displayNameChangeTime = value.getDisplayNameChangeTime();
- this.rosterPageEnabled = value.getRosterPageEnabled();
- this.rosterTime = value.getRosterTime();
- this.donePageEnabled = value.getDonePageEnabled();
- this.donePageText = value.getDonePageText();
- this.donePageTime = value.getDonePageTime();
- this.doneRedirectUrl = value.getDoneRedirectUrl();
- this.couldNotAssignToTeamMessage = value.getCouldNotAssignToTeamMessage();
- this.taskExecutionType = value.getTaskExecutionType();
- this.roundsEnabled = value.getRoundsEnabled();
- this.numberOfRounds = value.getNumberOfRounds();
- this.communicationType = value.getCommunicationType();
- this.chatBotName = value.getChatBotName();
- this.scoreboardEnabled = value.getScoreboardEnabled();
- this.scoreboardDisplayType = value.getScoreboardDisplayType();
- this.scoreboardUseDisplayNames = value.getScoreboardUseDisplayNames();
- this.collaborationTodoListEnabled = value.getCollaborationTodoListEnabled();
- this.collaborationFeedbackWidgetEnabled = value.getCollaborationFeedbackWidgetEnabled();
- this.collaborationVotingWidgetEnabled = value.getCollaborationVotingWidgetEnabled();
- this.teamCreationMoment = value.getTeamCreationMoment();
- this.teamCreationType = value.getTeamCreationType();
- this.teamMinSize = value.getTeamMinSize();
- this.teamMaxSize = value.getTeamMaxSize();
- this.teamCreationMethod = value.getTeamCreationMethod();
- this.teamCreationMatrix = value.getTeamCreationMatrix();
- this.fixedInteractionTime = value.getFixedInteractionTime();
- this.sessionScheduleType = value.getSessionScheduleType();
- this.perpetualStartDate = value.getPerpetualStartDate();
- this.perpetualEndDate = value.getPerpetualEndDate();
- this.perpetualSubjectsNumber = value.getPerpetualSubjectsNumber();
- this.perpetualSubjectsPrefix = value.getPerpetualSubjectsPrefix();
- this.doneUrlParameter = value.getDoneUrlParameter();
- this.scheduleConditionType = value.getScheduleConditionType();
- this.executableScriptId = value.getExecutableScriptId();
- this.sessionWideScriptId = value.getSessionWideScriptId();
- this.displayNameGenerationEnabled = value.getDisplayNameGenerationEnabled();
- }
-
- public String getScheduleConditionType() {
- return scheduleConditionType;
- }
-
- public void setScheduleConditionType(String scheduleConditionType) {
- this.scheduleConditionType = scheduleConditionType;
- }
-
- public Long getExecutableScriptId() {
- return executableScriptId;
- }
-
- public void setExecutableScriptId(Long executableScriptId) {
- this.executableScriptId = executableScriptId;
- }
-
- public String getSessionScheduleType() {
- return sessionScheduleType;
- }
-
- public void setSessionScheduleType(String sessionScheduleType) {
- this.sessionScheduleType = sessionScheduleType;
- }
-
- public Timestamp getPerpetualStartDate() {
- return perpetualStartDate;
- }
-
- public void setPerpetualStartDate(Timestamp perpetualStartDate) {
- this.perpetualStartDate = perpetualStartDate;
- }
-
- public Timestamp getPerpetualEndDate() {
- return perpetualEndDate;
- }
-
- public void setPerpetualEndDate(Timestamp perpetualEndDate) {
- this.perpetualEndDate = perpetualEndDate;
- }
-
- public Integer getPerpetualSubjectsNumber() {
- return perpetualSubjectsNumber;
- }
-
- public void setPerpetualSubjectsNumber(Integer perpetualSubjectsNumber) {
- this.perpetualSubjectsNumber = perpetualSubjectsNumber;
- }
-
- public String getPerpetualSubjectsPrefix() {
- return perpetualSubjectsPrefix;
- }
-
- public void setPerpetualSubjectsPrefix(String perpetualSubjectsPrefix) {
- this.perpetualSubjectsPrefix = perpetualSubjectsPrefix;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getSessionSuffix() {
- return sessionSuffix;
- }
-
- public void setSessionSuffix(String sessionSuffix) {
- this.sessionSuffix = sessionSuffix;
- }
-
- public Timestamp getSessionStartDate() {
- return sessionStartDate;
- }
-
- public void setSessionStartDate(Timestamp sessionStartDate) {
- this.sessionStartDate = sessionStartDate;
- }
-
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public Integer getWaitingRoomTime() {
- return waitingRoomTime;
- }
-
- public void setWaitingRoomTime(Integer waitingRoomTime) {
- this.waitingRoomTime = waitingRoomTime;
- }
-
- public Boolean getIntroPageEnabled() {
- return introPageEnabled;
- }
-
- public void setIntroPageEnabled(Boolean introPageEnabled) {
- this.introPageEnabled = introPageEnabled;
- }
-
- public String getIntroText() {
- return introText;
- }
-
- public void setIntroText(String introText) {
- this.introText = introText;
- }
-
- public Integer getIntroTime() {
- return introTime;
- }
-
- public void setIntroTime(Integer introTime) {
- this.introTime = introTime;
- }
-
- public Boolean getDisplayNameChangePageEnabled() {
- return displayNameChangePageEnabled;
- }
-
- public void setDisplayNameChangePageEnabled(Boolean displayNameChangePageEnabled) {
- this.displayNameChangePageEnabled = displayNameChangePageEnabled;
- }
-
- public Integer getDisplayNameChangeTime() {
- return displayNameChangeTime;
- }
-
- public void setDisplayNameChangeTime(Integer displayNameChangeTime) {
- this.displayNameChangeTime = displayNameChangeTime;
- }
-
- public Boolean getRosterPageEnabled() {
- return rosterPageEnabled;
- }
-
- public void setRosterPageEnabled(Boolean rosterPageEnabled) {
- this.rosterPageEnabled = rosterPageEnabled;
- }
-
- public Integer getRosterTime() {
- return rosterTime;
- }
-
- public void setRosterTime(Integer rosterTime) {
- this.rosterTime = rosterTime;
- }
-
- public Boolean getDonePageEnabled() {
- return donePageEnabled;
- }
-
- public void setDonePageEnabled(Boolean donePageEnabled) {
- this.donePageEnabled = donePageEnabled;
- }
-
- public String getDonePageText() {
- return donePageText;
- }
-
- public void setDonePageText(String donePageText) {
- this.donePageText = donePageText;
- }
-
- public Integer getDonePageTime() {
- return donePageTime;
- }
-
- public void setDonePageTime(Integer donePageTime) {
- this.donePageTime = donePageTime;
- }
-
- public String getDoneRedirectUrl() {
- return doneRedirectUrl;
- }
-
- public void setDoneRedirectUrl(String doneRedirectUrl) {
- this.doneRedirectUrl = doneRedirectUrl;
- }
-
- public String getCouldNotAssignToTeamMessage() {
- return couldNotAssignToTeamMessage;
- }
-
- public void setCouldNotAssignToTeamMessage(String couldNotAssignToTeamMessage) {
- this.couldNotAssignToTeamMessage = couldNotAssignToTeamMessage;
- }
-
- public String getTaskExecutionType() {
- return taskExecutionType;
- }
-
- public void setTaskExecutionType(String taskExecutionType) {
- this.taskExecutionType = taskExecutionType;
- }
-
- public Boolean getRoundsEnabled() {
- return roundsEnabled;
- }
-
- public void setRoundsEnabled(Boolean roundsEnabled) {
- this.roundsEnabled = roundsEnabled;
- }
-
- public Integer getNumberOfRounds() {
- return numberOfRounds;
- }
-
- public void setNumberOfRounds(Integer numberOfRounds) {
- this.numberOfRounds = numberOfRounds;
- }
-
- public String getCommunicationType() {
- return communicationType;
- }
-
- public boolean canHaveCommunicationMatrix() {
- return (communicationType.equals(CommunicationConstraint.DYADIC_CHAT.getId().toString())||communicationType.equals(CommunicationConstraint.MATRIX_CHAT.getId().toString()));
- }
-
- public void setCommunicationType(String communicationType) {
- this.communicationType = communicationType;
- }
-
- public String getChatBotName() {
- return chatBotName;
- }
-
- public void setChatBotName(String chatBotName) {
- this.chatBotName = chatBotName;
- }
-
- public Boolean getScoreboardEnabled() {
- return scoreboardEnabled;
- }
-
- public void setScoreboardEnabled(Boolean scoreboardEnabled) {
- this.scoreboardEnabled = scoreboardEnabled;
- }
-
- public String getScoreboardDisplayType() {
- return scoreboardDisplayType;
- }
-
- public void setScoreboardDisplayType(String scoreboardDisplayType) {
- this.scoreboardDisplayType = scoreboardDisplayType;
- }
-
- public Boolean getScoreboardUseDisplayNames() {
- return scoreboardUseDisplayNames;
- }
-
- public void setScoreboardUseDisplayNames(Boolean scoreboardUseDisplayNames) {
- this.scoreboardUseDisplayNames = scoreboardUseDisplayNames;
- }
-
- public Boolean getCollaborationTodoListEnabled() {
- return collaborationTodoListEnabled;
- }
-
- public void setCollaborationTodoListEnabled(Boolean collaborationTodoListEnabled) {
- this.collaborationTodoListEnabled = collaborationTodoListEnabled;
- }
-
- public Boolean getCollaborationFeedbackWidgetEnabled() {
- return collaborationFeedbackWidgetEnabled;
- }
-
- public void setCollaborationFeedbackWidgetEnabled(Boolean collaborationFeedbackWidgetEnabled) {
- this.collaborationFeedbackWidgetEnabled = collaborationFeedbackWidgetEnabled;
- }
-
- public Boolean getCollaborationVotingWidgetEnabled() {
- return collaborationVotingWidgetEnabled;
- }
-
- public void setCollaborationVotingWidgetEnabled(Boolean collaborationVotingWidgetEnabled) {
- this.collaborationVotingWidgetEnabled = collaborationVotingWidgetEnabled;
- }
-
- public String getTeamCreationMoment() {
- return teamCreationMoment;
- }
-
- public void setTeamCreationMoment(String teamCreationMoment) {
- this.teamCreationMoment = teamCreationMoment;
- }
-
- public String getTeamCreationType() {
- return teamCreationType;
- }
-
- public void setTeamCreationType(String teamCreationType) {
- this.teamCreationType = teamCreationType;
- }
-
- public Integer getTeamMinSize() {
- return teamMinSize;
- }
-
- public void setTeamMinSize(Integer teamMinSize) {
- this.teamMinSize = teamMinSize;
- }
-
- public Integer getTeamMaxSize() {
- return teamMaxSize;
- }
-
- public void setTeamMaxSize(Integer teamMaxSize) {
- this.teamMaxSize = teamMaxSize;
- }
-
- public String getTeamCreationMethod() {
- return teamCreationMethod;
- }
-
- public void setTeamCreationMethod(String teamCreationMethod) {
- this.teamCreationMethod = teamCreationMethod;
- }
-
- public String getTeamCreationMatrix() {
- return teamCreationMatrix;
- }
-
- public void setTeamCreationMatrix(String teamCreationMatrix) {
- this.teamCreationMatrix = teamCreationMatrix;
+ super(value);
}
public SessionHasTaskGroupRelationshipBean getSessionHasTaskGroupRelationshipBean() {
@@ -459,14 +26,6 @@ public void setSessionHasTaskGroupRelationshipBean(SessionHasTaskGroupRelationsh
this.sessionHasTaskGroupRelationshipBean = sessionHasTaskGroupRelationshipBean;
}
- public Long getStudyId() {
- return studyId;
- }
-
- public void setStudyId(Long studyId) {
- this.studyId = studyId;
- }
-
public boolean getHasSessionStarted() {
if(getStatus()!=null) {
return !getStatus()
@@ -475,36 +34,4 @@ public boolean getHasSessionStarted() {
return false;
}
-
- public Integer getFixedInteractionTime() {
- return fixedInteractionTime;
- }
-
- public void setFixedInteractionTime(Integer fixedInteractionTime) {
- this.fixedInteractionTime = fixedInteractionTime;
- }
-
- public Boolean getDoneUrlParameter() {
- return doneUrlParameter;
- }
-
- public void setDoneUrlParameter(Boolean doneUrlParameter) {
- this.doneUrlParameter = doneUrlParameter;
- }
-
- public Long getSessionWideScriptId() {
- return sessionWideScriptId;
- }
-
- public void setSessionWideScriptId(Long sessionWideScriptId) {
- this.sessionWideScriptId = sessionWideScriptId;
- }
-
- public Boolean getDisplayNameGenerationEnabled() {
- return displayNameGenerationEnabled;
- }
-
- public void setDisplayNameGenerationEnabled(Boolean displayNameGenerationEnabled) {
- this.displayNameGenerationEnabled = displayNameGenerationEnabled;
- }
}
diff --git a/src/main/java/edu/mit/cci/pogs/view/study/StudyController.java b/src/main/java/edu/mit/cci/pogs/view/study/StudyController.java
index 649e7a31..f3ec47b1 100644
--- a/src/main/java/edu/mit/cci/pogs/view/study/StudyController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/study/StudyController.java
@@ -75,9 +75,7 @@ public String createStudy(@PathVariable("studyId") Long studyId, Model model) {
StudyBean sb = new StudyBean(studyDao.get(studyId));
sb.setResearchGroupRelationshipBean(
new ResearchGroupRelationshipBean());
- sb.getResearchGroupRelationshipBean()
- .setStudyHasResearchSelectedValues(
- studyService.listStudyHasResearchGroupByStudyId(studyId));
+ sb.getResearchGroupRelationshipBean().setObjectHasResearchSelectedValues(studyService.listStudyHasResearchGroupByStudyId(studyId));
model.addAttribute("study", sb);
return "study/study-edit";
diff --git a/src/main/java/edu/mit/cci/pogs/view/study/beans/StudyBean.java b/src/main/java/edu/mit/cci/pogs/view/study/beans/StudyBean.java
index 9599bfb5..14978751 100644
--- a/src/main/java/edu/mit/cci/pogs/view/study/beans/StudyBean.java
+++ b/src/main/java/edu/mit/cci/pogs/view/study/beans/StudyBean.java
@@ -4,64 +4,18 @@
import edu.mit.cci.pogs.model.jooq.tables.pojos.Study;
import edu.mit.cci.pogs.view.researchgroup.beans.ResearchGroupRelationshipBean;
-public class StudyBean {
+public class StudyBean extends Study {
public StudyBean() {
}
public StudyBean(Study study) {
-
- this.id = study.getId();
- this.studyName = study.getStudyName();
- this.studyDescription = study.getStudyDescription();
- this.studySessionPrefix = study.getStudySessionPrefix();
-
+ super(study);
}
-
- private Long id;
-
- private String studyName;
-
- private String studyDescription;
-
- private String studySessionPrefix;
-
private ResearchGroupRelationshipBean researchGroupRelationshipBean;
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getStudyName() {
- return studyName;
- }
-
- public void setStudyName(String studyName) {
- this.studyName = studyName;
- }
-
- public String getStudyDescription() {
- return studyDescription;
- }
-
- public void setStudyDescription(String studyDescription) {
- this.studyDescription = studyDescription;
- }
-
- public String getStudySessionPrefix() {
- return studySessionPrefix;
- }
-
- public void setStudySessionPrefix(String studySessionPrefix) {
- this.studySessionPrefix = studySessionPrefix;
- }
-
public ResearchGroupRelationshipBean getResearchGroupRelationshipBean() {
return researchGroupRelationshipBean;
}
diff --git a/src/main/java/edu/mit/cci/pogs/view/task/TaskController.java b/src/main/java/edu/mit/cci/pogs/view/task/TaskController.java
index 3d2dc4cf..0c4800ad 100644
--- a/src/main/java/edu/mit/cci/pogs/view/task/TaskController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/task/TaskController.java
@@ -122,11 +122,8 @@ public String createTask(Model model) {
public String createTask(@PathVariable("id") Long id, Model model) {
TaskBean tb = new TaskBean(taskDao.get(id));
- tb.setResearchGroupRelationshipBean(
- new ResearchGroupRelationshipBean());
- tb.getResearchGroupRelationshipBean()
- .setTaskyHasResearchSelectedValues(
- taskService.listTaskHasResearchGroupByTaskId(id));
+ tb.setResearchGroupRelationshipBean(new ResearchGroupRelationshipBean());
+ tb.getResearchGroupRelationshipBean().setObjectHasResearchSelectedValues(taskService.listTaskHasResearchGroupByTaskId(id));
TaskHasTaskConfiguration thtc = taskHasTaskConfigurationDao.getByTaskId(tb.getId());
tb.setTaskConfigurationId(thtc.getTaskConfigurationId());
diff --git a/src/main/java/edu/mit/cci/pogs/view/task/bean/TaskBean.java b/src/main/java/edu/mit/cci/pogs/view/task/bean/TaskBean.java
index 844cf4cd..d8afcf2e 100644
--- a/src/main/java/edu/mit/cci/pogs/view/task/bean/TaskBean.java
+++ b/src/main/java/edu/mit/cci/pogs/view/task/bean/TaskBean.java
@@ -3,32 +3,9 @@
import edu.mit.cci.pogs.model.jooq.tables.pojos.Task;
import edu.mit.cci.pogs.view.researchgroup.beans.ResearchGroupRelationshipBean;
-public class TaskBean {
-
- private Long id;
- private String taskName;
- private String taskPluginType;
- private Boolean soloTask;
- private Integer interactionTime;
- private Boolean introPageEnabled;
- private String introText;
- private Integer introTime;
- private Boolean primerPageEnabled;
- private String primerText;
- private Integer primerTime;
- private Boolean primerVideoAutoplayMute;
- private Boolean interactionWidgetEnabled;
- private String interactionText;
- private String communicationType;
- private Boolean collaborationTodoListEnabled;
- private Boolean collaborationFeedbackWidgetEnabled;
- private Boolean collaborationVotingWidgetEnabled;
- private String scoringType;
- private Long subjectCommunicationId;
- private Long chatScriptId;
+public class TaskBean extends Task{
private Long taskConfigurationId;
- private Boolean shouldScore;
@@ -38,28 +15,7 @@ public TaskBean() {
}
public TaskBean(Task value) {
- this.id = value.getId();
- this.taskName = value.getTaskName();
- this.taskPluginType = value.getTaskPluginType();
- this.soloTask = value.getSoloTask();
- this.interactionTime = value.getInteractionTime();
- this.introPageEnabled = value.getIntroPageEnabled();
- this.introText = value.getIntroText();
- this.introTime = value.getIntroTime();
- this.primerPageEnabled = value.getPrimerPageEnabled();
- this.primerText = value.getPrimerText();
- this.primerTime = value.getPrimerTime();
- this.interactionWidgetEnabled = value.getInteractionWidgetEnabled();
- this.interactionText = value.getInteractionText();
- this.communicationType = value.getCommunicationType();
- this.collaborationTodoListEnabled = value.getCollaborationTodoListEnabled();
- this.collaborationFeedbackWidgetEnabled = value.getCollaborationFeedbackWidgetEnabled();
- this.collaborationVotingWidgetEnabled = value.getCollaborationVotingWidgetEnabled();
- this.scoringType = value.getScoringType();
- this.subjectCommunicationId = value.getSubjectCommunicationId();
- this.chatScriptId = value.getChatScriptId();
- this.primerVideoAutoplayMute = value.getPrimerVideoAutoplayMute();
- this.shouldScore = value.getShouldScore();
+ super(value);
}
@@ -71,157 +27,6 @@ public void setResearchGroupRelationshipBean(ResearchGroupRelationshipBean resea
this.researchGroupRelationshipBean = researchGroupRelationshipBean;
}
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getTaskName() {
- return taskName;
- }
-
- public void setTaskName(String taskName) {
- this.taskName = taskName;
- }
-
- public String getTaskPluginType() {
- return taskPluginType;
- }
-
- public void setTaskPluginType(String taskPluginType) {
- this.taskPluginType = taskPluginType;
- }
-
- public Boolean getSoloTask() {
- return soloTask;
- }
-
- public void setSoloTask(Boolean soloTask) {
- this.soloTask = soloTask;
- }
-
- public Integer getInteractionTime() {
- return interactionTime;
- }
-
- public void setInteractionTime(Integer interactionTime) {
- this.interactionTime = interactionTime;
- }
-
- public Boolean getIntroPageEnabled() {
- return introPageEnabled;
- }
-
- public void setIntroPageEnabled(Boolean introPageEnabled) {
- this.introPageEnabled = introPageEnabled;
- }
-
- public String getIntroText() {
- return introText;
- }
-
- public void setIntroText(String introText) {
- this.introText = introText;
- }
-
- public Integer getIntroTime() {
- return introTime;
- }
-
- public void setIntroTime(Integer introTime) {
- this.introTime = introTime;
- }
-
- public Boolean getPrimerPageEnabled() {
- return primerPageEnabled;
- }
-
- public void setPrimerPageEnabled(Boolean primerPageEnabled) {
- this.primerPageEnabled = primerPageEnabled;
- }
-
- public String getPrimerText() {
- return primerText;
- }
-
- public void setPrimerText(String primerText) {
- this.primerText = primerText;
- }
-
- public Integer getPrimerTime() {
- return primerTime;
- }
-
- public void setPrimerTime(Integer primerTime) {
- this.primerTime = primerTime;
- }
-
- public Boolean getInteractionWidgetEnabled() {
- return interactionWidgetEnabled;
- }
-
- public void setInteractionWidgetEnabled(Boolean interactionWidgetEnabled) {
- this.interactionWidgetEnabled = interactionWidgetEnabled;
- }
-
- public String getInteractionText() {
- return interactionText;
- }
-
- public void setInteractionText(String interactionText) {
- this.interactionText = interactionText;
- }
-
- public String getCommunicationType() {
- return communicationType;
- }
-
- public void setCommunicationType(String communicationType) {
- this.communicationType = communicationType;
- }
-
- public Boolean getCollaborationTodoListEnabled() {
- return collaborationTodoListEnabled;
- }
-
- public void setCollaborationTodoListEnabled(Boolean collaborationTodoListEnabled) {
- this.collaborationTodoListEnabled = collaborationTodoListEnabled;
- }
-
- public Boolean getCollaborationFeedbackWidgetEnabled() {
- return collaborationFeedbackWidgetEnabled;
- }
-
- public void setCollaborationFeedbackWidgetEnabled(Boolean collaborationFeedbackWidgetEnabled) {
- this.collaborationFeedbackWidgetEnabled = collaborationFeedbackWidgetEnabled;
- }
-
- public Boolean getCollaborationVotingWidgetEnabled() {
- return collaborationVotingWidgetEnabled;
- }
-
- public void setCollaborationVotingWidgetEnabled(Boolean collaborationVotingWidgetEnabled) {
- this.collaborationVotingWidgetEnabled = collaborationVotingWidgetEnabled;
- }
-
- public String getScoringType() {
- return scoringType;
- }
-
- public void setScoringType(String scoringType) {
- this.scoringType = scoringType;
- }
-
- public Long getSubjectCommunicationId() {
- return subjectCommunicationId;
- }
-
- public void setSubjectCommunicationId(Long subjectCommunicationId) {
- this.subjectCommunicationId = subjectCommunicationId;
- }
public Long getTaskConfigurationId() {
return taskConfigurationId;
@@ -231,27 +36,4 @@ public void setTaskConfigurationId(Long taskConfigurationId) {
this.taskConfigurationId = taskConfigurationId;
}
- public Long getChatScriptId() {
- return chatScriptId;
- }
-
- public void setChatScriptId(Long chatScriptId) {
- this.chatScriptId = chatScriptId;
- }
-
- public Boolean getPrimerVideoAutoplayMute() {
- return primerVideoAutoplayMute;
- }
-
- public void setPrimerVideoAutoplayMute(Boolean primerVideoAutoplayMute) {
- this.primerVideoAutoplayMute = primerVideoAutoplayMute;
- }
-
- public Boolean getShouldScore() {
- return shouldScore;
- }
-
- public void setShouldScore(Boolean shouldScore) {
- this.shouldScore = shouldScore;
- }
}
diff --git a/src/main/java/edu/mit/cci/pogs/view/taskgroup/TaskGroupController.java b/src/main/java/edu/mit/cci/pogs/view/taskgroup/TaskGroupController.java
index 1627b7e8..00d4fca4 100644
--- a/src/main/java/edu/mit/cci/pogs/view/taskgroup/TaskGroupController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/taskgroup/TaskGroupController.java
@@ -77,13 +77,8 @@ public String createTaskGroup(Model model) {
public String editTaskGroup(@PathVariable("id") Long id, Model model) {
TaskGroupBean bean = new TaskGroupBean(taskGroupDao.get(id));
-
- bean.setResearchGroupRelationshipBean(
- new ResearchGroupRelationshipBean());
- bean.getResearchGroupRelationshipBean()
- .setTaskGroupHasResearchSelectedValues(
- taskGroupService.listTaskGroupHasResearchGroupByTaskGroup(id));
-
+ bean.setResearchGroupRelationshipBean(new ResearchGroupRelationshipBean());
+ bean.getResearchGroupRelationshipBean().setObjectHasResearchSelectedValues(taskGroupService.listTaskGroupHasResearchGroupByTaskGroup(id));
model.addAttribute("taskGroup", bean);
diff --git a/src/main/java/edu/mit/cci/pogs/view/taskgroup/bean/TaskGroupBean.java b/src/main/java/edu/mit/cci/pogs/view/taskgroup/bean/TaskGroupBean.java
index 902f9a8f..f28cb19d 100644
--- a/src/main/java/edu/mit/cci/pogs/view/taskgroup/bean/TaskGroupBean.java
+++ b/src/main/java/edu/mit/cci/pogs/view/taskgroup/bean/TaskGroupBean.java
@@ -5,10 +5,9 @@
import edu.mit.cci.pogs.model.jooq.tables.pojos.TaskGroup;
import edu.mit.cci.pogs.view.researchgroup.beans.ResearchGroupRelationshipBean;
-public class TaskGroupBean {
+public class TaskGroupBean extends TaskGroup{
+
- private Long id;
- private String taskGroupName;
private List selectedTasks;
private ResearchGroupRelationshipBean researchGroupRelationshipBean;
@@ -18,25 +17,9 @@ public TaskGroupBean() {
}
public TaskGroupBean(TaskGroup tg) {
- this.id = tg.getId();
- this.taskGroupName = tg.getTaskGroupName();
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getTaskGroupName() {
- return taskGroupName;
+ super(tg);
}
- public void setTaskGroupName(String taskGroupName) {
- this.taskGroupName = taskGroupName;
- }
public List getSelectedTasks() {
return selectedTasks;
diff --git a/src/main/java/edu/mit/cci/pogs/view/taskgroup/bean/TaskGroupHasTaskBean.java b/src/main/java/edu/mit/cci/pogs/view/taskgroup/bean/TaskGroupHasTaskBean.java
index 5be7f68a..853702fb 100644
--- a/src/main/java/edu/mit/cci/pogs/view/taskgroup/bean/TaskGroupHasTaskBean.java
+++ b/src/main/java/edu/mit/cci/pogs/view/taskgroup/bean/TaskGroupHasTaskBean.java
@@ -1,34 +1,23 @@
package edu.mit.cci.pogs.view.taskgroup.bean;
-public class TaskGroupHasTaskBean {
+import edu.mit.cci.pogs.model.jooq.tables.pojos.TaskGroupHasTask;
- private Long taskId;
-
- private Integer order;
+public class TaskGroupHasTaskBean extends TaskGroupHasTask {
private String taskName;
- public Long getTaskId() {
- return taskId;
- }
-
- public void setTaskId(Long taskId) {
- this.taskId = taskId;
- }
-
- public Integer getOrder() {
- return order;
+ public TaskGroupHasTaskBean(TaskGroupHasTask base){
+ super(base);
}
+ public TaskGroupHasTaskBean(){
- public void setOrder(Integer order) {
- this.order = order;
}
- public String getTaskName() {
+ public String getTaskName(){
return taskName;
}
- public void setTaskName(String taskName) {
+ public void setTaskName(String taskName){
this.taskName = taskName;
}
}
diff --git a/src/main/java/edu/mit/cci/pogs/view/taskplugin/TaskPluginController.java b/src/main/java/edu/mit/cci/pogs/view/taskplugin/TaskPluginController.java
index 18f2dd09..a6d50a84 100644
--- a/src/main/java/edu/mit/cci/pogs/view/taskplugin/TaskPluginController.java
+++ b/src/main/java/edu/mit/cci/pogs/view/taskplugin/TaskPluginController.java
@@ -152,7 +152,7 @@ public String getTaskConfig(@PathVariable("taskPluginName") String taskPluginNam
List test = taskConfigurationService.listTaskConfigurationyHasResearchGroupByTaskConfigurationId(configurationId);
tpcb.setResearchGroupRelationshipBean(new ResearchGroupRelationshipBean());
- tpcb.getResearchGroupRelationshipBean().setTaskConfigurationHasResearchSelectedValues(taskConfigurationService.listTaskConfigurationyHasResearchGroupByTaskConfigurationId(configurationId));
+ tpcb.getResearchGroupRelationshipBean().setObjectHasResearchSelectedValues(taskConfigurationService.listTaskConfigurationyHasResearchGroupByTaskConfigurationId(configurationId));
setupModelAttributesForPlugin(model, taskPlugin, tpcb);
diff --git a/src/main/resources/db/migration/V10__taskandtaskgroup.sql b/src/main/resources/db/migration/V10__taskandtaskgroup.sql
index d13ef664..458bb361 100644
--- a/src/main/resources/db/migration/V10__taskandtaskgroup.sql
+++ b/src/main/resources/db/migration/V10__taskandtaskgroup.sql
@@ -3,13 +3,13 @@ CREATE TABLE IF NOT EXISTS `task` (
`task_name` VARCHAR(255) NULL,
`task_plugin_type` VARCHAR(45) NOT NULL,
`solo_task` TINYINT NULL,
- `interaction_time` INT NULL,
+ `interaction_time` INT NOT NULL DEFAULT 0,
`intro_page_enabled` TINYINT NULL,
`intro_text` LONGTEXT NULL,
- `intro_time` INT NULL,
+ `intro_time` INT NOT NULL DEFAULT 0,
`primer_page_enabled` TINYINT NULL,
`primer_text` LONGTEXT NULL,
- `primer_time` INT NULL,
+ `primer_time` INT NOT NULL DEFAULT 0,
`interaction_widget_enabled` TINYINT NULL,
`interaction_text` LONGTEXT NULL,
`communication_type` CHAR(1) NULL,
diff --git a/src/main/resources/db/migration/V29__sessionfixedtime.sql b/src/main/resources/db/migration/V29__sessionfixedtime.sql
index 1362bb7b..097938ce 100644
--- a/src/main/resources/db/migration/V29__sessionfixedtime.sql
+++ b/src/main/resources/db/migration/V29__sessionfixedtime.sql
@@ -1,2 +1,2 @@
ALTER TABLE `session`
-ADD COLUMN `fixed_interaction_time` INT(11) NULL AFTER `team_creation_matrix`;
+ADD COLUMN `fixed_interaction_time` INT(11) NOT NULL DEFAULT 0 AFTER `team_creation_matrix`;
diff --git a/src/main/resources/db/migration/V37__task_score_boolean.sql b/src/main/resources/db/migration/V37__task_score_boolean.sql
index 19b7bbf7..24a1e75e 100644
--- a/src/main/resources/db/migration/V37__task_score_boolean.sql
+++ b/src/main/resources/db/migration/V37__task_score_boolean.sql
@@ -1,2 +1,2 @@
ALTER TABLE `task`
-ADD COLUMN `should_score` TINYINT(4) NULL AFTER `chat_script_id`;
+ADD COLUMN `should_score` TINYINT(4) NOT NULL DEFAULT 0 AFTER `chat_script_id`;
diff --git a/src/main/resources/db/migration/V5__userisadmin.sql b/src/main/resources/db/migration/V5__userisadmin.sql
index 69c7ae6e..8f602a41 100644
--- a/src/main/resources/db/migration/V5__userisadmin.sql
+++ b/src/main/resources/db/migration/V5__userisadmin.sql
@@ -1,2 +1,2 @@
ALTER TABLE `auth_user`
-ADD COLUMN `is_admin` TINYINT NULL DEFAULT 0 AFTER `last_name`;
+ADD COLUMN `is_admin` TINYINT NOT NULL DEFAULT 0 AFTER `last_name`;
diff --git a/src/main/resources/db/migration/V7__conditionsession.sql b/src/main/resources/db/migration/V7__conditionsession.sql
index c8480a16..40d4c024 100644
--- a/src/main/resources/db/migration/V7__conditionsession.sql
+++ b/src/main/resources/db/migration/V7__conditionsession.sql
@@ -17,17 +17,17 @@ CREATE TABLE IF NOT EXISTS `session` (
`session_start_date` DATETIME NULL,
`condition_id` BIGINT NOT NULL,
`status` VARCHAR(1) NULL,
- `waiting_room_time` INT NULL,
+ `waiting_room_time` INT NOT NULL DEFAULT 0,
`intro_page_enabled` TINYINT NULL,
`intro_text` LONGTEXT NULL,
- `intro_time` INT NULL,
+ `intro_time` INT NOT NULL DEFAULT 0,
`display_name_change_page_enabled` VARCHAR(45) NULL,
- `display_name_change_time` INT NULL,
+ `display_name_change_time` INT NOT NULL DEFAULT 0,
`roster_page_enabled` TINYINT NULL,
- `roster_time` INT NULL,
+ `roster_time` INT NOT NULL DEFAULT 0,
`done_page_enabled` TINYINT NULL,
`done_page_text` LONGTEXT NULL,
- `done_page_time` INT NULL,
+ `done_page_time` INT NOT NULL DEFAULT 0,
`done_redirect_url` VARCHAR(400) NULL,
`could_not_assign_to_team_message` VARCHAR(400) NULL,
`task_execution_type` CHAR(1) NULL,
diff --git a/src/main/resources/templates/auth/login.html b/src/main/resources/templates/auth/login.html
index 4a8e559c..50c73bd7 100644
--- a/src/main/resources/templates/auth/login.html
+++ b/src/main/resources/templates/auth/login.html
@@ -1,7 +1,7 @@
+ layout:decorate="~{layouts/base-layout.html}" xmlns:div="http://www.w3.org/1999/XSL/Transform">
@@ -10,26 +10,36 @@
Login - POGS
-