use of org.eclipse.ecf.bulletinboard.IMember in project ecf by eclipse.
the class AbstractBulletinBoard method getMember.
public IMember getMember(ID id) throws BBException {
if (cachedMembers.containsKey(id)) {
return cachedMembers.get(id);
} else {
final WebRequest request = createMemberPageRequest(id);
try {
request.execute();
final String str = request.getResponseBodyAsString();
request.releaseConnection();
final IMember member = parser.parseMemberPageForName(str, id);
if (member != null) {
((AbstractBBObject) member).setBulletinBoard(this);
cachedMembers.put(member.getID(), member);
return member;
}
} catch (final Exception e) {
e.printStackTrace();
}
return null;
}
}
use of org.eclipse.ecf.bulletinboard.IMember in project ecf by eclipse.
the class MemberGroup method getMembers.
public Collection<IMember> getMembers() {
Map<ID, IMember> map = Collections.emptyMap();
GetRequest request = new GetRequest(bb.getHttpClient(), bb.getURL(), "groupcp.php");
request.addParameter(new NameValuePair("g", String.valueOf(id.getLongValue())));
try {
request.execute();
String str = request.getResponseBodyAsString();
request.releaseConnection();
if (str != null) {
map = bb.getParser().parseMembers(str);
for (IMember member : map.values()) {
((AbstractBBObject) member).setBulletinBoard(bb);
}
}
} catch (IOException e) {
e.printStackTrace();
}
return new HashSet<IMember>(map.values());
}
use of org.eclipse.ecf.bulletinboard.IMember in project ecf by eclipse.
the class PHPBB method getMessage.
public IThreadMessage getMessage(ID id) throws BBException {
GetRequest request = new GetRequest(httpClient, url, "viewtopic.php");
request.addParameter(new NameValuePair("p", String.valueOf(((ThreadMessageID) id).getLongValue())));
String resp = null;
try {
request.execute();
resp = request.getResponseBodyAsString();
} catch (IOException e) {
e.printStackTrace();
}
request.releaseConnection();
if (resp != null) {
ThreadMessage msg = getParser().parseRequestedMessage((ThreadMessageID) id, resp);
msg.setBulletinBoard(this);
IMember author = msg.author;
((Member) author).setBulletinBoard(this);
return msg;
}
return null;
}
use of org.eclipse.ecf.bulletinboard.IMember in project ecf by eclipse.
the class AbstractBulletinBoard method getMembers.
public List<IMember> getMembers() throws BBException {
// TODO: this only returns first page
if (cachedMembers.isEmpty()) {
final WebRequest request = createMemberListRequest();
try {
request.execute();
final String str = request.getResponseBodyAsString();
request.releaseConnection();
cachedMembers = parser.parseMembers(str);
for (final IMember member : cachedMembers.values()) {
((AbstractBBObject) member).setBulletinBoard(this);
}
} catch (final IOException e) {
e.printStackTrace();
}
}
return new ArrayList<IMember>(cachedMembers.values());
}
use of org.eclipse.ecf.bulletinboard.IMember in project ecf by eclipse.
the class AbstractParser method parseMembers.
public Map<ID, IMember> parseMembers(final CharSequence seq) {
// TODO is stripHTMLTrim needed? GenericParser doesn't do it
Map<ID, IBBObject> objects = genericParser.parseMultiIdName(getMemberPattern(), seq, getMemberFactory(), true);
Map<ID, IMember> members = new LinkedHashMap<ID, IMember>(objects.size());
for (IBBObject obj : objects.values()) {
members.put(obj.getID(), (IMember) obj);
}
return members;
}
Aggregations