Version 5

    Status


    Defining requirement


    Description

     

    A portal admin would like to modify all existing portal, group and user sites from templates.

    Templates are used in GateIn to create user sites (dashboards), group sites or portal sites.

    This new requirement proposes an extended REST management interface for updating sites (user, group or portal) using templates.

     

    Scenario 1

    Let’s imagine a portal with 1000 users and each one with their own dashboard.

    A portal admin would like to modify (all or some) dashboards adding changes to dashboard layout or adding new pages and navigation nodes.

    This task can be can be done in the present version (3.6) via REST management but in an individual way: exporting all users sites (dashboards), modifying dashboards individually and re-importing with a MERGE strategy.

    With the proposed feature this change would be done from a template for all (or some) users dashboards.

     

    Scenario 2

    Let’s imagine a portal with 100 portal sites created from “templateA” and 50 portal sites created from “templateB”.

    A portal admin would like to add 2 new pages to all “templateA” based sites and 3 new pages to all “templateB” based sites.

    With the proposed feature these changes would be done in “templateA” and “templateB” and propagated to portal sites through REST interface.

     

    Scenario 3

    Let’s imagine a portal with 20 different group navigations.

    A portal admin would like to add 3 new pages to 10 group navigations.

    With the proposed feature this change would be done from a single template applied to these 10 group navigations.

     

    Proposed solution

     

    Extend REST management with:

    • Detect template from user, group and portal sites ({user,porgal,group,pages,navigation}.xml).
    • Add/modify PUT entrypoint to accept list of users, groups or portal (wildcards allowed).
    • Modify site creation to store template used (or null if no template used). This will help for uses cases where a portal template is applied for all portal sites created from “templateA”, a site should store “templateA” (for example, like a property in PortalConfig object).
    • Resolve patterns in templates and combine with list of users, groups or portals to import changes (“@owner@” patterns used in templates)


    Example on scenario 1

     

    Operation 1.1:

     

    curl -i -H "Content-Type: application/zip" -u root:gtn -X PUT -T "template-user.zip" http://localhost:8080/rest/private/managed-components/template/user?importMode=overwrite

     

    Where template-user.zip:

    user/template/navigation.xml

    user/template/pages.xml

    user/template/user.xml

     

    In a similar format defined in:

    $GATEIN_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/user/template/

     

    Result:

    All dashboards updated with OVERWRITE strategy using template defined in template-user.zip


    Operation 1.2:

     

    curl -i -H "Content-Type: application/zip" -u root:gtn -X PUT -T "template-user.zip" http://localhost:8080/rest/private/managed-components/template/user?importMode=merge&targetUser=user1&targetUser=user2&targetUser=user3

     

    Where template-user.zip:

    user/template/navigation.xml

    user/template/pages.xml

    user/template/user.xml

     

    In a similar format defined in:

    $GATEIN_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/user/template/

     

    Result:

    {user1,user2,user3} dashboards updated with MERGE strategy using template defined in template-user.zip

     

    Operation 1.3:

     

    curl -i -H "Content-Type: application/zip" -u root:gtn -X PUT -T "template-user.zip" http://localhost:8080/rest/private/managed-components/template/user?importMode=merge&targetExpr=user*

     

    Where template-user.zip:

    user/template/navigation.xml

    user/template/pages.xml

    user/template/user.xml

     

    In a similar format defined in:

    $GATEIN_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/user/template/

     

    Result:

    All dashboards from users starting with “user” updated with MERGE strategy using template defined in template-user.zip

    Wildcards support can be limited to not add unnecesary complexity but giving a tool to query users (number of users can be huge in some portal instances)


    Example on scenario 2


    Operation 2.1:

     

    curl -i -H "Content-Type: application/zip" -u root:gtn -X PUT -T "template-templateA.zip" http://localhost:8080/rest/private/managed-components/template/portal?importMode=merge

     

    Where template-templateA.zip:

    portal/template/templateA/navigation.xml

    portal/template/templateA/pages.xml

    portal/tempalte/templateA/portal.xml

     

    In a similar format defined in:

    $GATEIN_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal/template/{basic,classic}

     

    Result:

    All sites created from “templateA” are updated with MERGE strategy using template defined in template-templateA.zip

     

    Operation 2.2:

     

    curl -i -H "Content-Type: application/zip" -u root:gtn -X PUT -T "template-templateB.zip" http://localhost:8080/rest/private/managed-components/template/portal?importMode=merge

     

    Where template-templateB.zip:

    portal/template/templateB/navigation.xml

    portal/template/templateB/pages.xml

    portal/tempalte/templateB/portal.xml

     

    In a similar format defined in:

    $GATEIN_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal/template/{basic,classic}

     

    Result:

    All sites created from “templateB” are updated with MERGE strategy using template defined in template-templateB.zip

     

    Example on scenario 3

     

    Operation 3.1:

     

    curl -i -H "Content-Type: application/zip" -u root:gtn -X PUT -T "template-group.zip" http://localhost:8080/rest/private/managed-components/template/group?importMode=merge&targetGroup=myorg/mygroup1&targetGroup=myorg/mygroup2

     

    Where template-group.zip:

    group/template/navigation.xml

    group/template/pages.xml

    group/tempalte/group.xml

     

    Result:

    {myorg/mygroup1,myorg/mygroup2} groups sites created are updated with MERGE strategy using template defined in template-group.zip