com.instantbank.lettertemplate.control.web.handlers
Class TemplatesHandler

java.lang.Object
  |
  +--com.instantbank.lettertemplate.control.web.handlers.RequestHandlerSupport
        |
        +--com.instantbank.lettertemplate.control.web.handlers.TemplatesHandler
All Implemented Interfaces:
RequestHandler

public class TemplatesHandler
extends RequestHandlerSupport

Letter Templates usecase: handler of user requests in the Application layer

Author:
Instant-bank (Jorge Cardenas)

Field Summary
(package private)  javax.servlet.ServletContext context
           
private  Debug debug
           
private  boolean gotoDB
           
 
Constructor Summary
TemplatesHandler()
           
 
Method Summary
private  LetterTemplateEvent createListTemplatesEvent(javax.servlet.http.HttpServletRequest request)
          method for instantiating a TemplatesEvent demanding a service of getting the templates list
private  LetterTemplateEvent createUpdateTemplatesEvent(javax.servlet.http.HttpServletRequest request)
          method for instantiating a TemplatesEvent demanding a service of updating several letters templates
private  java.util.ArrayList parseXMLTemplates(java.lang.String templateItems)
          auxiliary method for parsing a XML string containing items to update in letters templates
 LetterTemplateEvent processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext context)
          principal method that process a user request instantiating a TemplatesEvent with the user request data
 
Methods inherited from class com.instantbank.lettertemplate.control.web.handlers.RequestHandlerSupport
doEnd, doStart
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

debug

private Debug debug

context

javax.servlet.ServletContext context

gotoDB

private boolean gotoDB
Constructor Detail

TemplatesHandler

public TemplatesHandler()
Method Detail

processRequest

public LetterTemplateEvent processRequest(javax.servlet.http.HttpServletRequest request,
                                          javax.servlet.ServletContext context)
                                   throws LetterTemplateEventException
principal method that process a user request instantiating a TemplatesEvent with the user request data
Parameters:
request - of MainServlet
context - of MainServlet
Returns:
TemplatesEvent with the user request data
Throws:
LetterTemplateEventException -  

createListTemplatesEvent

private LetterTemplateEvent createListTemplatesEvent(javax.servlet.http.HttpServletRequest request)
                                              throws LetterTemplateEventException
method for instantiating a TemplatesEvent demanding a service of getting the templates list
Parameters:
request - of MainServlet
Returns:
TemplatesEvent with the user request data
Throws:
LetterTemplateEventException -  

createUpdateTemplatesEvent

private LetterTemplateEvent createUpdateTemplatesEvent(javax.servlet.http.HttpServletRequest request)
                                                throws LetterTemplateEventException
method for instantiating a TemplatesEvent demanding a service of updating several letters templates
Parameters:
request - of MainServlet
Returns:
TemplatesEvent with the user request data
Throws:
LetterTemplateEventException -  

parseXMLTemplates

private java.util.ArrayList parseXMLTemplates(java.lang.String templateItems)
                                       throws java.lang.Exception
auxiliary method for parsing a XML string containing items to update in letters templates
Parameters:
templateItems - is the XML string
Returns:
a ArrayList with 4 elements of type String[] representing the attributes of items: code of template, code of category, name and status
Throws:
java.lang.Exception -