class DialogDescriptorService {

    public void decreaseHitcountWhenUsageIsHitcount(final DialogDescriptor dialogDescriptor) {
        if (dialogDescriptor.getAttributes().getUsage() == DialogDescriptorUsage.HITCOUNT) {
            long validityValue = dialogDescriptor.getAttributes().decreaseHitcount();
            LOGGER.debug("Hitcount was decreased to " + validityValue + " in dialog descriptor '" + dialogDescriptor.getAttributes().getName() + "'!");
            if (validityValue == 0) {
                dialogDescriptor.getAttributes().setUsage(DialogDescriptorUsage.DISABLED);
                LOGGER.debug("Dialog descriptor '" + dialogDescriptor.getAttributes().getName() + "' was disabled!");
            }
        }
    }

}