001/*
002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     bstefanescu, jcarsique
016 */
017package org.nuxeo.connect.update.task.update;
018
019import org.apache.commons.lang.builder.ReflectionToStringBuilder;
020import org.apache.commons.lang.builder.ToStringStyle;
021
022/**
023 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
024 */
025public class RollbackOptions {
026
027    protected String pkgId;
028
029    protected String key;
030
031    protected String version;
032
033    protected boolean deleteOnExit;
034
035    public RollbackOptions(String pkgId, String key, String version) {
036        this.pkgId = pkgId;
037        this.key = key;
038        this.version = version;
039    }
040
041    /**
042     * @param key
043     * @param opt
044     * @since 5.7
045     */
046    public RollbackOptions(String key, UpdateOptions opt) {
047        this.key = key;
048        this.pkgId = opt.pkgId;
049        this.version = opt.version;
050        this.deleteOnExit = opt.deleteOnExit;
051    }
052
053    public String getPackageId() {
054        return pkgId;
055    }
056
057    public String getKey() {
058        return key;
059    }
060
061    public String getVersion() {
062        return version;
063    }
064
065    public boolean isDeleteOnExit() {
066        return deleteOnExit;
067    }
068
069    public void setDeleteOnExit(boolean deleteOnExit) {
070        this.deleteOnExit = deleteOnExit;
071    }
072
073    /**
074     * @since 5.7
075     */
076    @Override
077    public String toString() {
078        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
079    }
080
081}