basics of enterprise portal development using java

Upload: aishatu-musa-abba

Post on 03-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    1/29

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    2/29

    For developing enterprise portals through SAP Netweaver using JAVA we need to use the packages,classes or interfaces provided in the API.

    There are various APIs provided by SAP to help in development of Netweaver applications using JAVA.

    Here I will try to discuss Enterprise Portal APIs. They are used in development of enterprise portals.

    The following three APIs are most commonly used while developing an Enterprise portal:-

    1. Enterprise Portal (Enterprise Portal Runtime and Services API)2. PCD (Portal Content Directory API)

    3. HTMLB (HTML Business for Java API)

    There are various packages in Enterprise Portal API which provides classes and interfaces forimplementing Portal runtime, Page builders, wizards , dynamic system resolutions etc.

    We will discuss few useful classes and interfaces generally used in EP development.

    Interface IPortalComponent

    It is present in package com.sapportals.portal.prt.component

    All Portal Components implement this interface either directly, or more commonly by extending a classthat implements this interface.

    It is implemented by class AbstractPortalComponent class.

    This interface contains 3 methods :

    1. init() - The container calls the init method each time this Portal Component isloaded in memory. It is deprecated in the new versions.

    2. destroy() - The destroy method is called each time the PRT (Portal BuilderRuntime) decides to discard this component. After this garbage collector comes

    into action.

    3. service() - This method is called for each request that the Portal builder runtime

    routes to an instance of Portal Component. Multiple threads may be executing

    within the service at any time. It processes the clients requests. Animplementation of the IPortalComponent interface can have access to the request

    and the type of request sent by the client.

    publicvoid service(IPortalComponentRequest request, IPortalComponentResponse response) throws PortalComponentException

    request parameter clients request

    response parameter- servers response

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    3/29

    Class AbstractPortalComponent

    It is present in package com.sapportals.portal.prt.component

    AbstratPortalComponent class implements following interfaces :

    IEventListenerComponent IPortalComponent

    IPortalComponentInit

    It provides portal Edit, Help etc modes.

    For this it has many methods like doHandleEditData(), doHelp(), doPreview() and many other methods.

    2 Creating a simple portal application project

    We will create a simple portal application project and then we will use this project to create iView, page

    and roles on EP.

    2.1 Create a Portal Application Project

    Open Netweaver.

    Click the Create Portal Application Project icon or use menu path.

    File -> New -> Other -> Portal Application -> Create Portal Application Project

    Enter name of project and directory where you want to store the project and click Finish.

    Now click on icon Create Portal Application Objects

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    4/29

    Now select the project you created and click next.

    Select Abstract Portal Component and click next.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    5/29

    Enter name, class name and package name.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    6/29

    Click on finish . Then add following code as given in figure. Most of the code is auto generated.

    package test.hello;

    import com.sapportals.portal.prt.component.*;

    publicclass HelloTest1 extends AbstractPortalComponent

    {

    publicvoid doContent(IPortalComponentRequest request, IPortalComponentResponse response)

    {

    response.write("First portal application project demo");

    }

    }

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    7/29

    2.2 Configure portal landscape

    We need to upload our project to portal. For this we will configure portal landscape.

    Open Window->Preferences

    Click on SAP Enterprise Portal.

    Click Add to add a new portal system.

    Suppose my portal has address : http://punitp54700d:50100/irj/portal

    Enter Alias = Any name (MyPortal)

    Host = punitp54700d

    Port = 50100

    User id for login

    And click OK.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    8/29

    Make it default. Remember you can add more but only one can be default.

    2.3 Deployment and creation of PAR file

    Now click on icon Create/Export PAR file in toolbar.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    9/29

    Click on your project to create PAR file.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    10/29

    Click next.

    Give the PAR file name and password for the portal to login. Check the checkbox Deploy PAR to upload.

    You can also check the box Include source code of portal application.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    11/29

    Click Finish to begin the upload.

    2.4 Run the project

    To run and check the project.

    Go to project explorer window

    Click on

    Dist -> PORTAL-INF -> portalapp.xml

    Now u can see the Run button beside the component you created. Click and run. Enter portal user id and

    password if asked for.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    12/29

    Your application runs.

    You can see the output in browser window.

    First portal application project demo

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    13/29

    3 Creating iView, Page and Role on EP

    We will use the project we just uploaded in to EP to create iView, page and roles on the portal

    3.1 Working with iView

    IView is smallest unit of display in a portal. It can represent sap or non-sap application.

    3.1.1 Open the Enterprise Portal

    Log in to the Enterprise Portal. Home Page is displayed.

    Now we will create our own folder on EP to keep everything at one place.

    Click on Content Administration tab.

    Go to Content Administration -> Portal Content and right click ->New ->Folder.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    14/29

    3.1.2 Creation of Folder

    Give the folder name and id. Then click on Finish button.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    15/29

    Then click on finish button.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    16/29

    3.1.3 Create iView

    Now to create IView :-

    Right click on folder you created ->New -> iView

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    17/29

    Now here we will use the portal component deployed by us i.e. HelloProject to create the iView.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    18/29

    Click on next button. Now you will go to screen for archive selection screen.

    Select the archive you want to add. We will select HelloProject.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    19/29

    Click next. You will get Portal component selection screen. Select the component.

    Click on next.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    20/29

    Click next and then finally click on finish button

    3.2 Working with Pages

    To hold an iView we need to create a page and assign the iView.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    21/29

    Enter the name and id for page

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    22/29

    Click on next button and select default page template.

    Click on next button and finally click on finish.

    3.3 Assign iViews to page

    First of all open the page

    Now right click on the iview and chose Add iView toPage -> delta link

    We use delta link when we want that the changes done to the iview should also reflect in the page, else

    create a copy of it.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    23/29

    Now save the page.

    3.4 Working with Roles

    Now we will create a new role and add the page we created to this role.

    Right click on folder -> New -> Role

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    24/29

    Enter the role name and role id.

    Finally press next and then finish.

    We have now created the role.

    Now we will assign the page we created to this role.

    Open the role by right click - > Open -> Object

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    25/29

    Now right click on the Page and then select Add page to Role -> Delta link

    Then finally we will get.

    Now open the iView by right click.

    For Entry Point radio button check Yes.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    26/29

    3.5 Assigning Roles to users

    Goto User Administration -> Roles -> search for the user

    Select the user you want to assign the role.

    Then in the details of user tab click on Modify.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    27/29

    Click on assigned roles tab. Now search for the role u created i.e. role_helloproject1 (role id used).

    Select the role and add the role to users assigned roles and save.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    28/29

    Now log-off.

    Now log-in as Administrator for changing the properties of role or you need sufficient privileges.

    Upon logging in as administrator open the role and you can see the properties button. Click on that.

    For Entry Point radio button check Yes. Save it.

    Re-login from the user-id you assigned for the role above.

  • 7/28/2019 Basics of Enterprise Portal Development Using Java

    29/29

    Now you can see the Role added in the navigation. Click on the role link to display output.