Skip to content

Commit 00fb970

Browse files
author
Lloyd Watkin
committed
Formatting updates
1 parent 4f05715 commit 00fb970

1 file changed

Lines changed: 31 additions & 24 deletions

File tree

src/main/java/org/buddycloud/channelserver/channel/ValidateEntry.java

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ValidateEntry {
2525
public static final String IN_REPLY_TO_MISSING = "missing-in-reply-to";
2626
public static final String MISSING_TARGET_ID = "missing-target-id";
2727
public static final String TARGET_MUST_BE_IN_SAME_THREAD = "target-outside-thread";
28-
28+
2929
public static final String CONTENT_TEXT = "text";
3030
public static final String CONTENT_XHTML = "xhtml";
3131

@@ -41,7 +41,7 @@ public class ValidateEntry {
4141
public static final String POST_TYPE_COMMENT = "comment";
4242

4343
public static final String ACTIVITY_VERB_POST = "post";
44-
44+
4545
private static Logger LOGGER = Logger.getLogger(ValidateEntry.class);
4646

4747
private Element entry;
@@ -51,7 +51,7 @@ public class ValidateEntry {
5151
private String targetId;
5252
private Element meta;
5353
private Element media;
54-
54+
5555
private JID jid;
5656
private String channelServerDomain;
5757
private String node;
@@ -62,28 +62,30 @@ public class ValidateEntry {
6262

6363
private Element geoloc;
6464

65-
public ValidateEntry() {}
66-
65+
public ValidateEntry() {
66+
}
67+
6768
public ValidateEntry(Element entry) {
6869
setEntry(entry);
6970
}
70-
71+
7172
public void setEntry(Element entry) {
7273
this.entry = entry;
7374
}
7475

7576
public String getErrorMessage() {
7677
return this.errorMessage;
7778
}
78-
79+
7980
public void setChannelManager(ChannelManager channelManager) {
8081
this.channelManager = channelManager;
8182
}
8283

8384
/**
8485
* This is a big hackety-hack.
85-
* @throws InterruptedException
86-
* @throws NodeStoreException
86+
*
87+
* @throws InterruptedException
88+
* @throws NodeStoreException
8789
*/
8890
public boolean isValid() throws NodeStoreException {
8991
if (this.entry == null) {
@@ -217,8 +219,10 @@ public Element getPayload() {
217219
}
218220

219221
if (null != targetId) {
220-
GlobalItemIDImpl globalTargetId = new GlobalItemIDImpl(new JID(channelServerDomain), node, targetId);
221-
entry.addElement("activity:target").addElement("id").setText(globalTargetId.toString());
222+
GlobalItemIDImpl globalTargetId = new GlobalItemIDImpl(new JID(
223+
channelServerDomain), node, targetId);
224+
entry.addElement("activity:target").addElement("id")
225+
.setText(globalTargetId.toString());
222226
}
223227

224228
return entry;
@@ -235,20 +239,21 @@ public void setNode(String node) {
235239
public void setTo(String channelServerDomain) {
236240
this.channelServerDomain = channelServerDomain;
237241
}
238-
239242

240-
private boolean validateInReplyToElement(Element reply) throws NodeStoreException {
241-
if (null == reply) {
242-
return true;
243-
}
243+
private boolean validateInReplyToElement(Element reply)
244+
throws NodeStoreException {
245+
if (null == reply) {
246+
return true;
247+
}
244248

245-
inReplyTo = reply.attributeValue("ref");
246-
if (true == GlobalItemIDImpl.isGlobalId(inReplyTo)) {
247-
inReplyTo = GlobalItemIDImpl.toLocalId(inReplyTo);
249+
inReplyTo = reply.attributeValue("ref");
250+
if (true == GlobalItemIDImpl.isGlobalId(inReplyTo)) {
251+
inReplyTo = GlobalItemIDImpl.toLocalId(inReplyTo);
248252
}
249253

250254
replyingToItem = null;
251-
if (null == (replyingToItem = channelManager.getNodeItem(node, inReplyTo))) {
255+
if (null == (replyingToItem = channelManager.getNodeItem(node,
256+
inReplyTo))) {
252257
this.errorMessage = PARENT_ITEM_NOT_FOUND;
253258
return false;
254259
}
@@ -260,7 +265,8 @@ private boolean validateInReplyToElement(Element reply) throws NodeStoreExceptio
260265
return true;
261266
}
262267

263-
private boolean validateTargetElement(Element target) throws NodeStoreException {
268+
private boolean validateTargetElement(Element target)
269+
throws NodeStoreException {
264270
if (null == target) {
265271
return true;
266272
}
@@ -274,13 +280,13 @@ private boolean validateTargetElement(Element target) throws NodeStoreException
274280
return false;
275281
}
276282
if (true == GlobalItemIDImpl.isGlobalId(targetId)) {
277-
targetId = GlobalItemIDImpl.toLocalId(targetId);
283+
targetId = GlobalItemIDImpl.toLocalId(targetId);
278284
}
279285
NodeItem targetItem;
280286
if (true == targetId.equals(replyingToItem.getId())) {
281287
targetItem = replyingToItem;
282288
} else {
283-
targetItem = channelManager.getNodeItem(node, targetId);
289+
targetItem = channelManager.getNodeItem(node, targetId);
284290
}
285291
if (null == targetItem) {
286292
this.errorMessage = TARGETED_ITEM_NOT_FOUND;
@@ -289,7 +295,8 @@ private boolean validateTargetElement(Element target) throws NodeStoreException
289295
if (true == targetItem.getId().equals(targetId)) {
290296
return true;
291297
}
292-
if ((null == targetItem.getInReplyTo()) || (false == targetItem.getInReplyTo().equals(targetId))) {
298+
if ((null == targetItem.getInReplyTo())
299+
|| (false == targetItem.getInReplyTo().equals(targetId))) {
293300
this.errorMessage = TARGET_MUST_BE_IN_SAME_THREAD;
294301
return false;
295302
}

0 commit comments

Comments
 (0)