001/* 002 * (C) Copyright 2006-2018 Nuxeo (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * bstefanescu, jcarsique 018 */ 019package org.nuxeo.connect.update.task.update; 020 021import org.apache.commons.lang3.builder.ReflectionToStringBuilder; 022import org.apache.commons.lang3.builder.ToStringStyle; 023 024/** 025 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 026 */ 027public class RollbackOptions { 028 029 protected String pkgId; 030 031 protected String key; 032 033 protected String version; 034 035 protected boolean deleteOnExit; 036 037 public RollbackOptions(String pkgId, String key, String version) { 038 this.pkgId = pkgId; 039 this.key = key; 040 this.version = version; 041 } 042 043 /** 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}