Search in sources :

Example 1 with MagicService

use of com.iluwatar.servicelayer.magic.MagicService in project java-design-patterns by iluwatar.

the class App method queryData.

/**
 * Query the data
 */
public static void queryData() {
    MagicService service = new MagicServiceImpl(new WizardDaoImpl(), new SpellbookDaoImpl(), new SpellDaoImpl());
    LOGGER.info("Enumerating all wizards");
    for (Wizard w : service.findAllWizards()) {
        LOGGER.info(w.getName());
    }
    LOGGER.info("Enumerating all spellbooks");
    for (Spellbook s : service.findAllSpellbooks()) {
        LOGGER.info(s.getName());
    }
    LOGGER.info("Enumerating all spells");
    for (Spell s : service.findAllSpells()) {
        LOGGER.info(s.getName());
    }
    LOGGER.info("Find wizards with spellbook 'Book of Idores'");
    List<Wizard> wizardsWithSpellbook = service.findWizardsWithSpellbook("Book of Idores");
    for (Wizard w : wizardsWithSpellbook) {
        LOGGER.info("{} has 'Book of Idores'", w.getName());
    }
    LOGGER.info("Find wizards with spell 'Fireball'");
    List<Wizard> wizardsWithSpell = service.findWizardsWithSpell("Fireball");
    for (Wizard w : wizardsWithSpell) {
        LOGGER.info("{} has 'Fireball'", w.getName());
    }
}
Also used : SpellDaoImpl(com.iluwatar.servicelayer.spell.SpellDaoImpl) Spellbook(com.iluwatar.servicelayer.spellbook.Spellbook) WizardDaoImpl(com.iluwatar.servicelayer.wizard.WizardDaoImpl) MagicServiceImpl(com.iluwatar.servicelayer.magic.MagicServiceImpl) SpellbookDaoImpl(com.iluwatar.servicelayer.spellbook.SpellbookDaoImpl) MagicService(com.iluwatar.servicelayer.magic.MagicService) Wizard(com.iluwatar.servicelayer.wizard.Wizard) Spell(com.iluwatar.servicelayer.spell.Spell)

Aggregations

MagicService (com.iluwatar.servicelayer.magic.MagicService)1 MagicServiceImpl (com.iluwatar.servicelayer.magic.MagicServiceImpl)1 Spell (com.iluwatar.servicelayer.spell.Spell)1 SpellDaoImpl (com.iluwatar.servicelayer.spell.SpellDaoImpl)1 Spellbook (com.iluwatar.servicelayer.spellbook.Spellbook)1 SpellbookDaoImpl (com.iluwatar.servicelayer.spellbook.SpellbookDaoImpl)1 Wizard (com.iluwatar.servicelayer.wizard.Wizard)1 WizardDaoImpl (com.iluwatar.servicelayer.wizard.WizardDaoImpl)1