Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add private notes flag to journals #376

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/com/taskadapter/redmineapi/bean/Journal.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class Journal {
public final static Property<String> NOTES = new Property<String>(String.class, "notes");
public final static Property<User> USER = new Property<>(User.class, "user");
public final static Property<Date> CREATED_ON = new Property<>(Date.class, "createdOn");
public final static Property<Boolean> PRIVATE_NOTES = new Property<>(Boolean.class, "privateNotes");
public final static Property<List<JournalDetail>> DETAILS = (Property<List<JournalDetail>>) new Property(List.class, "details");

public Journal() {
Expand Down Expand Up @@ -69,6 +70,14 @@ public List<JournalDetail> getDetails() {
public void addDetails(Collection<JournalDetail> details) {
storage.get(DETAILS).addAll(details);
}

public Boolean isPrivateNotes() {
return storage.get(PRIVATE_NOTES);
}

public void setIsPrivateNotes(Boolean isPrivate) {
storage.set(PRIVATE_NOTES, isPrivate);
}

@Override
public boolean equals(Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ public static Journal parseJournal(JSONObject content) throws JSONException {
result.setCreatedOn(getDateOrNull(content, "created_on"));
result.setNotes(JsonInput.getStringOrNull(content, "notes"));
result.setUser(JsonInput.getObjectOrNull(content, "user", RedmineJSONParser::parseUser));
result.setIsPrivateNotes(JsonInput.getOptionalBool(content, "private_notes"));
result.addDetails(JsonInput.getListOrEmpty(content, "details", RedmineJSONParser::parseJournalDetail));
return result;
}
Expand Down