private Option<Address> findAddressOfOwnerByPhoneNumber(String number, Integer ownerId) {
   if (checkOwner) {
     return addressDAO.findAddressOfOwnerByCategoryAndPhoneNumber(ownerId, category, number);
   } else {
     return addressDAO.findAddressByCategoryAndPhoneNumber(category, number);
   }
 }
 @Override
 public Option<Address> findAddressOfOwnerByPhoneNumber(PhoneNumber number, Integer ownerId) {
   if (checkOwner) {
     return addressDAO.findAddressOfOwnerByCategoryAndPhoneNumber(ownerId, category, number);
   } else {
     return addressDAO.findAddressByCategoryAndPhoneNumber(category, number);
   }
 }
 @Override
 public List<Address> findAddressOfOwnerByNameStartsWith(String name, Integer ownerId) {
   if (checkOwner) {
     return addressDAO.findAddressesOfOwnerByCategoryAndLastNameOrCompanyStartsWith(
         ownerId, category, name);
   } else {
     return addressDAO.findAddressesByCategoryAndNameOrCompanyStartsWith(category, name);
   }
 }
 @Override
 public Option<Address> findAddressByOwnerAndContactNumber(Integer ownerId, String contactNumber) {
   if (ownerId != null && isGlobalStore()) {
     return null;
   }
   return addressDAO.findAddressByOwnerAndCategoryAndContactNumber(
       ownerId, category, contactNumber);
 }
  @Override
  public List<PhoneNumber> findPhoneNumbersOfOwnerEndingWith(String number, Integer ownerId) {
    if (checkOwner) {
      return addressDAO.findPhoneNumbersOfOwnerEndingWith(ownerId, number);
    }

    return new LinkedList<PhoneNumber>();
  }
  @Override
  public List<PhoneNumber> findPhoneNumbersEndingWith(String number) {
    if (!checkOwner) {
      return addressDAO.findPhoneNumbersEndingWith(number);
    }

    return new LinkedList<PhoneNumber>();
  }
  @Override
  public Option<Address> findAddressByPhoneNumber(String number) {
    if (!checkOwner) {
      return addressDAO.findAddressByCategoryAndPhoneNumber(category, number);
    }

    return new Empty();
  }
 @Override
 public Option<Address> findAddressByOnwerAndFirstNameOrLastNameOrCompany(
     Integer ownerId, String firstName, String lastName, String company) {
   if (ownerId != null && isGlobalStore()) {
     return new Empty();
   }
   return addressDAO.findAddressByOwnerAndCategoryAndFirstNameOrLastNameOrCompany(
       ownerId, category, firstName, lastName, company);
 }
 @Override
 public List<Address> createAddressListing(
     Integer userId,
     String search,
     String orderBy,
     SortOrder orderDir,
     int firstResult,
     int maxResults) {
   return addressDAO.createAddressListing(
       userId, category, checkOwner, search, orderBy, orderDir, firstResult, maxResults);
 }
Esempio n. 10
0
  @Override
  public Object createAddress(Address address, Integer ownerId) {
    if (editable) {
      address.setCategory(category);

      if (checkOwner) {
        address.setOwnerId(ownerId);
      }

      addressDAO.createAddress(address);
      return address.getId();
    }

    return null;
  }
Esempio n. 11
0
 @Override
 public void deleteAllAddresses() {
   addressDAO.deleteAddressesByCategory(category);
 }
Esempio n. 12
0
 @Override
 public Option<Address> findAddressByPhoneNumber(PhoneNumber phoneNumber) {
   return addressDAO.findAddressByCategoryAndPhoneNumber(category, phoneNumber);
 }
Esempio n. 13
0
 @Override
 public List<PhoneNumber> findAllPhoneNumbersByAddressDnSortedByCategoryList(
     String addressDn, String[] categories) {
   return addressDAO.findAllPhoneNumbersByAddressIdSortedByCategories(
       NumberTools.toInt(addressDn, -1), categories);
 }
Esempio n. 14
0
 @Override
 public List<Address> findAddressByNameStartsWith(String name) {
   return addressDAO.findAddressesByCategoryAndNameOrCompanyStartsWith(category, name);
 }
Esempio n. 15
0
 @Override
 public Option<Address> findAddressByLastNameOrCompany(String name) {
   return addressDAO.findAddressByCategoryAndLastNameOrCompany(category, name);
 }
Esempio n. 16
0
 @Override
 public Option<Address> findAddressByDn(Object addressDn) {
   return addressDAO.findAddressByDn(addressDn);
 }
Esempio n. 17
0
 public void bulkImport(Collection<Address> addresses) {
   addressDAO.bulkImport(addresses);
 }
Esempio n. 18
0
 @Override
 public void deleteAllAddressesOfOwner(Integer userId) {
   if (checkOwner) {
     addressDAO.deleteAllAddressesOfOnwerByCategory(category, userId);
   }
 }
Esempio n. 19
0
 @Override
 public boolean canBeDeleted() {
   return addressDAO.countAddressesByCategory(category) == 0;
 }
Esempio n. 20
0
 @Override
 public long countAddressesByOwnerAndSearch(Integer userId, String search) {
   return addressDAO.countAddressesByOwenrAndCategoryAndSearch(
       userId, checkOwner, category, search);
 }
Esempio n. 21
0
 @Override
 public void deleteAddressWithDn(Object addressDn) {
   if (editable) {
     addressDAO.deleteAddressWithDn(addressDn);
   }
 }
Esempio n. 22
0
 @Override
 public void updateAddress(Address address) {
   if (editable) {
     addressDAO.updateAddress(address);
   }
 }