Package oasis.names.specification.ubl.schema.xsd.invoice_2

Examples of oasis.names.specification.ubl.schema.xsd.invoice_2.ObjectFactory


            .addParam("param1", "value 1")
            .addParam("param2", "value 2")
            .addParam("param3", "value 3")
            .build();

        ObjectFactory factory = container.getInstance(ObjectFactory.class);
        ServletActionRedirectResult result = (ServletActionRedirectResult) factory.buildResult(resultConfig, new HashMap());
        assertNotNull(result);
    }
View Full Code Here


     * @throws javax.xml.stream.XMLStreamException
     */
    public XMLStreamReader readHeader() throws XMLStreamException {
        XMLStreamBufferResult xbr = new XMLStreamBufferResult();
        JAXBElement<BinarySecurityTokenType> bstElem =
                new ObjectFactory().createBinarySecurityToken(bst);
        try{
            getMarshaller().marshal(bstElem, xbr);
        }catch(JAXBException je){
            //log here
            throw new XMLStreamException(je);
View Full Code Here

     * @param streamWriter XMLStreamWriter
     * @throws javax.xml.stream.XMLStreamException
     */
    public void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException {
        JAXBElement<BinarySecurityTokenType> bstElem =
                new ObjectFactory().createBinarySecurityToken(bst);
        try {
            // If writing to Zephyr, get output stream and use JAXB UTF-8 writer
            if (streamWriter instanceof Map) {
                OutputStream os = (OutputStream) ((Map) streamWriter).get("sjsxp-outputstream");
                if (os != null) {
View Full Code Here

            "<Body2 xmlns=\"http://commons.dspc.net/activitymodel2\"/>"
        };
        for (int i = 0;  i < inputs.length;  i++) {
          unmarshalMarshalUnmarshal(Body1.class, inputs[i]);
        }
        Body1 body1 = new ObjectFactory().createBody1();
        body1.setValue("ok");
        Body2 body2 = new ObjectFactory().createBody2();
        body2.setValue("ok");
    }
View Full Code Here

        File invoiceFile = new File(invoiceFilePath);
        if (!invoiceFile.exists()) {
            throw new FailedToRenderException(String.format("The specified invoice file '%s' doesn't exist",
                    invoiceFile.getAbsolutePath()));
        }
        InvoiceType invoiceType = InvoiceTypeUnMarshaller.unMarshal(new FileInputStream(invoiceFile));
        InvoiceCreationInput input = new InvoiceRenderingInput(invoiceType);
        input = initOutputOptions(input);
        InvoiceRenderingTask task = new InvoiceRenderingTask();
        task.execute(input);
        print(task);
View Full Code Here

            throws FileNotFoundException, FailedToUnMarshalException,
            org.openinvoice.ubl4j.core.common.FailedToMarshalException {

        FileInputStream fis = new FileInputStream(new File("E:/Temp/in/2011-12-28_72.xml"));

        InvoiceType it = InvoiceTypeUnMarshaller.unMarshal(fis);

        System.err.println(it.getID().getValue());

        InvoiceType it2 = it;

        IDType id = new IDType();
        id.setValue("100");
        it2.setID(id);

        System.err.println(it2.getID().getValue());

        FileOutputStream fos = new FileOutputStream(new File(new File("E:/Temp/in"), id.getValue()));

        InvoiceTypeMarshaller.marshal(it2, fos);
    }
View Full Code Here

        orderType = orderTypeProcessUnitManager.process(orderType, ubl4JConfigurationBean);

        // Parse the order and produce the invoice
        OrderTypeToInvoiceTypeTransformerHelper orderTypeToInvoiceTypeTransformerHelper = new OrderTypeToInvoiceTypeTransformerHelper(orderType);

        InvoiceType invoiceType = orderTypeToInvoiceTypeTransformerHelper.process();

        // Invoice is valid, check all Constraints before running process units
        invoiceType = invoiceTypeConstraintManager.process(invoiceType, ubl4JConfigurationBean);

        // Run InvoiceType Process units
View Full Code Here

    private void createInvoiceFromOrder() throws IOException, UBL4JException {
        InvoiceCreationOutput output = (InvoiceCreationOutput) getOutput();
        OrderTypeToInvoiceTypeTransformer orderTypeToInvoiceTypeTransformer =
                new OrderTypeToInvoiceTypeTransformer();
        CreateInvoiceBasedOnOrderInput input = (CreateInvoiceBasedOnOrderInput) getInput();
        InvoiceType generatedInvoiceType = orderTypeToInvoiceTypeTransformer.create(input.getOrderInputStream());
        output.setGeneratedInvoiceType(generatedInvoiceType);
        InvoiceTypeMarshaller.marshal(generatedInvoiceType, output.getInvoiceOutputStream(generatedInvoiceType));
        output.setInvoiceOutputURI(output.getInvoiceOutputURI());
    }
View Full Code Here

    }

    public void testWrite() throws Exception {
        org.openinvoice.ubl4j.core.invoice.InvoiceTypePersistence
                itp = new org.openinvoice.ubl4j.core.invoice.InvoiceTypePersistence();
        InvoiceType it = itp.read(invoiceInputStream);
        File tmpFile = FileUtil.getTempFile("inv", "xml", SystemUtil.TMP_DIR);
        itp.write(it, new FileOutputStream(tmpFile), UBL4JConfigurationBeanBuilder.DEFAULT_ENCODING);
        assertTrue(tmpFile.exists());
    }
View Full Code Here

    public static void marshal(InvoiceType invoiceType, OutputStream outputStream,
                               String encoding) throws FailedToMarshalException {
        try {
            JAXBContext jc = JAXBContext.newInstance(UBL_INV_PKG);
            ObjectFactory of = new ObjectFactory();
            javax.xml.bind.Marshaller m = jc.createMarshaller();
            m.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, encoding);
            m.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            Schema schema = getInvoiceTypeSchema();
            if (schema != null) {
                m.setSchema(schema);
            }
            m.marshal(of.createInvoice(invoiceType), outputStream);
        } catch (Exception e) {
            throw new FailedToMarshalException(e);
        }
    }
View Full Code Here

TOP

Related Classes of oasis.names.specification.ubl.schema.xsd.invoice_2.ObjectFactory

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.