com.ferri.portlet.factura.action
Class ViewFacturaAction

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.portlet.context.PortletApplicationObjectSupport
          extended by org.springframework.web.portlet.handler.PortletContentGenerator
              extended by org.springframework.web.portlet.mvc.AbstractController
                  extended by org.springframework.web.portlet.mvc.BaseCommandController
                      extended by org.springframework.web.portlet.mvc.AbstractFormController
                          extended by org.springframework.web.portlet.mvc.SimpleFormController
                              extended by com.ferri.portlet.factura.action.ViewFacturaAction
All Implemented Interfaces:
org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.portlet.context.PortletContextAware, org.springframework.web.portlet.mvc.Controller

public class ViewFacturaAction
extends org.springframework.web.portlet.mvc.SimpleFormController
implements org.springframework.web.portlet.mvc.Controller, org.springframework.web.context.ServletContextAware

Controlador de les pantalles de llistat.jsp i manteniment.jsp de la entitat Factura

Author:
dferri

Field Summary
private  ClientService clientService
           
private  FacturaService facturaService
           
private static org.apache.commons.logging.Log log
           
private static String PAGE_LIST
           
private static String PAGE_MANT
           
private  javax.servlet.ServletContext servletContext
           
 
Fields inherited from class org.springframework.web.portlet.mvc.BaseCommandController
DEFAULT_COMMAND_NAME
 
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
 
Constructor Summary
ViewFacturaAction()
           
 
Method Summary
private  void buscar(javax.portlet.PortletRequest request)
          Cerca un llistat d'entitats Factura que compleixin els criteris i ordenació passats per formulari request.
private  void cobrar(javax.portlet.PortletRequest request)
          Cambia l'estat de l'entitat Factura a Cobrada.
private  void defecte(javax.portlet.PortletRequest request)
          Carrega el llistat amb tots els elements Factura i l'afegeix a la request.
private  void editar(javax.portlet.PortletRequest request)
          Carrega una entitat Factura en request a partir del número pasat també per request.
private  void enviar(javax.portlet.PortletRequest request)
          Genera un pdf de l'entitat Factura, i l'envia com attachment en un mail preformat d'aquesta entitat als destinataris passats per formulari en la request.
private  void getClientsAutoComplete(javax.portlet.PortletRequest request)
          Carrega un String en el atribut request 'arrayClientAutocomplete' amb la relació de NIF separada per comes de tots els clients amb la forma '"NIF1","NIF2","NIF3",...'.
 ClientService getClientService()
           
 FacturaService getFacturaService()
           
private  void getMails(javax.portlet.PortletRequest request)
          Metode que cerca els emails vinculats a un client, sempre el seu, i opcionalment el de la gestoria i l'administrador: sempre que es traci d'una comunitat.
private  Boolean guardar(javax.portlet.PortletRequest request)
          Guarda una entitat Factura, previa validació, amb tots els camps del forumlari pasats per request: pot crear-lo de nou si no existeix o actualitzar-lo si esxisteix.
 void handleActionRequest(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
           
 org.springframework.web.portlet.ModelAndView handleRenderRequest(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
 void setClientService(ClientService clientService)
           
 void setFacturaService(FacturaService facturaService)
           
 void setServletContext(javax.servlet.ServletContext servletContext)
           
private  void subElements(javax.portlet.PortletRequest request)
          Carrega els llistats d'elements secundaris: Estat, i l'afegeix a la request.
private  boolean validaBusqueda(FacturaDTO dto, javax.portlet.PortletRequest request)
          Valida els camps del formulari de cerca en format data o import per entitats Factura.
private  boolean validaCamps(FacturaDTO dto, javax.portlet.PortletRequest request)
          Valida els camps del formulari de l'entitat Factura abans de guardar-los.
 
Methods inherited from class org.springframework.web.portlet.mvc.SimpleFormController
doSubmitAction, getFormView, getSuccessView, isFormChangeRequest, onFormChange, onFormChange, onSubmitAction, onSubmitAction, onSubmitAction, onSubmitRender, onSubmitRender, onSubmitRender, processFormSubmission, referenceData, referenceData, renderFormSubmission, setFormView, setSuccessView, showForm, showForm, suppressValidation
 
Methods inherited from class org.springframework.web.portlet.mvc.AbstractFormController
formBackingObject, getCommand, getErrorsForNewForm, getFormSessionAttributeName, getFormSessionAttributeName, getFormSubmitParameterName, getInvalidSubmitParameterName, getRenderParameters, handleActionRequestInternal, handleInvalidSubmit, handleRenderRequestInternal, isBindOnNewForm, isFormSubmission, isInvalidSubmission, isRedirectAction, isSessionForm, onBindOnNewForm, onBindOnNewForm, passRenderParameters, renderInvalidSubmit, setBindOnNewForm, setFormSubmit, setInvalidSubmit, setRedirectAction, setRenderParameters, setSessionForm, showForm, showForm, showNewForm
 
Methods inherited from class org.springframework.web.portlet.mvc.BaseCommandController
bindAndValidate, checkCommand, createBinder, createCommand, getBindingErrorProcessor, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getRenderCommand, getRenderCommandSessionAttributeName, getRenderErrors, getRenderErrorsSessionAttributeName, getValidator, getValidators, getWebBindingInitializer, initApplicationContext, initBinder, isValidateOnBinding, onBind, onBind, onBindAndValidate, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setRenderCommandAndErrors, setValidateOnBinding, setValidator, setValidators, setWebBindingInitializer, suppressBinding, useDirectFieldAccess
 
Methods inherited from class org.springframework.web.portlet.mvc.AbstractController
isRenderWhenMinimized, isSynchronizeOnSession, setRenderWhenMinimized, setSynchronizeOnSession
 
Methods inherited from class org.springframework.web.portlet.handler.PortletContentGenerator
applyCacheSeconds, cacheForSeconds, check, checkAndPrepare, checkAndPrepare, getCacheSeconds, isRequireSession, preventCaching, setCacheSeconds, setRequireSession
 
Methods inherited from class org.springframework.web.portlet.context.PortletApplicationObjectSupport
getPortletContext, getTempDir, isContextRequired, setPortletContext
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

facturaService

private FacturaService facturaService

clientService

private ClientService clientService

servletContext

private javax.servlet.ServletContext servletContext

PAGE_MANT

private static final String PAGE_MANT
See Also:
Constant Field Values

PAGE_LIST

private static final String PAGE_LIST
See Also:
Constant Field Values
Constructor Detail

ViewFacturaAction

public ViewFacturaAction()
Method Detail

handleActionRequest

public void handleActionRequest(javax.portlet.ActionRequest request,
                                javax.portlet.ActionResponse response)
                         throws Exception
Specified by:
handleActionRequest in interface org.springframework.web.portlet.mvc.Controller
Overrides:
handleActionRequest in class org.springframework.web.portlet.mvc.AbstractController
Throws:
Exception

handleRenderRequest

public org.springframework.web.portlet.ModelAndView handleRenderRequest(javax.portlet.RenderRequest request,
                                                                        javax.portlet.RenderResponse response)
                                                                 throws Exception
Specified by:
handleRenderRequest in interface org.springframework.web.portlet.mvc.Controller
Overrides:
handleRenderRequest in class org.springframework.web.portlet.mvc.AbstractController
Throws:
Exception

defecte

private void defecte(javax.portlet.PortletRequest request)
              throws CommonServiceException
Carrega el llistat amb tots els elements Factura i l'afegeix a la request.

Parameters:
request -
Throws:
CommonServiceException

getClientsAutoComplete

private void getClientsAutoComplete(javax.portlet.PortletRequest request)
                             throws CommonServiceException
Carrega un String en el atribut request 'arrayClientAutocomplete' amb la relació de NIF separada per comes de tots els clients amb la forma '"NIF1","NIF2","NIF3",...'. Es fa servir per generar l'autocomplete del camp client amb JQuery.

Parameters:
request -
Throws:
CommonServiceException

getMails

private void getMails(javax.portlet.PortletRequest request)
               throws CommonServiceException
Metode que cerca els emails vinculats a un client, sempre el seu, i opcionalment el de la gestoria i l'administrador: sempre que es traci d'una comunitat.

Parameters:
request - amb la informació, s'afegeis el llistat 'llistaMails' per referencia
Throws:
CommonServiceException

guardar

private Boolean guardar(javax.portlet.PortletRequest request)
                 throws Exception
Guarda una entitat Factura, previa validació, amb tots els camps del forumlari pasats per request: pot crear-lo de nou si no existeix o actualitzar-lo si esxisteix.

Parameters:
request -
Returns:
boolean resultat
Throws:
Exception

enviar

private void enviar(javax.portlet.PortletRequest request)
             throws CommonServiceException
Genera un pdf de l'entitat Factura, i l'envia com attachment en un mail preformat d'aquesta entitat als destinataris passats per formulari en la request.

Parameters:
request -
Throws:
CommonServiceException

cobrar

private void cobrar(javax.portlet.PortletRequest request)
             throws CommonServiceException
Cambia l'estat de l'entitat Factura a Cobrada.

Parameters:
request -
Throws:
CommonServiceException

editar

private void editar(javax.portlet.PortletRequest request)
             throws Exception
Carrega una entitat Factura en request a partir del número pasat també per request.

Parameters:
request -
Throws:
Exception

buscar

private void buscar(javax.portlet.PortletRequest request)
             throws Exception
Cerca un llistat d'entitats Factura que compleixin els criteris i ordenació passats per formulari request. El llistat resultant es passat per request.

Parameters:
request -
Throws:
Exception

subElements

private void subElements(javax.portlet.PortletRequest request)
                  throws CommonServiceException
Carrega els llistats d'elements secundaris: Estat, i l'afegeix a la request.

Parameters:
request -
Throws:
CommonServiceException

validaCamps

private boolean validaCamps(FacturaDTO dto,
                            javax.portlet.PortletRequest request)
Valida els camps del formulari de l'entitat Factura abans de guardar-los. Si troba errors son afegits per request.

Parameters:
dto - FacturaDTO
request -
Returns:
boolean resultat

validaBusqueda

private boolean validaBusqueda(FacturaDTO dto,
                               javax.portlet.PortletRequest request)
Valida els camps del formulari de cerca en format data o import per entitats Factura.

Parameters:
dto - FacturaDTO
request -
Returns:
boolean resultat

getFacturaService

public FacturaService getFacturaService()
Returns:
the facturaService

setFacturaService

public void setFacturaService(FacturaService facturaService)
Parameters:
facturaService - the facturaService to set

getClientService

public ClientService getClientService()
Returns:
the clientService

setClientService

public void setClientService(ClientService clientService)
Parameters:
clientService - the clientService to set

setServletContext

public void setServletContext(javax.servlet.ServletContext servletContext)
Specified by:
setServletContext in interface org.springframework.web.context.ServletContextAware