aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/loaders/OwnerGeocacheListLoader.java
blob: 70db74c1e7e5e6821d1ce9fb9fe48d8c1049d88f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package cgeo.geocaching.loaders;

import cgeo.geocaching.SearchResult;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.capability.ISearchByOwner;

import org.eclipse.jdt.annotation.NonNull;
import rx.functions.Func1;

import android.content.Context;

public class OwnerGeocacheListLoader extends AbstractSearchLoader {

    private final @NonNull String username;

    public OwnerGeocacheListLoader(final Context context, final @NonNull String username) {
        super(context);
        this.username = username;
    }

    @Override
    public SearchResult runSearch() {
        return SearchResult.parallelCombineActive(ConnectorFactory.getSearchByOwnerConnectors(),
                new Func1<ISearchByOwner, SearchResult>() {
                    @Override
                    public SearchResult call(final ISearchByOwner connector) {
                        return connector.searchByOwner(username, OwnerGeocacheListLoader.this);
            }
        });
    }

}