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.subscription;
020
021import org.shredzone.flattr4j.FlattrService;
022import org.shredzone.flattr4j.async.FlattrCallable;
023import org.shredzone.flattr4j.async.VoidFlattrCallable;
024import org.shredzone.flattr4j.model.ThingId;
025
026/**
027 * {@link FlattrCallable} for invoking
028 * {@link FlattrService#pauseSubscription(ThingId, boolean)}
029 *
030 * @author Iulius Gutberlet
031 * @author Richard "Shred" Körber
032 */
033public class PauseSubscriptionMethod extends VoidFlattrCallable {
034
035    private ThingId thingId;
036    private boolean paused;
037
038    public PauseSubscriptionMethod() {
039        // default constructor
040    }
041
042    public PauseSubscriptionMethod(ThingId thingId, boolean paused) {
043        this.thingId = thingId;
044        this.paused = paused;
045    }
046
047    public ThingId getThingId()                 { return thingId; }
048    public void setThingId(ThingId thingId)     { this.thingId = thingId; }
049
050    public boolean isPaused()                   { return paused; }
051    public void setPaused(boolean paused)       { this.paused = paused; }
052
053    @Override
054    public void execute(FlattrService service) throws Exception {
055        service.pauseSubscription(thingId, paused);
056    }
057
058}