Skip to content

Commit 1130cc9

Browse files
committed
Updated Node API. Changed string representation of EmojiList. Added the list of standard reactions.
1 parent d5790ff commit 1130cc9

File tree

12 files changed

+436
-122
lines changed

12 files changed

+436
-122
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>org.moera</groupId>
77
<artifactId>moeralib</artifactId>
8-
<version>0.17.0</version>
8+
<version>0.17.1</version>
99

1010
<name>moeralib</name>
1111
<description>Java library to interact with Moera decentralized social network</description>

src/main/java/org/moera/lib/node/types/CommentInfo.java

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public class CommentInfo extends Structure implements Cloneable, MediaInfo {
4444
private CommentOperations seniorOperations;
4545
private List<String> blockedOperations;
4646
private List<SheriffMark> sheriffMarks;
47-
private AcceptedReactions acceptedReactions;
47+
private RejectedReactions rejectedReactions;
48+
private RejectedReactions ownerRejectedReactions;
49+
private RejectedReactions seniorRejectedReactions;
4850
private ClientReactionInfo clientReaction;
4951
private ClientReactionInfo seniorReaction;
5052
private ReactionTotalsInfo reactions;
@@ -683,21 +685,57 @@ public void setSheriffMarks(List<SheriffMark> sheriffMarks) {
683685
}
684686

685687
/**
686-
* Retrieves types of reactions that the comment accepts.
688+
* Retrieves types of reactions that the comment rejects.
687689
*
688690
* @return the value
689691
*/
690-
public AcceptedReactions getAcceptedReactions() {
691-
return acceptedReactions;
692+
public RejectedReactions getRejectedReactions() {
693+
return rejectedReactions;
692694
}
693695

694696
/**
695-
* Sets types of reactions that the comment accepts.
697+
* Sets types of reactions that the comment rejects.
696698
*
697-
* @param acceptedReactions the value to be set
699+
* @param rejectedReactions the value to be set
698700
*/
699-
public void setAcceptedReactions(AcceptedReactions acceptedReactions) {
700-
this.acceptedReactions = acceptedReactions;
701+
public void setRejectedReactions(RejectedReactions rejectedReactions) {
702+
this.rejectedReactions = rejectedReactions;
703+
}
704+
705+
/**
706+
* Retrieves types of reactions that the comment rejects, as defined by the comments' owner.
707+
*
708+
* @return the value
709+
*/
710+
public RejectedReactions getOwnerRejectedReactions() {
711+
return ownerRejectedReactions;
712+
}
713+
714+
/**
715+
* Sets types of reactions that the comment rejects, as defined by the comments' owner.
716+
*
717+
* @param ownerRejectedReactions the value to be set
718+
*/
719+
public void setOwnerRejectedReactions(RejectedReactions ownerRejectedReactions) {
720+
this.ownerRejectedReactions = ownerRejectedReactions;
721+
}
722+
723+
/**
724+
* Retrieves types of reactions that the comment rejects, as defined by the posting's owner ("senior").
725+
*
726+
* @return the value
727+
*/
728+
public RejectedReactions getSeniorRejectedReactions() {
729+
return seniorRejectedReactions;
730+
}
731+
732+
/**
733+
* Sets types of reactions that the comment rejects, as defined by the posting's owner ("senior").
734+
*
735+
* @param seniorRejectedReactions the value to be set
736+
*/
737+
public void setSeniorRejectedReactions(RejectedReactions seniorRejectedReactions) {
738+
this.seniorRejectedReactions = seniorRejectedReactions;
701739
}
702740

703741
/**
@@ -757,8 +795,14 @@ public void setReactions(ReactionTotalsInfo reactions) {
757795
@Override
758796
public void validate() {
759797
super.validate();
760-
if (acceptedReactions != null) {
761-
acceptedReactions.validate();
798+
if (rejectedReactions != null) {
799+
rejectedReactions.validate();
800+
}
801+
if (ownerRejectedReactions != null) {
802+
ownerRejectedReactions.validate();
803+
}
804+
if (seniorRejectedReactions != null) {
805+
seniorRejectedReactions.validate();
762806
}
763807
if (reactions != null) {
764808
reactions.validate();

src/main/java/org/moera/lib/node/types/CommentMassAttributes.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
public class CommentMassAttributes extends Structure implements Cloneable {
99

1010
private CommentOperations seniorOperations;
11+
private RejectedReactions seniorRejectedReactions;
1112

1213
/**
1314
* Retrieves the operations and the corresponding principals that are overridden by the comment's owner ("senior")
@@ -29,6 +30,32 @@ public void setSeniorOperations(CommentOperations seniorOperations) {
2930
this.seniorOperations = seniorOperations;
3031
}
3132

33+
/**
34+
* Retrieves types of reactions that the comment rejects, as defined by the posting's owner ("senior").
35+
*
36+
* @return the value
37+
*/
38+
public RejectedReactions getSeniorRejectedReactions() {
39+
return seniorRejectedReactions;
40+
}
41+
42+
/**
43+
* Sets types of reactions that the comment rejects, as defined by the posting's owner ("senior").
44+
*
45+
* @param seniorRejectedReactions the value to be set
46+
*/
47+
public void setSeniorRejectedReactions(RejectedReactions seniorRejectedReactions) {
48+
this.seniorRejectedReactions = seniorRejectedReactions;
49+
}
50+
51+
@Override
52+
public void validate() {
53+
super.validate();
54+
if (seniorRejectedReactions != null) {
55+
seniorRejectedReactions.validate();
56+
}
57+
}
58+
3259
/**
3360
* Creates and returns a copy of this {@code CommentMassAttributes} object.
3461
*

src/main/java/org/moera/lib/node/types/CommentSourceText.java

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public class CommentSourceText extends Structure implements Cloneable {
1515
private Body bodySrc;
1616
private SourceFormat bodySrcFormat;
1717
private List<MediaWithDigest> media;
18-
private AcceptedReactions acceptedReactions;
18+
private RejectedReactions rejectedReactions;
19+
private RejectedReactions seniorRejectedReactions;
1920
private String repliedToId;
2021
private CommentOperations operations;
2122
private ReactionOperations reactionOperations;
@@ -98,21 +99,43 @@ public void setMedia(List<MediaWithDigest> media) {
9899
}
99100

100101
/**
101-
* Retrieves types of reactions that the comment accepts.
102+
* Retrieves types of reactions that the comment rejects.
102103
*
103104
* @return the value
104105
*/
105-
public AcceptedReactions getAcceptedReactions() {
106-
return acceptedReactions;
106+
public RejectedReactions getRejectedReactions() {
107+
return rejectedReactions;
107108
}
108109

109110
/**
110-
* Sets types of reactions that the comment accepts.
111+
* Sets types of reactions that the comment rejects.
111112
*
112-
* @param acceptedReactions the value to be set
113+
* @param rejectedReactions the value to be set
113114
*/
114-
public void setAcceptedReactions(AcceptedReactions acceptedReactions) {
115-
this.acceptedReactions = acceptedReactions;
115+
public void setRejectedReactions(RejectedReactions rejectedReactions) {
116+
this.rejectedReactions = rejectedReactions;
117+
}
118+
119+
/**
120+
* Retrieves types of reactions that the comment rejects, as defined by the posting's owner ("senior"); only the
121+
* senior may set this
122+
* .
123+
*
124+
* @return the value
125+
*/
126+
public RejectedReactions getSeniorRejectedReactions() {
127+
return seniorRejectedReactions;
128+
}
129+
130+
/**
131+
* Sets types of reactions that the comment rejects, as defined by the posting's owner ("senior"); only the senior
132+
* may set this
133+
* .
134+
*
135+
* @param seniorRejectedReactions the value to be set
136+
*/
137+
public void setSeniorRejectedReactions(RejectedReactions seniorRejectedReactions) {
138+
this.seniorRejectedReactions = seniorRejectedReactions;
116139
}
117140

118141
/**
@@ -196,8 +219,11 @@ public void validate() {
196219
super.validate();
197220
ValidationUtil.notNull(bodySrc, "comment.body-src.blank");
198221
ValidationUtil.maxSize(bodySrc, 65535, "comment.body-src.wrong-size");
199-
if (acceptedReactions != null) {
200-
acceptedReactions.validate();
222+
if (rejectedReactions != null) {
223+
rejectedReactions.validate();
224+
}
225+
if (seniorRejectedReactions != null) {
226+
seniorRejectedReactions.validate();
201227
}
202228
}
203229

src/main/java/org/moera/lib/node/types/CommentText.java

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public class CommentText extends Structure implements Cloneable {
2222
private BodyFormat bodyFormat;
2323
private List<String> media;
2424
private Long createdAt;
25-
private AcceptedReactions acceptedReactions;
25+
private RejectedReactions rejectedReactions;
26+
private RejectedReactions seniorRejectedReactions;
2627
private String repliedToId;
2728
private byte[] signature;
2829
private Short signatureVersion;
@@ -233,21 +234,43 @@ public void setCreatedAt(Long createdAt) {
233234
}
234235

235236
/**
236-
* Retrieves types of reactions that the comment accepts.
237+
* Retrieves types of reactions that the comment rejects.
237238
*
238239
* @return the value
239240
*/
240-
public AcceptedReactions getAcceptedReactions() {
241-
return acceptedReactions;
241+
public RejectedReactions getRejectedReactions() {
242+
return rejectedReactions;
242243
}
243244

244245
/**
245-
* Sets types of reactions that the comment accepts.
246+
* Sets types of reactions that the comment rejects.
246247
*
247-
* @param acceptedReactions the value to be set
248+
* @param rejectedReactions the value to be set
248249
*/
249-
public void setAcceptedReactions(AcceptedReactions acceptedReactions) {
250-
this.acceptedReactions = acceptedReactions;
250+
public void setRejectedReactions(RejectedReactions rejectedReactions) {
251+
this.rejectedReactions = rejectedReactions;
252+
}
253+
254+
/**
255+
* Retrieves types of reactions that the comment rejects, as defined by the posting's owner ("senior"); only the
256+
* senior may set this
257+
* .
258+
*
259+
* @return the value
260+
*/
261+
public RejectedReactions getSeniorRejectedReactions() {
262+
return seniorRejectedReactions;
263+
}
264+
265+
/**
266+
* Sets types of reactions that the comment rejects, as defined by the posting's owner ("senior"); only the senior
267+
* may set this
268+
* .
269+
*
270+
* @param seniorRejectedReactions the value to be set
271+
*/
272+
public void setSeniorRejectedReactions(RejectedReactions seniorRejectedReactions) {
273+
this.seniorRejectedReactions = seniorRejectedReactions;
251274
}
252275

253276
/**
@@ -372,8 +395,11 @@ public void validate() {
372395
ValidationUtil.maxSize(ownerName, 63, "comment.owner-name.wrong-size");
373396
ValidationUtil.maxSize(ownerFullName, 96, "comment.owner-full-name.wrong-size");
374397
ValidationUtil.maxSize(ownerGender, 31, "comment.owner-gender.wrong-size");
375-
if (acceptedReactions != null) {
376-
acceptedReactions.validate();
398+
if (rejectedReactions != null) {
399+
rejectedReactions.validate();
400+
}
401+
if (seniorRejectedReactions != null) {
402+
seniorRejectedReactions.validate();
377403
}
378404
}
379405

src/main/java/org/moera/lib/node/types/DraftInfo.java

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public class DraftInfo extends Structure implements Cloneable {
2121
private Long deadline;
2222
private String ownerFullName;
2323
private AvatarImage ownerAvatar;
24-
private AcceptedReactions acceptedReactions;
24+
private RejectedReactions rejectedReactions;
25+
private RejectedReactions commentRejectedReactions;
2526
private Body bodySrc;
2627
private SourceFormat bodySrcFormat;
2728
private Body body;
@@ -232,21 +233,39 @@ public void setOwnerAvatar(AvatarImage ownerAvatar) {
232233
}
233234

234235
/**
235-
* Retrieves types of reactions that the posting accepts.
236+
* Retrieves types of reactions that the posting rejects.
236237
*
237238
* @return the value
238239
*/
239-
public AcceptedReactions getAcceptedReactions() {
240-
return acceptedReactions;
240+
public RejectedReactions getRejectedReactions() {
241+
return rejectedReactions;
241242
}
242243

243244
/**
244-
* Sets types of reactions that the posting accepts.
245+
* Sets types of reactions that the posting rejects.
245246
*
246-
* @param acceptedReactions the value to be set
247+
* @param rejectedReactions the value to be set
247248
*/
248-
public void setAcceptedReactions(AcceptedReactions acceptedReactions) {
249-
this.acceptedReactions = acceptedReactions;
249+
public void setRejectedReactions(RejectedReactions rejectedReactions) {
250+
this.rejectedReactions = rejectedReactions;
251+
}
252+
253+
/**
254+
* Retrieves types of reactions that the comment should reject, set for posting drafts, if needed.
255+
*
256+
* @return the value
257+
*/
258+
public RejectedReactions getCommentRejectedReactions() {
259+
return commentRejectedReactions;
260+
}
261+
262+
/**
263+
* Sets types of reactions that the comment should reject, set for posting drafts, if needed.
264+
*
265+
* @param commentRejectedReactions the value to be set
266+
*/
267+
public void setCommentRejectedReactions(RejectedReactions commentRejectedReactions) {
268+
this.commentRejectedReactions = commentRejectedReactions;
250269
}
251270

252271
/**
@@ -440,8 +459,11 @@ public void setCommentOperations(CommentOperations commentOperations) {
440459
@Override
441460
public void validate() {
442461
super.validate();
443-
if (acceptedReactions != null) {
444-
acceptedReactions.validate();
462+
if (rejectedReactions != null) {
463+
rejectedReactions.validate();
464+
}
465+
if (commentRejectedReactions != null) {
466+
commentRejectedReactions.validate();
445467
}
446468
if (updateInfo != null) {
447469
updateInfo.validate();

0 commit comments

Comments
 (0)