This Space has blogs on various topics in the field of SAP. These blogs point out solutions to various technical and functional issues that consultants face during implementation or support of SAP Projects. Readers/followers are welcome to contribute to this space by emailing your content at bohra.mohammadi@gmail.com. You will be rewarded according to the topic/number of words/complexity of the topic/issue which are you addressing in your blog.
Tuesday, October 9
Creation of a Custom Navigation Connector in SAP Enterprise Portal
A default navigation connector called a Roles connector is supplied with the SAP Enterprise portal. This navigation connector retrieves navigation nodes based on the roles that are assigned to the user. These navigation nodes are then visible in navigation iviews. It is possible to create a custom navigation connector. Using custom navigation connector, you can retrieve and display navigation nodes as per custom requirements. So in addition to the nodes which are retrieved by roles connector, more navigation nodes can be retrieved for the logged in user using a custom navigation connector. There are 3 steps to create a custom navigation connector. A navigation connector is packaged in a portal application (PAR file).
· Create Navigation connector node
· Create navigation connector
· Register Navigation connector
Create Navigation Connector Node
Create a class that extends AbstractNavigationConnectorNod e. Each object of this class is a Navigation node. There is a method called listBindings() in this class. Implement this method. This method returns javax.naming.NamingEnumeration of nodes related to the current node. Nodes or set of nodes that can be available for the current node are Children of the current node, first child of the current node, dynamic navigation iviews for the current node, drag and relate targets of the current node etc. So listBinding() method should be implemented in to return relevant set of nodes. An example implementation is shown below
1. public NamingEnumeration listBindings(String binding, String mode,
2. Hashtable filterParameters)
3. throws NamingException {
4.
5. if (mode.equals(NAVIGATION_GET_ CHILDREN))
6. return new NavigationEnum( childrenBindings);
7. if (mode.equals(NAVIGATION_GET_ RELATED_SEE_ALSO))
8. return new NavigationEnum( SeeAlsoNodeBindings);
9. if (mode.equals(NAVIGATION_GET_ RELATED_DR_TARGETS))
10. return new NavigationEnum( TargetNodeBindings);
11. if (mode.equals(NAVIGATION_GET_ FIRST_CHILD)){
12. return new NavigationEnum(
13. Collections.singletonList( childrenBindings.get(0)));
14. }
15. else
16.{
17.throw new NamingException("Unknown mode named "+mode);
18.}
19.}
Create navigation connector
Create a class that extends AbstractNavigationConnector. Methods available in this class aregetInitialNodes(),getNode(), getNodes(), getNodeByQuickLink(), getConnectorCacheDiscriminator s(). These methods need to be implemented.
Example of getInitialNodes() implementation is given below
1. public NamingEnumeration getInitialNodes(Hashtable environment) {
2. if (isUserInJavaDeveloperRole(environment))
3. return new NavigationEnum(initialNodes);
4. else
5. return NavigationEnum.EMPTY_ENUM;
6. }
getNode() returns a InavigationConnectorNode. getNodes() returns a javax.naming.NamingEnumeration of INavigationConnectorNode objects.
Example of getNodes() implementation is shown below
1. public NamingEnumeration getNodes(
2. Hashtable environment, Vector connectorNodeURLs) {
3. myConnectorNode node;
4.
5. int size = connectorNodeURLs.size();
6. List nodeBindings = new ArrayList(size);
7.
8. for (int i = 0; i < size; i++) {
9. node = (myConnectorNode) getNode(
10. environment, (String) connectorNodeURLs.get(i));
11. if (node != null) nodeBindings.add(
12. new Binding(node.getName(), node));
13. }
14.
15. return new NavigationEnum(nodeBindings);
16.}
Register Navigation connector
Create a portal service which implements IService. In the Init() method of the service, create an instance of INavigationConnector class.
1. public void init(IServiceContext serviceContext) {
2. mm_serviceContext = serviceContext;
3. myConnector = new myConnector();
4. }
Register the navigation connector in the afterInit() method of the connector.
1. public void afterInit() {
2. INavigationConnectorRegistrati on service =
3. ( INavigationConnectorRegistrati on)
4. getContext(). getService(INavigationService. KEY);
5. if (service != null) {
6. service. registerConnector(
7. NAV_FILE_ CONNECTOR_PREFIX, myConnector);
8. }
9. }
In the portalApp.xml, create an entry for the navigation services created above.
related posts:
Knowledge management component of SAP Enterprise portal
Implementing external facing portal
Creation of custom navigation connector
Navigation in sap enterprise portal
Trust between sap ep and backend system
J2ee course content it training
It training sap training ear training
Java api to retrieve work sets assigned
Could not find system aliasSap ep web dynpro java error srm portal
Unsupportedclassversionerror in sap
Sap ep 73 upgrade related error
related posts:
Knowledge management component of SAP Enterprise portal
Implementing external facing portal
Creation of custom navigation connector
Navigation in sap enterprise portal
Trust between sap ep and backend system
J2ee course content it training
It training sap training ear training
Java api to retrieve work sets assigned
Could not find system aliasSap ep web dynpro java error srm portal
Unsupportedclassversionerror in sap
Sap ep 73 upgrade related error
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
You are welcome to express your views here...