Changed package naming across all examples.

This commit is contained in:
Ilkka Seppala
2015-05-31 11:55:18 +03:00
parent 703ebd3e20
commit 8524c75ba6
437 changed files with 1095 additions and 1402 deletions

View File

@@ -0,0 +1,57 @@
package com.iluwatar.servicelayer.magic;
import java.util.ArrayList;
import java.util.List;
import com.iluwatar.servicelayer.servicelayer.spell.Spell;
import com.iluwatar.servicelayer.servicelayer.spell.SpellDao;
import com.iluwatar.servicelayer.spellbook.Spellbook;
import com.iluwatar.servicelayer.spellbook.SpellbookDao;
import com.iluwatar.servicelayer.wizard.Wizard;
import com.iluwatar.servicelayer.wizard.WizardDao;
/**
*
* Service implementation.
*
*/
public class MagicServiceImpl implements MagicService {
private WizardDao wizardDao;
private SpellbookDao spellbookDao;
private SpellDao spellDao;
public MagicServiceImpl(WizardDao wizardDao, SpellbookDao spellbookDao, SpellDao spellDao) {
this.wizardDao = wizardDao;
this.spellbookDao = spellbookDao;
this.spellDao = spellDao;
}
@Override
public List<Wizard> findAllWizards() {
return wizardDao.findAll();
}
@Override
public List<Spellbook> findAllSpellbooks() {
return spellbookDao.findAll();
}
@Override
public List<Spell> findAllSpells() {
return spellDao.findAll();
}
@Override
public List<Wizard> findWizardsWithSpellbook(String name) {
Spellbook spellbook = spellbookDao.findByName(name);
return new ArrayList<Wizard>(spellbook.getWizards());
}
@Override
public List<Wizard> findWizardsWithSpell(String name) {
Spell spell = spellDao.findByName(name);
Spellbook spellbook = spell.getSpellbook();
return new ArrayList<Wizard>(spellbook.getWizards());
}
}