use of org.eclipse.ecf.internal.provider.vbulletin.internal.ForumFactory in project ecf by eclipse.
the class VBParser method parseForums.
public Map<ID, Forum> parseForums(final CharSequence seq) {
Map<ID, Forum> forums = new LinkedHashMap<ID, Forum>();
Matcher matcher = PAT_FORUM.matcher(seq);
while (matcher.find()) {
String name = StringUtil.stripHTMLTrim(matcher.group(2));
// String desc = StringUtil.stripHTMLTrim(matcher.group(3));
if (StringUtil.notEmptyStr(name)) {
ForumFactory ff = new ForumFactory();
String idStr = matcher.group(1);
ID id = null;
try {
id = ff.createBBObjectId(namespace, baseURL, idStr);
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IDCreateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Forum forum = (Forum) ff.createBBObject(id, name, null);
// forum.setDescription(desc);
forums.put(id, forum);
}
}
return forums;
}
use of org.eclipse.ecf.internal.provider.vbulletin.internal.ForumFactory in project ecf by eclipse.
the class VBParser method parseThreadPageForThreadAttributes.
public Thread parseThreadPageForThreadAttributes(CharSequence seq) throws BBException {
Thread t = (Thread) genericParser.parseSingleIdName(PD_THREAD_ATTRS, seq, new ThreadFactory());
if (t != null) {
Map<ID, IBBObject> forums = genericParser.parseMultiIdName(PD_THREAD_ATTRS_FORUM, seq, new ForumFactory(), true);
Forum prev = null;
Forum f = null;
for (IBBObject obj : forums.values()) {
f = (Forum) obj;
if (prev != null) {
prev.subforums.add(f);
}
f.setParent(prev);
prev = f;
}
t.forum = f;
return t;
} else {
throw new BBException("Failed to parse the thread.");
}
}
Aggregations