Search in sources :

Example 1 with IMemberGroup

use of org.eclipse.ecf.bulletinboard.IMemberGroup in project ecf by eclipse.

the class AbstractParser method parseMemberGroups.

public Map<ID, IMemberGroup> parseMemberGroups(final CharSequence seq) throws BBException {
    Matcher m = getMemberGroupContainerPattern().matcher(seq);
    if (m.find()) {
        // TODO is stripHTMLTrim needed? GenericParser doesn't do it
        Map<ID, IBBObject> objects = genericParser.parseMultiIdName(getMemberGroupPattern(), m.group(0), getMemberGroupFactory(), true);
        Map<ID, IMemberGroup> members = new LinkedHashMap<ID, IMemberGroup>(objects.size());
        for (IBBObject obj : objects.values()) {
            members.put(obj.getID(), (IMemberGroup) obj);
        }
        return members;
    } else {
        throwException("Could not find member groups.", seq);
    }
    return Collections.emptyMap();
}
Also used : IMemberGroup(org.eclipse.ecf.bulletinboard.IMemberGroup) Matcher(java.util.regex.Matcher) IBBObject(org.eclipse.ecf.bulletinboard.IBBObject) ID(org.eclipse.ecf.core.identity.ID) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with IMemberGroup

use of org.eclipse.ecf.bulletinboard.IMemberGroup in project ecf by eclipse.

the class AbstractBulletinBoard method getMemberGroups.

public Collection<IMemberGroup> getMemberGroups() throws BBException {
    if (cachedMemberGroups.isEmpty()) {
        final WebRequest request = createMemberGroupListRequest();
        try {
            request.execute();
            final String str = request.getResponseBodyAsString();
            request.releaseConnection();
            cachedMemberGroups = parser.parseMemberGroups(str);
            for (final IMemberGroup grp : cachedMemberGroups.values()) {
                ((AbstractBBObject) grp).setBulletinBoard(this);
            }
        } catch (final IOException e) {
        // log.error(e);
        }
    }
    return new HashSet<IMemberGroup>(cachedMemberGroups.values());
}
Also used : IMemberGroup(org.eclipse.ecf.bulletinboard.IMemberGroup) WebRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest) IOException(java.io.IOException) HashSet(java.util.HashSet)

Aggregations

IMemberGroup (org.eclipse.ecf.bulletinboard.IMemberGroup)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Matcher (java.util.regex.Matcher)1 IBBObject (org.eclipse.ecf.bulletinboard.IBBObject)1 ID (org.eclipse.ecf.core.identity.ID)1 WebRequest (org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest)1