Weblogic Portal – Create Streaming Desktop Page Definition Error

| Posted by watashii | Filed under Programming, Web

Got the following error when (re)creating a streaming desktop from an updated .portal file, using the Create Desktop Wizard on Portal Admin Console.
javax.ejb.EJBException: SQL Error while trying to createPageDefinition: SQL [insert into PF_PAGE_DEFINITION ( PAGE_DEFINITION_ID, MARKUP_DEFINITION_ID, IS_PUBLIC, IS_HIDDEN, INTERSECTION_ID, PAGE_LABEL, WEBAPP_NAME) values (?,?,?,?,?,?,?)] database error code [25,222] SQL state [22028] .; nested exception is: java.sql.SQLException: Data exception -- row already exist in index AX1_PAGE_DEF on table PF_PAGE_DEFINITION.
To temporarily bypass this error this so the streaming desktop can be created with the wizard, remove all the Pages manually from the Library.

The problem is one of the Page definition(s) in the .portal file is corrupted which prevents the library page resource from being refreshed.  You will need to work out which page is causing the problem, then the redo the page in the .portal file via Weblogic Portal Workshop.

Tags: , , ,

Weblogic Portal Authorization – Get and Check User’s Roles

| Posted by watashii | Filed under Programming, Web

The Authorization class provides runtime methods for security policies and roles checks.  The following code fragment obtains the set of roles the logged-in user belongs to.  Note the user must be authenticated first, see Authentication class.

String entAppName = ApplicationHelper.getNonVersionedAppName();
String webAppName = ApplicationHelper.getWebAppName(request);
EnterpriseRoleResource resource = new EnterpriseRoleResource(entAppName,webAppName,EntitlementConstants.P13N_ROLE_POLICY_POOL,"");
Map userRoles = Authorization.getRoles((P13nResource) resource);
if (Authorization.isUserInRole("Admin", userRoles)) {
	return true;
}

Global and Enterprise Application roles are obtained using EnterpriseRoleResource.  For Global, Enterprise, and Web Application roles, use WebappRoleResource.

com.bea.p13n.security.Authentication

Tags: , , , ,

Reading Portlet Preferences in Weblogic Portal

| Posted by watashii | Filed under Programming, Web

Portlet preferences enables portlets to be associated with external application data.  This data should generally be used to store (or update) configuration data in a portlet.  For example, to store/update dynamic stock codes in a stock quotes portlet.  A portlet preference is basically a name-value pair data structure.

Portlet preferences can be added/updated in the following ways:

  1. During design-time on Workshop for Weblogic Portal (screenshot above)
  2. Invoked programmatically at request-time using javax.portlet.* API
  3. Manually during run-time of a portal (via Portal Administration Console when a portal desktop is created)

When we have added our preferences, we can read them using using the Weblogic Portal API’s.  The following sample code fragments are for JSP Portlets, and JSF Portlets:

Read the rest of this entry »

Tags: , , , , ,

Simple Content Repository Search Example

| Posted by watashii | Filed under Programming, Web


Here is a simple code fragment to perform search on the Weblogic Portal 10 Content Repository using the search api.  The important part is the query string to extract the content, and the sort order. Some examples here.
Read the rest of this entry »

Tags: , , , ,

Using JSF 1.2 on Oracle Workshop for Weblogic (Portal 10.3)

| Posted by watashii | Filed under Programming, Web

When choosing facets during the creation of a new portal web project, the built-in Sun RI JSF 1.2 (together with JSTL 1.2)  facets cannot be selected.  Here are the recommended (by Oracle) steps to get around this problem.  Note that this is because Apache Beehive Page Flow has a dependecy with  JSF 1.2, therefore only follow this if not using the page flow integration components provided by Beehive.

Read the rest of this entry »

Tags: , , , ,