Skip to main content

 Advanced

Advanced topics

Generator: GetMemberGroups

Class name:org.weborganic.bastille.pageseeder.GetMemberGroups
Version:0.8.1 - 18 December 2012
Library:Bastille
Cacheable:No
Generated:2012-12-21

Description

A generator that returns the list of projects and groups a user is a member of.

Configuration

There is no configuration associated with this generator.

Parameters

No parameter is required; however, the user does need to be logged in as a PageSeeder user.

Returned XML

This generator invokes a PageSeeder service and returns the content of this service verbatim.

The content is wrapped in:

<ps-service resource="/members/[member id]/projects" 
            http-status="[status code]"
            content-type="application/xml">
  <!-- XML returned by PageSeeder Service -->
</ps-service>

The PageSeeder service returns the projects and group in hierarchical form. 

<projects for="[user email]">
  <!-- for each project -->
  <project id="[project id]"
           name="[name]"
           description="[description]"
           owner="[owner]"
           owner-directory="[owner dir]">
    <!-- for each group/sub-project -->
    <group id="[group id]"
           name="[name]"
           description="[description]"
           owner="[owner]"
           owner-directory="[owner dir]"/>
    <!-- more groups / sub-project ... -->
  </project>
  <!-- more projects ... -->
</projects>

Error handling 

If an error occurs while invoking the service, the XML also includes the error and message attributes. The HTTP status should correspond to an HTTP error code.

<ps-service resource="/members/[member id]/projects" 
            http-status="[error]"
            content-type="application/xml"
            error="[error-type]"
            message="[error-message]">
</ps-service>

Sample output

<content generator="com.weborganic.bastille.pageseeder.GetMemberGroups"
         name="classes"
         target="main"
         status="ok">
  <ps-service resource="/members/123/projects"
              http-status="200" 
             content-type="application/xml">
    <projects for="No Email">
      <project id="5"
               name="Project X" 
               owner="XYZ"
               owner-directory="project_x"
               description="This is Project X">
        <project id="6"
                 name="project_x-2011"
                 description="Project X in 2011 (Sub-project)"
                 owner="XYZ"
                 owner-directory="project_x-2011">
          <group id="7"
                 name="project_x-2011-dev" 
                 description="Dev group on project X in 2011"
                 owner="XYZ" owner-directory="project_x-2011"/>
        </project>
      </project>
    </projects>
  </ps-service>
</content>

Usage

To use this generator in Berlioz (in /WEB-INF/config/services.xml): 

<generator class="org.weborganic.bastille.pageseeder.GetMemberGroups" 
           name="[name]"
           target="[target]"/>
Created on , last edited on