Package org.wso2.carbon.reporting.api

Examples of org.wso2.carbon.reporting.api.ReportingException


    }

    public byte[] getProcessInstanceImage(String definitionId, String instanceId) {

        QName qName = decode(definitionId);
        SVGInterface svg = createSVG(qName);

        List<Event> executionHistory =
                bpafDataSource.getPastActivities(instanceId);// no need to decode?


        for(Event event : executionHistory)
        {
            for(Tuple t : event.getDataElement())
            {
                if("line-number".equals(t.getName()))
                {
                    Integer line = Integer.valueOf(t.getValue());
                    if(line>0) // TODO: still carries -1 for begin/end
                    {
                        ActivityInterface activity =
                                svg.getActivityAtLineNumber(line);
                        if(null==activity)
                            throw new RuntimeException("No activity matching line number "+
                                    t.getValue() + " in process "
                                    + qName);

                        activity.setState(ActivityInterface.ActivityState.Completed);
                    }
                }
            }
        }

        return svg.toPNGBytes();
    }
View Full Code Here


    }

    public byte[] getProcessImage(String processId) {

        QName qName = decode(processId);
        SVGInterface svg = createSVG(qName);
        return svg.toPNGBytes();
    }
View Full Code Here

    private SVGInterface createSVG(QName qName) {

        // generate new
        InputStream in = getBpelDescriptor(qName);

        SVGInterface svg = null;

        try {
            svg = BPEL2SVGUtil.generate(in);

            if (svg == null)
View Full Code Here

   
    protected static SVGImpl generateSVGImpl(java.io.InputStream is) throws java.io.IOException {
      byte[] b=new byte[is.available()];
      is.read(b);
   
      BPELInterface bpel = new BPELImpl();
        OMElement bpelStr = bpel.load(new String(b));
       
        bpel.processBpelString(bpelStr);

        LayoutManager layoutManager = BPEL2SVGFactory.getInstance().getLayoutManager();
        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

   * @param transformer The optional image transformer
   * @throws java.io.IOException Failed to generate the representation
   */
    public static void generate(java.io.InputStream is, java.io.OutputStream os,
                SVGImageTransformer transformer) throws java.io.IOException {
        SVGImpl svg = generateSVGImpl(is);
       
        if (transformer == null) {
          String str=svg.getHeaders()+svg.generateSVGString();
          os.write(str.getBytes());
        } else {
          transformer.transform(svg, os);
        }
    }
View Full Code Here

        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

                } else if (reportType.equals("html")) {
                    // used HtmlReport to generate HTML report
                    HtmlReport htmlReport = new HtmlReport();
                    outputStream = htmlReport.generateHtmlReport(jasperPrint);
                } else {
                    throw new ReportingException("requested report type " + reportType + " invalid");
                }
            } finally {
                if (outputStream != null) {
                    outputStream.close();
                }
            }
        } catch (IOException e) {
            throw new ReportingException(" Error occurred when closing report stream", e);
        }
        return outputStream;
    }
View Full Code Here

                } else if (reportType.equals("html")) {
                    // used HtmlReport to generate HTML report
                    HtmlReport htmlReport = new HtmlReport();
                    outputStream = htmlReport.generateHtmlReport(jasperPrint);
                } else {
                    throw new ReportingException("requested report type " + reportType + " invalid");
                }
            } finally {
                if (outputStream != null) {
                    outputStream.close();
                }
            }
        } catch (IOException e) {
            throw new ReportingException(" Error occurred when closing report stream", e);
        }catch (JRException e){
            throw new JRException("Failed to generate "+ reportType + " report" ,e);
        }
        if (outputStream == null) {
            throw new ReportingException("generated report byte stream null");
        }
        return outputStream.toByteArray();
    }
View Full Code Here

                if (log.isDebugEnabled()) {
                    log.info("no any report templates called " + templateName + " , to delete");
                }
            }
        } catch (RegistryException e) {
            throw new ReportingException("Error occurred deleting the report template : "+ templateName, e);
        }


    }
View Full Code Here

                if (log.isDebugEnabled()) {
                    log.info("no any report templates available to generate reports");
                }
            }
        } catch (RegistryException e) {
            throw new ReportingException("Error occurred getting all the reports names", e);
        }
        return reportNames;

     }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.reporting.api.ReportingException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.