@Override public List<LocalContactCollection> getCollections() { List<LocalContactCollection> collections = new LinkedList<LocalContactCollection>(); Optional<String> collectionPath = account.getCardDavCollectionPath(context); if (collectionPath.isPresent()) collections.add( new LocalContactCollection( context, client, account.getOsAccount(), collectionPath.get())); return collections; }
@Override public Optional<LocalContactCollection> getCollection(String remotePath) throws RemoteException { Optional<String> collectionPath = account.getCardDavCollectionPath(context); String remotePathDecoded; try { remotePathDecoded = (URLDecoder.decode(remotePath, "UTF8")); } catch (UnsupportedEncodingException e) { Log.e(TAG, "caught exception while returning collection", e); throw new RemoteException(e.toString()); // HACK :( } if (collectionPath.isPresent() && (collectionPath.get().equals(remotePath) || collectionPath.get().equals(remotePathDecoded))) { return Optional.of( new LocalContactCollection( context, client, account.getOsAccount(), collectionPath.get())); } return Optional.absent(); }