Search in sources :

Example 1 with ApplicationModel

use of it.cnr.si.cool.jconon.model.ApplicationModel in project cool-jconon by consiglionazionaledellericerche.

the class PrintService method getRicevutaReportModel.

@SuppressWarnings({ "unchecked", "deprecation" })
public byte[] getRicevutaReportModel(Session cmisSession, Folder application, String contextURL, String nameRicevutaReportModel, boolean immediate) throws CMISApplicationException {
    Folder call = application.getFolderParent();
    Locale locale = Locale.ITALY;
    Properties props = i18nService.loadLabels(locale);
    props.putAll(competitionService.getDynamicLabels(call, cmisSession));
    ApplicationModel applicationModel = new ApplicationModel(application, cmisSession.getDefaultContext(), props, contextURL);
    try {
        CMISUser applicationUser = userService.loadUserForConfirm(application.getPropertyValue(JCONONPropertyIds.APPLICATION_USER.value()));
        applicationModel.getProperties().put("jasperReport:user_matricola", applicationUser.getMatricola());
        applicationModel.getProperties().put("jasperReport:user_email_comunicazione", applicationUser.getEmail());
        applicationModel.getProperties().put("jconon_application:objectId", application.getId());
    } catch (CoolUserFactoryException e) {
        LOGGER.error("User not found", e);
    }
    final Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").excludeFieldsWithoutExposeAnnotation().registerTypeAdapter(GregorianCalendar.class, new JsonSerializer<GregorianCalendar>() {

        @Override
        public JsonElement serialize(GregorianCalendar src, Type typeOfSrc, JsonSerializationContext context) {
            return context.serialize(src.getTime());
        }
    }).create();
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_ASSOCIATIONS.value()) != null) {
        applicationModel.getProperties().put("allegati", getAllegati(application, JCONONPolicyType.JCONON_ATTACHMENT_GENERIC_DOCUMENT, cmisSession, applicationModel));
    }
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_CURRICULUM.value()) != null) {
        applicationModel.getProperties().put("curriculum", getCurriculum(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_CURRICULUM.value()), application, cmisSession, applicationModel));
    }
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_CURRICULUM_ULTERIORE.value()) != null) {
        applicationModel.getProperties().put("curriculum_ulteriore", getCurriculum(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_CURRICULUM_ULTERIORE.value()), application, cmisSession, applicationModel));
    }
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_PRODOTTI.value()) != null) {
        applicationModel.getProperties().put("prodotti", getProdotti(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_PRODOTTI.value()), application, JCONONPolicyType.PEOPLE_NO_SELECTED_PRODUCT, cmisSession, applicationModel));
        applicationModel.getProperties().put("prodottiScelti", getProdotti(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_PRODOTTI.value()), application, JCONONPolicyType.PEOPLE_SELECTED_PRODUCT, cmisSession, applicationModel));
    }
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_SCHEDE_ANONIME.value()) != null) {
        applicationModel.getProperties().put("schedeAnonime", getCurriculum(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_SCHEDE_ANONIME.value()), application, cmisSession, applicationModel));
    }
    applicationModel.getProperties().put(Dichiarazioni.dichiarazioni.name(), getDichiarazioni(bulkInfoService.find(application.getType().getId()), application, JCONONPropertyIds.CALL_ELENCO_ASPECTS, applicationModel, Dichiarazioni.dichiarazioni));
    applicationModel.getProperties().put(Dichiarazioni.datiCNR.name(), getDichiarazioni(bulkInfoService.find(application.getType().getId()), application, JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_CNR, applicationModel, Dichiarazioni.datiCNR));
    applicationModel.getProperties().put(Dichiarazioni.ulterioriDati.name(), getDichiarazioni(bulkInfoService.find(application.getType().getId()), application, JCONONPropertyIds.CALL_ELENCO_ASPECTS_ULTERIORI_DATI, applicationModel, Dichiarazioni.ulterioriDati));
    String labelSottoscritto = i18nService.getLabel("application.text.sottoscritto.lower." + application.getPropertyValue(JCONONPropertyIds.APPLICATION_SESSO.value()), locale);
    String labelSanzioniPenali = i18nService.getLabel("text.jconon_application_dichiarazione_sanzioni_penali_" + call.getPropertyValue(JCONONPropertyIds.CALL_CODICE.value()), locale);
    if (labelSanzioniPenali == null)
        labelSanzioniPenali = i18nService.getLabel("text.jconon_application_dichiarazione_sanzioni_penali", locale, labelSottoscritto);
    else
        labelSanzioniPenali = i18nService.getLabel("text.jconon_application_dichiarazione_sanzioni_penali_" + call.getPropertyValue(JCONONPropertyIds.CALL_CODICE.value()), locale, labelSottoscritto);
    applicationModel.getProperties().put("label_jconon_application_dichiarazione_sanzioni_penali", labelSanzioniPenali);
    applicationModel.getProperties().put("label_jconon_application_dichiarazione_dati_personali", i18nService.getLabel("text.jconon_application_dichiarazione_dati_personali", locale, labelSottoscritto));
    for (Object key : call.getProperty(JCONONPropertyIds.CALL_ELENCO_SEZIONI_DOMANDA.value()).getValues()) {
        applicationModel.getProperties().put(String.valueOf(key), props.get(key));
    }
    if (immediate) {
        applicationModel.getProperties().put(JCONONPropertyIds.APPLICATION_STATO_DOMANDA.value(), StatoDomanda.CONFERMATA.getValue());
        applicationModel.getProperties().put(JCONONPropertyIds.APPLICATION_DATA_DOMANDA.value(), Calendar.getInstance());
    }
    String json = "{\"properties\":" + gson.toJson(applicationModel.getProperties()) + "}";
    try {
        /**
         * Calcolo il QRCODE del link alla stampa
         */
        ByteArrayOutputStream qrcode = QrCodeUtil.getQrcode(contextURL + "/rest/application/print-download?nodeRef=" + application.getId());
        Map<String, Object> parameters = new HashMap<String, Object>();
        JRDataSource datasource = new JsonDataSource(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8)), "properties");
        JRGzipVirtualizer vir = new JRGzipVirtualizer(100);
        final ResourceBundle resourceBundle = ResourceBundle.getBundle("net.sf.jasperreports.view.viewer", locale);
        parameters.put(JRParameter.REPORT_LOCALE, locale);
        parameters.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle);
        parameters.put(JRParameter.REPORT_DATA_SOURCE, datasource);
        parameters.put(JRParameter.REPORT_VIRTUALIZER, vir);
        parameters.put("DIR_IMAGE", new ClassPathResource(PRINT_RESOURCE_PATH).getPath());
        parameters.put("SUBREPORT_DIR", new ClassPathResource(PRINT_RESOURCE_PATH).getPath());
        if (qrcode != null) {
            parameters.put("QRCODE", new ByteArrayInputStream(qrcode.toByteArray()));
        }
        ClassLoader classLoader = ClassLoader.getSystemClassLoader();
        parameters.put(JRParameter.REPORT_CLASS_LOADER, classLoader);
        JasperReport jasperReport = cacheRepository.jasperReport(PRINT_RESOURCE_PATH + "DomandaConcorso.jrxml", jasperCompileManager());
        JasperPrint jasperPrint = jasperFillManager().fill(jasperReport, parameters);
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        JRPdfExporter exporter = new JRPdfExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os);
        exporter.setParameter(JRPdfExporterParameter.FORCE_LINEBREAK_POLICY, Boolean.TRUE);
        exporter.exportReport();
        return os.toByteArray();
    } catch (Exception e) {
        throw new CMISApplicationException("Error in JASPER", e);
    }
}
Also used : CMISUser(it.cnr.cool.security.service.impl.alfresco.CMISUser) ApplicationModel(it.cnr.si.cool.jconon.model.ApplicationModel) CMISApplicationException(it.cnr.cool.web.scripts.exception.CMISApplicationException) JRPdfExporter(net.sf.jasperreports.engine.export.JRPdfExporter) JsonDataSource(net.sf.jasperreports.engine.data.JsonDataSource) JRGzipVirtualizer(net.sf.jasperreports.engine.fill.JRGzipVirtualizer) ClassPathResource(org.springframework.core.io.ClassPathResource) JSONException(org.json.JSONException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) WriterException(com.google.zxing.WriterException) ParseException(java.text.ParseException) CMISApplicationException(it.cnr.cool.web.scripts.exception.CMISApplicationException) CoolUserFactoryException(it.cnr.cool.exception.CoolUserFactoryException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) CmisStreamNotSupportedException(org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException) ClientMessageException(it.cnr.cool.web.scripts.exception.ClientMessageException) ACLType(it.cnr.cool.cmis.model.ACLType) Type(java.lang.reflect.Type) PDImageXObject(org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject) JSONObject(org.json.JSONObject) CoolUserFactoryException(it.cnr.cool.exception.CoolUserFactoryException)

Example 2 with ApplicationModel

use of it.cnr.si.cool.jconon.model.ApplicationModel in project cool-jconon by consiglionazionaledellericerche.

the class PrintService method getSchedaAnonimaSintetica.

@SuppressWarnings("unchecked")
public byte[] getSchedaAnonimaSintetica(Session cmisSession, Folder application, String contextURL, Locale locale, int index) throws CMISApplicationException {
    Folder call = application.getFolderParent();
    ApplicationModel applicationModel = new ApplicationModel(application, cmisSession.getDefaultContext(), i18nService.loadLabels(locale), contextURL, false);
    final Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").excludeFieldsWithoutExposeAnnotation().registerTypeAdapter(GregorianCalendar.class, new JsonSerializer<GregorianCalendar>() {

        @Override
        public JsonElement serialize(GregorianCalendar src, Type typeOfSrc, JsonSerializationContext context) {
            return context.serialize(src.getTime());
        }
    }).create();
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_SCHEDE_ANONIME.value()) != null) {
        applicationModel.getProperties().put("schedeAnonime", getCurriculum(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_SCHEDE_ANONIME.value()), application, cmisSession, applicationModel));
    }
    String json = "{\"properties\":" + gson.toJson(applicationModel.getProperties()) + "}";
    try {
        Map<String, Object> parameters = new HashMap<String, Object>();
        JRDataSource datasource = new JsonDataSource(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8)), "properties");
        JRGzipVirtualizer vir = new JRGzipVirtualizer(100);
        final ResourceBundle resourceBundle = ResourceBundle.getBundle("net.sf.jasperreports.view.viewer", locale);
        parameters.put(JRParameter.REPORT_LOCALE, locale);
        parameters.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle);
        parameters.put(JRParameter.REPORT_DATA_SOURCE, datasource);
        parameters.put(JRParameter.REPORT_VIRTUALIZER, vir);
        parameters.put("INDICE", index);
        parameters.put("DIR_IMAGE", new ClassPathResource(PRINT_RESOURCE_PATH).getPath());
        parameters.put("SUBREPORT_DIR", new ClassPathResource(PRINT_RESOURCE_PATH).getPath());
        ClassLoader classLoader = ClassLoader.getSystemClassLoader();
        parameters.put(JRParameter.REPORT_CLASS_LOADER, classLoader);
        JasperReport jasperReport = cacheRepository.jasperReport(PRINT_RESOURCE_PATH + "SchedaAnonima.jrxml", jasperCompileManager());
        JasperPrint jasperPrint = jasperFillManager().fill(jasperReport, parameters);
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        JRPdfExporter exporter = new JRPdfExporter();
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os);
        exporter.setParameter(JRPdfExporterParameter.FORCE_LINEBREAK_POLICY, Boolean.TRUE);
        exporter.exportReport();
        return os.toByteArray();
    } catch (Exception e) {
        throw new CMISApplicationException("Error in JASPER", e);
    }
}
Also used : ApplicationModel(it.cnr.si.cool.jconon.model.ApplicationModel) CMISApplicationException(it.cnr.cool.web.scripts.exception.CMISApplicationException) JRPdfExporter(net.sf.jasperreports.engine.export.JRPdfExporter) JsonDataSource(net.sf.jasperreports.engine.data.JsonDataSource) JRGzipVirtualizer(net.sf.jasperreports.engine.fill.JRGzipVirtualizer) ClassPathResource(org.springframework.core.io.ClassPathResource) JSONException(org.json.JSONException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) WriterException(com.google.zxing.WriterException) ParseException(java.text.ParseException) CMISApplicationException(it.cnr.cool.web.scripts.exception.CMISApplicationException) CoolUserFactoryException(it.cnr.cool.exception.CoolUserFactoryException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) CmisStreamNotSupportedException(org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException) ClientMessageException(it.cnr.cool.web.scripts.exception.ClientMessageException) ACLType(it.cnr.cool.cmis.model.ACLType) Type(java.lang.reflect.Type) PDImageXObject(org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject) JSONObject(org.json.JSONObject)

Example 3 with ApplicationModel

use of it.cnr.si.cool.jconon.model.ApplicationModel in project cool-jconon by consiglionazionaledellericerche.

the class PrintService method addContentToChild.

@SuppressWarnings("unchecked")
public void addContentToChild(Folder application, Folder call, Session cmisSession, Properties messages, String contextURL) {
    ApplicationModel applicationModel = new ApplicationModel(application, cmisSession.getDefaultContext(), messages, contextURL);
    List<String> types = new ArrayList<String>();
    types.addAll(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_CURRICULUM.value()));
    types.addAll(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_PRODOTTI.value()));
    types.addAll(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_SCHEDE_ANONIME.value()));
    for (CmisObject cmisObject : application.getChildren()) {
        if (types.contains(cmisObject.getType().getId())) {
            cmisObject.refresh();
            addContentToCmisObject(applicationModel, cmisObject, Locale.ITALY);
        }
    }
}
Also used : ApplicationModel(it.cnr.si.cool.jconon.model.ApplicationModel)

Example 4 with ApplicationModel

use of it.cnr.si.cool.jconon.model.ApplicationModel in project cool-jconon by consiglionazionaledellericerche.

the class PrintService method getSchedaValutazione.

public byte[] getSchedaValutazione(Session cmisSession, Folder application, String contextURL, Locale locale) throws CMISApplicationException {
    Folder call = application.getFolderParent();
    ApplicationModel applicationModel = new ApplicationModel(application, cmisSession.getDefaultContext(), i18nService.loadLabels(locale), contextURL, false);
    final Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").excludeFieldsWithoutExposeAnnotation().registerTypeAdapter(GregorianCalendar.class, new JsonSerializer<GregorianCalendar>() {

        @Override
        public JsonElement serialize(GregorianCalendar src, Type typeOfSrc, JsonSerializationContext context) {
            return context.serialize(src.getTime());
        }
    }).create();
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_ASSOCIATIONS.value()) != null) {
        applicationModel.getProperties().put("allegati", getAllegati(application, JCONONPolicyType.JCONON_ATTACHMENT_GENERIC_DOCUMENT, cmisSession, applicationModel, false, false));
    }
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_CURRICULUM.value()) != null) {
        applicationModel.getProperties().put("curriculum", getCurriculum(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_CURRICULUM.value()), application, cmisSession, applicationModel, false));
    }
    if (call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_PRODOTTI.value()) != null) {
        applicationModel.getProperties().put("prodotti", getProdotti(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_PRODOTTI.value()), application, JCONONPolicyType.PEOPLE_NO_SELECTED_PRODUCT, cmisSession, applicationModel, false));
        applicationModel.getProperties().put("prodottiScelti", getProdotti(call.getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONE_PRODOTTI.value()), application, JCONONPolicyType.PEOPLE_SELECTED_PRODUCT, cmisSession, applicationModel, false));
    }
    String json = "{\"properties\":" + gson.toJson(applicationModel.getProperties()) + "}";
    LOGGER.debug(json);
    try {
        Map<String, Object> parameters = new HashMap<String, Object>();
        JRDataSource datasource = new JsonDataSource(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8)), "properties");
        final ResourceBundle resourceBundle = ResourceBundle.getBundle("net.sf.jasperreports.view.viewer", locale);
        parameters.put(JRParameter.REPORT_LOCALE, locale);
        parameters.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle);
        parameters.put(JRParameter.REPORT_DATA_SOURCE, datasource);
        parameters.put("DIR_IMAGE", new ClassPathResource(PRINT_RESOURCE_PATH).getPath());
        parameters.put("SUBREPORT_DIR", new ClassPathResource(PRINT_RESOURCE_PATH).getPath());
        ClassLoader classLoader = ClassLoader.getSystemClassLoader();
        parameters.put(JRParameter.REPORT_CLASS_LOADER, classLoader);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        JasperReport report = JasperCompileManager.compileReport(new ClassPathResource(PRINT_RESOURCE_PATH + "scheda_valutazione.jrxml").getInputStream());
        JasperPrint jasperPrint = jasperFillManager().fill(report, parameters);
        JRXlsExporter exporter = new JRXlsExporter();
        exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
        exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(baos));
        SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
        configuration.setOnePagePerSheet(false);
        configuration.setDetectCellType(true);
        configuration.setCollapseRowSpan(false);
        configuration.setRemoveEmptySpaceBetweenRows(true);
        configuration.setWhitePageBackground(false);
        exporter.setConfiguration(configuration);
        exporter.exportReport();
        return baos.toByteArray();
    } catch (Exception e) {
        throw new CMISApplicationException("Error in JASPER", e);
    }
}
Also used : SimpleXlsReportConfiguration(net.sf.jasperreports.export.SimpleXlsReportConfiguration) SimpleOutputStreamExporterOutput(net.sf.jasperreports.export.SimpleOutputStreamExporterOutput) ApplicationModel(it.cnr.si.cool.jconon.model.ApplicationModel) CMISApplicationException(it.cnr.cool.web.scripts.exception.CMISApplicationException) JsonDataSource(net.sf.jasperreports.engine.data.JsonDataSource) SimpleExporterInput(net.sf.jasperreports.export.SimpleExporterInput) ClassPathResource(org.springframework.core.io.ClassPathResource) JSONException(org.json.JSONException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) WriterException(com.google.zxing.WriterException) ParseException(java.text.ParseException) CMISApplicationException(it.cnr.cool.web.scripts.exception.CMISApplicationException) CoolUserFactoryException(it.cnr.cool.exception.CoolUserFactoryException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) CmisStreamNotSupportedException(org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException) ClientMessageException(it.cnr.cool.web.scripts.exception.ClientMessageException) ACLType(it.cnr.cool.cmis.model.ACLType) Type(java.lang.reflect.Type) JRXlsExporter(net.sf.jasperreports.engine.export.JRXlsExporter) PDImageXObject(org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject) JSONObject(org.json.JSONObject)

Example 5 with ApplicationModel

use of it.cnr.si.cool.jconon.model.ApplicationModel in project cool-jconon by consiglionazionaledellericerche.

the class PrintService method printComunicazione.

public byte[] printComunicazione(Session cmisSession, Folder application, String contextURL, Locale locale, String note, String firma) throws CMISApplicationException {
    ApplicationModel applicationBulk = new ApplicationModel(application, cmisSession.getDefaultContext(), i18nService.loadLabels(locale), contextURL, false);
    applicationBulk.getProperties().put("note", note);
    applicationBulk.getProperties().put("firma", firma);
    final Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").excludeFieldsWithoutExposeAnnotation().registerTypeAdapter(GregorianCalendar.class, new JsonSerializer<GregorianCalendar>() {

        @Override
        public JsonElement serialize(GregorianCalendar src, Type typeOfSrc, JsonSerializationContext context) {
            return context.serialize(src.getTime());
        }
    }).create();
    String json = "{\"properties\":" + gson.toJson(applicationBulk.getProperties()) + "}";
    LOGGER.debug(json);
    try {
        Map<String, Object> parameters = new HashMap<String, Object>();
        JRDataSource datasource = new JsonDataSource(new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8)), "properties");
        JRGzipVirtualizer vir = new JRGzipVirtualizer(100);
        final ResourceBundle resourceBundle = ResourceBundle.getBundle("net.sf.jasperreports.view.viewer", locale);
        parameters.put(JRParameter.REPORT_LOCALE, locale);
        parameters.put(JRParameter.REPORT_RESOURCE_BUNDLE, resourceBundle);
        parameters.put(JRParameter.REPORT_DATA_SOURCE, datasource);
        parameters.put(JRParameter.REPORT_VIRTUALIZER, vir);
        parameters.put("DIR_IMAGE", new ClassPathResource(PRINT_RESOURCE_PATH).getPath());
        parameters.put("SUBREPORT_DIR", new ClassPathResource(PRINT_RESOURCE_PATH).getPath());
        ClassLoader classLoader = ClassLoader.getSystemClassLoader();
        parameters.put(JRParameter.REPORT_CLASS_LOADER, classLoader);
        JasperReport jasperReport = cacheRepository.jasperReport(PRINT_RESOURCE_PATH + "comunicazione.jrxml", jasperCompileManager());
        JasperPrint jasperPrint = jasperFillManager().fill(jasperReport, parameters);
        return JasperExportManager.exportReportToPdf(jasperPrint);
    } catch (Exception e) {
        throw new CMISApplicationException("Error in JASPER", e);
    }
}
Also used : JsonDataSource(net.sf.jasperreports.engine.data.JsonDataSource) ApplicationModel(it.cnr.si.cool.jconon.model.ApplicationModel) JRGzipVirtualizer(net.sf.jasperreports.engine.fill.JRGzipVirtualizer) CMISApplicationException(it.cnr.cool.web.scripts.exception.CMISApplicationException) ClassPathResource(org.springframework.core.io.ClassPathResource) JSONException(org.json.JSONException) CmisObjectNotFoundException(org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException) WriterException(com.google.zxing.WriterException) ParseException(java.text.ParseException) CMISApplicationException(it.cnr.cool.web.scripts.exception.CMISApplicationException) CoolUserFactoryException(it.cnr.cool.exception.CoolUserFactoryException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) CmisStreamNotSupportedException(org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException) ClientMessageException(it.cnr.cool.web.scripts.exception.ClientMessageException) ACLType(it.cnr.cool.cmis.model.ACLType) Type(java.lang.reflect.Type) PDImageXObject(org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject) JSONObject(org.json.JSONObject)

Aggregations

ApplicationModel (it.cnr.si.cool.jconon.model.ApplicationModel)11 WriterException (com.google.zxing.WriterException)10 ACLType (it.cnr.cool.cmis.model.ACLType)10 CoolUserFactoryException (it.cnr.cool.exception.CoolUserFactoryException)10 CMISApplicationException (it.cnr.cool.web.scripts.exception.CMISApplicationException)10 ClientMessageException (it.cnr.cool.web.scripts.exception.ClientMessageException)10 Type (java.lang.reflect.Type)10 ParseException (java.text.ParseException)10 JsonDataSource (net.sf.jasperreports.engine.data.JsonDataSource)10 CmisObjectNotFoundException (org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException)10 CmisStreamNotSupportedException (org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException)10 NotImplementedException (org.apache.commons.lang3.NotImplementedException)10 PDImageXObject (org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject)10 JSONException (org.json.JSONException)10 JSONObject (org.json.JSONObject)10 ClassPathResource (org.springframework.core.io.ClassPathResource)10 JRGzipVirtualizer (net.sf.jasperreports.engine.fill.JRGzipVirtualizer)9 CMISUser (it.cnr.cool.security.service.impl.alfresco.CMISUser)4 SimpleExporterInput (net.sf.jasperreports.export.SimpleExporterInput)4 SimpleOutputStreamExporterOutput (net.sf.jasperreports.export.SimpleOutputStreamExporterOutput)4