From de507fd1e36faee2f211e1cfd915d3e50b01c8ac Mon Sep 17 00:00:00 2001
From: tudtianus <tudtianus@gmail.com>
Date: Sun, 1 Jul 2018 13:31:29 +0200
Subject: [PATCH] fix: java some cleanup

---
 .../gf/modules/journal/model/Journal.java      | 17 ++++++++---------
 .../journal/model/ProjectDescription.java      | 18 +++++++++---------
 .../journal/service/DummyJournalService.java   | 13 ++++++-------
 .../service/DummyProjectDescription.java       |  8 ++------
 .../gf/modules/journal/view/JournalView.java   |  6 +++---
 .../journal/view/ProjectDescriptionView.java   |  4 ++--
 6 files changed, 30 insertions(+), 36 deletions(-)

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 43670730..65a17d1f 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
@@ -10,18 +10,17 @@ import static unipotsdam.gf.core.management.utils.MarkdownUtils.convertMarkdownT
  */
 public class Journal {
 
-    long id;
-    StudentIdentifier studentIdentifier;
-    String creator;
-    String entryHTML;
-    String entryMD;
-    long timestamp;
-    Visibility visibility;
-    String category; //TODO enum
+    private long id;
+    private StudentIdentifier studentIdentifier;
+    private String creator;
+    private String entryHTML;
+    private String entryMD;
+    private long timestamp;
+    private Visibility visibility;
+    private String category;//TODO enum
 
     public Journal() {}
 
-
     public Journal(long id, StudentIdentifier studentIdentifier, String entry, long timestamp, Visibility visibility, String category) {
         this.id = id;
         this.studentIdentifier = studentIdentifier;
diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/ProjectDescription.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/ProjectDescription.java
index 88daca37..7c73443a 100644
--- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/ProjectDescription.java
+++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/model/ProjectDescription.java
@@ -13,15 +13,15 @@ import static unipotsdam.gf.core.management.utils.MarkdownUtils.convertMarkdownT
 
 public class ProjectDescription {
 
-    long id;
-    String name;
-    String descriptionHTML;
-    String descriptionMD;
-    boolean open;
-    Project project;
-    Map<String,String> links;
-    ArrayList<String> group;
-    long timestamp;
+    private long id;
+    private String name;
+    private String descriptionHTML;
+    private String descriptionMD;
+    private boolean open;
+    private Project project;
+    private Map<String,String> links;
+    private ArrayList<String> group;
+    private long timestamp;
 
     public ProjectDescription() {
     }
diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/DummyJournalService.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/DummyJournalService.java
index 5773092e..d005bbd9 100644
--- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/DummyJournalService.java
+++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/DummyJournalService.java
@@ -16,14 +16,14 @@ import java.util.Calendar;
 
 public class DummyJournalService implements JournalService {
 
-    Logger log = LoggerFactory.getLogger(DummyJournalService.class);
+    private Logger log = LoggerFactory.getLogger(DummyJournalService.class);
 
 
-    Calendar cal = Calendar.getInstance();
+    private Calendar cal = Calendar.getInstance();
 
-    long id = 4;
+    private long id = 4;
 
-    ArrayList<Journal> journals = new ArrayList<>();
+    private ArrayList<Journal> journals = new ArrayList<>();
 
     public DummyJournalService(){
 
@@ -80,7 +80,7 @@ public class DummyJournalService implements JournalService {
 
     @Override
     public boolean saveJournal(long id, String student, String project, String text, String visibility, String category) {
-        if (Long.valueOf(id) == -1){
+        if (id == -1){
 
             StudentIdentifier studentId = new StudentIdentifier(student,project);
             journals.add(new Journal(this.id++, studentId, text , cal.getTimeInMillis(), stringToVisibility(visibility) , category));
@@ -126,7 +126,7 @@ public class DummyJournalService implements JournalService {
         return v;
     }
 
-    ArrayList<Journal> resetList () {
+    private void resetList() {
 
         StudentIdentifier studentIdentifier = new StudentIdentifier("0","0");
         StudentIdentifier studentIdentifier2 = new StudentIdentifier("0","1");
@@ -152,7 +152,6 @@ public class DummyJournalService implements JournalService {
         journals.add(j4);
         journals.add(j5);
 
-        return journals;
     }
 
 
diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/DummyProjectDescription.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/DummyProjectDescription.java
index 395db961..83d23f00 100644
--- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/DummyProjectDescription.java
+++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/journal/service/DummyProjectDescription.java
@@ -6,22 +6,18 @@ import unipotsdam.gf.modules.journal.model.ProjectDescription;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.Map;
 
 public class DummyProjectDescription implements ProjectDescriptionService {
 
-    ArrayList<Map<String,String>> links;
-    ArrayList<String> group;
-    ProjectDescription testProject;
+    private ProjectDescription testProject;
 
     public DummyProjectDescription(){
 
-        links = new ArrayList();
         HashMap<String,String> link = new HashMap<>();
         link.put("Test", "www.test.de");
         link.put("Google", "www.google.de");
 
-        group = new ArrayList<>();
+        ArrayList<String> group = new ArrayList<>();
         group.add("Test Person");
         group.add("Person Test");
 
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 6a4298d5..8a26fbc4 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
@@ -23,8 +23,8 @@ import java.util.ArrayList;
 @Path("/journal")
 public class JournalView {
 
-    Logger log = LoggerFactory.getLogger(JournalView.class);
-    JournalService journalService = new DummyJournalService();
+    private Logger log = LoggerFactory.getLogger(JournalView.class);
+    private JournalService journalService = new DummyJournalService();
 
     /**
      * Returns a specific Journal
@@ -111,7 +111,7 @@ public class JournalView {
         journalService.saveJournal(id, student, project, text, visibility, category);
 
         //TODO token
-        URI location = null;
+        URI location;
         try {
             location = new URI("../pages/eportfolio.jsp?token=test");
             log.debug("<<< saveJournal: redirect to "  +location.toString());
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 f4d01024..5e8afa67 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
@@ -21,8 +21,8 @@ import java.net.URISyntaxException;
 @Path("/projectdescription")
 public class ProjectDescriptionView {
 
-    Logger log = LoggerFactory.getLogger(ProjectDescriptionView.class);
-    ProjectDescriptionService descriptionService = new DummyProjectDescription();
+    private Logger log = LoggerFactory.getLogger(ProjectDescriptionView.class);
+    private ProjectDescriptionService descriptionService = new DummyProjectDescription();
 
     //get Description
     @GET
-- 
GitLab