예제 #1
0
  @Override
  public void toHitsModel(VendorInfoType source, VendorInfo target) {
    if (source != null && target != null) {
      target.setRefId(source.getRefId());
      target.setABN(getJAXBValue(source.getABN()));
      target.setAccountName(getJAXBValue(source.getAccountName()));
      target.setAccountNumber(getJAXBValue(source.getAccountNumber()));
      target.setBPay(getJAXBValue(source.getBPay()));
      target.setBSB(getJAXBValue(source.getBSB()));

      ContactInfoType contactInfo = getJAXBValue(source.getContactInfo());
      if (contactInfo != null) {
        target.setAddress(addressConverter.toHitsModel(getJAXBValue(contactInfo.getAddress())));
        target.getAddress().setPersonRefId(source.getRefId());

        EmailListType emailList = getJAXBValue(contactInfo.getEmailList());
        if (emailList != null && emailList.getEmail() != null && !emailList.getEmail().isEmpty()) {
          target.setContactInfoEmail(emailList.getEmail().get(0).getValue());
        }

        NameType name = contactInfo.getName();
        if (name != null) {
          target.setContactInfoGivenName(getJAXBValue(name.getGivenName()));
          target.setContactInfoFamilyName(getJAXBValue(name.getFamilyName()));
          target.setContactInfoMiddleName(getJAXBValue(name.getMiddleName()));
        }

        PhoneNumberListType phoneNumberList = getJAXBValue(contactInfo.getPhoneNumberList());
        if (phoneNumberList != null
            && phoneNumberList.getPhoneNumber() != null
            && !phoneNumberList.getPhoneNumber().isEmpty()) {
          target.setContactInfoPhoneNumber(phoneNumberList.getPhoneNumber().get(0).getNumber());
        }
        target.setContactInfoPositionTitle(getJAXBValue(contactInfo.getPositionTitle()));
        target.setContactInfoRole(getJAXBValue(contactInfo.getRole()));
      }
      target.setCustomerId(getJAXBValue(source.getCustomerId()));
      target.setName(source.getName());
      target.setPaymentTerms(getJAXBValue(source.getPaymentTerms()));
      target.setRegisteredForGST(getJAXBEnumValue(source.getRegisteredForGST()));
    }
  }
예제 #2
0
  @Override
  public void toSifModel(VendorInfo source, VendorInfoType target) {
    if (source != null && target != null) {
      IObjectFactory objectFactory = getObjectFactory();

      target.setRefId(source.getRefId());
      target.setABN(objectFactory.createVendorInfoTypeABN(source.getABN()));
      target.setAccountName(objectFactory.createVendorInfoTypeAccountName(source.getAccountName()));
      target.setAccountNumber(
          objectFactory.createVendorInfoTypeAccountNumber(source.getAccountNumber()));
      target.setBPay(objectFactory.createVendorInfoTypeBPay(source.getBPay()));
      target.setBSB(objectFactory.createVendorInfoTypeBSB(source.getBSB()));

      if (source.hasContactInfo()) {
        ContactInfoType contactInfoType = new ContactInfoType();
        contactInfoType.setAddress(
            objectFactory.createContactInfoTypeAddress(
                addressConverter.toSifModel(source.getAddress())));
        if (StringUtils.isNotBlank(source.getContactInfoEmail())) {
          EmailListType emailListType = new EmailListType();
          EmailType email = new EmailType();
          email.setValue(source.getContactInfoEmail());
          email.setType(DEFAULT_EMAIL_TYPE);
          emailListType.getEmail().add(email);
          contactInfoType.setEmailList(objectFactory.createContactInfoTypeEmailList(emailListType));
        }
        if (source.hasNameInfo()) {
          NameType name = new NameType();
          name.setType(DEFAULT_NAME_TYPE_ENUM);
          name.setFamilyName(
              objectFactory.createBaseNameTypeFamilyName(source.getContactInfoFamilyName()));
          name.setGivenName(
              objectFactory.createBaseNameTypeGivenName(source.getContactInfoGivenName()));
          name.setMiddleName(
              objectFactory.createBaseNameTypeMiddleName(source.getContactInfoMiddleName()));
          contactInfoType.setName(name);
        }
        if (StringUtils.isNotBlank(source.getContactInfoPhoneNumber())) {
          PhoneNumberListType phoneNumberList = new PhoneNumberListType();
          PhoneNumberType phoneNumber = new PhoneNumberType();
          phoneNumber.setType(DEFAULT_PHONE_TYPE);
          phoneNumber.setNumber(source.getContactInfoPhoneNumber());
          phoneNumberList.getPhoneNumber().add(phoneNumber);
          contactInfoType.setPhoneNumberList(
              objectFactory.createContactInfoTypePhoneNumberList(phoneNumberList));
        }
        contactInfoType.setPositionTitle(
            objectFactory.createContactInfoTypePositionTitle(source.getContactInfoPositionTitle()));
        contactInfoType.setRole(
            objectFactory.createContactInfoTypeRole(source.getContactInfoRole()));
        target.setContactInfo(objectFactory.createVendorInfoTypeContactInfo(contactInfoType));
      }
      target.setCustomerId(objectFactory.createVendorInfoTypeCustomerId(source.getCustomerId()));
      target.setName(source.getName());
      target.setPaymentTerms(
          objectFactory.createVendorInfoTypePaymentTerms(source.getPaymentTerms()));
      target.setRegisteredForGST(
          objectFactory.createVendorInfoTypeRegisteredForGST(
              getEnumValue(source.getRegisteredForGST(), AUCodeSetsYesOrNoCategoryType.class)));
    }
  }