001/*
002 * flattr4j - A Java library for Flattr
003 *
004 * Copyright (C) 2014 Richard "Shred" Körber
005 *   http://flattr4j.shredzone.org
006 *
007 * This program is free software: you can redistribute it and/or modify
008 * it under the terms of the GNU General Public License / GNU Lesser
009 * General Public License as published by the Free Software Foundation,
010 * either version 3 of the License, or (at your option) any later version.
011 *
012 * Licensed under the Apache License, Version 2.0 (the "License");
013 * you may not use this file except in compliance with the License.
014 *
015 * This program is distributed in the hope that it will be useful,
016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
018 */
019package org.shredzone.flattr4j.async.activity;
020
021import java.util.List;
022
023import org.shredzone.flattr4j.FlattrService;
024import org.shredzone.flattr4j.async.AbstractFlattrCallable;
025import org.shredzone.flattr4j.async.FlattrCallable;
026import org.shredzone.flattr4j.model.Activity;
027import org.shredzone.flattr4j.model.UserId;
028
029/**
030 * {@link FlattrCallable} for invoking
031 * {@link FlattrService#getActivities(UserId, org.shredzone.flattr4j.model.Activity.Type)}
032 *
033 * @author Iulius Gutberlet
034 * @author Richard "Shred" Körber
035 */
036public class GetActivitiesMethod extends AbstractFlattrCallable<List<Activity>> {
037
038    private UserId userId;
039    private Activity.Type type;
040
041    public GetActivitiesMethod() {
042        // default constructor
043    }
044
045    public GetActivitiesMethod(UserId userId, Activity.Type type) {
046        this.userId = userId;
047        this.type = type;
048    }
049
050    public UserId getUserId()                   { return userId; }
051    public void setUserId(UserId userId)        { this.userId = userId; }
052
053    public Activity.Type getType()              { return type; }
054    public void setType(Activity.Type type)     { this.type = type; }
055
056    @Override
057    public List<Activity> call(FlattrService service) throws Exception {
058        return service.getActivities(userId, type);
059    }
060
061}