English flagItalian flagGerman flagSpanish flagFrench flagPortuguese flagRussian flag
IC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Business Objects - Linux - XI Release 2 - Su vida módulo 2

Business Objects XI Java SDK Example, Part 3 Business Objects XI SDK Java Ejemplo, Parte 3

Continued from Business Objects XI Java SDK Example, Part 2 Viene de Business Objects XI SDK Java Ejemplo, Parte 2

Using the Business Objects example applications is a good starting point for creating a first Java SDK application. Usando el ejemplo aplicaciones de Business Objects es un buen punto de partida para la creación de un primer SDK Java de aplicación.

The sample applications provide some basic tasks, and an easy way to get started with the SDK is to use one of the examples, and trim out the code that you don't need. La muestra algunas aplicaciones de las tareas básicas, y una manera fácil de empezar con el SDK es utilizar uno de los ejemplos, y recortar el código que usted no necesita.

For our application I pieced together several of the jsp's and combined them into 2 final jsps. Para nuestra aplicación monté varios de los jsp y combinado en 2 final JSP. To do this, I walked through the flow of the jsp examples and noted the dependencies, and ultimately combined them into to files (jsp's). Para ello, caminé a través de la corriente de los ejemplos jsp y tomó nota de las dependencias y, en última instancia combinado en los archivos (jsp's).

So in this example, there are 2 jsp's that are packaged at the root level of the web app (loginforward.jsp and data-getter.jsp). Así pues, en este ejemplo, hay 2 jsp la que están empaquetados en el nivel raíz de la aplicación web (loginforward.jsp y datos getter.jsp). The contents are listed below: Los contenidos se enumeran a continuación:

loginforward.jsp



<!--
********************************************************************************

Adapted from WebIntelligence RE SDK JSP Tutorials 115.000.00000

Tutorials are Copyright (c) 2002-2005 Business Objects SA

********************************************************************************
-->

<%@ page language="java" errorPage="err_page.jsp"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.businessobjects.rebean.wi.ReportEngine" %>
<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
<%@ page import="com.crystaldecisions.sdk.exception.SDKServerException" %>
<%@ 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.occa.infostore.IInfoStore" %>
<%@ page import="com.crystaldecisions.sdk.occa.security.IUserInfo" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.CeSecurityID" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObjects" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObject" %>
<%@ page import="com.crystaldecisions.sdk.plugin.desktop.server.IServer"%>
<%@ page import="com.crystaldecisions.sdk.plugin.CeKind" %>
<%@ page import="com.crystaldecisions.sdk.occa.enadmin.*" %>
<%@ page import="com.businessobjects.sdk.plugin.desktop.webintelligence.CeWebIntelligenceRightID" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.util.Hashtable" %>

<%@ include file="rights_method.jsp" %>

<%
request.setCharacterEncoding("utf-8");
String CMS = request.getParameter("CMS");
if (CMS.equals("localhost"))
response.sendRedirect("loginForm.jsp?strError=localhost");
String userName= request.getParameter("User");
String userPass = request.getParameter("Password");
String auth = request.getParameter("auth");

// doc identifier
request.setAttribute("docIdentifier",request.getParameter("docIdentifier"));

IEnterpriseSession enterpriseSession= null;
IInfoStore iStore = null;
IUserInfo userInfo = null;

try
{
//Open the session
final ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
enterpriseSession = sessionMgr.logon(userName, userPass, CMS, auth);

}
catch(SDKServerException ex)
{
%>
<jsp:forward page="error_wrongLogin.html" />
<%

}

catch(SDKException.SecurityError exSec)
{
%>
<jsp:forward page="error_authentication.html" />
<%
}

catch(SDKException.OCAFramework exOCA )
{
%>
<jsp:forward page="error_serverName.html" />
<%
}

catch(Exception e)
{

%>
<jsp:forward page="error_login.html" />
<%
}

try{

userInfo = enterpriseSession.getUserInfo();
iStore = (IInfoStore)enterpriseSession.getService("InfoStore");

ReportEngines reportEngines = null;
if (enterpriseSession != null)
{
reportEngines = (ReportEngines)request.getAttribute("ReportEngines");
if (reportEngines == null)
{
//Create a new ReportEngines
reportEngines = (ReportEngines)enterpriseSession.getService("ReportEngines");

request.setAttribute("ReportEngines", reportEngines);
}
}

}
catch (Exception e)
{
%>
<jsp:forward page="error_login.html" />
<%
}


String strSampleVersion = "11.5";

//Test the version of the server
String strQuery = "Select SI_ID, SI_NAME, SI_SERVER_KIND from CI_SYSTEMOBJECTS where SI_KIND ='" CeKind.SERVER "'" " AND SI_SERVER_KIND= 'aps'";
IInfoObjects iServers = (IInfoObjects)iStore.query(strQuery);

String strShortServerVersion ="";
if (iServers != null)
{
IServer iServer = (IServer)iServers.get(0);
IServerGeneralMetrics iServerGeneralMetrics = (IServerGeneralMetrics) iServer.getServerGeneralAdmin();
String strServerVersion = iServerGeneralMetrics.getVersion();
strShortServerVersion = strServerVersion.substring(0,4);

}//if (IServers != null)


//Test the version of the REBEAN SDK
String strSDKVersion = enterpriseSession.getClass().getPackage().getImplementationVersion();
String strShortSDKVersion = strSDKVersion.substring(0,4);


String strErrorMessage="";
if (!strShortServerVersion.equals(strShortSDKVersion))
{
strErrorMessage="Warning: SDK and backbone versions do not match </br> Please update your sdk librairies to version" strShortServerVersion;
}
else if((Float.parseFloat(strSampleVersion)) < (Float.parseFloat(strShortSDKVersion)) )
{
strErrorMessage = "Warning: application was not tested using version " strShortSDKVersion "of the sdk";
}
else if((Float.parseFloat(strSampleVersion)) > (Float.parseFloat(strShortSDKVersion)) )
{
strErrorMessage="Warning: application was developed with a more recent sdk. Execution may fail.";
}

if(!strErrorMessage.equals(""))
response.sendRedirect("error_version.jsp?message=" strErrorMessage);

request.setAttribute("EnterpriseSession", enterpriseSession);

request.setAttribute("InfoStore", iStore);

//Store user info
session.setAttribute("UserInfo",userInfo);
request.setAttribute("UserInfo",userInfo);

//Check if the password has expired
if (userInfo.getPasswordExpiry() == 0){

StringBuffer urlChgPasswd = new StringBuffer();
urlChgPasswd = urlChgPasswd.append("forceChgPassword.jsp?");
urlChgPasswd = urlChgPasswd.append("User=");
urlChgPasswd = urlChgPasswd.append(userName);
urlChgPasswd = urlChgPasswd.append("&auth=");
urlChgPasswd = urlChgPasswd.append(auth);
urlChgPasswd = urlChgPasswd.append("&CMS=");
urlChgPasswd = urlChgPasswd.append(CMS);

response.sendRedirect(urlChgPasswd.toString());
}
else
{

// Get the folder id that is root of all universes
strQuery = "SELECT SI_ID, SI_NAME, SI_PARENTID FROM CI_APPOBJECTS "
"WHERE SI_PARENTID = '" CeSecurityID.Folder.SEMANTIC_LAYERS "' AND SI_KIND = '" CeKind.FOLDER "' AND SI_NAME = 'Universes'";

IInfoObjects iInfoObjects = iStore.query(strQuery);
String strUniverseRootFolderId = "";

if (iInfoObjects != null && iInfoObjects.size() > 0)
strUniverseRootFolderId = String.valueOf(((IInfoObject) iInfoObjects.get(0)).getID());

// Store folder id that is root of all universes
session.setAttribute("UniverseRootFolderId", strUniverseRootFolderId);

// Create a Hashtable to store the rights of the user
Hashtable userRights = new Hashtable();

strQuery = "SELECT SI_ID, SI_KIND FROM CI_APPOBJECTS "
"WHERE SI_PARENTID = '" CeSecurityID.Folder.APPLICATIONS "' AND SI_KIND = '" CeKind.WEBINTELLIGENCE "'";
IInfoObjects iWebiAppObjects = iStore.query(strQuery);

if (iWebiAppObjects != null && iWebiAppObjects.size()>0)
{
IInfoObject iWebiAppObject = (IInfoObject) iWebiAppObjects.get(0);

// Check the some rights on the application object "Webintelligence" and store their value in the hashtable userRights
checkApplicationObjectRight(CeWebIntelligenceRightID.CREATEDOCUMENTS, iWebiAppObject, "CREATE_DOCUMENT", userRights);
checkApplicationObjectRight(CeWebIntelligenceRightID.DRILLMODE, iWebiAppObject, "DRILL_MODE", userRights);
checkApplicationObjectRight(CeWebIntelligenceRightID.EXTENDSCOPE, iWebiAppObject, "EXTEND_SCOPE", userRights);
}

session.setAttribute("userRights", userRights);


%><jsp:forward page="data-getter2.jsp" /><%
} // else of if (userInfo.getPasswordExpiry() == 0)
%>

data-getter.jsp datos getter.jsp





<!--
********************************************************************************

Adapted from WebIntelligence RE SDK JSP Tutorials 115.000.00000

Tutorials are Copyright (c) 2002-2005 Business Objects SA

********************************************************************************
-->


<%@ page language="java" errorPage="../err_page.jsp"%>
<%@ page import="com.businessobjects.rebean.wi.*,java.io.*" %>
<%@ page import="java.util.BitSet, java.util.Enumeration, java.util.StringTokenizer, java.util.Date" %><%@ page import="java.text.ParseException, java.text.SimpleDateFormat, java.io.IOException" %><%!
// =============================================================================

// The separator between the different selected values of a list
static final String C_STR_SEPARATOR = ";";

// =============================================================================

static final int iCaseDiff = ('a' - 'A');

// =============================================================================

// The list of characters that are not encoded have been determined
// by referencing O'Reilly's "HTML: The Definitive Guide" (page 164).
static BitSet objBitSetCharactersNotToEncode;

static
{
int iCharIndex;

objBitSetCharactersNotToEncode = new BitSet(256);

for (iCharIndex = 'a'; iCharIndex <= 'z'; iCharIndex )
objBitSetCharactersNotToEncode.set(iCharIndex);

for (iCharIndex = 'A'; iCharIndex <= 'Z'; iCharIndex )
objBitSetCharactersNotToEncode.set(iCharIndex);

for (iCharIndex = '0'; iCharIndex <= '9'; iCharIndex )
objBitSetCharactersNotToEncode.set(iCharIndex);

// A space needs a special encoding: it should be transformed into a ' '
// this is done in the method URLEncodeUTF8 below
objBitSetCharactersNotToEncode.set(' ');
objBitSetCharactersNotToEncode.set('-');
objBitSetCharactersNotToEncode.set('_');
objBitSetCharactersNotToEncode.set('.');
objBitSetCharactersNotToEncode.set('*');
} // static code

// =============================================================================

// Tell if the given value is an item of the array of the selected values
public String isValuePartOfTheSelection(String strValue, String[] astrSelectedValues)
{
if (astrSelectedValues == null)
return "";

for (int iSelectedIndex = 0; iSelectedIndex < astrSelectedValues.length; iSelectedIndex )
if (strValue.equals(astrSelectedValues[iSelectedIndex]))
return " selected";

return "";
} // method isValuePartOfTheSelection

// =============================================================================

// Concatenate the given value to the list of the selected values
public void addToList(String strItem, StringBuffer objStringBufferItemList)
{
if (objStringBufferItemList.length() != 0)
objStringBufferItemList.append(C_STR_SEPARATOR);

objStringBufferItemList.append(strItem);
} // method addToList

// =============================================================================

// Return a string listing the different values of the given array
// Known limitation: value should not include C_STR_SEPARATOR
public String convertArrayToString(String[] astr)
{
if ((astr == null) || (astr.length == 0))
return "";

StringBuffer objStringBuffer = new StringBuffer("");

for (int iIndex = 0; iIndex < astr.length; iIndex )
{
if (iIndex != 0)
objStringBuffer.append(C_STR_SEPARATOR);

objStringBuffer.append(astr[iIndex]);
} // for (iIndex)

return objStringBuffer.toString();
} // method convertArrayToString

// =============================================================================

// Split delimited string of values into an array
public String[] splitValues(String strValueList)
{
if (strValueList == null)
return null;

StringTokenizer strTokenizer = new StringTokenizer(strValueList, C_STR_SEPARATOR);
int iValueCount = strTokenizer.countTokens();
String[] astrValues = new String[iValueCount];

for (int iValueIndex = 0; iValueIndex < iValueCount; iValueIndex )
astrValues[iValueIndex] = strTokenizer.nextToken();

return astrValues;
} // method splitValues

// =============================================================================

// Return a non null value for the given string
public String getNonNullValue(String strParameterValue, String strDefaultValue)
{
if (strParameterValue == null)
strParameterValue = strDefaultValue;
else if (strParameterValue.equals("null"))
strParameterValue = strDefaultValue;

return strParameterValue;
} // method getNonNullValue

// =============================================================================

// Return a non null value for the given string
// (considering that default value is an empty string)
public String getNonNullValue(String strParameterValue)
{
return getNonNullValue(strParameterValue, "");
} // method getNonNullValue

// =============================================================================

// Return an array of non null values for the given string array
public String[] getNonNullValues(String[] astrParameterValues)
{
if (astrParameterValues == null)
astrParameterValues = new String[0];

return astrParameterValues;
} // method getNonNullValues

String URLEncodeUTF8(String strToEncode)
{
try
{
byte[] abyUTF8 = strToEncode.getBytes("UTF-8");
// The maximal size should be string length * 3 (%XX instead of a single char)
StringBuffer objStringBuffer = new StringBuffer(abyUTF8.length * 3);

for (int iByteIndex = 0; iByteIndex < abyUTF8.length; iByteIndex )
{
int iChar = (int) abyUTF8[iByteIndex];

if (iChar < 0)
iChar = 256; // get an unsigned byte value in [0,256[

// If the character doesn't need encoding,
if (objBitSetCharactersNotToEncode.get(iChar))
{
if (iChar == 0x20)
// ' ' replaced by ' '
iChar = 0x2B;

objStringBuffer.append((char) iChar);
}
// Else, the character needs encoding,
else
{
// It should be escaped by %XX (XX is the hex value of the byte)
objStringBuffer.append('%');

char cChar = Character.forDigit((abyUTF8[iByteIndex] >> 4) & 0xF, 16);

if (Character.isLetter(cChar))
// convert the character to upper case (ex: 'a' -> 'A') as part of the hex value
cChar -= iCaseDiff;

objStringBuffer.append(cChar);

cChar = Character.forDigit(abyUTF8[iByteIndex] & 0xF, 16);

if (Character.isLetter(cChar))
// convert the character to upper case (ex: 'a' -> 'A') as part of the hex value
cChar -= iCaseDiff;

objStringBuffer.append(cChar);
} // else of if (objBitSetCharactersNotToEncode.get(iChar))
} // for (iByteIndex)

return objStringBuffer.toString();
}
catch (java.io.UnsupportedEncodingException objUnsupportedEncodingException)
{
System.out.println("UnsupportedEncodingException on " strToEncode);
return (java.net.URLEncoder.encode(strToEncode));
} // catch (java.io.UnsupportedEncodingException)
} // method URLEncodeUTF8

// ============================================================================= end useful methods
%>


<%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>
<%

// The session attribute, used for displaying user messages
final String C_STR_INFORMATION_SESSION_ATTRIBUTE = "informationMessage";

// The different values of the page parameter, used for navigating into documents
final String C_STR_PAGE_FIRST = "first";
final String C_STR_PAGE_PREVIOUS = "prev";
final String C_STR_PAGE_NEXT = "next";
final String C_STR_PAGE_LAST = "last";

// The display of the particular values of a list
final String C_STR_ALL = "*";
final String C_STR_NOTHING = "Nothing";

//Retrieve the Object Session
IEnterpriseSession enterpriseSession = (IEnterpriseSession)request.getAttribute("EnterpriseSession");

// Get the locale of the server
String strLocale = request.getLocale().getLanguage();


%>


<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore" %>
<%@ page import="com.crystaldecisions.sdk.occa.security.IUserInfo" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObjects" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObject" %>
<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.ISecurityInfo" %>
<%@ page import="java.util.Locale" %>
<%@ page import="java.io.IOException" %>

<%

ReportEngines reportEngines = (ReportEngines) request.getAttribute("ReportEngines");

IInfoStore iStore = (IInfoStore) request.getAttribute("InfoStore");

String strDocUID = (String) request.getAttribute("docIdentifier");


String strDocUIDType = "id";
String strEntry = getNonNullValue(request.getParameter("entry"));
String strDocId = null;

if (strDocUID.length() != 0)
if (strDocUIDType.equals("id"))
strDocId = strDocUID;
else
strEntry = strDocUID;


DocumentInstance document = null;

// If a storage token has been given
if (! strEntry.equals(""))
{
try{
// Retrieve the correct ReportEngine from the storage token
ReportEngine reportEngine = reportEngines.getServiceFromStorageToken(strEntry);

// Retrieve the document using its storage token
document = reportEngine.getDocumentFromStorageToken(strEntry);
}catch(Exception ex){
response.sendRedirect("../error_token.html");
}

}
// Else if a document id or a document name has been given
else if (! strDocId.equals(""))
{
//Check the SI_KIND of the Document to instanciate the correct reportEngine
String strQuery = "Select SI_KIND from CI_INFOOBJECTS where SI_ID=" strDocId;
IInfoObjects iDocObjects = iStore.query(strQuery);
IInfoObject iDocObject = null;

String strQuery2 = "Select * from CI_INFOOBJECTS where SI_ID=" strDocId;
IInfoObjects iDocObjects2 = iStore.query(strQuery2);


IInfoObject iDocObject2 = null;

try{

iDocObject = (IInfoObject) iDocObjects.get(0);

iDocObject2 = (IInfoObject) iDocObjects2.get(0);
}
catch(Exception ex)
{
response.sendRedirect("../error_documentNotFound.html");
}

String strKind = iDocObject.getKind();
com.crystaldecisions.sdk.occa.infostore.ISchedulable iDocObject3 = (com.crystaldecisions.sdk.occa.infostore.ISchedulable) iDocObject2;

IInfoObject iDocObject4 = iDocObject3.getLatestInstance();

int latestInstanceID = iDocObject4.getID();


ReportEngine reportEngine = null;


if(strKind.equalsIgnoreCase("Webi"))
{
reportEngine = reportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
reportEngine.setLocale(strLocale);
}
else
{
reportEngine = reportEngines.getService(ReportEngines.ReportEngineType.FC_REPORT_ENGINE);
reportEngine.setLocale(strLocale);
}


// Open the document from its identifiers
// document = reportEngine.openDocument(Integer.parseInt(strDocId));
try{
document = reportEngine.openDocument( latestInstanceID );
}catch(Exception e9){
e9.printStackTrace();
}


} // if (! strEntry.equals(""))

// *****************************************************************************
%>


<%

// Retrieve parameters
String strDataProviderIndex = getNonNullValue(request.getParameter("dataprovider"), "0");
int iDataProvider = Integer.parseInt(strDataProviderIndex);

DataProviders dataProviders = document.getDataProviders();
int iDataProviderCount = dataProviders.getCount();


// If document is empty
if (iDataProviderCount <= 0)
{
%><%@ include file="../error_noDataProvider.html" %><%

return;
} // if (iDataProvider <= 0)

// Set dataprovider
DataProvider dataProvider = dataProviders.getItem(iDataProvider);

// *****************************************************************************
%>

<%
response.setDateHeader("expires", 0);

%>

<%


if (strEntry.equals(""))
// Get storage token
strEntry = document.getStorageToken();

out.clearBuffer();
CharacterView cvOutput;
InputStream isXML;
int available;
byte[] data;
int nbBytes;
StringBuffer sbResult = new StringBuffer();

cvOutput = dataProvider.getResultAsCSV(-1); //cih
out.print(cvOutput.getContent()); //cih

%>



<%
if (enterpriseSession != null){
enterpriseSession.logoff();
}
// *****************************************************************************
%>

Spread the word Corra la voz

del.icio.us Digg Furl Reddit del.icio.us Digg Furl Reddit

Permalink Print 1 Comment Permalink Imprimir 1 Comentario

Business Objects XI SDK Example, Part 2 Business Objects XI SDK Ejemplo, Parte 2

Continued from Business Objects XI SDK Example, part 1 Viene de Business Objects XI SDK Ejemplo, parte 1

In this post, we'll go over how we can use a python script to process BO XI Java SDK CSV output. En este puesto, nos vamos más de cómo podemos utilizar un script de python para procesar BO XI SDK Java CSV de salida.

The python script makes an http request to the web app and receives the contents. La secuencia de comandos Python hace una petición HTTP a la aplicación web y recibe el contenido.

The configuration file stores information to email a report. El fichero de configuración almacena la información a enviar un informe. It contains the following information: Que contiene la siguiente información:


#report-mailer.py

REMOVE_HEADER_ROW = True
#REMOVE_HEADER_ROW = False

COLUMN_SEPARATOR = " "
#COLUMN_SEPARATOR = ","

to = "noreply@noreply.com,noreply2@noreply.com "
sentfrom = "noreply@noreply.com"

User = "testuser "
Password = "password"
docIdentifier = "442005"


The contents of the config file should be self-explanatory. El contenido del archivo de configuración debe ser auto-explicativo. It allows for the option of removing the header report from the dat Permite la opción de eliminar el encabezado informe de la dat

The "#" is the python comment symbol. El "#" es el símbolo de comentario python.

Python is case sensitive. Python es sensible a mayúsculas y minúsculas. Be aware of this when creating configuration files. Ser conscientes de ello al crear archivos de configuración.

The above code is read inline from the python script report-mailer.py (it is executable python code). El código anterior se lee en línea de la secuencia de comandos Python-mailer.py informe (que es código ejecutable python). The config files sets the appropriate values that are needed by report-mailer.py. Los archivos de configuración fija los valores adecuados que se necesitan según el informe-mailer.py.

Here's the contents of the python script: He aquí el contenido de la secuencia de comandos:

import sys
import smtplib
from email.MIMEText import MIMEText
import urllib

REMOVE_HEADER_ROW = True

COLUMN_SEPARATOR = " "
#COLUMN_SEPARATOR = ","

CSV_EXTRACT_URL = "http://dev1:8080/dpvalues/loginforward.jsp"

auth = "secEnterprise"
CMS = "ersdev1"

to = "noreply@noreply.com"
sentfrom = "noreply@noreply.com"

config_file = sys.argv[1]


#read in config info, and overwrite defaults set above
execfile(config_file)

params = urllib.urlencode({'CMS': CMS, 'User': User, 'Password': Password, 'auth':auth, 'docIdentifier':docIdentifier })

print str(params)

f = urllib.urlopen(CSV_EXTRACT_URL, params)
raw = f.read()

rows = raw.split("\n")
if REMOVE_HEADER_ROW:
rows = rows[1:]

buf = ""
for x in rows:
cln = x.strip()
if len(cln) < 3:
continue
sp = cln[1:-1].split('";"')
buf = COLUMN_SEPARATOR.join( sp ) "\n"


msg = MIMEText(buf)

msg['Subject'] = 'csv values'
msg['From'] = sentfrom
msg['To'] = to

s = smtplib.SMTP()
s.connect()
s.sendmail(sentfrom, [to], msg.as_string())
s.close()



Continued on Business Objects XI SDK Example, part 3 Continúa en Business Objects XI SDK Ejemplo, parte 3

Spread the word Corra la voz

del.icio.us Digg Furl Reddit del.icio.us Digg Furl Reddit

Permalink Print 2 Comments Permalink Imprimir 2 Comentarios

Business Objects XI SDK Example, Part 1 Business Objects XI SDK Ejemplo, Parte 1

The following example walks through a simple use of the Java SDK for XI. En el ejemplo siguiente se camina a través de un simple uso de la SDK para Java XI. It explains in a step-by-step manner how the Business Objects SDK can be used in conjunction with some complementary technologies - a python script. En él se explica en un paso a paso la manera de cómo Business Objects SDK puede ser usado en conjunción con algunas tecnologías complementarias - un script de python.

To illustrate SDK usage we will build a utility script that emails the contents of a Web Intelligence data source as a csv or tab delimited output. Para ilustrar el uso del SDK vamos a construir un script que los correos electrónicos de utilidad el contenido de un sitio de Inteligencia de las fuentes de datos como un csv delimitado por tabuladores o de salida.

Why base the output on the BO data source? ¿Por qué la base de producción en el BO de las fuentes de datos?

Because of the nature of reports being intended for human readability, various elements are included in a report that would be undesirable for system to system communication. Debido a la naturaleza de los informes destinados a la alimentación humana legibilidad, varios elementos se incluyen en un informe que sería conveniente para el sistema a la comunicación. For example, reports typically have logo files, report dates, etc. When converting a report to csv these "human intended" elements can cause problems. Por ejemplo, los informes suelen tener logotipo archivos, fechas, etc Al convertir un informe a csv estos "humanos destinados" elementos pueden causar problemas.

We want clean, tabular output. Queremos limpiar, de cuadros de salida.

A quick way of learning a new API is to take supplied example code and modify. Una manera rápida de aprender un nuevo API es suministrado a tomar ejemplo y modificar el código.

So for this example, we will take the examples included with the Buiness Objects SDK as a starting point. Por lo tanto, para este ejemplo, vamos a tomar los ejemplos se incluye con el SDK de Buiness objetos como punto de partida.

The functionality will be exposed as a call to a java web application (WAR), and will thus be easily deployable. La funcionalidad se expone como una llamada a una aplicación Java Web (WAR), y, por tanto, ser fácilmente desplegables.

The primary components of the example this little system are: Los principales componentes de este pequeño ejemplo el sistema son:

1. Web application (.war file) - contains SDK code Aplicación Web (archivo. War) - contiene el código del SDK

2. Python script (report-mailer.py) - talks to the web app Secuencia de comandos Python (informe-mailer.py) - habla con la aplicación web

3. Configuration file - text file that stores configuration information, one file per report emailed Archivo de configuración - archivo de texto que almacena información de configuración, un archivo de informe por correo electrónico

This example is intended for a non-packaged report with a single data source (query). Este ejemplo es para un informe no envasados con una sola fuente de datos (consulta). Based on the configured document identifier (docIdentifier in the config file), it will pull the data source from the latest instance and email the contents as requested in the configuration file. Configurado sobre la base de los documentos de identificación (docIdentifier en el archivo de configuración), se tire de la fuente de datos de la última instancia y el contenido de correo electrónico tal como se solicita en el archivo de configuración.

With a little modification of the python script, we could supply output in a number of different formats. Con un poco de modificación de la secuencia de comandos, nos podría proporcionar la salida en una serie de formatos diferentes. We could write to the local file system in an ftp accessible directory (available for "pull" by other systems). Podemos escribir en el sistema de archivos local en un directorio ftp accesible (disponible para "tirar" de otros sistemas). We could "push" the data to another server via FTP, SFTP, SCP, etc. Se podría "empujar" los datos a otro servidor a través de FTP, SFTP, SCP, etc

The war is deployed into a java application server (eg Tomcat). La guerra se despliega en un servidor de aplicaciones Java (por ejemplo, Tomcat). This can be the same server or a different one than the one running BO. Este puede ser el mismo servidor o uno diferente que el funcionamiento BO.

The example code supplied by Busness Objects is packaged with jars such that they can run standalone (from a BOXI server). El código de ejemplo facilitada por Business Objects está empaquetado con los frascos de manera que puedan ejecutarse por separado (de un servidor BOXI).

Continued in Business Objects XI SDK Example , Part 2 Continuó en Business Objects XI SDK Ejemplo, Parte 2

Spread the word Corra la voz

del.icio.us Digg Furl Reddit del.icio.us Digg Furl Reddit

Permalink Print 1 Comment Permalink Imprimir 1 Comentario