Search in sources :

Example 11 with HttpActionContext

use of it.cnr.jada.action.HttpActionContext in project sigla-main by consiglionazionaledellericerche.

the class CRUDDistintaCassiereBP method scaricaDocumento.

public void scaricaDocumento(ActionContext actioncontext) throws Exception {
    Integer esercizio = Integer.valueOf(((HttpActionContext) actioncontext).getParameter("esercizio"));
    String cds = ((HttpActionContext) actioncontext).getParameter("cds");
    Long numero_documento = Long.valueOf(((HttpActionContext) actioncontext).getParameter("numero_documento"));
    String tipo = ((HttpActionContext) actioncontext).getParameter("tipo");
    InputStream is = documentiContabiliService.getStreamDocumento((StatoTrasmissione) getComponentSession().findByPrimaryKey(actioncontext.getUserContext(), new V_mandato_reversaleBulk(esercizio, tipo, cds, numero_documento)));
    if (is != null) {
        ((HttpActionContext) actioncontext).getResponse().setContentType("application/pdf");
        OutputStream os = ((HttpActionContext) actioncontext).getResponse().getOutputStream();
        ((HttpActionContext) actioncontext).getResponse().setDateHeader("Expires", 0);
        byte[] buffer = new byte[((HttpActionContext) actioncontext).getResponse().getBufferSize()];
        int buflength;
        while ((buflength = is.read(buffer)) > 0) {
            os.write(buffer, 0, buflength);
        }
        is.close();
        os.flush();
    }
}
Also used : BigInteger(java.math.BigInteger) V_mandato_reversaleBulk(it.cnr.contab.doccont00.intcass.bulk.V_mandato_reversaleBulk) HttpActionContext(it.cnr.jada.action.HttpActionContext)

Example 12 with HttpActionContext

use of it.cnr.jada.action.HttpActionContext in project sigla-main by consiglionazionaledellericerche.

the class CRUDDistintaCassiereBP method scaricaDistinta.

public void scaricaDistinta(ActionContext actioncontext) throws Exception {
    Distinta_cassiereBulk distinta = (Distinta_cassiereBulk) getModel();
    final HttpActionContext httpActionContext = (HttpActionContext) actioncontext;
    Optional.ofNullable(this.getParametriCnr()).map(Parametri_cnrBulk::getFl_tesoreria_unica).filter(tesoreriaUnica -> tesoreriaUnica.equals(Boolean.TRUE)).ifPresent(tesoreriaUnica -> {
        Optional.ofNullable(documentiContabiliService.getStorageObjectByPath(distinta.getStorePath().concat(StorageDriver.SUFFIX).concat(String.valueOf(distinta.getEsercizio())).concat("-").concat(distinta.getCd_unita_organizzativa()).concat("-").concat(String.valueOf(distinta.getPg_distinta_def())).concat("-I.").concat(formatoflusso))).ifPresent(storageObject -> {
            httpActionContext.getResponse().setCharacterEncoding("UTF-8");
            httpActionContext.getResponse().setContentType(storageObject.getPropertyValue(StoragePropertyNames.CONTENT_STREAM_MIME_TYPE.value()));
            httpActionContext.getResponse().setDateHeader("Expires", 0);
            try {
                IOUtils.copyLarge(documentiContabiliService.getResource(storageObject), httpActionContext.getResponse().getOutputStream());
            } catch (IOException e) {
                throw new StorageException(StorageException.Type.GENERIC, e);
            }
        });
    });
}
Also used : ObjectFactory(it.cnr.contab.doccont00.intcass.xmlbnl.ObjectFactory) Format(java.text.Format) ServletException(javax.servlet.ServletException) LoggerFactory(org.slf4j.LoggerFactory) ActionContext(it.cnr.jada.action.ActionContext) DatatypeFactory(javax.xml.datatype.DatatypeFactory) Button(it.cnr.jada.util.jsp.Button) StatoTrasmissione(it.cnr.contab.doccont00.intcass.bulk.StatoTrasmissione) BigDecimal(java.math.BigDecimal) StorageException(it.cnr.si.spring.storage.StorageException) FlussoOrdinativi(it.cnr.contab.doccont00.intcass.xmlbnl.FlussoOrdinativi) DistintaCassiereComponent(it.cnr.contab.doccont00.comp.DistintaCassiereComponent) Reversale(it.cnr.contab.doccont00.intcass.xmlbnl.Reversale) DatatypeConstants(javax.xml.datatype.DatatypeConstants) XmlSignatureType(it.cnr.si.firmadigitale.firma.arss.stub.XmlSignatureType) BigInteger(java.math.BigInteger) PrintService(it.cnr.contab.reports.service.PrintService) Print_spooler_paramBulk(it.cnr.contab.reports.bulk.Print_spooler_paramBulk) StorageObject(it.cnr.si.spring.storage.StorageObject) it.cnr.contab.util(it.cnr.contab.util) EJBCommonServices(it.cnr.jada.util.ejb.EJBCommonServices) Risultato(it.cnr.si.siopeplus.model.Risultato) Parametri_cnrBulk(it.cnr.contab.config00.bulk.Parametri_cnrBulk) Collectors(java.util.stream.Collectors) OrdinativiSiopePlusService(it.cnr.si.siopeplus.service.OrdinativiSiopePlusService) RemoteException(java.rmi.RemoteException) BusinessProcessException(it.cnr.jada.action.BusinessProcessException) FirmaOTPBulk(it.cnr.contab.firma.bulk.FirmaOTPBulk) StorageDriver(it.cnr.si.spring.storage.StorageDriver) IOUtils(org.apache.commons.io.IOUtils) AbstractPrintBP(it.cnr.jada.util.action.AbstractPrintBP) SAXException(org.xml.sax.SAXException) StoragePropertyNames(it.cnr.si.spring.storage.config.StoragePropertyNames) AnagraficoBulk(it.cnr.contab.anagraf00.core.bulk.AnagraficoBulk) SpringUtil(it.cnr.contab.service.SpringUtil) ArubaSignServiceClient(it.cnr.si.firmadigitale.firma.arss.ArubaSignServiceClient) UserContext(it.cnr.jada.UserContext) HttpActionContext(it.cnr.jada.action.HttpActionContext) Classificazione(it.cnr.contab.doccont00.intcass.xmlbnl.Mandato.InformazioniBeneficiario.Classificazione) OggettoBulk(it.cnr.jada.bulk.OggettoBulk) java.util(java.util) Unita_organizzativaBulk(it.cnr.contab.config00.sto.bulk.Unita_organizzativaBulk) V_mandato_reversaleBulk(it.cnr.contab.doccont00.intcass.bulk.V_mandato_reversaleBulk) PageContext(javax.servlet.jsp.PageContext) Marshaller(javax.xml.bind.Marshaller) DistintaCassiereComponentSession(it.cnr.contab.doccont00.ejb.DistintaCassiereComponentSession) SimpleDateFormat(java.text.SimpleDateFormat) Configurazione_cnrBulk(it.cnr.contab.config00.bulk.Configurazione_cnrBulk) HttpServletRequest(javax.servlet.http.HttpServletRequest) AllegatiCRUDBP(it.cnr.contab.util00.bp.AllegatiCRUDBP) CRUDComponentSession(it.cnr.jada.ejb.CRUDComponentSession) DocumentiContabiliService(it.cnr.contab.doccont00.service.DocumentiContabiliService) BancaBulk(it.cnr.contab.anagraf00.core.bulk.BancaBulk) RemoteIterator(it.cnr.jada.util.RemoteIterator) SIOPEPlusServiceUnavailable(it.cnr.si.siopeplus.exception.SIOPEPlusServiceUnavailable) Distinta_cassiereBulk(it.cnr.contab.doccont00.intcass.bulk.Distinta_cassiereBulk) RemoteDetailCRUDController(it.cnr.jada.util.action.RemoteDetailCRUDController) JAXBContext(javax.xml.bind.JAXBContext) VDocumentiFlussoBulk(it.cnr.contab.doccont00.intcass.bulk.VDocumentiFlussoBulk) AbilitatoFirma(it.cnr.contab.utenze00.bulk.AbilitatoFirma) CNRUserContext(it.cnr.contab.utenze00.bp.CNRUserContext) Configurazione_cnrComponentSession(it.cnr.contab.config00.ejb.Configurazione_cnrComponentSession) ApplicationException(it.cnr.jada.comp.ApplicationException) Logger(org.slf4j.Logger) Rif_modalita_pagamentoBulk(it.cnr.contab.anagraf00.tabrif.bulk.Rif_modalita_pagamentoBulk) Print_spoolerBulk(it.cnr.contab.reports.bulk.Print_spoolerBulk) HttpServletResponse(javax.servlet.http.HttpServletResponse) UtenteFirmaDettaglioBulk(it.cnr.contab.utenze00.bulk.UtenteFirmaDettaglioBulk) MandatoBulk(it.cnr.contab.doccont00.core.bulk.MandatoBulk) StorageFile(it.cnr.si.spring.storage.bulk.StorageFile) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) AllegatoGenericoBulk(it.cnr.contab.util00.bulk.storage.AllegatoGenericoBulk) DateServices(it.cnr.contab.doccont00.comp.DateServices) Report(it.cnr.contab.reports.bulk.Report) ArubaSignServiceException(it.cnr.si.firmadigitale.firma.arss.ArubaSignServiceException) CNRUserInfo(it.cnr.contab.utenze00.bulk.CNRUserInfo) MimeTypes(it.cnr.si.spring.storage.MimeTypes) java.io(java.io) UtenteComponentSession(it.cnr.contab.utente00.ejb.UtenteComponentSession) JSPUtils(it.cnr.jada.util.jsp.JSPUtils) DateTimeFormatter(java.time.format.DateTimeFormatter) StatoVariazioneSostituzione(it.cnr.contab.util.enumeration.StatoVariazioneSostituzione) Liquid_coriComponentSession(it.cnr.contab.cori00.ejb.Liquid_coriComponentSession) ReversaleBulk(it.cnr.contab.doccont00.core.bulk.ReversaleBulk) Mandato(it.cnr.contab.doccont00.intcass.xmlbnl.Mandato) OfflineReportPrintBP(it.cnr.contab.reports.bp.OfflineReportPrintBP) ComponentException(it.cnr.jada.comp.ComponentException) CompoundFindClause(it.cnr.jada.persistency.sql.CompoundFindClause) Distinta_cassiereBulk(it.cnr.contab.doccont00.intcass.bulk.Distinta_cassiereBulk) HttpActionContext(it.cnr.jada.action.HttpActionContext) StorageException(it.cnr.si.spring.storage.StorageException) Parametri_cnrBulk(it.cnr.contab.config00.bulk.Parametri_cnrBulk)

Example 13 with HttpActionContext

use of it.cnr.jada.action.HttpActionContext in project sigla-main by consiglionazionaledellericerche.

the class AbstractFirmaDigitaleDocContBP method scaricaDocumento.

public void scaricaDocumento(ActionContext actioncontext) throws Exception {
    Integer esercizio = Integer.valueOf(((HttpActionContext) actioncontext).getParameter("esercizio"));
    String cds = ((HttpActionContext) actioncontext).getParameter("cds");
    String uo = ((HttpActionContext) actioncontext).getParameter("uo");
    Long numero_documento = Long.valueOf(((HttpActionContext) actioncontext).getParameter("numero_documento"));
    String tipo = ((HttpActionContext) actioncontext).getParameter("tipo");
    InputStream is = SpringUtil.getBean("documentiContabiliService", DocumentiContabiliService.class).getStreamDocumento(getStatoTrasmissione(actioncontext, esercizio, tipo, cds, uo, numero_documento));
    if (is == null) {
        log.error("CMIS Object not found: " + esercizio + cds + numero_documento + tipo);
        is = this.getClass().getResourceAsStream("/cmis/404.pdf");
    }
    ((HttpActionContext) actioncontext).getResponse().setContentType("application/pdf");
    OutputStream os = ((HttpActionContext) actioncontext).getResponse().getOutputStream();
    ((HttpActionContext) actioncontext).getResponse().setDateHeader("Expires", 0);
    byte[] buffer = new byte[((HttpActionContext) actioncontext).getResponse().getBufferSize()];
    int buflength;
    while ((buflength = is.read(buffer)) > 0) {
        os.write(buffer, 0, buflength);
    }
    is.close();
    os.flush();
}
Also used : DocumentiContabiliService(it.cnr.contab.doccont00.service.DocumentiContabiliService) ZipOutputStream(java.util.zip.ZipOutputStream) HttpActionContext(it.cnr.jada.action.HttpActionContext)

Example 14 with HttpActionContext

use of it.cnr.jada.action.HttpActionContext in project sigla-main by consiglionazionaledellericerche.

the class CRUDDistintaCassiere1210BP method scaricaDocumento.

public void scaricaDocumento(ActionContext actioncontext) throws Exception {
    Integer esercizio = Integer.valueOf(((HttpActionContext) actioncontext).getParameter("esercizio"));
    String cds = ((HttpActionContext) actioncontext).getParameter("cds");
    String uo = ((HttpActionContext) actioncontext).getParameter("uo");
    Long numero_documento = Long.valueOf(((HttpActionContext) actioncontext).getParameter("numero_documento"));
    String tipo = ((HttpActionContext) actioncontext).getParameter("tipo");
    InputStream is = documentiContabiliService.getStreamDocumento(new Lettera_pagam_esteroBulk(cds, uo, esercizio, numero_documento));
    if (is == null) {
        log.error("CMIS Object not found: " + esercizio + cds + numero_documento + tipo);
        is = this.getClass().getResourceAsStream("/cmis/404.pdf");
    }
    ((HttpActionContext) actioncontext).getResponse().setContentType("application/pdf");
    OutputStream os = ((HttpActionContext) actioncontext).getResponse().getOutputStream();
    ((HttpActionContext) actioncontext).getResponse().setDateHeader("Expires", 0);
    byte[] buffer = new byte[((HttpActionContext) actioncontext).getResponse().getBufferSize()];
    int buflength;
    while ((buflength = is.read(buffer)) > 0) {
        os.write(buffer, 0, buflength);
    }
    is.close();
    os.flush();
}
Also used : Lettera_pagam_esteroBulk(it.cnr.contab.docamm00.docs.bulk.Lettera_pagam_esteroBulk) HttpActionContext(it.cnr.jada.action.HttpActionContext)

Example 15 with HttpActionContext

use of it.cnr.jada.action.HttpActionContext in project sigla-main by consiglionazionaledellericerche.

the class ConsStatoInvioBP method scaricaContabile.

public void scaricaContabile(ActionContext actioncontext) throws Exception {
    Integer esercizio = Integer.valueOf(((HttpActionContext) actioncontext).getParameter("esercizio"));
    String cds = ((HttpActionContext) actioncontext).getParameter("cds");
    Long numero_mandato = Long.valueOf(((HttpActionContext) actioncontext).getParameter("numero_mandato"));
    InputStream is = contabiliService.getStreamContabile(esercizio, cds, numero_mandato, tipo);
    if (is != null) {
        ((HttpActionContext) actioncontext).getResponse().setContentType("application/pdf");
        OutputStream os = ((HttpActionContext) actioncontext).getResponse().getOutputStream();
        ((HttpActionContext) actioncontext).getResponse().setDateHeader("Expires", 0);
        byte[] buffer = new byte[((HttpActionContext) actioncontext).getResponse().getBufferSize()];
        int buflength;
        while ((buflength = is.read(buffer)) > 0) {
            os.write(buffer, 0, buflength);
        }
        is.close();
        os.flush();
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) HttpActionContext(it.cnr.jada.action.HttpActionContext)

Aggregations

HttpActionContext (it.cnr.jada.action.HttpActionContext)31 HttpServletResponse (javax.servlet.http.HttpServletResponse)12 BusinessProcessException (it.cnr.jada.action.BusinessProcessException)11 BigInteger (java.math.BigInteger)11 StorageObject (it.cnr.si.spring.storage.StorageObject)10 RemoteException (java.rmi.RemoteException)10 ComponentException (it.cnr.jada.comp.ComponentException)9 OutputStream (java.io.OutputStream)9 ApplicationException (it.cnr.jada.comp.ApplicationException)7 UserContext (it.cnr.jada.UserContext)6 InputStream (java.io.InputStream)6 Unita_organizzativaBulk (it.cnr.contab.config00.sto.bulk.Unita_organizzativaBulk)5 DocumentiContabiliService (it.cnr.contab.doccont00.service.DocumentiContabiliService)5 Print_spoolerBulk (it.cnr.contab.reports.bulk.Print_spoolerBulk)5 CNRUserContext (it.cnr.contab.utenze00.bp.CNRUserContext)5 ActionContext (it.cnr.jada.action.ActionContext)5 ServletException (javax.servlet.ServletException)5 HttpServletRequest (javax.servlet.http.HttpServletRequest)5 StreamSource (javax.xml.transform.stream.StreamSource)5 V_mandato_reversaleBulk (it.cnr.contab.doccont00.intcass.bulk.V_mandato_reversaleBulk)4