示例#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
 public SalesPointVO toVO(SalesPoint entity) {
   if (entity == null) {
     return null;
   }
   SalesPointVO rv = new SalesPointVO();
   try {
     rv.setAddress(adConverter.toVO(addressDao.findAddressByAddressId(entity.getAdressId())));
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   rv.setSalePointPhoneNumber(entity.getSalePointPhoneNumber());
   rv.setId(entity.getId());
   rv.setSalePointId(entity.getSalePointId());
   rv.setName(entity.getName());
   try {
     rv.setWarehouse(
         whConverter.toVO(warehouseDao.findWarehouseByWarehouseId(entity.getWarehouseId())));
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return rv;
 }
示例#3
0
 public boolean containsAddress(String address, int addressFlag) throws ValidationException {
   return contains(AddressConverter.fromSatoshiStyle(address, addressFlag));
 }
示例#4
0
 public void addAddress(String address, int addressFlag) throws ValidationException {
   add(AddressConverter.fromSatoshiStyle(address, addressFlag));
 }
示例#5
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)));
    }
  }