diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IJournal.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IJournal.java index 24c7cd99c37535e026277bf7449ab6c7eb441089..e53ddc887eac0127b51f629a31e14e7fc76586d6 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IJournal.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IJournal.java @@ -3,13 +3,10 @@ package unipotsdam.gf.interfaces; import unipotsdam.gf.core.management.project.Project; import unipotsdam.gf.core.management.user.User; -import unipotsdam.gf.assignments.NotImplementedLogger; -import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; -import unipotsdam.gf.modules.journal.model.EPorfolio; +import unipotsdam.gf.modules.journal.model.EPortfolio; import unipotsdam.gf.modules.journal.model.Journal; import unipotsdam.gf.modules.researchreport.ResearchReport; -import javax.swing.text.html.HTML; import java.io.File; import java.util.List; @@ -57,5 +54,5 @@ public interface IJournal { * @return EPortfolio (containing Report, ProjectDescription and Journal) */ - EPorfolio getFinalPortfolioForAssessment(Project project, User user) ; + EPortfolio getFinalPortfolioForAssessment(Project project, User user) ; } diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/EPorfolio.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/EPortfolio.java similarity index 61% rename from gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/EPorfolio.java rename to gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/EPortfolio.java index 1377afb417a9b58a14ef68d4c0524daf2aa63f9a..be23df134dd8e3f8f8c56d6c04f5e118fba3bf01 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/EPorfolio.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/EPortfolio.java @@ -9,21 +9,21 @@ import java.util.ArrayList; * Class for passing e-portfolio to assessment */ -public class EPorfolio { +public class EPortfolio { - StudentIdentifier student; - ProjectDescription descrition; - ArrayList<Journal> journals; - ResearchReport report; - //TODO mehr? + private StudentIdentifier student; + private ProjectDescription description; + private ArrayList<Journal> journals; + private ResearchReport report; - public EPorfolio() { + + public EPortfolio() { } - public EPorfolio(StudentIdentifier student, ProjectDescription descrition, ArrayList<Journal> journals, ResearchReport report) { + public EPortfolio(StudentIdentifier student, ProjectDescription description, ArrayList<Journal> journals, ResearchReport report) { this.student = student; - this.descrition = descrition; + this.description = description; this.journals = journals; this.report = report; } @@ -36,12 +36,12 @@ public class EPorfolio { this.student = student; } - public ProjectDescription getDescrition() { - return descrition; + public ProjectDescription getDescription() { + return description; } - public void setDescrition(ProjectDescription descrition) { - this.descrition = descrition; + public void setDescription(ProjectDescription description) { + this.description = description; } public ArrayList<Journal> getJournals() { diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/Journal.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/Journal.java index 499c53d55036a3618d391d74052d0524c1d3be19..7c098dbb1aac9b0aa9f9a7aca2db9b54ab889d28 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/Journal.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/Journal.java @@ -9,7 +9,7 @@ import java.util.Date; import static unipotsdam.gf.view.MarkdownUtils.convertMarkdownToHtml; /** - * Model Class for the learnig journal of the e-portfolio + * Model Class for the learning journal of the e-portfolio */ public class Journal { diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/Link.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/Link.java index 2a4b7e63cb02c70f5f58bfe78f519e5d4b2298da..1d7d8006da568b5e497305f3b19f48328e308715 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/Link.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/Link.java @@ -2,10 +2,10 @@ package unipotsdam.gf.modules.journal.model; public class Link { - String id; - String projectDescription; - String name; - String link; + private String id; + private String projectDescription; + private String name; + private String link; public Link() { } diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/LinkDAOImpl.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/LinkDAOImpl.java index f78a69f71a2db188392b540104f1c1e430785d13..3b7ff8613a52c7c616b82cc91be9ba514dba42e5 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/LinkDAOImpl.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/LinkDAOImpl.java @@ -36,7 +36,7 @@ public class LinkDAOImpl implements LinkDAO{ MysqlConnect connection = new MysqlConnect(); connection.connect(); - // build and execute requestxam + // build and execute request stream String request = "DELETE FROM links WHERE id = ?;"; connection.issueInsertOrDeleteStatement(request, linkId); diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionDAO.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionDAO.java index d4f31bab858c799d258aa77c90894141337f8ad4..0ebb749d4cf824e02a95646123595c3b2b0fc1b0 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionDAO.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionDAO.java @@ -5,7 +5,6 @@ import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; import unipotsdam.gf.modules.journal.model.ProjectDescription; import java.util.ArrayList; -import java.util.Collection; public interface ProjectDescriptionDAO { diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionDAOImpl.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionDAOImpl.java index 0db2468007ef2a9c24d5b8a12761741688c82d40..c0b07344e684abc9a2912d02f8be0b2486e12d06 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionDAOImpl.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionDAOImpl.java @@ -14,8 +14,6 @@ import java.util.UUID; public class ProjectDescriptionDAOImpl implements ProjectDescriptionDAO { - private final Logger log = LoggerFactory.getLogger(ProjectDescriptionDAOImpl.class); - @Override public void createDescription(ProjectDescription projectDescription) { diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/IJournalImpl.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/IJournalImpl.java index f22f951a7b6f95ca3d036c90adcdfe91ba45bf01..d4e9d8a8e99438365fa13c1b2ddad1c30c3d7957 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/IJournalImpl.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/IJournalImpl.java @@ -6,7 +6,7 @@ import unipotsdam.gf.core.management.project.Project; import unipotsdam.gf.core.management.user.User; import unipotsdam.gf.interfaces.IJournal; import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; -import unipotsdam.gf.modules.journal.model.EPorfolio; +import unipotsdam.gf.modules.journal.model.EPortfolio; import unipotsdam.gf.modules.journal.model.Journal; import unipotsdam.gf.modules.researchreport.ResearchReport; @@ -16,23 +16,15 @@ import java.util.List; public class IJournalImpl implements IJournal { - private Logger log = LoggerFactory.getLogger(IJournalImpl.class); + private final Logger log = LoggerFactory.getLogger(IJournalImpl.class); - JournalService journalService = new JournalServiceImpl(); - ProjectDescriptionService descriptionService = new ProjectDescriptionImpl(); + private final JournalService journalService = new JournalServiceImpl(); + private final ProjectDescriptionService descriptionService = new ProjectDescriptionImpl(); @Override public Boolean getPortfoliosForEvaluationPrepared(Project project) { - - if(!descriptionService.checkIfAllDescriptionsClosed(project) || !journalService.checkIfAllJournalClosed(project)){ - //assignMissingPortfolioTasks()? - return false; - } - - //TODO check Constrains (5? Journals...)... - - return true; + return descriptionService.checkIfAllDescriptionsClosed(project) && journalService.checkIfAllJournalClosed(project); } @@ -71,12 +63,12 @@ public class IJournalImpl implements IJournal { } @Override - public EPorfolio getFinalPortfolioForAssessment(Project project, User user) { + public EPortfolio getFinalPortfolioForAssessment(Project project, User user) { - EPorfolio result = new EPorfolio(); + EPortfolio result = new EPortfolio(); StudentIdentifier studentIdentifier = new StudentIdentifier(project.getId(),user.getId()); - result.setDescrition(descriptionService.getProjectbyStudent(studentIdentifier)); + result.setDescription(descriptionService.getProjectByStudent(studentIdentifier)); result.setJournals(journalService.getAllJournals(user.getId(),project.getId())); //TODO result.setReport(...); diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/JournalServiceImpl.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/JournalServiceImpl.java index 9e9d1a7d6c8834de87d11d0823734f8bc202ff52..e6367199fb8ecea4fc583389ca7cef4b553027d1 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/JournalServiceImpl.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/JournalServiceImpl.java @@ -18,7 +18,7 @@ import java.util.ArrayList; public class JournalServiceImpl implements JournalService { private final Logger log = LoggerFactory.getLogger(JournalServiceImpl.class); - private JournalDAO journalDAO = new JournalDAOImpl(); + private final JournalDAO journalDAO = new JournalDAOImpl(); @Override public Journal getJournal(String id) { diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionImpl.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionImpl.java index 9c3a3539a33e33c24c094e97c4322cad0625f26c..22ca2a4b63429bdda422f3be7547439caa8c1f0d 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionImpl.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionImpl.java @@ -15,13 +15,13 @@ import java.util.ArrayList; public class ProjectDescriptionImpl implements ProjectDescriptionService { - private ProjectDescriptionDAO descriptionDAO = new ProjectDescriptionDAOImpl(); - private LinkDAO linkDAO = new LinkDAOImpl(); + private final ProjectDescriptionDAO descriptionDAO = new ProjectDescriptionDAOImpl(); + private final LinkDAO linkDAO = new LinkDAOImpl(); @Override - public ProjectDescription getProjectbyStudent(StudentIdentifier studentIdentifier) { + public ProjectDescription getProjectByStudent(StudentIdentifier studentIdentifier) { - //if no description exists (when page is opend for the first time), create a new one + //if no description exists (when page is opened for the first time), create a new one if(descriptionDAO.getDescription(studentIdentifier)==null){ ProjectDescription description = new ProjectDescription("0", studentIdentifier.getStudentId(), "Hier soll ein Turtorialtext stehen", studentIdentifier.getProjectId(), null); descriptionDAO.createDescription(description); @@ -34,7 +34,7 @@ public class ProjectDescriptionImpl implements ProjectDescriptionService { } @Override - public ProjectDescription getProjectbyId(String id) { + public ProjectDescription getProjectById(String id) { ProjectDescription returnDesc = descriptionDAO.getDescription(id); returnDesc.setLinks(linkDAO.getAllLinks(returnDesc.getId())); return returnDesc; @@ -43,7 +43,7 @@ public class ProjectDescriptionImpl implements ProjectDescriptionService { @Override public void saveProjectText(StudentIdentifier studentIdentifier, String text) { - ProjectDescription desc = getProjectbyStudent(studentIdentifier); + ProjectDescription desc = getProjectByStudent(studentIdentifier); desc.setDescription(text); descriptionDAO.updateDescription(desc); } diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionService.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionService.java index fbf6dc1e9ef202d2e9ae12c214b284d472e931f1..a99aef7d96d10670e5e6b580481b5df727a543cf 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionService.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionService.java @@ -14,9 +14,9 @@ import java.util.ArrayList; public interface ProjectDescriptionService { - ProjectDescription getProjectbyStudent(StudentIdentifier studentIdentifier); + ProjectDescription getProjectByStudent(StudentIdentifier studentIdentifier); - ProjectDescription getProjectbyId(String id); + ProjectDescription getProjectById(String id); void saveProjectText(StudentIdentifier studentIdentifier, String text); void addLink(String project, String link, String name); diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/util/JournalUtils.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/util/JournalUtils.java index dbab027795a3bf7eac78cd3cc476c327365b2304..4133b81fc2b406d71f03ab56d3c4e9fd6f365744 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/util/JournalUtils.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/util/JournalUtils.java @@ -15,7 +15,7 @@ public class JournalUtils { public static final Logger log = LoggerFactory.getLogger(JournalUtils.class); /** - * Coverts a strirng to enum category + * Coverts a string to enum category * * @param category string * @return category, TITLE if string does not match @@ -30,7 +30,7 @@ public class JournalUtils { } catch (IllegalArgumentException e) { c = Category.TITEL; //TODO extra Category for fail? - JournalUtils.log.debug("Illegal argument for visibility, default to TITLR"); + JournalUtils.log.debug("Illegal argument for visibility, default to TITLE"); } return c; } @@ -67,10 +67,9 @@ public class JournalUtils { connection.connect(); // build and execute request - //TODO Formatstring String request = "SELECT COUNT(*) > 0 AS `exists` FROM " + table+ " WHERE id = ?;"; VereinfachtesResultSet rs = connection.issueSelectStatement(request,id); - JournalUtils.log.debug("querry: " + rs.toString()); + JournalUtils.log.debug("query: " + rs.toString()); if (rs.next()) { // save the response int count = rs.getInt("exists"); @@ -79,11 +78,7 @@ public class JournalUtils { connection.close(); // return true if we found the id - if (count < 1) { - return false; - } else { - return true; - } + return count >= 1; } // something happened diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/view/JournalView.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/view/JournalView.java index 68059e911c2c6e91921895d1cc26bb9a837bd3ea..d85291ced130bb3ec0108c8f05e56d238b42c1b4 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/view/JournalView.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/view/JournalView.java @@ -60,8 +60,8 @@ public class JournalView { log.debug(">>> getJournals: student=" + student + " project=" + project +" filter=" + filter ); - JournalFilter filt = (filter.equals("ALL")) ? JournalFilter.ALL:JournalFilter.OWN; - ArrayList<Journal> result = journalService.getAllJournals(student,project,filt); + JournalFilter journalFilter = (filter.equals("ALL")) ? JournalFilter.ALL:JournalFilter.OWN; + ArrayList<Journal> result = journalService.getAllJournals(student,project,journalFilter); log.debug(">>> getJournals: size=" + result.size()); diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/view/ProjectDescriptionView.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/view/ProjectDescriptionView.java index 2b9fe312ee621cfb9ce686deeccfcce77f16c8e1..a8cb61a98d5c351f52b87ab03e817cd4d098de64 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/view/ProjectDescriptionView.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/view/ProjectDescriptionView.java @@ -32,7 +32,7 @@ public class ProjectDescriptionView { public Response getProjectDescription(@PathParam("project") String project, @PathParam("student") String student){ log.debug(">>> getProjectDescription: " + project + "/" + student); - ProjectDescription result = descriptionService.getProjectbyStudent(new StudentIdentifier(project, student)); + ProjectDescription result = descriptionService.getProjectByStudent(new StudentIdentifier(project, student)); log.debug(">>> getProjectDescription"); return Response.ok(result).build(); @@ -71,7 +71,7 @@ public class ProjectDescriptionView { public Response addLink(@FormParam("link") String link, @FormParam("name") String name, @FormParam("projectdescriptionId") String project){ log.debug(">>> addLink: " + name + ":" + link); - ProjectDescription desc = descriptionService.getProjectbyId(project); + ProjectDescription desc = descriptionService.getProjectById(project); descriptionService.addLink(project,link, name ); @@ -122,7 +122,7 @@ public class ProjectDescriptionView { public Response closeDescription(String desc){ log.debug(">>> closeDescription: " + desc); - StudentIdentifier student = descriptionService.getProjectbyId(desc).getStudent(); + StudentIdentifier student = descriptionService.getProjectById(desc).getStudent(); descriptionService.closeDescription(desc); try { URI location = new URI("../pages/eportfolio.jsp?token=" + student.getStudentId() + "&projectId=" + student.getProjectId()); diff --git a/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionImplDAOTest.java b/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionImplDAOTest.java index bfcf503f12693ece2998ab4908928352ef2a23dc..c63a1b8d70c2fd9251cab2852516f55a11966741 100644 --- a/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionImplDAOTest.java +++ b/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/journal/model/dao/ProjectDescriptionImplDAOTest.java @@ -22,7 +22,6 @@ public class ProjectDescriptionImplDAOTest { private String testStudent = "testStudent"; private String testDescription = "testDescription"; private String testProjekt = "testProjekt"; - private ArrayList<String> testGroup = new ArrayList<>(); private ProjectDescription testProjectDescription = new ProjectDescription(testId, testStudent, testDescription, testProjekt, null /*Links are added in Service*/); @@ -31,8 +30,6 @@ public class ProjectDescriptionImplDAOTest { connection.connect(); - ProjectDescription createDescription = testProjectDescription; - descriptionDAO.createDescription(testProjectDescription); ArrayList<ProjectDescription> resultProjectDescriptions = getProjectDescription(); diff --git a/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionImplTest.java b/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionImplTest.java index 08fed12a66e4607f14f071e120834e6a17e1d6f8..66b84406055c680e3c314354ec6897e9126eff5e 100644 --- a/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionImplTest.java +++ b/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/journal/service/ProjectDescriptionImplTest.java @@ -58,7 +58,7 @@ public class ProjectDescriptionImplTest { @Test public void getProjectbyStudent() { //NO description exists - projectDescriptionService.getProjectbyStudent(new StudentIdentifier(testProject, testStudent)); + projectDescriptionService.getProjectByStudent(new StudentIdentifier(testProject, testStudent)); ProjectDescription resProjectDescription = descriptionDAO.getDescription(new StudentIdentifier(testProject, testStudent)); String id = resProjectDescription.getId(); @@ -88,7 +88,7 @@ public class ProjectDescriptionImplTest { testLinkObj.setProjectDescription(id); linkDAO.addLink(testLinkObj); - ProjectDescription resProjectDescription = projectDescriptionService.getProjectbyId(id); + ProjectDescription resProjectDescription = projectDescriptionService.getProjectById(id); assertNotNull(resProjectDescription); assertEquals(testDescription, resProjectDescription.getDescriptionMD());