{
String newURI = null;
String propertiesParameter = "URILookup.";
TemplateLink uri = new TemplateLink( rundata );
if (aType==TYPE_HOME)
{
propertiesParameter += "home.";
if (aSubType==SUBTYPE_RESTORE)
{
propertiesParameter += "restore.";
newURI = getMarkedPage( rundata );
}
else if (aSubType==SUBTYPE_MAXIMIZE)
{
propertiesParameter += "maximize.";
if (aPortletName==null)
{
throw new JetspeedException( "A portlet is required to return an URI." );
}
uri.setAction( ACTION_MARKPAGE );
uri.addPathInfo( "portlet", aPortletName );
}
else if (aSubType==SUBTYPE_LOGOUT)
{
propertiesParameter += "logout.";
uri.setAction( ACTION_LOGOUT );
}
else if (aSubType==SUBTYPE_ACCEPT_LOGIN)
{
propertiesParameter += "acceptlogin.";
uri.setAction( ACTION_ACCEPT_LOGIN );
}
else if (aSubType!=SUBTYPE_NONE)
{
throw new JetspeedException( "Incorrect Type / Subtype combination." );
}
}
else if (aType==TYPE_INFO)
{
propertiesParameter += "info.";
if (aPortletName==null)
{
throw new JetspeedException( "A portlet is required to return an URI." );
}
uri.setPage( SCREEN_INFO );
uri.addPathInfo( "portlet", aPortletName );
if (aSubType==SUBTYPE_MARK)
{
propertiesParameter += "mark.";
uri.setAction( ACTION_MARKPAGE );
}
else if (aSubType!=SUBTYPE_NONE)
{
throw new JetspeedException( "Incorrect Type / Subtype combination." );
}
}
else if (aType==TYPE_EDIT_ACCOUNT)
{
propertiesParameter += "editaccount.";
uri.setPage( SCREEN_EDIT_ACCOUNT );
if (aSubType==SUBTYPE_NONE)
{
uri.setAction( ACTION_PREPARE_SCREEN_EDIT_ACCOUNT );
}
else if (aSubType==SUBTYPE_MARK)
{
propertiesParameter += "mark.";
if (aPortletName==null)
{
throw new JetspeedException( "A portlet is required to return an URI." );
}
// FIX ME: how can we add a prepare action and a mark action at the same time?
// But I think this branch is never used anyway. (?)
uri.setAction( ACTION_MARKPAGE );
uri.addPathInfo( "portlet", aPortletName );
}
else
{
throw new JetspeedException( "Incorrect Type / Subtype combination." );
}
}
else if (aType==TYPE_CUSTOMIZE)
{
propertiesParameter += "customize.";
uri.setPage( SCREEN_CUSTOMIZE );
if( aPortletName != null )
{
uri.addPathInfo( "portlet", aPortletName );
}
if (aSubType==SUBTYPE_NONE)
{
if (ACTION_CUSTOMIZER!=null) uri.setAction( ACTION_CUSTOMIZER );
}
else if (aSubType==SUBTYPE_SAVE)
{
propertiesParameter += "save.";
uri.setAction( ACTION_CUSTOMIZER_SAVE );
}
else
{
throw new JetspeedException( "Incorrect Type / Subtype combination." );
}
}
else if (aType==TYPE_LOGIN)
{
propertiesParameter += "login.";
if (aSubType==SUBTYPE_NONE)
{
uri.setPage( SCREEN_LOGIN );
}
else
{
throw new JetspeedException( "Incorrect Type / Subtype combination." );
}
}
else if (aType==TYPE_BACK)
{
propertiesParameter += "back.";
if (aSubType==SUBTYPE_NONE)
{
newURI = getMarkedPage( rundata );
}
else
{
throw new JetspeedException( "Incorrect Type / Subtype combination." );
}
}
else if (aType==TYPE_ENROLLMENT)
{
propertiesParameter += "enrollment.";
uri.setPage( SCREEN_NEWACCOUNT );
}
else
{
throw new JetspeedException( "Incorrect Type / Subtype combination." );
}
if (newURI==null)
{
newURI = uri.toString();
}
propertiesParameter += "uri";
String propertiesParameterValue = JetspeedResources.getString( propertiesParameter, null );