it.eng.spagobi.services
Class IReportPluginServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by it.eng.spagobi.services.IReportPluginServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class IReportPluginServlet
extends javax.servlet.http.HttpServlet

A servlet used to manage the requests of the spagobi ireport plugin

Author:
Luca Fiscato
See Also:
Serialized Form

Field Summary
private  java.lang.String ATTR_PATH_SYS_FUNCT
           
private  java.util.List drivers
           
private  int ERROR_CHECK_IN
           
private  java.lang.String ERROR_CHECK_IN_MSG
           
private  int ERROR_CHECK_OUT
           
private  java.lang.String ERROR_CHECK_OUT_MSG
           
private  int ERROR_CMS_FILE
           
private  java.lang.String ERROR_CMS_FILE_MSG
           
private  int FILENAME_PAR_NOT_FOUND
           
private  java.lang.String FILENAME_PAR_NOT_FOUND_MSG
           
private  int OP_PAR_NOT_FOUND
           
private  java.lang.String OP_PAR_NOT_FOUND_MSG
           
private  int PATH_PAR_NOT_FOUND
           
private  java.lang.String PATH_PAR_NOT_FOUND_MSG
           
private  int PWD_PAR_NOT_FOUND
           
private  java.lang.String PWD_PAR_NOT_FOUND_MSG
           
private  int TREE_GEN_ERROR
           
private  java.lang.String TREE_GEN_ERROR_MSG
           
private  int USER_NOT_AUTH
           
private  java.lang.String USER_NOT_AUTH_MSG
           
private  int USER_PAR_NOT_FOUND
           
private  java.lang.String USER_PAR_NOT_FOUND_MSG
           
 
Constructor Summary
IReportPluginServlet()
           
 
Method Summary
private  void addItemTree(java.lang.StringBuffer tree, it.eng.spago.base.SourceBean dataTree, java.util.List userRoles, boolean isRoot, boolean canDev)
          Recursively analize all the xml nodes of the object tree and push all the not right objects
private  void checkinManager(java.util.Map mapPar, java.io.OutputStream out)
          Manage the checkin request
private  void checkoutManager(java.util.Map mapPar, java.io.OutputStream out, javax.servlet.http.HttpServletResponse response)
          Manage the checkout request
private  java.lang.String createErrorMessage(int code, java.lang.String error)
          Create the xml evelope for the response message when an error occur
private  java.lang.String createResponseMessage(java.lang.String body)
          Create the xml evelope for the response message when no errors occur
private  java.lang.String filterTree(it.eng.spago.base.SourceBean treeSB, java.util.List userRoles)
          Filter the object tree, base on the user roles, calling a recursive function.
private  void flushOut(java.lang.String message, java.io.OutputStream out)
          Flush out to the client the response message
private  java.util.Map getParameter(javax.servlet.http.HttpServletRequest request)
          Retrive all parameter from the request and put them into a map.
private  java.util.List getRoles(java.lang.String username, java.lang.String password)
          Get the portal roles assigned to a user, if the user doesn't exist the role list is empty
 void init(javax.servlet.ServletConfig config)
          Init method definition
private  void loginManager(java.util.Map mapPar, java.io.OutputStream out)
          Manage the login request, authenticate the user and send back the object tree or an error message
 void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Service method definition
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_PATH_SYS_FUNCT

private final java.lang.String ATTR_PATH_SYS_FUNCT
See Also:
Constant Field Values

OP_PAR_NOT_FOUND

private final int OP_PAR_NOT_FOUND
See Also:
Constant Field Values

USER_PAR_NOT_FOUND

private final int USER_PAR_NOT_FOUND
See Also:
Constant Field Values

PWD_PAR_NOT_FOUND

private final int PWD_PAR_NOT_FOUND
See Also:
Constant Field Values

USER_NOT_AUTH

private final int USER_NOT_AUTH
See Also:
Constant Field Values

PATH_PAR_NOT_FOUND

private final int PATH_PAR_NOT_FOUND
See Also:
Constant Field Values

FILENAME_PAR_NOT_FOUND

private final int FILENAME_PAR_NOT_FOUND
See Also:
Constant Field Values

TREE_GEN_ERROR

private final int TREE_GEN_ERROR
See Also:
Constant Field Values

ERROR_CHECK_IN

private final int ERROR_CHECK_IN
See Also:
Constant Field Values

ERROR_CHECK_OUT

private final int ERROR_CHECK_OUT
See Also:
Constant Field Values

ERROR_CMS_FILE

private final int ERROR_CMS_FILE
See Also:
Constant Field Values

OP_PAR_NOT_FOUND_MSG

private final java.lang.String OP_PAR_NOT_FOUND_MSG
See Also:
Constant Field Values

USER_PAR_NOT_FOUND_MSG

private final java.lang.String USER_PAR_NOT_FOUND_MSG
See Also:
Constant Field Values

PWD_PAR_NOT_FOUND_MSG

private final java.lang.String PWD_PAR_NOT_FOUND_MSG
See Also:
Constant Field Values

USER_NOT_AUTH_MSG

private final java.lang.String USER_NOT_AUTH_MSG
See Also:
Constant Field Values

PATH_PAR_NOT_FOUND_MSG

private final java.lang.String PATH_PAR_NOT_FOUND_MSG
See Also:
Constant Field Values

TREE_GEN_ERROR_MSG

private final java.lang.String TREE_GEN_ERROR_MSG
See Also:
Constant Field Values

ERROR_CHECK_IN_MSG

private final java.lang.String ERROR_CHECK_IN_MSG
See Also:
Constant Field Values

ERROR_CMS_FILE_MSG

private final java.lang.String ERROR_CMS_FILE_MSG
See Also:
Constant Field Values

FILENAME_PAR_NOT_FOUND_MSG

private final java.lang.String FILENAME_PAR_NOT_FOUND_MSG
See Also:
Constant Field Values

ERROR_CHECK_OUT_MSG

private final java.lang.String ERROR_CHECK_OUT_MSG
See Also:
Constant Field Values

drivers

private java.util.List drivers
Constructor Detail

IReportPluginServlet

public IReportPluginServlet()
Method Detail

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Init method definition

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

service

public void service(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws java.io.IOException,
                    javax.servlet.ServletException
Service method definition

Overrides:
service in class javax.servlet.http.HttpServlet
Parameters:
request - The http servlet request
response - The http servlet response
Throws:
java.io.IOException - If any exception occurred
javax.servlet.ServletException

checkoutManager

private void checkoutManager(java.util.Map mapPar,
                             java.io.OutputStream out,
                             javax.servlet.http.HttpServletResponse response)
Manage the checkout request

Parameters:
mapPar - request parameters
out - buffer output
response - http response

checkinManager

private void checkinManager(java.util.Map mapPar,
                            java.io.OutputStream out)
Manage the checkin request

Parameters:
mapPar - map of the request parameters
out - buffer output

loginManager

private void loginManager(java.util.Map mapPar,
                          java.io.OutputStream out)
Manage the login request, authenticate the user and send back the object tree or an error message

Parameters:
mapPar - map of the request parameter
out - output buffer

filterTree

private java.lang.String filterTree(it.eng.spago.base.SourceBean treeSB,
                                    java.util.List userRoles)
Filter the object tree, base on the user roles, calling a recursive function.

Parameters:
treeSB - Sourcebean that contains the object tree xml format
userRoles - list of the user roles
Returns:
String format of the filtered tree

addItemTree

private void addItemTree(java.lang.StringBuffer tree,
                         it.eng.spago.base.SourceBean dataTree,
                         java.util.List userRoles,
                         boolean isRoot,
                         boolean canDev)
Recursively analize all the xml nodes of the object tree and push all the not right objects

Parameters:
tree - StringBuffer
dataTree -
userRoles -
isRoot -
canDev -

getRoles

private java.util.List getRoles(java.lang.String username,
                                java.lang.String password)
Get the portal roles assigned to a user, if the user doesn't exist the role list is empty

Parameters:
username - username of the user
password - password of the user
Returns:

getParameter

private java.util.Map getParameter(javax.servlet.http.HttpServletRequest request)
Retrive all parameter from the request and put them into a map. If the parameter is a file uploaded it will be put into the map whit "FILE" keyword

Parameters:
request - http request
Returns:
Map of the request parameters

createResponseMessage

private java.lang.String createResponseMessage(java.lang.String body)
Create the xml evelope for the response message when no errors occur

Parameters:
body - body of the response message
Returns:
The String format of the xml envelope response

createErrorMessage

private java.lang.String createErrorMessage(int code,
                                            java.lang.String error)
Create the xml evelope for the response message when an error occur

Parameters:
code - numeric code of the error
error - message of the error
Returns:
The String format of the xml envelope response

flushOut

private void flushOut(java.lang.String message,
                      java.io.OutputStream out)
Flush out to the client the response message

Parameters:
message - message that will be sent to the client
out - OutputStream to flush out