@Override public void update(ActionInstance actionInstance) { // Find an existing one to update ActionInstance existingInstance = actionInstanceDao.getActionInstance(actionInstance.getId()); if (existingInstance == null) { throw new ActionOperationException( String.format( "No existing actionInstance with id %s found for the update operation", actionInstance.getId())); } // Set the id of the existing action instance so that this looks like an "update" operation actionInstance.setId(existingInstance.getId()); // Validate the new one before deleting the existing one validate(actionInstance); // Delete the existing one delete(existingInstance); // Register the new one this.register(actionInstance); logger.info("Successfully updated the actionInstance {}", actionInstance); }