Package com.plainsource.commons.text.template.token

Examples of com.plainsource.commons.text.template.token.Token


    public void postProcess() {
        StringBuffer graphicsPaths = new StringBuffer();
        graphicsPaths.append("{").append(FileUtil.normalizePath(SystemUtil.USER_CURRENT_DIR)).append("}");
        graphicsPaths.append("{").append(FileUtil.normalizePath(SystemUtil.USER_HOME_DIR)).append("}");
        getTemplate().addToken(new Token("tex_graphics_path", graphicsPaths.toString()));
    }
View Full Code Here


        template.setContent(template.replaceTokens());
    }


    private void addOrderTokens() {
        template.addToken(new Token(TextLabel.ORDER_ID_LABEL.toLowerCase(),
                TextLabel.ORDER_ID_LABEL.toString(locale)));
        template.addToken(new Token(TextLabel.ORDER_ID.toLowerCase(),
                InvoiceTypeParser.parseOrderReferenceID(invoiceType.getOrderReference())));
    }
View Full Code Here

    }

    private void addGrandTotalTokens() {
        BigDecimal total = invoiceType.getLegalMonetaryTotal().getPayableAmount().getValue();
        CurrencyDecimal totalCurrency = new CurrencyDecimal(total, invoiceTypeCurrency, locale);
        template.addToken(new Token(TextLabel.INV_TOTAL_LABEL.toLowerCase(),
                TextLabel.INV_TOTAL_LABEL.toString(locale)));
        template.addToken(new Token(TextLabel.INV_TOTAL.toLowerCase(), totalCurrency.format()));
    }
View Full Code Here

    private void addTaxTotalTokens() {
        if (invoiceType.getTaxTotal().size() > 0) {
            TaxTotalType taxTotalType = invoiceType.getTaxTotal().get(0);
            BigDecimal totalTax = taxTotalType.getTaxAmount().getValue();
            template.addToken(new Token(TextLabel.INV_TAX_TOTAL_LABEL.toLowerCase(),
                    TextLabel.INV_TAX_TOTAL_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.INV_TAX_TOTAL.toLowerCase(),
                    new CurrencyDecimal(totalTax, invoiceTypeCurrency, locale).format()));
        }
    }
View Full Code Here

        }
    }

    private void addSubTotalTokens() {
        BigDecimal subtotal = invoiceType.getLegalMonetaryTotal().getLineExtensionAmount().getValue();
        template.addToken(new Token(TextLabel.INV_SUBTOTAL_LABEL.toLowerCase(),
                TextLabel.INV_SUBTOTAL_LABEL.toString(locale)));
        template.addToken(new Token(TextLabel.INV_SUBTOTAL.toLowerCase(),
                new CurrencyDecimal(subtotal, invoiceTypeCurrency, locale).format()));
    }
View Full Code Here

    private void addCurrencyTokens() {
        if (invoiceType.getDocumentCurrencyCode() != null) {
            String currencyCode = invoiceType.getDocumentCurrencyCode().getValue();
            Currency currency = Currency.getInstance(currencyCode);
            template.addToken(new Token(TextLabel.INV_CURRENCY_CODE.toLowerCase(), currencyCode));
            template.addToken(new Token(TextLabel.INV_CURRENCY_SYMBOL.toLowerCase(), currency.getSymbol(locale)));
        }
    }
View Full Code Here

    private void addContactTokens(ContactType contactType, boolean supplierParty) {
        if (contactType != null) {
            // Name
            if (supplierParty) {
                template.addToken(new Token(TextLabel.SUPPLIER_NAME_LABEL.toLowerCase(),
                        TextLabel.SUPPLIER_NAME_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.SUPPLIER_NAME.toLowerCase(),
                        InvoiceTypeParser.parseNameType(contactType.getName())));
            } else {
                template.addToken(new Token(TextLabel.CUSTOMER_NAME_LABEL.toLowerCase(),
                        TextLabel.CUSTOMER_NAME_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.CUSTOMER_NAME.toLowerCase(),
                        InvoiceTypeParser.parseNameType(contactType.getName())));
            }
            // Email
            if (supplierParty) {
                template.addToken(new Token(TextLabel.SUPPLIER_EMAIL_LABEL.toLowerCase(),
                        TextLabel.SUPPLIER_EMAIL_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.SUPPLIER_EMAIL.toLowerCase(),
                        InvoiceTypeParser.parseElectronicMailType(contactType.getElectronicMail())));
            } else {
                template.addToken(new Token(TextLabel.CUSTOMER_EMAIL_LABEL.toLowerCase(),
                        TextLabel.CUSTOMER_EMAIL_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.CUSTOMER_EMAIL.toLowerCase(),
                        InvoiceTypeParser.parseElectronicMailType(contactType.getElectronicMail())));
            }
            // Fax.
            if (supplierParty) {
                template.addToken(new Token(TextLabel.SUPPLIER_FAX_LABEL.toLowerCase(),
                        TextLabel.SUPPLIER_FAX_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.SUPPLIER_FAX.toLowerCase(),
                        InvoiceTypeParser.parseTelefaxType(contactType.getTelefax())));
            } else {
                template.addToken(new Token(TextLabel.CUSTOMER_FAX_LABEL.toLowerCase(),
                        TextLabel.CUSTOMER_FAX_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.CUSTOMER_FAX.toLowerCase(),
                        InvoiceTypeParser.parseTelefaxType(contactType.getTelefax())));
            }
            // Tel.
            if (supplierParty) {
                template.addToken(new Token(TextLabel.SUPPLIER_TEL_LABEL.toLowerCase(),
                        TextLabel.SUPPLIER_TEL_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.SUPPLIER_TEL.toLowerCase(),
                        InvoiceTypeParser.parseTelephoneType(contactType.getTelephone())));
            } else {
                template.addToken(new Token(TextLabel.CUSTOMER_TEL_LABEL.toLowerCase(),
                        TextLabel.CUSTOMER_TEL_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.CUSTOMER_TEL.toLowerCase(),
                        InvoiceTypeParser.parseTelephoneType(contactType.getTelephone())));
            }
        }
    }
View Full Code Here

                    fullPartyName.get().append(" ");
                }
                fullPartyName.get().append(InvoiceTypeParser.parsePersonType(person));
            }
            if (supplierParty) {
                template.addToken(new Token(TextLabel.SUPPLIER_NAME.toLowerCase(),
                        fullPartyName.get().toString()));
                template.addToken(new Token(TextLabel.SUPPLIER_ID_LABEL.toLowerCase(),
                        TextLabel.SUPPLIER_ID_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.SUPPLIER_ID.toLowerCase(), partyID.get().toString()));
            } else {
                template.addToken(new Token(TextLabel.CUSTOMER_NAME.toLowerCase(), fullPartyName.get().toString()));
                template.addToken(new Token(TextLabel.CUSTOMER_ID_LABEL.toLowerCase(),
                        TextLabel.CUSTOMER_ID_LABEL.toString(locale)));
                template.addToken(new Token(TextLabel.CUSTOMER_ID.toLowerCase(), partyID.get().toString()));
            }
        }
    }
View Full Code Here

        }
    }

    private void addPaymentMeansTokens(PaymentMeansType paymentMeansType, boolean supplierParty) {
        if (supplierParty) {
            template.addToken(new Token(TextLabel.SUPPLIER_BANK_NAME_LABEL.toLowerCase(),
                    TextLabel.SUPPLIER_BANK_NAME_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.SUPPLIER_BANK_NAME.toLowerCase(),
                    InvoiceTypeParser.parseFinancialInstitutionName(paymentMeansType.getPayeeFinancialAccount())));
            template.addToken(new Token(
                    TextLabel.SUPPLIER_BANK_ACCOUNT_LABEL.toLowerCase(),
                    TextLabel.SUPPLIER_BANK_ACCOUNT_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.SUPPLIER_BANK_ACCOUNT.toLowerCase(),
                    InvoiceTypeParser.parseFinancialAccountID(paymentMeansType.getPayeeFinancialAccount())));
            template.addToken(new Token(TextLabel.SUPPLIER_BANK_BIC_LABEL.toLowerCase(),
                    TextLabel.SUPPLIER_BANK_BIC_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.SUPPLIER_BANK_BIC.toLowerCase(),
                    InvoiceTypeParser.parseFinancialInstitutionID(paymentMeansType.getPayeeFinancialAccount())));
            template.addToken(new Token(
                    TextLabel.SUPPLIER_BANK_ADDRESS_LABEL.toLowerCase(),
                    TextLabel.SUPPLIER_BANK_ADDRESS_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.SUPPLIER_BANK_ADDRESS.toLowerCase(),
                    InvoiceTypeParser.parseFinancialInstitutionBranchAddress(paymentMeansType.getPayeeFinancialAccount())));
        } else {
            template.addToken(new Token(TextLabel.CUSTOMER_BANK_NAME_LABEL.toLowerCase(),
                    TextLabel.CUSTOMER_BANK_NAME_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.CUSTOMER_BANK_NAME.toLowerCase(),
                    InvoiceTypeParser.parseFinancialInstitutionName(paymentMeansType.getPayeeFinancialAccount())));
            template.addToken(new Token(
                    TextLabel.CUSTOMER_BANK_ACCOUNT_LABEL.toLowerCase(),
                    TextLabel.CUSTOMER_BANK_ACCOUNT_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.CUSTOMER_BANK_ACCOUNT.toLowerCase(),
                    InvoiceTypeParser.parseFinancialAccountName(paymentMeansType.getPayeeFinancialAccount())));
            template.addToken(new Token(TextLabel.CUSTOMER_BANK_BIC_LABEL.toLowerCase(),
                    TextLabel.CUSTOMER_BANK_BIC_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.CUSTOMER_BANK_BIC.toLowerCase(),
                    InvoiceTypeParser.parseFinancialInstitutionID(paymentMeansType.getPayeeFinancialAccount())));
            template.addToken(new Token(
                    TextLabel.CUSTOMER_BANK_ADDRESS_LABEL.toLowerCase(),
                    TextLabel.CUSTOMER_BANK_ADDRESS_LABEL.toString(locale)));
            template.addToken(new Token(TextLabel.CUSTOMER_BANK_ADDRESS.toLowerCase(),
                    InvoiceTypeParser.parseFinancialInstitutionBranchAddress(paymentMeansType.getPayeeFinancialAccount())));
        }
    }
View Full Code Here

                    InvoiceTypeParser.parseFinancialInstitutionBranchAddress(paymentMeansType.getPayeeFinancialAccount())));
        }
    }

    private void addPaymentTermsTokens() {
        template.addToken(new Token(TextLabel.INV_PAYMENT_TERMS_LABEL.toLowerCase(),
                TextLabel.INV_PAYMENT_TERMS_LABEL.toString(locale)));
        template.addToken(new Token(TextLabel.INV_PAYMENT_TERMS.toLowerCase(),
                InvoiceTypeParser.parsePaymentTerms(invoiceType.getPaymentTerms())));
    }
View Full Code Here

TOP

Related Classes of com.plainsource.commons.text.template.token.Token

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.