package com.nicewuerfel.blockown.database; class DatabaseOperation implements Runnable { private final DatabaseAction action; private final Database database; DatabaseOperation(Database database, DatabaseAction action) { this.action = action; this.database = database; } @Override public void run() { if (action.getActionType() == DatabaseAction.Type.DROP) { database.dropDatabaseUserData(action.getUser()); } else if (!database.setDatabaseOwner(action)) { database.getOutput().printException("An action has not been performed", new ActionNotPerformedException(action)); } } }