001/*
002 * Syncany, www.syncany.org
003 * Copyright (C) 2011-2016 Philipp C. Heckel <philipp.heckel@gmail.com>
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU General Public License as published by
007 * the Free Software Foundation, either version 3 of the License, or
008 * (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU General Public License for more details.
014 *
015 * You should have received a copy of the GNU General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018package org.syncany.operations.update;
019
020import org.syncany.operations.OperationOptions;
021
022/**
023 * Options class to configure the {@link UpdateOperation}.
024 * The options alter/influence the behavior of the operation.
025 * 
026 * @see <a href="https://github.com/syncany/syncany-website">Syncany Website/API</a>
027 * @author Philipp C. Heckel (philipp.heckel@gmail.com)
028 */
029public class UpdateOperationOptions implements OperationOptions {
030        private UpdateOperationAction action = null;
031        private boolean snapshots = false;
032        private String apiEndpoint = null;
033
034        /**
035         * Set the action to execute when the {@link UpdateOperation} 
036         * is run. Depending on the action, the bavior of the operation
037         * is changed/altered.
038         */
039        public void setAction(UpdateOperationAction action) {
040                this.action = action;
041        }
042
043        /**
044         * Set whether or not snapshots are included when the Syncany
045         * API is queried for updates. 
046         */
047        public void setSnapshots(boolean snapshots) {
048                this.snapshots = snapshots;
049        }
050        
051        /**
052         * Set an alternative API endpoint. If left as set by default,
053         * the default API endpoint will be used.
054         */
055        public void setApiEndpoint(String apiEndpoint) {
056                this.apiEndpoint = apiEndpoint;
057        }
058
059        /**
060         * Get the update action 
061         */
062        public UpdateOperationAction getAction() {
063                return action;
064        }
065
066        /**
067         * Get whether or not snapshots are included
068         * when the Syncany API is queried. 
069         */
070        public boolean isSnapshots() {
071                return snapshots;
072        }
073
074        /**
075         * Return the API endpoint (if changed), or null
076         * otherwise.
077         */
078        public String getApiEndpoint() {
079                return apiEndpoint;
080        }
081}