Package no.sws.invoice.recipient

Examples of no.sws.invoice.recipient.Recipient


   */
  public static List<Element> getRecipientValuesAsXmlElements(final Invoice invoice) throws SwsRequiredInvoiceValueException,
      SwsNoRecipientForInvoiceException {

    // get the recipient object from the invoice
    final Recipient recipient = invoice.getRecipient();

    if(recipient != null) {
      // let RecipientHelper generate the list of XML elements
      return RecipientHelper.getRecipientValuesAsXmlElements(recipient);
    }
View Full Code Here


  }

  public static List<Element> getOptionalRecipientValuesAsXmlElements(final Invoice invoice) throws SwsNoRecipientForInvoiceException {

    // get the recipient object from the invoice
    final Recipient recipient = invoice.getRecipient();

    if(recipient != null) {
      // let RecipientHelper generate the list of XML elements
      return RecipientHelper.getOptionalRecipientValuesAsXmlElements(recipient);
    }
View Full Code Here

      throw new IllegalArgumentException("Param invoice can't be null. I'm trying to add the Recipient object to that object");
    }

    if(invoiceElement != null && invoiceElement.getName().equalsIgnoreCase("invoice")) {

      final Recipient recipient = RecipientFactory.getInstance();

      // get name, zip and city from invoice element (these are required)
      recipient.setName(getElementValue(invoiceElement, "name", true));
      recipient.setZip(getElementValue(invoiceElement, "zip", true));
      recipient.setCity(getElementValue(invoiceElement, "city", true));

      // get recipientNo, address1, address2, country from the optional element
      final Element optionalElement = invoiceElement.getChild("optional");

      if(optionalElement == null) {
        log.info("No <optional> element in <invoice> element:\n" + XmlUtils.xmlElement2String(invoiceElement, Format.getPrettyFormat()));
      }
      else {

        recipient.setRecipientNo(getElementValue(optionalElement, "recipientNo", false));
                recipient.setOrgNo(getElementValue(optionalElement, "recipientOrgNo", false));
        recipient.setAddress1(getElementValue(optionalElement, "address1", false));
        recipient.setAddress2(getElementValue(optionalElement, "address2", false));
        recipient.setCountry(getElementValue(optionalElement, "country", false));
        recipient.setEmail(getElementValue(optionalElement, "email", false));
      }

      // add recipient to invoice
      invoice.setRecipient(recipient);
    }
View Full Code Here

        // get all recipients
        List<Recipient> recipients = swsClient.getAllRecipients();

        // get one recipient
        Recipient recipient = swsClient.getRecipientByRecipientNo("1");

        // get all recipients named "Ola"
        recipients = swsClient.findRecipientByName("Ola");

        // get all recipient categories
View Full Code Here

     * @return A demo Recipient
     */
    private static Recipient generateDemoRecipient() {

        // Instantiate a new Recipient
        Recipient result = RecipientFactory.getInstance();

        // set demo name and address
        result.setRecipientNo("demo1");
        result.setName("Ola Nordmann");
        result.setAddress1("Drammensveien 1");
        result.setZip("0012");
        result.setCity("OSLO");

        return result;
    }
View Full Code Here

TOP

Related Classes of no.sws.invoice.recipient.Recipient

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.