Saturday, 1 November 2014

Accessing models in theme to perform all required opertions

Expression language beans for accessing programming models



Expression language (EL) beans are available for accessing WebSphere Programming models. These beans are accessed through the PortalBean represented in the global namespace by wp. The beans provide access to IBM® WebSphere® Portal Express® models and associated classes.

PortalBean

The PortalBean provides access to EL Beans that represent some of WebSphere Portal Express models. You can use these models to access resource information in your JSPs. For more information, see the following example. To access the current user, use the following example.
${wp.user}
You can access the PortalBean (wp) with the following items.
ac
AccessControlRuntimeModelBean - Provides read access to the current access control permissions for a resource.
clientProfile
ClientProfileBean - Provides access to the client profile.
identification
IdentificationBean - Provides access to the identification services serialize and deserial
languageList
LanguageListBean - Provides access to the list of languages defined in portal.
layoutModel
LayoutModelBean - Provides access to the tree model representation of the layout of a page.
localizedDescription
DescriptionBean - Provides access to the description of an object in the current locale.
metadata
AggregatedMetatdataProviderBean - Provides access to the metadata for a specified resource.
navigationModel
NavigationModelBean - Provides access to the navigation model.
rep
ResourceEnvironmentProviderAccessorBean - Provides access to the set of configuration entries for the specified resource environment provider.
selectionModel
NavigationSelectionModelBean - Provides access to a selection model for a navigation model.
themeConfig
ThemeConfigBean - Encapsulates the theme "configuration" parameter lookup process.
themeList
ThemeListBean - Provides access to list of theme objects.
title
TitleBean - Provides access to the title of the currently rendered page or the title information set by a portlet.
user
UserBean - Provides access to the active user

EL Beans

Table 1. List of beans, description, and an example of each
Bean nameDescriptionExample
AccessControlRuntimeModelBeanProvides read access to the current access control permissions for a resource.${wp.ac[node].hasPermission['editor']}
AggregatedMetadataProviderBeanProvides access to the metadata for a specified resource${wp.metadata[node]}
ClientProfileBeanProvides access to the client profile${wp.clientProfile['DeviceClass']}
ContentNodeBeanProvides access to a content node. This interface offers a way to obtain the type of the content node.${wp.node.contentNode}
DescriptionBeanProvides access to the description of an object in the current locale.${wp.description[window]}
IdentificationBeanProvides access to the identification services serialize and deserialize methods.${wp.identification[node]}
LanguageBeanProvides access to the interface representing a portal language.none
LanguageListBeanProvides access to the list of languages defined in portal.${wp.languageList}
LayoutContainerBeanProvides access to the interface representing a container in a LayoutModelnone
LayoutControlBeanProvides access to the interface representing a control in a LayoutModelnone
LayoutModelBeanProvides access to the tree model representation of the layout of a page.${wp.layoutModel[node]}
MetaDataBeanReturns a Map of the current MetaData object${wp.node.metadata['metaDataKey']}
NavigationModelBeanProvides access to the navigation model. The navigation model describes the toplogy of the navigation visible to a specific user.${wp.navigationModel}
NavigationNodeBeanProvides access to a navigation node in a navigation model.${wp.node.description}
NavigationSelectionModelBeanProvides access to a selection model for a navigation model.${wp.selectionModel[node]}
ObjectIDBeanRepresents an object ID in the portal model.${node.objectID.uniqueName}
ProfileBeanProvides access to the attributes of one profile.${wp.themeList.current.profiles.current.uri}
ProfileListBeanProvides access to all profiles in a theme as well as the currently selected profile.none
ResourceEnvironmentProviderAccessorBeanProvides access to the set of configuration entries for the specified resource environment provider.${wp.rep["REP Name"]}
ThemeBeanProvides access to the theme object${wp.themeList.current}
ThemeConfigBeanEncapsulates the theme "configuration" parameter lookup process.${wp.themeConfig['themeurl']}
ThemeListBeanProvides access to list of theme objects${wp.themeList.current}
TitleBeanProvides access to the title of the currently rendered page or the title information set by a portlet.${wp.title}
UserBeanProvides access to the active user${wp.user}

EL Bean attributes

AccessControlRuntimeModelBean
This bean provides read access to the current access control permissions on one resource.
Attributes:
node
This value represent an entry in a model. This could be a NavigationNodeBean or ContentNodeBean. The following example checks if the currently selected page is private.
${wp.ac[wp.selectionModel.selected].isPrivate}
hasPermission
Determine if the resource has a specific permission. Attribute is the case in-sensitive name of the com.ibm.portal.ac.data.RoleType as listed in the table in the topic Roles. Returns: boolean value.
Example:
${wp.ac[node].hasPermission['Administrator']}
${wp.ac[node].hasPermission['ManageR']}
${wp.ac[node].hasPermission['editor']}
isPrivate
Determine if the specified page is private. Returns: boolean. Example:
 ${wp.ac[node].isPrivate}
hasPersonalizePermission
Determine if the specified page is a private page and the current user has PRIVILEGED_USER permission. Returns: boolean. Example:
${wp.ac[node].hasPersonalizePermission}
hasEditSharedPermission
Determine if the page is a non-private page and the current user has EDITOR, MANAGER, or ADMIN permission for the specified page. Returns: boolean. Example:
${wp.ac[node].hasEditSharedPermission}
hasAddChildPermission
 ${wp.ac[node].hasAddChildPermission}
AggregatedMetadataProviderBean
Provides access to the aggregated meta data of a node. The meta data that may be provided by individual nodes of the content model are combined according to the hierarchy that the ContentModel exposes for these nodes. Values set on the node itself take precedence over values set for its parents. Attributes:
node
This value represents an entry in the ContentModel. Returns: Map of meta data entries. See MetaDataBean. Example:
${wp.metadata[node]} 
ClientProfileBean
Provides access to the defined attributes associated with the client profile. Attributes:
attribute
This is a defined value associated with the client profile. Returns: value associated with the specified attribute. Example:
${wp.clientProfile[attribute]}
The following displays how to access the device class information for the client profile:
<c:set var=”deviceClass” scope=”request” value=”${wp.clientProfile['DeviceClass']}” />

 

  <c:choose>

 

  <c:when test=”${deviceClass == 'desktop'}”>

  <jsp:forward page=”/jsp/html/desktop/View.jsp”/>

  </c:when>

  <c:when test=”${deviceClass == 'tablet'}”>

  <jsp:forward page=”/jsp/html/tablet/View.jsp”/>

  </c:when>

  <c:otherwise>

  <jsp:forward page=”/jsp/html/View.jsp”/>

  </c:otherwise>

  </choose>
ContentNodeBean
The ContentNodeBean represents a node in the ContentModel. Attributes:
contentNodeType
Returns: com.ibm.portal.content.ContentNodeType – COMPOSITION, EXTERNALURL, LABEL, PAGE, STATICPAGE. Example:
${wp.node.contentNodeType}
The following displays how to check if the currently selected node is a label:
<c:if test=”${wp.selectionModel.selected.contentNode.contentNodeType == com.ibm.portal.content.ContentNodeType.LABEL}”>
description
Returns: DescriptionBean associated with this content node
metadata
Returns: MetaDatabean associated with this content node
objectID
Returns: objectID associated with this content node. Example:
${wp.contentNode.objectID}
title
Returns: TitleBean associated with this content node
DescriptionBean
Provides access to the description of an object in the current locale. Attributes:
window
object with description Returns: String the description of an object. Example:
${wp.localizedDescription[window]}

${wp.node.description}
IdentificationBean
Provides access to the identification services serialize and deserialize methods. The Identification interface provides serialization and deserialization functionality for ObjectID instances. Attributes:
node
This value represent an entry in a model. Returns: objectiid or String representation of the node. Example:
${wp.identification[node]}
LanguageBean
Provides access to the interface representing a language that portal supports. Attributes:
created
Returns: date this language was created.
description
Returns: DescriptionBean associated with this language.
lastModified
Returns: date this language was last modified.
locale
Returns: locale of this language.
locales
Returns: ListModel of the locales associated with this language.
objectID
Returns: objectID associated with this language
title
Returns: TitleBean associated with this content node
LanguageListBean
Provides access to the list of languages defined in portal.
LayoutContainerBean
Provides access to the interface representing a container in a layout model. Attributes:
metaData
MetaDatabean associated with this content node. Returns: Map of metadata keys pairs for the container
objectID
Returns: Object Identifier for the current control. The following displays an example of getting the layout model for the currently selected node from the selection model. The second line retrieves the children of the root mode of the layout model. The children of the root node will be represented as LayoutContainerBeans.
<c:set var="layoutmodel" value="${wp.layoutModel[wp.selectionModel.selected]}"/>

 <c:set var="containers" value="${layoutmodel.children[layoutmodel.root]}"/>
LayoutControlBean
Provides access to the interface representing a control in a layout model. Attributes:
description
Returns DescriptionBean the description set for the current control
metadata
Returns: MetaDatabean associated with this content node, Map of metadata key pairs for the control
objectID
Returns: Object identifier for the current control.
title
Returns: TitleBean Title of the control
LayoutModelBean
This bean provides access to the tree model for the layout of a page. The nodes of the tree are objects implementing the LayoutNode interface. This model describes the layout of a page (row and column containers, LayoutContainer) and the content (controls representing portlets, LayoutControl). Attributes:
layoutModel
Provides the layout model of the given node
node
This value represent an entry in a model. Returns: iterator of layout nodes. Example:
 ${wp.layoutModel[node]}
The following displays an example of getting the layout model for the currently selected node from the selection model. The second line retrieves the children of the root mode of the layout model.
<c:set var="layoutmodel" value="${wp.layoutModel[wp.selectionModel.selected]}"/>

 <c:set var="containers" value="${layoutmodel.children[layoutmodel.root]}"/>
children
Attributes:
node
This value represent an entry in a model. Returns: children of the specified nodes. Example:
<c:set var="containers" value="${layoutmodel.children[layoutmodel.root]}"/>
hasChildren
Determine if the current layout model has children. Attributes:
node
This value represent an entry in a model. Returns: boolean. Example:
${layoutmodel.hasChildren[node]}
root
Returns: root node of the model
MetaDataBean
Returns a Map of the current MetaData object. Attributes:
metadata
Returns: Set of metadata key pairs for the specified node. Example:
 ${wp.node.metadata}
keyname
Metadata key Returns: Associated value. Example:
${wp.node.metadata["someKey"]}
NavigationModelBean
Provides access to the NavigationModel. The navigation model describes the topology of the navigation visible to a specific user. The nodes of the model are represented by NavigationNodes. Attributes:
children
Return the children of the specified node. Attributes:
node
This value represent an entry in a model. Returns: Children of the specified node. Example:
${wp.navigationModel.children[node]}
hasChildren
Determine if the specified Navigation Node has associated nodes. Attributes:
node
This value represent an entry in a model. Returns: boolean. Example:
 ${wp.navigationModel.hasChildren[node]}
navigationModel
Returns: iterator of Navigation Nodes in the navigation model The nodes are NavigationBean nodes. The accessors for the NavigationBean can be used on a node in the navigationModel. The following is an example,
<c:set var="layoutTemplate" ><c:out value='${wp.navigationModel[wp.selectionModel.selected.contentNode.objectID].metadata["layout"]}' default=""/></c:set>
parent
Attributes:
node
This value represent an entry in a model. Returns: Parent node of the specified Navigation Node. Example:
 ${wp.ac[wp.navigationModel.parent[node]}
NavigationNodeBean
Provides access to a navigation node in a navigation model. Attributes:
contentNode
Returns: ContentNodeBean content node associated with the current navigation node. Example:
${wp.node.contentNode]}
description
Returns: DescriptionBean Returns the description of this object. Example:
${wp.node.description}
isPrivate
Determine if the current node is marked as private Returns: boolean. Example:
${wp.node.isPrivate}
metadata
Returns: MetaDatabean Metadata associated with the current node. Example:
${wp.node.metadata}
objectID
Returns: The objectID associated with the current node
projectID
Returns: The project identifier associated with the current node
title
Returns: TitleBean Title associated with the current object. Example:
${wp.node.title }
NavigationSelectionModelBean
This bean provides access to the interface describing a selection model for a navigation model (NavigationModel). Elements of this model implement the NavigationNode interface. Input and output values must implement this interface. Attributes:
selectionModel
Returns: The iterator of selected Navigation nodes. Example:
${wp.selectionModel}
selected
Returns: NavigationNodeBean Selected Navigation node. Example:
${wp.selectionModel.selected}
selectionPath
Returns: List of currently selected Navigation nodes. Example:
${wp.selectionModel.selectionPath}
ObjectIDBean
The ObjectIDBean represents an object ID in the portal model. It can be used without any attribute and is then passed on as an object ID object or serialized into a string representation. Attributes:
uniqueName
Returns the unique name of the object ID if it is set. Optional.
ProfileListBean
Provides access to all profiles in a theme as well as the currently selected profile. Attributes:
current
To retrieve the currently selected profile. To get a list of all profiles, create a loop. The current attribute is of type profile bean.
ProfileBean
Provides access to the attributes of one profile. Attributes:
  • uri
  • relativePath
  • title
  • description
  • metadata
Examples:
<div>Current Theme: ${wp.themeList.current.title}</div>
<div>Current Profile URI: ${wp.themeList.current.profiles.current.uri}</div>
<div>Current Profile RelativePath: ${wp.themeList.current.profiles.current.relativePath}</div>
<div>Current Profile Title: ${wp.themeList.current.profiles.current.title}</div>
<div>Current Profile Description: ${wp.themeList.current.profiles.current.description}</div>
<div>Current Profile Metadata (Hidden): ${wp.themeList.current.profiles.current.metadata['com.ibm.portal.Hidden']}</div>
<div>
    All Profiles
    <c:forEach var="profile" items="${wp.themeList.current.profiles}" varStatus="profileStatus">
        ${profile.title} / ${profile.relativePath}<br/>
    </c:forEach>
</div>
ResourceEnvironmentProviderAccessorBean
Provides access to the set of configuration entries for the specified resource environment provider. Attributes:
resourceEnvironmentProvider
Specifies the Resource Environment Provider.
property
Specifies the property defined on the Resource Environment Provider. Example:
${wp.rep['resourceEnvironmentProvider']['property']}
To retrieve the Portal defined dojo context root.
${wp.rep['WP GlobalThemeConfig']['resources.js.dojo.contextRoot']}
ThemeBean
Provides access to the theme object.
You can access the profile list through the profiles attribute on the ThemeBean. Example:
${wp.themeList.current.profiles) 
Attributes:
description
Returns: DescriptionBean Description associated with the theme.
metadata
Returns: MetaDatabean Metadata associated with this theme.
profiles
Returns: ProfileListBean
themeTemplateURI
Returns the URI pointing to the theme template that has been configured for the current page being rendered. This attribute only works for the current theme and current page that is rendered. Use this example.
<%@ taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v8.5/resolver" prefix="r" %>
<r:dataSource uri='spa:${wp.identification[${wp.selectionModel.selected}]}' escape="none">
    <r:param name="themeURI" value="${wp.themeList.current.themeTemplateURI}"/>
    <r:param name="mime-type" value="text/html"/>
</r:dataSource>
title
Returns: TitleBean Title associated with the theme.
ThemeConfigBean
Encapsulates the theme "configuration" parameter lookup process. Attributes:
themeConfig
Encapsulates the theme “configuration” parameter lookup process. The lookup order is as follows: 1. Theme metadata 2. Provided Resource Environment Provider. Example:
<c:set var="themeModuleContextRoot" value="${wp.themeConfig['resources.modules.ibm.contextRoot']}" />
ThemeListBean
Provides access to the model for a list of installed portal themes. Elements of this model are implemented by Theme objects. The ThemeBean provides access to the Theme objects. Attributes:
themeList
Returns: Iterator of theme bean objects.
current
Provides access to the theme of the current selected node Returns: ThemeBean. Example:
 ${wp.themeList.current]}
TitleBean
Provides access to the title of the currently rendered page or the title information set by a portlet. Attributes:
title
Return: The title of the currently rendered page or the title information set by a portlet. Example:
${wp.title}
UserBean
Provides access to the active user. Attributes:
user
Return: Current active portal user. Example:
${wp.user}
objectID
Return the object identifier for the current user. Example:
${wp.identification[wp.user.objectID]}

No comments:

Post a Comment

Custom single threaded java server

 package com.diffengine.csv; import java.io.*; import java.net.*; import java.util.Date; public class Server { public static void main(Str...