Examples of RaceService


Examples of cz.muni.fi.pa165.ddtroops.serviceinterfaces.RaceService

       
        try
        {
            String url = "http://" + options.getServer() + ":" + options.getPort() + "/pa165/api/";
            SkillService ss = new SkillServiceImpl(url+"skill/");
            RaceService rs = new RaceServiceImpl(url+"race/");           
            switch(jc.getParsedCommand())
            {
                case "createrace":
                    rs.create(
                            rs.createNewRace(
                                createRace.getName(),
                                createRace.getDescription(),
                                createRace.getStrength(),
                                createRace.getDexterity(),
                                createRace.getConstitution(),
                                createRace.getIntelligence(),
                                createRace.getWisdom(),
                                createRace.getCharisma()));
                    break;
                case "updaterace":
                    RaceDTO r = rs.createNewRace(
                                updateRace.getName(),
                                updateRace.getDescription(),
                                updateRace.getStrength(),
                                updateRace.getDexterity(),
                                updateRace.getConstitution(),
                                updateRace.getIntelligence(),
                                updateRace.getWisdom(),
                                updateRace.getCharisma());
                    r.id = updateRace.getId();
                    rs.update(r);
                    break;
                case "createskill":
                    ss.create(
                            ss.createNewSkill(
                                createSkill.getName(),
                                createSkill.getDescription(),
                                createSkill.getProfession(),
                                createSkill.getMinXP()));
                    break;
                case "updateskill":
                    SkillDTO s = ss.createNewSkill(
                                updateSkill.getName(),
                                updateSkill.getDescription(),
                                updateSkill.getProfession(),
                                updateSkill.getMinXP());
                    s.id = updateSkill.getId();
                    ss.update(s);
                    break;
                case "find":
                    if(findCommand.getType().equals("skill"))
                        System.out.println("Returned object: " + ss.getById(findCommand.getId()));
                    else
                        System.out.println("Returned object: " + rs.getById(findCommand.getId()));
                    break;
                case "delete":
                    if(deleteCommand.getType().equals("skill"))
                    {
                        SkillDTO s1 = new SkillDTO();
                        s1.id = deleteCommand.getId();
                        ss.delete(s1);
                    }
                    else
                    {
                        RaceDTO r1 = new RaceDTO();
                        r1.id = deleteCommand.getId();
                        rs.delete(r1);
                    }
                    break;
            }
        }
        catch(Exception ex)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.