001/* 002 * (C) Copyright 2006-2012 Nuxeo SA (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.lang.builder.ReflectionToStringBuilder; 022import org.apache.commons.lang.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 * @param key 045 * @param opt 046 * @since 5.7 047 */ 048 public RollbackOptions(String key, UpdateOptions opt) { 049 this.key = key; 050 this.pkgId = opt.pkgId; 051 this.version = opt.version; 052 this.deleteOnExit = opt.deleteOnExit; 053 } 054 055 public String getPackageId() { 056 return pkgId; 057 } 058 059 public String getKey() { 060 return key; 061 } 062 063 public String getVersion() { 064 return version; 065 } 066 067 public boolean isDeleteOnExit() { 068 return deleteOnExit; 069 } 070 071 public void setDeleteOnExit(boolean deleteOnExit) { 072 this.deleteOnExit = deleteOnExit; 073 } 074 075 /** 076 * @since 5.7 077 */ 078 @Override 079 public String toString() { 080 return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); 081 } 082 083}