Simple tutorial on sap business objects
This document is the API
specification for the BusinessObjects Enterprise Java SDK.
The BusinessObjects Enterprise Java
SDK is a Software Development Kit that provides you with the tools for building
scalable web applications. These applications can be divided into two
categories: applications that allow users to perform client tasks, such as
viewing, scheduling, and exporting reports, and applications that enable
administrators to perform administrative tasks, such as managing servers,
creating user and groups, gathering metrics, and handling security.
Client
tasks
The BusinessObjects Enterprise Java
SDK provides you with the tools and components to design a client desktop with
the following functionality:
- logging on to a database
- maintaining inboxes
- organizing folders and categories
- previewing reports using thumbnails
- viewing reports
- searching for reports
- setting parameters for and applying filters to reports
- scheduling reports with events
- scheduling reports to a destination
- exporting reports to a common format
Administrative
tasks
The BusinessObjects Enterprise SDK
allows you to create your own management tools-- ones that can perform
administrative tasks such as the following:
- adding and modifying user accounts
- managing groups membership
- applying report processing extensions
- assigning security rights
- setting server properties
- auditing licenses and viewing system metrics
The apis commonly used in project:-
com.crystaldecisions.sdk.occa.security
This package contains interfaces that allow you to interact with the security
session.
In this we use interface to create
tokens:-
ILogonTokenMgr
This object manages the creation and release of logon tokens for logged on
users.
IUserInfo
This is an interface through which user information can be extracted from the
security session and then modified.
The above
interface is used in the following way
IUserInfo
userInfo = enterpriseSession.getUserInfo();
This method of the above interface
is used in project
com.crystaldecisions.sdk.occa.infostore
This package provides the ability to query for InfoObjects, as well as add,
delete, and update them.
In the above package we use following class:-
Methods
IInfoObjects
query(java.lang.String query)
Executes a query against the CMS.
IInfoObjects[]
query(java.lang.String[] queries)
Executes queries against the CMS.
com.crystaldecisions.sdk.framework
This package implements the highest object model that branches off to the
individual library implementations.
Inside the above
package we are using following classes in our project:-
CrystalEnterprise
The
CrystalEnterprise
class is
the starting point for BusinessObjects Enterprise.
In this class we use
CrystalEnterprise.
getSessionMgr();
IEnterpriseSession
IEnterpriseSession
is the first object to be acquired.
It precedes the creation of any other Enterprise components. It combines both
the name service and the client-side security objects, and also provides the
Service property that makes it possible for users to retrieve the object that
gives them access to services on the CMS machine.
In this class we use following method s
getSerializedSession
Returns an object to use a specific service exposed by the enterprise framework.
Returns an object to use a specific service exposed by a server.
()
Gets a string
of a serialized session java.lang.String[]
getServerNames()
Returns a
list of available servers.
java.lang.Object
getService(java.lang.String ServiceName)
Returns an object to use a specific service exposed by the enterprise framework.
java.lang.Object
getService(java.lang.String ServerName,
java.lang.String ServiceName)
Returns an object to use a specific service exposed by a server.
java.lang.String[]
getServiceNames(java.lang.String ServerName,
int type)
Returns a list of
available services on a particular server.
IUserInfo getUserInfo()
Retrieves
the UserInfo object, which has information about the user who created the
session.
ISessionMgr
This is the basic, top level client side object. which includes the methods
that must be called when a user attempts to access the BusinessObjects
Enterprise system.
In this class
we use following methods in our project
IEnterpriseSession
logon
Logs on to the specified CMS or Cluster.
(org.ietf.jgss.GSSCredential UserCreds,
org.ietf.jgss.GSSManager Manager, java.lang.String CMSName,
java.lang.String Authentication)
Logs on to the specified CMS or Cluster.
IEnterpriseSession
logon
Logs on to the specified CMS or Cluster.
(java.lang.String UserName,
java.lang.String Password, java.lang.String CMSName,
java.lang.String Authentication)
Logs on to the specified CMS or Cluster.
ITrustedPrincipal
createTrustedPrincipal(java.lang.String userName,
java.lang.String cmsName)
Creates a new
ITrustedPrincipal
trusted
principal object.
ITrustedPrincipal
createTrustedPrincipal(java.lang.String userName, java.lang.String cmsName,
java.lang.String sharedSecret)
Creates a new
ITrustedPrincipal
object.
com.crystaldecisions.sdk.exception
This package defines the exceptions thrown by BusinessObjects Enterprise.
The process of login in business objects:-
- Set the user name and password for the Administrator account. This uses the default values that were created when BusinessObjects Enterprise was installed.
String user = "Administrator"; String password = "";
- Set the name of the CMS to log on to.
String cmsName = "CMS";
- Set the authentication method to be used and initialize a variable to store any exceptions thrown.
String cmsAuthType =
"secEnterprise";
SDKException failure = null;
- Log on to the CMS using the specified values. If the logon is successful, the Enterprise session will be retrieved.
try
{
es = CrystalEnterprise.getSessionMgr().logon(
user,
password,
cmsName,
cmsAuthType);
}
- Catch the exception thrown if the logon process failed.
catch (SDKException error)
{
failure = error;
}
- Display an error message if the logon failed.
if (failure != null)
{
out.println(failure);
}
- Otherwise, if the logon was successful, set the enterprise session so that it can be retrieved later.
else
{
session.setAttribute("CE_Session", es);
}
- Retrieve the InfoStore from the Enterprise session.
IInfoStore iStore = (IInfoStore)
es.getService("", "InfoStore");
]
Simple example for login
authentication using BO:-
login.jsp
This page is opened when the user clicks Login in the form LoginForm described on 19. The user name and password used for the login are passed from the HTML form in the query string parameters Name and Pass.<%@
page import
="com.crystaldecisions.sdk.framework.CrystalEnterprise"
%>
<%@
page import
="com.crystaldecisions.sdk.framework.IEnterpriseSession"
%>
<%@
page import
="com.crystaldecisions.sdk.framework.ISessionMgr"
%>
<%@
page import
="com.crystaldecisions.sdk.exception.SDKException"
%>
<%@
page
import="com.businessobjects.rebean.wi.*" %>
<%
String
CMS = request.getParameter("CMS");String
userID = request.getParameter("Name");String
password = request.getParameter("pass");String
auth = request.getParameter("auth");if
( CMS
== null) CMS = "";if
(
userID == null) userID = "";if
(
password == null) password = "";if
( auth
== null) auth = "";IEnterpriseSession
enterpriseSession;try
{
ISessionMgr
mySessionMgr = CrystalEnterprise
.getSessionMgr();
enterpriseSession
= mySessionMgr.logon(userID,
password, CMS,auth);
if
(enterpriseSession != null)
session.setAttribute("EnterpriseSession",enterpriseSession);
IInfoStore
iStore = (IInfoStore
) enterpriseSession.getService("InfoStore");
session.setAttribute("InfoStore",
iStore);
response.sendRedirect("home.html");
}
Else
response.sendRedirect("index.jsp");
}
catch
( SDKException
mySDKExept)
{
response.sendRedirect("index.jsp");
}
%>
No comments:
Post a Comment