@Override
protected void performLiquibaseTask(Liquibase liquibase)
throws LiquibaseException {
switch (type) {
case COUNT: {
liquibase.rollback(rollbackCount, new Contexts(contexts), new LabelExpression(labels), outputWriter);
break;
}
case DATE: {
DateFormat format = DateFormat.getDateInstance();
try {
liquibase.rollback(format.parse(rollbackDate), new Contexts(contexts), new LabelExpression(labels),
outputWriter);
} catch (ParseException e) {
String message = "Error parsing rollbackDate: "
+ e.getMessage();
if (format instanceof SimpleDateFormat) {
message += "\nDate must match pattern: "
+ ((SimpleDateFormat) format).toPattern();
}
throw new LiquibaseException(message, e);
}
break;
}
case TAG: {
liquibase.rollback(rollbackTag, new Contexts(contexts), new LabelExpression(labels), outputWriter);
break;
}
default: {
throw new IllegalStateException("Unexpected rollback type, " + type);
}