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

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


        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.InvoiceType

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.