diff --git a/src/main/java/de/thm/arsnova/entities/Authorize.java b/src/main/java/de/thm/arsnova/entities/Authorize.java index de37e72a5164c3991549d71af68dc843f8b931e0..eacc7c5a859be40fd1758e8f287f0ea6da27b68a 100644 --- a/src/main/java/de/thm/arsnova/entities/Authorize.java +++ b/src/main/java/de/thm/arsnova/entities/Authorize.java @@ -17,10 +17,14 @@ */ package de.thm.arsnova.entities; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; + public class Authorize { private String user; private String socketid; + @JsonView(View.Public.class) public final String getUser() { return user; } @@ -29,6 +33,7 @@ public class Authorize { this.user = user; } + @JsonView(View.Public.class) public final String getSocketid() { return socketid; } diff --git a/src/main/java/de/thm/arsnova/entities/Feedback.java b/src/main/java/de/thm/arsnova/entities/Feedback.java index c50480f094e537aed33f579f4d71f94e1ed83313..dcccb924cfa4e7a713abd310128ccf6fab8bc707 100644 --- a/src/main/java/de/thm/arsnova/entities/Feedback.java +++ b/src/main/java/de/thm/arsnova/entities/Feedback.java @@ -17,6 +17,9 @@ */ package de.thm.arsnova.entities; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; + import java.util.ArrayList; import java.util.List; @@ -42,6 +45,7 @@ public class Feedback { values.add(d); } + @JsonView(View.Public.class) public final List<Integer> getValues() { return values; } diff --git a/src/main/java/de/thm/arsnova/entities/InterposedReadingCount.java b/src/main/java/de/thm/arsnova/entities/InterposedReadingCount.java index a254cb6c691b3154d2feb071e176a04d027dd0b2..a7551b602983c1a78cc4f12e2adafa40580e816c 100644 --- a/src/main/java/de/thm/arsnova/entities/InterposedReadingCount.java +++ b/src/main/java/de/thm/arsnova/entities/InterposedReadingCount.java @@ -17,6 +17,8 @@ */ package de.thm.arsnova.entities; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -40,6 +42,7 @@ public class InterposedReadingCount { } @ApiModelProperty(required = true, value = "the number of read interposed questions") + @JsonView(View.Public.class) public int getRead() { return read; } @@ -49,6 +52,7 @@ public class InterposedReadingCount { } @ApiModelProperty(required = true, value = "the number of unread interposed questions") + @JsonView(View.Public.class) public int getUnread() { return unread; } @@ -58,6 +62,7 @@ public class InterposedReadingCount { } @ApiModelProperty(required = true, value = "the number of total interposed questions") + @JsonView(View.Public.class) public int getTotal() { return getRead() + getUnread(); } diff --git a/src/main/java/de/thm/arsnova/entities/ServiceDescription.java b/src/main/java/de/thm/arsnova/entities/ServiceDescription.java index 421cc20471345e4483acbbec26dc4dbd8140657a..96d1251788186cb93ead776b33be90f634f55ad2 100644 --- a/src/main/java/de/thm/arsnova/entities/ServiceDescription.java +++ b/src/main/java/de/thm/arsnova/entities/ServiceDescription.java @@ -17,6 +17,9 @@ */ package de.thm.arsnova.entities; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; + /** * A login service description. For example, this class is used to display the login buttons in ARSnova mobile. */ @@ -51,6 +54,7 @@ public class ServiceDescription { } } + @JsonView(View.Public.class) public String getId() { return id; } @@ -59,6 +63,7 @@ public class ServiceDescription { this.id = id; } + @JsonView(View.Public.class) public String getName() { return name; } @@ -67,6 +72,7 @@ public class ServiceDescription { this.name = name; } + @JsonView(View.Public.class) public String getDialogUrl() { return dialogUrl; } @@ -75,6 +81,7 @@ public class ServiceDescription { this.dialogUrl = dialogUrl; } + @JsonView(View.Public.class) public String getImage() { return image; } @@ -83,6 +90,7 @@ public class ServiceDescription { this.image = image; } + @JsonView(View.Public.class) public int getOrder() { return order; } @@ -91,6 +99,7 @@ public class ServiceDescription { this.order = order; } + @JsonView(View.Public.class) public String[] getAllowedRoles() { return allowedRoles; } diff --git a/src/main/java/de/thm/arsnova/entities/SessionInfo.java b/src/main/java/de/thm/arsnova/entities/SessionInfo.java index e34227862f8f815e53779cd5cd7ef8fd3223ab9c..1c84049206b4f641dc87d8c3b8ca319b5740da79 100644 --- a/src/main/java/de/thm/arsnova/entities/SessionInfo.java +++ b/src/main/java/de/thm/arsnova/entities/SessionInfo.java @@ -17,6 +17,8 @@ */ package de.thm.arsnova.entities; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -69,6 +71,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the name") + @JsonView(View.Public.class) public String getName() { return name; } @@ -78,6 +81,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the short name") + @JsonView(View.Public.class) public String getShortName() { return shortName; } @@ -87,6 +91,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the keyword") + @JsonView(View.Public.class) public String getKeyword() { return keyword; } @@ -96,6 +101,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "true for active") + @JsonView(View.Public.class) public boolean isActive() { return active; } @@ -105,6 +111,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the source the course comes from (example: moodle)") + @JsonView(View.Public.class) public String getCourseType() { return courseType; } @@ -114,6 +121,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the session type") + @JsonView(View.Public.class) public String getSessionType() { return sessionType; } @@ -123,6 +131,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "used to display level") + @JsonView(View.Public.class) public String getPpLevel() { return ppLevel; } @@ -132,6 +141,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the public pool subject") + @JsonView(View.Public.class) public String getPpSubject() { return ppSubject; } @@ -141,6 +151,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the number of questions") + @JsonView(View.Public.class) public int getNumQuestions() { return numQuestions; } @@ -150,6 +161,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the number of answers") + @JsonView(View.Public.class) public int getNumAnswers() { return numAnswers; } @@ -159,6 +171,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "used to display interposed number") + @JsonView(View.Public.class) public int getNumInterposed() { return numInterposed; } @@ -168,6 +181,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the number of unanswered questions") + @JsonView(View.Public.class) public int getNumUnanswered() { return numUnanswered; } @@ -177,6 +191,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the creation timestamp") + @JsonView(View.Public.class) public long getCreationTime() { return creationTime; } @@ -186,6 +201,7 @@ public class SessionInfo { } @ApiModelProperty(required = true, value = "the number of unread interposed questions") + @JsonView(View.Public.class) public int getNumUnredInterposed() { return numUnredInterposed; } diff --git a/src/main/java/de/thm/arsnova/entities/Statistics.java b/src/main/java/de/thm/arsnova/entities/Statistics.java index 49f9179730fea33687d094bc932a939409f442d0..c0635f0200b85b0b6baa50939d88e651d847a5de 100644 --- a/src/main/java/de/thm/arsnova/entities/Statistics.java +++ b/src/main/java/de/thm/arsnova/entities/Statistics.java @@ -17,6 +17,8 @@ */ package de.thm.arsnova.entities; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -40,6 +42,7 @@ public class Statistics { private int flashcards; @ApiModelProperty(required = true, value = "the number of answers") + @JsonView(View.Public.class) public int getAnswers() { return answers; } @@ -49,6 +52,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of lecture questions") + @JsonView(View.Public.class) public int getLectureQuestions() { return lectureQuestions; } @@ -58,6 +62,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of prepartion uestions") + @JsonView(View.Public.class) public int getPreparationQuestions() { return preparationQuestions; } @@ -67,11 +72,13 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the total number of questions") + @JsonView(View.Public.class) public int getQuestions() { return getLectureQuestions() + getPreparationQuestions(); } @ApiModelProperty(required = true, value = "the number of open sessions") + @JsonView(View.Public.class) public int getOpenSessions() { return openSessions; } @@ -81,6 +88,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of closed Sessions") + @JsonView(View.Public.class) public int getClosedSessions() { return closedSessions; } @@ -90,11 +98,13 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the total number of Sessions") + @JsonView(View.Public.class) public int getSessions() { return getOpenSessions() + getClosedSessions(); } @ApiModelProperty(required = true, value = "used to display Active Users") + @JsonView(View.Public.class) public int getActiveUsers() { return activeUsers; } @@ -104,6 +114,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of users that are logged") + @JsonView(View.Public.class) public int getLoggedinUsers() { return loggedinUsers; } @@ -113,6 +124,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of interposed Questions") + @JsonView(View.Public.class) public int getInterposedQuestions() { return interposedQuestions; } @@ -122,6 +134,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of flashcards") + @JsonView(View.Public.class) public int getFlashcards() { return flashcards; } @@ -131,6 +144,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of creators") + @JsonView(View.Public.class) public int getCreators() { return creators; } @@ -140,6 +154,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of concept Questions") + @JsonView(View.Public.class) public int getConceptQuestions() { return conceptQuestions; } @@ -149,6 +164,7 @@ public class Statistics { } @ApiModelProperty(required = true, value = "the number of active Students") + @JsonView(View.Public.class) public int getActiveStudents() { return activeStudents; } diff --git a/src/main/java/de/thm/arsnova/entities/User.java b/src/main/java/de/thm/arsnova/entities/User.java index c3ed9bf78650a2236a06631794b71ddf6204900a..9d4729d44887ce9c8024b57300c31618db6ed1e0 100644 --- a/src/main/java/de/thm/arsnova/entities/User.java +++ b/src/main/java/de/thm/arsnova/entities/User.java @@ -17,6 +17,8 @@ */ package de.thm.arsnova.entities; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; import de.thm.arsnova.services.UserSessionService; import org.jasig.cas.client.authentication.AttributePrincipal; import org.pac4j.oauth.profile.facebook.FacebookProfile; @@ -76,6 +78,7 @@ public class User implements Serializable { setType(LDAP); } + @JsonView(View.Public.class) public String getUsername() { return username; } @@ -84,6 +87,7 @@ public class User implements Serializable { this.username = username; } + @JsonView(View.Public.class) public String getType() { return type; } @@ -108,6 +112,7 @@ public class User implements Serializable { this.isAdmin = a; } + @JsonView(View.Public.class) public boolean isAdmin() { return this.isAdmin; } diff --git a/src/main/java/de/thm/arsnova/entities/transport/Answer.java b/src/main/java/de/thm/arsnova/entities/transport/Answer.java index 4eaa7ba714a836492edb4a3e6777af3663e11917..5b6d24429c25daaead6c8b770bae04b401c16394 100644 --- a/src/main/java/de/thm/arsnova/entities/transport/Answer.java +++ b/src/main/java/de/thm/arsnova/entities/transport/Answer.java @@ -18,8 +18,10 @@ package de.thm.arsnova.entities.transport; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonView; import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.User; +import de.thm.arsnova.entities.serialization.View; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -59,6 +61,7 @@ public class Answer implements Serializable { } @ApiModelProperty(required = true, value = "used to display text answer") + @JsonView(View.Public.class) public String getAnswerText() { return answerText; } @@ -68,6 +71,7 @@ public class Answer implements Serializable { } @ApiModelProperty(required = true, value = "used to display subject answer") + @JsonView(View.Public.class) public String getAnswerSubject() { return answerSubject; } @@ -76,6 +80,7 @@ public class Answer implements Serializable { this.answerSubject = answerSubject; } + @JsonView(View.Public.class) public final String getAnswerTextRaw() { return this.answerTextRaw; } @@ -84,6 +89,7 @@ public class Answer implements Serializable { this.answerTextRaw = answerTextRaw; } + @JsonView(View.Public.class) public final String getAnswerSubjectRaw() { return this.answerSubjectRaw; } @@ -92,6 +98,7 @@ public class Answer implements Serializable { this.answerSubjectRaw = answerSubjectRaw; } + @JsonView(View.Public.class) public final double getFreeTextScore() { return this.freeTextScore; } @@ -110,6 +117,7 @@ public class Answer implements Serializable { } @ApiModelProperty(required = true, value = "abstention") + @JsonView(View.Public.class) public boolean isAbstention() { return abstention; } @@ -146,6 +154,7 @@ public class Answer implements Serializable { } @ApiModelProperty(required = true, value = "used to display image answer") + @JsonView(View.Public.class) public String getAnswerImage() { return answerImage; } diff --git a/src/main/java/de/thm/arsnova/entities/transport/ImportExportSession.java b/src/main/java/de/thm/arsnova/entities/transport/ImportExportSession.java index 02a01e975c8818aa1cbdac2b65a06c85ac535c55..08eec98e8af713efeb44a88b42f2a99d7e5dfeef 100644 --- a/src/main/java/de/thm/arsnova/entities/transport/ImportExportSession.java +++ b/src/main/java/de/thm/arsnova/entities/transport/ImportExportSession.java @@ -17,12 +17,14 @@ */ package de.thm.arsnova.entities.transport; +import com.fasterxml.jackson.annotation.JsonView; import de.thm.arsnova.entities.Motd; import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import de.thm.arsnova.entities.SessionFeature; import de.thm.arsnova.entities.SessionInfo; import de.thm.arsnova.entities.User; +import de.thm.arsnova.entities.serialization.View; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -56,6 +58,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display session") + @JsonView(View.Public.class) public ImportExportSesssion getSession() { return session; } @@ -65,6 +68,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display questions") + @JsonView(View.Public.class) public List<ImportExportQuestion> getQuestions() { return questions; } @@ -74,6 +78,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display questions feedback") + @JsonView(View.Public.class) public List<InterposedQuestion> getFeedbackQuestions() { return feedbackQuestions; } @@ -82,6 +87,7 @@ public class ImportExportSession { this.feedbackQuestions = feedbackQuestions; } + @JsonView(View.Public.class) public List<Motd> getMotds() { return motds; } @@ -90,6 +96,7 @@ public class ImportExportSession { this.motds = mL; } + @JsonView(View.Public.class) public SessionFeature getSessionFeature() { return sessionFeature; } @@ -98,6 +105,7 @@ public class ImportExportSession { sessionFeature = sF; } + @JsonView(View.Public.class) public SessionInfo getSessionInfo() { return sessionInfo; } @@ -217,6 +225,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = " used to display answers") + @JsonView(View.Public.class) public List<Answer> getAnswers() { return answers; } @@ -241,6 +250,7 @@ public class ImportExportSession { private SessionFeature sessionFeature; @ApiModelProperty(required = true, value = "used to display short name") + @JsonView(View.Public.class) public String getName() { return name; } @@ -250,6 +260,7 @@ public class ImportExportSession { } @ApiModelProperty(required = false, value = "used to identify public pool sessions") + @JsonView(View.Public.class) public String getSessionType() { return sessionType; } @@ -259,6 +270,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display short name") + @JsonView(View.Public.class) public String getShortName() { return shortName; } @@ -268,6 +280,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "active") + @JsonView(View.Public.class) public boolean isActive() { return active; } @@ -277,6 +290,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display public pool") + @JsonView(View.Public.class) public PublicPool getPublicPool() { return publicPool; } @@ -285,6 +299,7 @@ public class ImportExportSession { this.publicPool = publicPool; } + @JsonView(View.Public.class) public SessionFeature getSessionFeature() { return this.sessionFeature; } @@ -333,6 +348,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display author name") + @JsonView(View.Public.class) public String getPpAuthorName() { return ppAuthorName; } @@ -342,6 +358,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display author mail") + @JsonView(View.Public.class) public String getPpAuthorMail() { return ppAuthorMail; } @@ -351,6 +368,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display university") + @JsonView(View.Public.class) public String getPpUniversity() { return ppUniversity; } @@ -360,6 +378,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display logo") + @JsonView(View.Public.class) public String getPpLogo() { return ppLogo; } @@ -369,6 +388,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display subject") + @JsonView(View.Public.class) public String getPpSubject() { return ppSubject; } @@ -378,6 +398,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display license") + @JsonView(View.Public.class) public String getPpLicense() { return ppLicense; } @@ -387,6 +408,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display level") + @JsonView(View.Public.class) public String getPpLevel() { return ppLevel; } @@ -396,6 +418,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display description") + @JsonView(View.Public.class) public String getPpDescription() { return ppDescription; } @@ -405,6 +428,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display faculty") + @JsonView(View.Public.class) public String getPpFaculty() { return ppFaculty; } @@ -414,6 +438,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display name") + @JsonView(View.Public.class) public String getName() { return name; } @@ -423,6 +448,7 @@ public class ImportExportSession { } @ApiModelProperty(required = true, value = "used to display short name") + @JsonView(View.Public.class) public String getShortName() { return shortName; } diff --git a/src/main/java/de/thm/arsnova/entities/transport/InterposedQuestion.java b/src/main/java/de/thm/arsnova/entities/transport/InterposedQuestion.java index 86d3115267712ba2ea96c93e73b5c6fb2a540c30..4d378f55b03447d7f4e239bb10f6aed7cb8666b3 100644 --- a/src/main/java/de/thm/arsnova/entities/transport/InterposedQuestion.java +++ b/src/main/java/de/thm/arsnova/entities/transport/InterposedQuestion.java @@ -17,6 +17,8 @@ */ package de.thm.arsnova.entities.transport; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -54,6 +56,7 @@ public class InterposedQuestion { public InterposedQuestion() { } @ApiModelProperty(required = true, value = "used to display Id") + @JsonView(View.Public.class) public String getId() { return id; } @@ -63,6 +66,7 @@ public class InterposedQuestion { } @ApiModelProperty(required = true, value = "used to display Subject") + @JsonView(View.Public.class) public String getSubject() { return subject; } @@ -72,6 +76,7 @@ public class InterposedQuestion { } @ApiModelProperty(required = true, value = "used to display Text") + @JsonView(View.Public.class) public String getText() { return text; } @@ -81,6 +86,7 @@ public class InterposedQuestion { } @ApiModelProperty(required = true, value = "used to display Timetamp") + @JsonView(View.Public.class) public long getTimestamp() { return timestamp; } @@ -90,6 +96,7 @@ public class InterposedQuestion { } @ApiModelProperty(required = true, value = "is read") + @JsonView(View.Public.class) public boolean isRead() { return read; } diff --git a/src/main/java/de/thm/arsnova/entities/transport/LearningProgressValues.java b/src/main/java/de/thm/arsnova/entities/transport/LearningProgressValues.java index 041ee4d54c7bcf6e214eeb7da4d5cbb304909f38..686a733d09775ba257e97c8a11970bb105942ba4 100644 --- a/src/main/java/de/thm/arsnova/entities/transport/LearningProgressValues.java +++ b/src/main/java/de/thm/arsnova/entities/transport/LearningProgressValues.java @@ -17,6 +17,8 @@ */ package de.thm.arsnova.entities.transport; +import com.fasterxml.jackson.annotation.JsonView; +import de.thm.arsnova.entities.serialization.View; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -39,6 +41,7 @@ public class LearningProgressValues { private int numUsers; @ApiModelProperty(required = true, value = "used to display course progress") + @JsonView(View.Public.class) public int getCourseProgress() { return courseProgress; } @@ -48,6 +51,7 @@ public class LearningProgressValues { } @ApiModelProperty(required = true, value = "used to display my progress") + @JsonView(View.Public.class) public int getMyProgress() { return myProgress; } @@ -57,6 +61,7 @@ public class LearningProgressValues { } @ApiModelProperty(required = true, value = "used to display questions number") + @JsonView(View.Public.class) public int getNumQuestions() { return numQuestions; } @@ -65,6 +70,7 @@ public class LearningProgressValues { this.numQuestions = numQuestions; } + @JsonView(View.Public.class) public int getNumerator() { return numerator; } @@ -73,6 +79,7 @@ public class LearningProgressValues { this.numerator = numerator; } + @JsonView(View.Public.class) public int getDenominator() { return denominator; } @@ -82,6 +89,7 @@ public class LearningProgressValues { } @ApiModelProperty(required = true, value = "used to display user number") + @JsonView(View.Public.class) public int getNumUsers() { return numUsers; }