}
@PayloadRoot(localPart = "listAddressesRequest", namespace = "http://aktera.iritgo.de/webservices/address")
public ListAddressesResponse listAddresses(ListAddressesRequest request) throws Exception
{
AkteraUser user = securityContext.getUser();
int firstResult = request.getFirstResult() != null ? request.getFirstResult().intValue() : 0;
int maxResults = request.getMaxResults() != null ? request.getMaxResults().intValue() : - 1;
SortOrder orderDir = request.getOrderDir() != null ? SortOrder.byId(request.getOrderDir())
: SortOrder.ASCENDING;
String orderBy = request.getOrderBy() != null ? request.getOrderBy() : "lastName";
AddressStore store = addressManager.getAddressStoreByName(request.getAddressStoreName());
ListAddressesResponse response = new ListAddressesResponse();
for (Address address : store.createAddressListing(user.getId(), request.getQuery(), orderBy, orderDir,
firstResult, maxResults))
{
ListAddressesResponse.Address addressElement = new ListAddressesResponse.Address();
addressElement.setId(address.getAnyId().toString());
addressElement.setFirstName(address.getFirstName());