Examples of PlayerHistory


Examples of org.freerealm.history.PlayerHistory

        StringBuffer xml = new StringBuffer();
        xml.append("<history>\n");
        Iterator<Player> iterator = history.getPlayersIterator();
        while (iterator.hasNext()) {
            Player player = iterator.next();
            PlayerHistory playerHistory = history.getPlayerHistory(player);
            xml.append(new FreeRealmPlayerHistoryXMLConverter().toXML(playerHistory));
        }
        xml.append("</history>\n");
        return xml.toString();
    }
View Full Code Here

Examples of org.freerealm.history.PlayerHistory

    public History initializeFromNode(Realm realm, Node node) {
        FreeRealmHistory freeRealmHistory = new FreeRealmHistory();
        for (Node playerHistoryNode = node.getFirstChild(); playerHistoryNode != null; playerHistoryNode = playerHistoryNode.getNextSibling()) {
            if (playerHistoryNode.getNodeType() == Node.ELEMENT_NODE) {
                PlayerHistory playerHistory = new FreeRealmPlayerHistoryXMLConverter().initializeFromNode(realm, playerHistoryNode);
                freeRealmHistory.addPlayerHistory(playerHistory.getPlayer(), playerHistory);
            }
        }
        return freeRealmHistory;
    }
View Full Code Here

Examples of org.freerealm.history.PlayerHistory

        xml.append("</playerHistory>\n");
        return xml.toString();
    }

    public PlayerHistory initializeFromNode(Realm realm, Node node) {
        PlayerHistory playerHistory = new FreeRealmPlayerHistory();
        Node playerIdNode = XMLConverterUtility.findNode(node, "playerId");
        int playerId = Integer.parseInt(playerIdNode.getFirstChild().getNodeValue());
        playerHistory.setPlayer(realm.getPlayerManager().getPlayer(playerId));
        Node playerHistoryTurnsNode = XMLConverterUtility.findNode(node, "playerHistoryTurns");
        for (Node playerTurnHistoryNode = playerHistoryTurnsNode.getFirstChild(); playerTurnHistoryNode != null; playerTurnHistoryNode = playerTurnHistoryNode.getNextSibling()) {
            if (playerTurnHistoryNode.getNodeType() == Node.ELEMENT_NODE) {
                PlayerTurnHistory playerTurnHistory = new FreeRealmPlayerTurnHistoryXMLConverter().initializeFromNode(realm, playerTurnHistoryNode);
                playerHistory.addTurnHistory(playerTurnHistory);
            }
        }
        return playerHistory;
    }
View Full Code Here

Examples of org.freerealm.history.PlayerHistory

        return new CommandResult(CommandResult.RESULT_OK, "", CommandResult.TURN_ENDED_UPDATE);
    }

    private void managePlayerHistory(Player player) {
        if (realm.getHistory().getPlayerHistory(player) == null) {
            PlayerHistory playerHistory = new FreeRealmPlayerHistory();
            playerHistory.setPlayer(player);
            realm.getHistory().addPlayerHistory(player, playerHistory);
        }
        PlayerTurnHistory playerTurnHistory = new FreeRealmPlayerTurnHistory();
        playerTurnHistory.setTurn(realm.getNumberOfTurns());
        playerTurnHistory.setPopulation(player.getPopulation());
View Full Code Here

Examples of org.jmcdonnell.blackoutrugby.beans.PlayerHistory

        Long playerId = new Long(System.getProperty("player.1.id"));
        List<PlayerHistory> entitiesFromApi
                = requestManager.getListOfEntityByIdFromApi(playerId, PlayerHistory.class, Boolean.FALSE, Boolean.FALSE);

        assertTrue(entitiesFromApi.size() > 0);
        PlayerHistory get = entitiesFromApi.get(0);

        assertNotNull(get.getDate());
        assertNotNull(get.getEvent());
        assertTrue(get.getPlayerId().equals(playerId));
    }
View Full Code Here

Examples of org.newinstance.gucoach.model.PlayerHistory

     * Converts a data record of a player's history into a player history entity.
     *
     * @param record the record to convert
     */
    private void convertRecordToPlayerHistory(final String[] record) {
        final PlayerHistory playerHistory = new PlayerHistory();
        playerHistory.setPlayer(players.get(new Long(record[AttributePosition.ID])));
        // erase apostrophe in strength value
        final String strength = StringUtils.remove(record[AttributePosition.STRENGTH], '\'');
        playerHistory.setAverageStrength(new Float(strength));
        playerHistory.setForm(new Integer(record[AttributePosition.FORM]));
        playerHistory.setEnergy(new Integer(record[AttributePosition.ENERGY]));
        playerHistory.setEndurance(new Integer(record[AttributePosition.ENDURANCE]));
        playerHistory.setExperience(new Integer(record[AttributePosition.EXPERIENCE]));
        playerHistory.setSkillGoalkeeping(new Integer(record[AttributePosition.SKILL_GOALKEEPING]));
        playerHistory.setSkillTackling(new Integer(record[AttributePosition.SKILL_TACKLING]));
        playerHistory.setSkillPlaymaking(new Integer(record[AttributePosition.SKILL_PLAYMAKING]));
        playerHistory.setSkillPassing(new Integer(record[AttributePosition.SKILL_PASSING]));
        playerHistory.setSkillScoring(new Integer(record[AttributePosition.SKILL_SCORING]));
        playerHistory.setImportDate(importDate);
        history.put(playerHistory.getPlayer().getId(), playerHistory);
    }
View Full Code Here

Examples of org.newinstance.gucoach.model.PlayerHistory

    }

    @Test
    public void insertPlayerHistoryTest() {
        final Player player = createPlayer();
        final PlayerHistory playerHistory = createPlayerHistory(player);

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerHistoryService.insertPlayerHistory(playerHistory);
        em.getTransaction().commit();

        final PlayerHistory result = playerHistoryService.findPlayerHistoryById(playerHistory.getId());
        Assert.assertNotNull(result);
        Assert.assertEquals(77, result.getEndurance().intValue());
        Assert.assertEquals(17, result.getSkillPlaymaking().intValue());
    }
View Full Code Here

Examples of org.newinstance.gucoach.model.PlayerHistory

    @Test
    public void findAllImportDatesTest() {
        final Player player = createPlayer();

        final Calendar cal = Calendar.getInstance();
        final PlayerHistory playerHistory1 = createPlayerHistory(player);
        playerHistory1.setPlayer(player);
        playerHistory1.setImportDate(cal.getTime());

        cal.roll(Calendar.MONTH, -1);
        final PlayerHistory playerHistory2 = createPlayerHistory(player);
        playerHistory2.setPlayer(player);
        playerHistory2.setImportDate(cal.getTime());

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerHistoryService.insertPlayerHistory(playerHistory1);
        playerHistoryService.insertPlayerHistory(playerHistory2);
View Full Code Here

Examples of org.newinstance.gucoach.model.PlayerHistory

        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        final Date date1 = cal.getTime();
        final PlayerHistory playerHistory1 = createPlayerHistory(player);
        playerHistory1.setPlayer(player);
        playerHistory1.setImportDate(date1);

        // reduce import date by one day
        cal.set(Calendar.DAY_OF_MONTH, -1);
        final Date date2 = cal.getTime();
        final PlayerHistory playerHistory2 = createPlayerHistory(player);
        playerHistory2.setPlayer(player);
        playerHistory2.setImportDate(date2);

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerHistoryService.insertPlayerHistory(playerHistory1);
        playerHistoryService.insertPlayerHistory(playerHistory2);
View Full Code Here

Examples of org.newinstance.gucoach.model.PlayerHistory

    @Test
    public void insertAndDeletePlayerHistoryTest() {
        final Player player = createPlayer();

        final PlayerHistory playerHistory1 = createPlayerHistory(player);
        playerHistory1.setPlayer(player);

        em.getTransaction().begin();
        playerService.insertPlayer(player);
        playerHistoryService.insertPlayerHistory(playerHistory1);
        em.getTransaction().commit();

        List<Player> playerList = playerService.findAllPlayers();
        Assert.assertNotNull(playerList);
        Assert.assertFalse(playerList.isEmpty());

        List<PlayerHistory> playerHistoryList = playerHistoryService.findPlayerHistoryByPlayer(player);
        Assert.assertNotNull(playerHistoryList);
        Assert.assertFalse(playerHistoryList.isEmpty());
        Assert.assertTrue(playerHistoryList.size() == 1);
        Assert.assertEquals("Player history does not match to player.", player, playerHistoryList.get(0).getPlayer());

        // insert another history record
        final PlayerHistory playerHistory2 = createPlayerHistory(player);
        playerHistory2.setPlayer(player);

        em.getTransaction().begin();
        playerHistoryService.insertPlayerHistory(playerHistory2);
        em.getTransaction().commit();
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.