Methods Summary |
---|
public void | addBodyParam(java.lang.String key, java.lang.String value)Add a parameter value for the body template. It will be used to replace the corresponding token when
the feed entry is rendered.
addParam(bodyParams, key, value);
|
private void | addParam(org.json.JSONObject map, java.lang.String key, java.lang.String value)
if (("actor".equals(key)) || ("target".equals(key))) {
throw new RuntimeException(key + " is a reserved token name, you cannot set it yourself!");
}
try {
map.put(key, value);
}
catch (JSONException e) {
System.out.println("JSONException for key=" + key + ", value=" + value + "!");
e.printStackTrace();
}
|
public void | addPicture(java.lang.String imageHref, java.lang.String linkHref)Add a picture to be associated with this feed entry, along with a link to be associated with the picture (clicking
on the picture in the feed will go to the specified link).
Note that only 4 pictures may be present at any given time. Any pictures beyond this are ignored. Use removePicture
if you need to change something after 4 pictures have been added.
if (linkHref == null) {
this.addPicture(imageHref);
}
try {
addPicture(new URL(imageHref), new URL(linkHref));
}
catch (Exception e) {
System.out.println("Could not add entry for picture!");
e.printStackTrace();
}
|
public void | addPicture(java.lang.String imageHref)Add a picture to be associated with this feed entry, the picture will not have an associated link.
Note that only 4 pictures may be present at any given time. Any pictures beyond this are ignored. Use removePicture
if you need to change something after 4 pictures have been added.
try {
addPicture(new URL(imageHref), null);
}
catch (Exception e) {
System.out.println("Could not add entry for picture!");
e.printStackTrace();
}
|
private void | addPicture(java.net.URL imageUrl, java.net.URL linkUrl)
if (this.pictures == null) {
this.pictures = new ArrayList<IPair<Object, URL>>();
}
if (this.pictures.size() < 4) {
this.pictures.add(new Pair<Object, URL>(imageUrl, linkUrl));
}
|
public void | addTargetIds(java.lang.String newIds)Append to the list of friends who are associated with this action.
This method *will not* clear out any previously added target ids.
if (this.targetIds == null) {
this.targetIds = "";
}
if (! "".equals(this.targetIds)) {
this.targetIds += ",";
}
this.targetIds += newIds;
|
public void | addTargetIds(java.util.Collection facebookIds)Append to the set of friends who are associated with this action. This must be specified if you have used the "{target}" token
in any of your markup.
This method *will not* clear out any previously added target ids.
if (this.targetIds == null) {
this.targetIds = "";
}
for (Object current : facebookIds) {
if (! "".equals(this.targetIds)) {
this.targetIds += ",";
}
this.targetIds += current;
}
|
public void | addTitleParam(java.lang.String key, java.lang.String value)Add a parameter value for the title template. It will be used to replace the corresponding token when
the feed entry is rendered.
addParam(titleParams, key, value);
|
public java.lang.String | getBodyGeneral()
return bodyGeneral;
|
public java.lang.String | getBodyParams()Get the body params as a JSON-formatted string.
return getJsonParams(bodyParams);
|
public java.lang.String | getBodyTemplate()
return bodyTemplate;
|
private java.lang.String | getJsonParams(org.json.JSONObject params)
if (params.length() == 0) {
return null;
}
return params.toString();
|
public java.util.Collection | getPictures()Get the list of pictures.
if ((this.pictures == null) || (this.pictures.isEmpty())) {
return null;
}
return this.pictures;
|
public java.lang.String | getTargetIds()
if ("".equals(targetIds)) {
targetIds = null;
}
return targetIds;
|
public java.lang.String | getTitleParams()Get the title params as a JSON-formatted string.
return getJsonParams(titleParams);
|
public java.lang.String | getTitleTemplate()
return titleTemplate;
|
public void | removePicture(int index)Remove a picture from the list, this can be used to revise the list/free up space for alternate pictures.
if ((this.pictures == null) || (index > this.pictures.size())) {
return;
}
this.pictures.remove(index);
|
public void | setBodyGeneral(java.lang.String bodyGeneral)Set the general body content for this feed entry. This is optional, non-templatized markup, and is distinct from and unrelated
to bodyTemplate. A feed entry can have both at once, either or, or neither.
if ("".equals(bodyGeneral)) {
bodyGeneral = null;
}
this.bodyGeneral = bodyGeneral;
|
public void | setBodyTemplate(java.lang.String bodyTemplate)Set the body template for this feed entry. The body template is optinal.
if ("".equals(bodyTemplate)) {
bodyTemplate = null;
}
this.bodyTemplate = bodyTemplate;
|
public void | setPictures(java.util.List pics)Set the pictures to display all at once, if you feel like building the Collection> on your own. Otherwise
use the more convenient addPic() method instead.
if ((pics == null) || (pics.isEmpty())) {
this.pictures = null;
return;
}
if (pics.size() <= 4) {
this.pictures = (List<IPair<Object, URL>>)pics;
}
if (pics.size() > 4) {
int count = 0;
for (IPair<Object, URL> pic : pics) {
this.pictures.add(pic);
count++;
if (count == 4) {
break;
}
}
}
|
public void | setTargetIds(java.lang.String targetIds)Set the target ids of friends who are associated with this action. This must be specified if you have used the "{target}" token
in any of your markup.
This method will clear out any previously added target ids. To append additional target ids to a previous list, use addTargetIds
instead.
if ("".equals(targetIds)) {
targetIds = null;
}
this.targetIds = targetIds;
|
public void | setTargetIds(java.util.Collection facebookIds)Set the target ids of friends who are associated with this action. This must be specified if you have used the "{target}" token
in any of your markup.
This method will clear out any previously added target ids. To append additional target ids to a previous list, use addTargetIds
instead.
if (facebookIds.isEmpty()) {
this.targetIds = null;
return;
}
this.targetIds = "";
for (Object current : facebookIds) {
if (! "".equals(this.targetIds)) {
this.targetIds += ",";
}
this.targetIds += current;
}
|
public void | setTitleTemplate(java.lang.String titleTemplate)Set the title template for this feed entry. This is a required field, and the template must always contain the "{actor}" token.
if (titleTemplate == null) {
throw new RuntimeException("The title-template cannot be null!");
}
if (! titleTemplate.contains("{actor}")) {
throw new RuntimeException(titleTemplate + " is an invalid template! The title-template must contain the \"{actor}\" token.");
}
this.titleTemplate = titleTemplate;
|