WebSphere Portal, Express Beta Version 6.1
Operating systems: i5/OS, Linux,Windows


 

Site management extension of the Portal Scripting Interface

You can use the site management extension bean of the Portal Scripting Interface to publish, promote, or demote portal content.

The portal content can consist of content nodes, labels, pages or partial hierarchies, compositions, or links to both internal and external URLs.

Example scenario: A sales company has a test portal and a production portal. The administrator creates a page for a special sale on the test portal. When the approving parties are happy with that page, the administrator publishes the page by moving it from the test or source portal to the production or target portal. By personalization rules, only the administrator can view the page. For the start day of the sale, the administrator promotes the page on the production portal. This makes the page visible to portal users with the appropriate access permissions. When the sale period is over, the administrator demotes the page on the production portal. Users can then no longer view the page.

For more details about site management and publishing portal pages refer to Managing your site. Before using the portal scripting interface to manage your site, review this documentation.

The methods listed in the following are available for site management. You can use them to publish, promote, or demote a page. All commands start with $Publish .Notes:

  1. None of the parameters for the methods listed here have default values. You need to specify values for all of the parameters, otherwise the script will not run.
  2. Portlets that you publish by using site management must exist with the same unique name on both the source and target servers.
  3. If the pages or portlets that you publish have personalization visibility rules associated with them, site management will publish the rule associations, but not the rules themselves. As an administrator make sure that the same rules exist on both the source and target servers. In order to preserve the correct page-to-rule association, create a Publish Server by using the Personalization tools, and publish the required rule by using the Publish Selected menu option under Extra Options. For more information, refer to An overview of Personalization publishing.
  4. If you want to publish, promote, or demote portal content by using a secure connection with SSL (Secure Socket Layer), append the letter s to the http string of the source or target server URLs as follows: https. You might have to perform additional steps for the connection to work, such as importing a cert into cacerts.

publishPage

Use this property to publish the content page or hierarchy from the source server to the target server.

JACL syntax for publishing a page:

$Publish publishPage source_server userid password 
            target_server userid password 
            page_uniquename parent_uniquename sibling_uniquename 
            server_uniquename include_children [true|false] stop_on_error [true|false]

Example JACL code snippet for publishing a page:

$Publish publishPage 
   http://reclab100.rtp.raleigh.ibm.com:10038/wps/mycontenthandler wpsadmin wpsadmin 
   http://reclab101.rtp.raleigh.ibm.com:10038/wps/mycontenthandler wpsadmin wpsadmin 
   testPage ibm.portal.Home null null true true
For a full code example refer to Example JACL scripts for site management.

Description of Publish parameters:

Parameter example Description
http://reclab100.rtp.raleigh.ibm.com:10038/wps/mycontenthandler wpsadmin wpsadmin Replace this example source server URL, user ID, and password with the appropriate values for your environment.
http://reclab101.rtp.raleigh.ibm.com:10038/wps/mycontenthandler wpsadmin wpsadmin Replace this example target server URL, user ID, and password with the appropriate values for your environment.
testPage Replace this example page unique name with the object ID of your page.
ibm.portal.Home Replace this example parent page unique name with the object ID of the parent page in your portal hierarchy.
null Provide the unique name of a sibling page, or specify null. The published page will be inserted before that page in the sequence of sibling pages. If you want your page to be inserted as the last sibling page, specify the string null.
null To add the unique name of the target server to the published page metadata, enter the server unique name, or specify null. If a server name is provided, the published page will be updated to include this string in the page metadata. The Resource Manger portlet can use this server identifier to automatically republish the page to the same server on subsequent publish attempts via the portlet. If you do not want the page metadata to be updated, specify the string null as the value.
true This parameter determines whether children of the page will be published along with the page. Specify true or false.
true This parameter determines whether to stop the publish process on the first error. Specify true or false.

promotePage

Use this property to promote the content page or hierarchy on the target server.

JACL syntax for promoting a page:

$Publish promotePage targetserver userid password 
            pageuniquename integer_value include_children [true|false] stop_on_error [true|false]

Example JACL code snippet for promoting a page:

$Publish promotePage 
         http://reclabl101.rtp.raleigh.ibm.com:10038/wps/mycontenthandler 
         wpsadmin wpsadmin com.ibm.portal.published_testPage 0 true true
For a full code example refer to Example JACL scripts for site management.

Parameters:

Parameter example Description
http://reclab101.rtp.raleigh.ibm.com:10038/wps/mycontenthandler wpsadmin wpsadmin Replace this example target server URL, user ID, and password with the appropriate values for your environment.
com.ibm.portal.published_testPage Replace this example page unique name with the object ID of your page.
0 Specify an integer value after the page name to determine how you want the pages and hierarchy to be published. When you run the scripting command, the process compares the subtree hierarchy of the page that you are promoting on the source and target portals and then adds, replaces, or deletes nodes and customized preferences according to the specified integer value as follows:

  • 0 This method adds, replaces, and removes nodes on the target portal to exactly match the subtree of the source portal. It preserves customized preferences on replaced pages.
  • 1 This method adds and replaces nodes on the target portal by those from the source portal and leaves nodes that are not affected unchanged. It preserves customized preferences on replaced pages.
  • 2 This method adds, replaces, and removes nodes on the target portal to exactly match the subtree of the source portal. It overwrites customized preferences on replaced pages.
  • 3 This method adds and replaces nodes on the target portal by those from the source portal and leaves nodes that are not affected unchanged. It overwrites customized preferences on replaced pages.
true This parameter determines whether children of the page will be published along with the page. Specify true or false.
true This parameter determines whether to stop the publish process on the first error. Specify true or false.

demotePage

Use this property to demote the content page or hierarchy on the target server.

JACL syntax for demoting a page:

$Publish demotePage targetserver userid password pageuniquename include_children [true|false] stop_on_error [true|false]

Example JACL code snippet for demoting a page:

$Publish demotePage 
         http://reclab101.rtp.raleigh.ibm.com:10038/wps/mycontenthandler 
         wpsadmin wpsadmin testPage true true
For a full code example refer to Example JACL scripts for site management.

Parameters:

Parameter example Description
http://reclab101.rtp.raleigh.ibm.com:10038/wps/mycontenthandler wpsadmin wpsadmin Replace this example target server URL, user ID, and password with the appropriate values for your environment.
testPage Replace this example page unique name with the object ID of your page.
true This parameter determines whether children of the page will be published along with the page. Specify true or false.
true This parameter determines whether to stop the publish process on the first error. Specify true or false.

 

Example JACL scripts for site management

JACL code example for creating a page with a object ID for publishing:
# Scripting bean example: create a simple page (multi-column Layout)           
#                                                                              

# Procedure: create a multi-column page below the page that is currently       
# selected, and place the given portlets into the layout.                      
#                                                                              
# parameters:                                                                  
#   name              The name of the page                                     
#   portlet_names     A list of portlet names.                                 
# returns:
#   oid               The id of the page that has been created                 
proc create_multi_col_page { name uniqueName portlet_names } {           
  global Content Layout Portlet                                                
    set thePage [$Content create page $name html]                              
    $Content select $the Page  
    $Content set uniquename $uniqueName                                  
    set lyt0 [$Layout create container horizontal select]                      
    foreach pn $portlet_names {                                                
      set pid [$Portlet find portlet cn $pn]                                   
      $Layout create control $pid                                              
    }                                                                          
  return $thePage                                                              
}                                                                              
                                                                               
# main code starts here                                                        
                                                                               
# set User ID/ pwd for portal Login command                                    
# Hint: User ID and passwords should normally not be placed inside a           
# configuration script; better use property files or command line arguments    
  
set user portaladmin                                                           
set pwd  adminpwd                                                              
$Portal login $user $pwd                                                       
                                                                               
# determine and select the parent of the page to be created.                   
# In this example, This is the "Home" label.                                   
$Content select [$Content find all uniquename "ibm.portal.Home"]               
                                                                               
# Invoke the page creation procedure. The label of the page is "My test page", 
# portlets to be added are the workd clock portlet, and the welcome portlet.   
set newbie [create_multi_col_page "A Page" "aPage" 
           { "World_Clock" "Welcome_to_WebSphere_Portal" } ]
                                                                               
puts "ok, we are done."       
This example is based on the testme.jacl example for creating a page under Script mode. The additions that are required for later publishing are highlighted. JACL code example for publishing the page:
# Scripting bean example: publish a page with the uniquename of "aPage"     
                                                                            
                                                                            
# main code starts here                                                     
                                                                            
# set User ID/ pwd for portal Login command                                 
# Hint: User ID and passwords should normally not be placed inside a        
# configuration script; better use property files or command line arguments 

set user portaladmin                                                        
set pwd  adminpwd                                                           

set sourceServer http://sourceServer:sourceport/wps/mycontenthandler        
set sourceUser sourceUser                                                   
set sourcePwd  sourcePwd
 
set targetServer http://targetServer:sourceport/wps/mycontenthandler
set targetUser targetUser                                                   
set targetPwd  targetPwd

set uniqueName "aPage"
set parentPage parentPage
set siblingPage siblingPage

set targetServer MyTargetServerUn
                                                                            
$Portal login $user $pwd                                                    
                                                                            
# Publish a page               

$Publish publishPage $sourceServer $sourceUser $sourcePwd 
                     $targetServer $targetUser $targetPwd 
                     $uniqueName $parentPage $siblingPage $targetServer true true

                                                                            
puts "ok, we are done."       
JACL code example for promoting the page:
# Scripting bean example: promote a page with the uniquename of 
#   "com.ibm.portal.published_aPage"
# main code starts here                                                        
                                                                               
# set User ID/ pwd for portal Login command                                    
# Hint: User ID and passwords should normally not be placed inside a           
# configuration script; better use property files or command line arguments 

set user portaladmin                                                           
set pwd  adminpwd                                                              

set server http://server:port/wps/mycontenthandler
set sUser sUser                                                        
set sPwd  sPwd
set promoteOption 0

set uniqueName "com.ibm.portal.published_aPage"

                                                         
$Portal login $user $pwd                                                       
                                                                               
# Promote a page               

$Publish promotePage $server $sUser $sPwd $uniqueName $promoteOption true true
                                                                               
puts "ok, we are done."      
JACL code example for demoting the page:
# Scripting bean example: demote a page with the uniquename of "aPage"         
# main code starts here                                                        
                                                                               
# set User ID/ pwd for portal Login command                                    
# Hint: User ID and passwords should normally not be placed inside a           
# configuration script; better use property files or command line arguments 

set user portaladmin                                                           
set pwd  adminpwd                                                              

set server http://server:port/wps/mycontenthandler
set sUser sUser                                                        
set sPwd  sPwd

set uniqueName "aPage"
                                                         
$Portal login $user $pwd                                                       
                                                                               
# Demote a page               

$Publish demotePage $server $sUser $sPwd $uniqueName true true
                                                                               
puts "ok, we are done."       
Parent topic: Managing your site Related tasks
Enabling remote access to your servers Managing your servers Publishing your page Providing reviewer access to a published page Promoting your page Demoting your page Republishing and promoting a page Creating a portal page from an HTML file Disabling site management
Library | Support | Terms of use |