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();
}
}
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);
}
});
});
}
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();
}
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();
}
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();
}
}
Aggregations