Source:
<code>public void destroy(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws Exception { log.info("Destroying enviornment isntance " + envInstance.getBlueprintName() + " with environment " + envInstance.getEnvironment().getName() + " vdc " + envInstance.getVdc()); boolean error = false; try { envInstance.setStatus(Status.UNINSTALLING); envInstance = environmentInstanceDao.update(envInstance); for (int i = 0; i < envInstance.getTierInstances().size(); i++) { deleteVM(claudiaData, envInstance); } } catch (NullPointerException ne) { log.info("Environment Instance " + envInstance.getBlueprintName() + " does not have any TierInstances associated"); } List<TierInstance> tierInstancesSDC = envInstance.getTierInstances(); envInstance.setTierInstances(null); for (int i = 0; i < tierInstancesSDC.size(); i++) { TierInstance tierInstance = tierInstancesSDC.get(i); try { deleteTierOnSDC(claudiaData, tierInstance, error); } catch (Exception e) { String errorMsg = "Error deleting node from Node Manager : " + tierInstance.getVM().getFqn() + "" + e.getMessage(); log.error(errorMsg); error = true; } envInstance.setStatus(Status.UNINSTALLED); envInstance = environmentInstanceDao.update(envInstance); <START> deletePaasDB(claudiaData, envInstance, tierInstance, error); <END> } log.info("Environment Instance " + envInstance.getBlueprintName() + " DESTROYED"); envInstance.setStatus(Status.UNDEPLOYED); environmentInstanceDao.remove(envInstance); if (error) { String errorMsg = "Unexpected error destroying environmentInstance"; throw new Exception(errorMsg); } }</code><technical_language>I suggest write deletePaaSDB</technical_language>

Target:
public void destroy(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws Exception { log.info("Destroying enviornment isntance " + envInstance.getBlueprintName() + " with environment " + envInstance.getEnvironment().getName() + " vdc " + envInstance.getVdc()); boolean error = false; try { envInstance.setStatus(Status.UNINSTALLING); envInstance = environmentInstanceDao.update(envInstance); for (int i = 0; i < envInstance.getTierInstances().size(); i++) { deleteVM(claudiaData, envInstance); } } catch (NullPointerException ne) { log.info("Environment Instance " + envInstance.getBlueprintName() + " does not have any TierInstances associated"); } List<TierInstance> tierInstancesSDC = envInstance.getTierInstances(); envInstance.setTierInstances(null); for (int i = 0; i < tierInstancesSDC.size(); i++) { TierInstance tierInstance = tierInstancesSDC.get(i); try { deleteTierOnSDC(claudiaData, tierInstance, error); } catch (Exception e) { String errorMsg = "Error deleting node from Node Manager : " + tierInstance.getVM().getFqn() + "" + e.getMessage(); log.error(errorMsg); error = true; } envInstance.setStatus(Status.UNINSTALLED); envInstance = environmentInstanceDao.update(envInstance); deletePaaSDB(claudiaData, envInstance, tierInstance, error); } log.info("Environment Instance " + envInstance.getBlueprintName() + " DESTROYED"); envInstance.setStatus(Status.UNDEPLOYED); environmentInstanceDao.remove(envInstance); if (error) { String errorMsg = "Unexpected error destroying environmentInstance"; throw new Exception(errorMsg); } }