10.01 How to use Aspire Portlet


 

Installing Aspire to work with Jetspeed

This involves the following.

Placing the Aspire jar file

To be done

Placing the aspire.properties file

To be done

Defining the init servlet that initializes aspire

To be done

Registering the AspirePortlet with js

Defining an AspirePortlet to Jetspeed is like defining any other portlet to Jetspeed. This means creating a portlet-entry in an xreg file. Xreg files reside in \jetspeed\web-inf\conf sub directory


(!--
**********************************************************************
* SamplePortlet
**********************************************************************
--)
    (portlet-entry name="MyAspirePortlet" hidden="false" type="instance" application="false")
        (meta-info)
            (title)SamplePortlet title(/title)
            (description)SamplePortlet Description(/description)
        (/meta-info)
        (classname)com.indent.actions.portlets.AspirePortlet(/classname)
        (media-type ref="html"/)
        (url cachedOnURL="true"/)
    (/portlet-entry)

Defining the first page for AspirePortlet

In one of your aspire related properties files create the following entry


Portlet-entry.MyAspirePortlet.firstURL=your-first-aspire-url-name

See below for what 'your-first-aspire-url-name' could look like and what it defines

Aspire properties for "aspire template page display url"

See Aspire documentation to see the general structure of an aspire url. What follows is an example


###################################
# ShowFiledReportsViewJSPURL
###################################
ShowFiledReportsViewJSPURL=/reports/report-filing/reports-summary-view.html
ShowFiledReportsViewJSPURL.transformType=JSP
request.ShowFiledReportsViewJSPURL.transform.className=com.ai.jsp.JSPTransform
ShowFiledReportsViewJSPURL.formHandlerName=ShowFiledReportsViewURLFormHandler

#
#Data definition
#
request.ShowFiledReportsViewURLFormHandler.form_handler.class_request.className=com.ai.htmlgen.DBHashTableFormHandler1
ShowFiledReportsViewURLFormHandler.loopNames=FoldersLoop1

#
#Maindata request
#
request.ShowFiledReportsViewURLFormHandler.maindataRequest.classname=com.ai.db.DBRequestExecutor2
request.ShowFiledReportsViewURLFormHandler.maindataRequest.db=reportsDB
request.ShowFiledReportsViewURLFormHandler.maindataRequest.stmt=\
\
select first_name as user_first_name \
	,last_name as user_last_name \
	,email as user_email \
from users \
where user_id = {ownerUserId.quote}


#first primary loop
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.class_request.className=com.ai.htmlgen.GenericTableHandler6
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.loopNames=itemsLoop
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.query_request.className=com.ai.db.DBRequestExecutor2
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.query_request.db=reportsDB
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.query_request.stmt=\
	select * from folders  \
	where 1=1 \
		and parent_folder_id is null \
		and public = 'Y' \
		and owner_user_id = {ownerUserId.quote} \
	order by folder_name 

Aspire properties for "jsp display url"


###################################
# ShowFiledReportsViewJSPURL
###################################
ShowFiledReportsViewJSPURL=/reports/report-filing/reports-summary-view.html
ShowFiledReportsViewJSPURL.transformType=JSP
ShowFiledReportsViewJSPURL.formHandlerName=ShowFiledReportsViewURLFormHandler

#
#Data definition
#
request.ShowFiledReportsViewURLFormHandler.form_handler.class_request.className=com.ai.htmlgen.DBHashTableFormHandler1
ShowFiledReportsViewURLFormHandler.loopNames=FoldersLoop1

#
#Maindata request
#
request.ShowFiledReportsViewURLFormHandler.maindataRequest.classname=com.ai.db.DBRequestExecutor2
request.ShowFiledReportsViewURLFormHandler.maindataRequest.db=reportsDB
request.ShowFiledReportsViewURLFormHandler.maindataRequest.stmt=\
\
select first_name as user_first_name \
	,last_name as user_last_name \
	,email as user_email \
from users \
where user_id = {ownerUserId.quote}


#first primary loop
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.class_request.className=com.ai.htmlgen.GenericTableHandler6
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.loopNames=itemsLoop
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.query_request.className=com.ai.db.DBRequestExecutor2
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.query_request.db=reportsDB
request.ShowFiledReportsViewURLFormHandler.FoldersLoop1.query_request.stmt=\
	select * from folders  \
	where 1=1 \
		and parent_folder_id is null \
		and public = 'Y' \
		and owner_user_id = {ownerUserId.quote} \
	order by folder_name 

Aspire properties for "xslt display url"

To be done

Aspire properties for "update url". Covers all updates

################################### # SetFolderAccess ###################################

request.SetFolderAccess.classname=com.ai.db.DBRequestExecutor2
request.SetFolderAccess.query_type=update
request.SetFolderAccess.db=reportsDB
request.SetFolderAccess.stmt=\
	update folders \
	set public = {access.quote} \
	where folder_id = {folderId}

request.SetFolderAccess.redirectURL=any-display-url-including-jsp
request.SetFolderAccess.failureRedirectURL=any-display-url-including-jsp

Dealing with JSP caching

The following attribute is available in the request object


      // Allow access to portlet from .jsp template
      request.setAttribute("aspire_jsp_deliver_cache", "true");

Additional parameters available in the hashtable

The param "aspire_jetspeed_selflink" is in the hashtable for access

The param "aspire_turbine_rundata" in the hash table points to the turbine rundata

Additional parameters in the request object


      //Get the action object from aspire
      Object dataObj = FormUtils.getDataObjectFor(url,params);


      HttpServletRequest request = rundata.getRequest();

      //Set it in the rundata or request
      request.setAttribute("AspireDataSet",dataObj);

      // Allow access to portlet from .jsp template
      request.setAttribute("portlet", this);

      // Add js_peid out of convenience
      request.setAttribute("js_peid", getID());

      // Add rundata out of convenience (JspService.RUNDATA differs from GenericMVCPortlet.RUNDATA)
      request.setAttribute(JspService.RUNDATA, rundata);

AspirePortlet's caching strategy

To be done

References

To be done

for any questions email me at 'satya at activeintellect dot com'