Package gwlpr.database.entities

Examples of gwlpr.database.entities.Map


            StreamTerminatorView.send(clientHandle.get().getChannel(), ErrorCode.InternalServerError);
        }

        // retrieve socket address for that game server
        InetSocketAddress address = context.getManager().localAddressFor(mapShardHandle);
        Map map = model.getBean(mapShardHandle).getMap();

        // failcheck
        if (address == null || map == null) { return; }

        LOGGER.debug("The map shard accepted the client.");

        MapDispatchView.referToGameServer(
                clientHandle.get().getChannel(),
                address,
                event.getServerUid(),
                event.getClientUid(),
                map.getGameID());
    }
View Full Code Here


        if(parentContext == null || additionalParams.isEmpty()) { return false; }

        // TODO: create db stuff
       
        // parse the parameters for the worldbean
        Map                 mapEntity   = MapJpaController.get().findMap(Integer.parseIntadditionalParams.get("MapId")));
        boolean             isPvP       = Boolean.parseBoolean(                             additionalParams.get("IsPvP"));
        boolean             isOutpost   = Boolean.parseBoolean(                             additionalParams.get("IsOutpost"));
        int                 instanceNum = Integer.parseInt(                                 additionalParams.get("InstanceNumber"));
        DistrictRegion      region      = DistrictRegion.valueOf(                           additionalParams.get("DistrictRegion"));
        DistrictLanguage    language    = DistrictLanguage.valueOf(                         additionalParams.get("DistrictLanguage"));
View Full Code Here

    public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Map map;
            try {
                map = em.getReference(Map.class, id);
                map.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The map with id " + id + " no longer exists.", enfe);
            }
            List<String> illegalOrphanMessages = null;
            Collection<Spawnpoint> spawnpointCollectionOrphanCheck = map.getSpawnpointCollection();
            for (Spawnpoint spawnpointCollectionOrphanCheckSpawnpoint : spawnpointCollectionOrphanCheck) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("This Map (" + map + ") cannot be destroyed since the Spawnpoint " + spawnpointCollectionOrphanCheckSpawnpoint + " in its spawnpointCollection field has a non-nullable map field.");
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            Collection<Character> characterCollection = map.getCharacterCollection();
            for (Character characterCollectionCharacter : characterCollection) {
                characterCollectionCharacter.setLastOutpost(null);
                characterCollectionCharacter = em.merge(characterCollectionCharacter);
            }
            em.remove(map);
View Full Code Here

        spawnpoint.getSpawnpointPK().setMapID(spawnpoint.getMap().getId());
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Map map = spawnpoint.getMap();
            if (map != null) {
                map = em.getReference(map.getClass(), map.getId());
                spawnpoint.setMap(map);
            }
            em.persist(spawnpoint);
            if (map != null) {
                map.getSpawnpointCollection().add(spawnpoint);
                map = em.merge(map);
            }
            em.getTransaction().commit();
        } catch (Exception ex) {
            if (findSpawnpoint(spawnpoint.getSpawnpointPK()) != null) {
View Full Code Here

        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Spawnpoint persistentSpawnpoint = em.find(Spawnpoint.class, spawnpoint.getSpawnpointPK());
            Map mapOld = persistentSpawnpoint.getMap();
            Map mapNew = spawnpoint.getMap();
            if (mapNew != null) {
                mapNew = em.getReference(mapNew.getClass(), mapNew.getId());
                spawnpoint.setMap(mapNew);
            }
            spawnpoint = em.merge(spawnpoint);
            if (mapOld != null && !mapOld.equals(mapNew)) {
                mapOld.getSpawnpointCollection().remove(spawnpoint);
                mapOld = em.merge(mapOld);
            }
            if (mapNew != null && !mapNew.equals(mapOld)) {
                mapNew.getSpawnpointCollection().add(spawnpoint);
                mapNew = em.merge(mapNew);
            }
            em.getTransaction().commit();
        } catch (Exception ex) {
            String msg = ex.getLocalizedMessage();
View Full Code Here

                spawnpoint = em.getReference(Spawnpoint.class, id);
                spawnpoint.getSpawnpointPK();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The spawnpoint with id " + id + " no longer exists.", enfe);
            }
            Map map = spawnpoint.getMap();
            if (map != null) {
                map.getSpawnpointCollection().remove(spawnpoint);
                map = em.merge(map);
            }
            em.remove(spawnpoint);
            em.getTransaction().commit();
        } finally {
View Full Code Here

                attachedCharacterCollection.add(characterCollectionCharacterToAttach);
            }
            map.setCharacterCollection(attachedCharacterCollection);
            em.persist(map);
            for (Spawnpoint spawnpointCollectionSpawnpoint : map.getSpawnpointCollection()) {
                Map oldMapOfSpawnpointCollectionSpawnpoint = spawnpointCollectionSpawnpoint.getMap();
                spawnpointCollectionSpawnpoint.setMap(map);
                spawnpointCollectionSpawnpoint = em.merge(spawnpointCollectionSpawnpoint);
                if (oldMapOfSpawnpointCollectionSpawnpoint != null) {
                    oldMapOfSpawnpointCollectionSpawnpoint.getSpawnpointCollection().remove(spawnpointCollectionSpawnpoint);
                    oldMapOfSpawnpointCollectionSpawnpoint = em.merge(oldMapOfSpawnpointCollectionSpawnpoint);
                }
            }
            for (Character characterCollectionCharacter : map.getCharacterCollection()) {
                Map oldLastOutpostOfCharacterCollectionCharacter = characterCollectionCharacter.getLastOutpost();
                characterCollectionCharacter.setLastOutpost(map);
                characterCollectionCharacter = em.merge(characterCollectionCharacter);
                if (oldLastOutpostOfCharacterCollectionCharacter != null) {
                    oldLastOutpostOfCharacterCollectionCharacter.getCharacterCollection().remove(characterCollectionCharacter);
                    oldLastOutpostOfCharacterCollectionCharacter = em.merge(oldLastOutpostOfCharacterCollectionCharacter);
                }
            }
            em.getTransaction().commit();
        } finally {
View Full Code Here

    public void edit(Map map) throws IllegalOrphanException, NonexistentEntityException, Exception {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Map persistentMap = em.find(Map.class, map.getId());
            Collection<Spawnpoint> spawnpointCollectionOld = persistentMap.getSpawnpointCollection();
            Collection<Spawnpoint> spawnpointCollectionNew = map.getSpawnpointCollection();
            Collection<Character> characterCollectionOld = persistentMap.getCharacterCollection();
            Collection<Character> characterCollectionNew = map.getCharacterCollection();
            List<String> illegalOrphanMessages = null;
            for (Spawnpoint spawnpointCollectionOldSpawnpoint : spawnpointCollectionOld) {
                if (!spawnpointCollectionNew.contains(spawnpointCollectionOldSpawnpoint)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Spawnpoint " + spawnpointCollectionOldSpawnpoint + " since its map field is not nullable.");
                }
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            Collection<Spawnpoint> attachedSpawnpointCollectionNew = new ArrayList<Spawnpoint>();
            for (Spawnpoint spawnpointCollectionNewSpawnpointToAttach : spawnpointCollectionNew) {
                spawnpointCollectionNewSpawnpointToAttach = em.getReference(spawnpointCollectionNewSpawnpointToAttach.getClass(), spawnpointCollectionNewSpawnpointToAttach.getSpawnpointPK());
                attachedSpawnpointCollectionNew.add(spawnpointCollectionNewSpawnpointToAttach);
            }
            spawnpointCollectionNew = attachedSpawnpointCollectionNew;
            map.setSpawnpointCollection(spawnpointCollectionNew);
            Collection<Character> attachedCharacterCollectionNew = new ArrayList<Character>();
            for (Character characterCollectionNewCharacterToAttach : characterCollectionNew) {
                characterCollectionNewCharacterToAttach = em.getReference(characterCollectionNewCharacterToAttach.getClass(), characterCollectionNewCharacterToAttach.getId());
                attachedCharacterCollectionNew.add(characterCollectionNewCharacterToAttach);
            }
            characterCollectionNew = attachedCharacterCollectionNew;
            map.setCharacterCollection(characterCollectionNew);
            map = em.merge(map);
            for (Spawnpoint spawnpointCollectionNewSpawnpoint : spawnpointCollectionNew) {
                if (!spawnpointCollectionOld.contains(spawnpointCollectionNewSpawnpoint)) {
                    Map oldMapOfSpawnpointCollectionNewSpawnpoint = spawnpointCollectionNewSpawnpoint.getMap();
                    spawnpointCollectionNewSpawnpoint.setMap(map);
                    spawnpointCollectionNewSpawnpoint = em.merge(spawnpointCollectionNewSpawnpoint);
                    if (oldMapOfSpawnpointCollectionNewSpawnpoint != null && !oldMapOfSpawnpointCollectionNewSpawnpoint.equals(map)) {
                        oldMapOfSpawnpointCollectionNewSpawnpoint.getSpawnpointCollection().remove(spawnpointCollectionNewSpawnpoint);
                        oldMapOfSpawnpointCollectionNewSpawnpoint = em.merge(oldMapOfSpawnpointCollectionNewSpawnpoint);
                    }
                }
            }
            for (Character characterCollectionOldCharacter : characterCollectionOld) {
                if (!characterCollectionNew.contains(characterCollectionOldCharacter)) {
                    characterCollectionOldCharacter.setLastOutpost(null);
                    characterCollectionOldCharacter = em.merge(characterCollectionOldCharacter);
                }
            }
            for (Character characterCollectionNewCharacter : characterCollectionNew) {
                if (!characterCollectionOld.contains(characterCollectionNewCharacter)) {
                    Map oldLastOutpostOfCharacterCollectionNewCharacter = characterCollectionNewCharacter.getLastOutpost();
                    characterCollectionNewCharacter.setLastOutpost(map);
                    characterCollectionNewCharacter = em.merge(characterCollectionNewCharacter);
                    if (oldLastOutpostOfCharacterCollectionNewCharacter != null && !oldLastOutpostOfCharacterCollectionNewCharacter.equals(map)) {
                        oldLastOutpostOfCharacterCollectionNewCharacter.getCharacterCollection().remove(characterCollectionNewCharacter);
                        oldLastOutpostOfCharacterCollectionNewCharacter = em.merge(oldLastOutpostOfCharacterCollectionNewCharacter);
                    }
                }
            }
            em.getTransaction().commit();
View Full Code Here

            Level level = character.getLevel();
            if (level != null) {
                level = em.getReference(level.getClass(), level.getLevel());
                character.setLevel(level);
            }
            Map lastOutpost = character.getLastOutpost();
            if (lastOutpost != null) {
                lastOutpost = em.getReference(lastOutpost.getClass(), lastOutpost.getId());
                character.setLastOutpost(lastOutpost);
            }
            Inventory equipmentPack = character.getEquipmentPack();
            if (equipmentPack != null) {
                equipmentPack = em.getReference(equipmentPack.getClass(), equipmentPack.getId());
                character.setEquipmentPack(equipmentPack);
            }
            Inventory equipment = character.getEquipment();
            if (equipment != null) {
                equipment = em.getReference(equipment.getClass(), equipment.getId());
                character.setEquipment(equipment);
            }
            Inventory beltpouch = character.getBeltpouch();
            if (beltpouch != null) {
                beltpouch = em.getReference(beltpouch.getClass(), beltpouch.getId());
                character.setBeltpouch(beltpouch);
            }
            Inventory bag2 = character.getBag2();
            if (bag2 != null) {
                bag2 = em.getReference(bag2.getClass(), bag2.getId());
                character.setBag2(bag2);
            }
            Inventory bag1 = character.getBag1();
            if (bag1 != null) {
                bag1 = em.getReference(bag1.getClass(), bag1.getId());
                character.setBag1(bag1);
            }
            Inventory backpack = character.getBackpack();
            if (backpack != null) {
                backpack = em.getReference(backpack.getClass(), backpack.getId());
                character.setBackpack(backpack);
            }
            Account accountID = character.getAccountID();
            if (accountID != null) {
                accountID = em.getReference(accountID.getClass(), accountID.getEMail());
                character.setAccountID(accountID);
            }
            Collection<Skill> attachedSkillCollection = new ArrayList<Skill>();
            for (Skill skillCollectionSkillToAttach : character.getSkillCollection()) {
                skillCollectionSkillToAttach = em.getReference(skillCollectionSkillToAttach.getClass(), skillCollectionSkillToAttach.getId());
                attachedSkillCollection.add(skillCollectionSkillToAttach);
            }
            character.setSkillCollection(attachedSkillCollection);
            Collection<Profession> attachedProfessionCollection = new ArrayList<Profession>();
            for (Profession professionCollectionProfessionToAttach : character.getProfessionCollection()) {
                professionCollectionProfessionToAttach = em.getReference(professionCollectionProfessionToAttach.getClass(), professionCollectionProfessionToAttach.getId());
                attachedProfessionCollection.add(professionCollectionProfessionToAttach);
            }
            character.setProfessionCollection(attachedProfessionCollection);
            Collection<EquippedSkill> attachedEquippedSkillCollection = new ArrayList<EquippedSkill>();
            for (EquippedSkill equippedSkillCollectionEquippedSkillToAttach : character.getEquippedSkillCollection()) {
                equippedSkillCollectionEquippedSkillToAttach = em.getReference(equippedSkillCollectionEquippedSkillToAttach.getClass(), equippedSkillCollectionEquippedSkillToAttach.getEquippedSkillPK());
                attachedEquippedSkillCollection.add(equippedSkillCollectionEquippedSkillToAttach);
            }
            character.setEquippedSkillCollection(attachedEquippedSkillCollection);
            Collection<Weaponset> attachedWeaponsetCollection = new ArrayList<Weaponset>();
            for (Weaponset weaponsetCollectionWeaponsetToAttach : character.getWeaponsetCollection()) {
                weaponsetCollectionWeaponsetToAttach = em.getReference(weaponsetCollectionWeaponsetToAttach.getClass(), weaponsetCollectionWeaponsetToAttach.getWeaponsetPK());
                attachedWeaponsetCollection.add(weaponsetCollectionWeaponsetToAttach);
            }
            character.setWeaponsetCollection(attachedWeaponsetCollection);
            Collection<Item> attachedItemCollection = new ArrayList<Item>();
            for (Item itemCollectionItemToAttach : character.getItemCollection()) {
                itemCollectionItemToAttach = em.getReference(itemCollectionItemToAttach.getClass(), itemCollectionItemToAttach.getId());
                attachedItemCollection.add(itemCollectionItemToAttach);
            }
            character.setItemCollection(attachedItemCollection);
            Collection<Attributepoint> attachedAttributepointCollection = new ArrayList<Attributepoint>();
            for (Attributepoint attributepointCollectionAttributepointToAttach : character.getAttributepointCollection()) {
                attributepointCollectionAttributepointToAttach = em.getReference(attributepointCollectionAttributepointToAttach.getClass(), attributepointCollectionAttributepointToAttach.getAttributepointPK());
                attachedAttributepointCollection.add(attributepointCollectionAttributepointToAttach);
            }
            character.setAttributepointCollection(attachedAttributepointCollection);
            em.persist(character);
            if (secondaryProfession != null) {
                secondaryProfession.getCharacterCollection().add(character);
                secondaryProfession = em.merge(secondaryProfession);
            }
            if (primaryProfession != null) {
                primaryProfession.getCharacterCollection().add(character);
                primaryProfession = em.merge(primaryProfession);
            }
            if (level != null) {
                level.getCharacterCollection().add(character);
                level = em.merge(level);
            }
            if (lastOutpost != null) {
                lastOutpost.getCharacterCollection().add(character);
                lastOutpost = em.merge(lastOutpost);
            }
            if (equipmentPack != null) {
                equipmentPack.getCharacterCollection().add(character);
                equipmentPack = em.merge(equipmentPack);
View Full Code Here

            Profession secondaryProfessionNew = character.getSecondaryProfession();
            Profession primaryProfessionOld = persistentCharacter.getPrimaryProfession();
            Profession primaryProfessionNew = character.getPrimaryProfession();
            Level levelOld = persistentCharacter.getLevel();
            Level levelNew = character.getLevel();
            Map lastOutpostOld = persistentCharacter.getLastOutpost();
            Map lastOutpostNew = character.getLastOutpost();
            Inventory equipmentPackOld = persistentCharacter.getEquipmentPack();
            Inventory equipmentPackNew = character.getEquipmentPack();
            Inventory equipmentOld = persistentCharacter.getEquipment();
            Inventory equipmentNew = character.getEquipment();
            Inventory beltpouchOld = persistentCharacter.getBeltpouch();
            Inventory beltpouchNew = character.getBeltpouch();
            Inventory bag2Old = persistentCharacter.getBag2();
            Inventory bag2New = character.getBag2();
            Inventory bag1Old = persistentCharacter.getBag1();
            Inventory bag1New = character.getBag1();
            Inventory backpackOld = persistentCharacter.getBackpack();
            Inventory backpackNew = character.getBackpack();
            Account accountIDOld = persistentCharacter.getAccountID();
            Account accountIDNew = character.getAccountID();
            Collection<Skill> skillCollectionOld = persistentCharacter.getSkillCollection();
            Collection<Skill> skillCollectionNew = character.getSkillCollection();
            Collection<Profession> professionCollectionOld = persistentCharacter.getProfessionCollection();
            Collection<Profession> professionCollectionNew = character.getProfessionCollection();
            Collection<EquippedSkill> equippedSkillCollectionOld = persistentCharacter.getEquippedSkillCollection();
            Collection<EquippedSkill> equippedSkillCollectionNew = character.getEquippedSkillCollection();
            Collection<Weaponset> weaponsetCollectionOld = persistentCharacter.getWeaponsetCollection();
            Collection<Weaponset> weaponsetCollectionNew = character.getWeaponsetCollection();
            Collection<Item> itemCollectionOld = persistentCharacter.getItemCollection();
            Collection<Item> itemCollectionNew = character.getItemCollection();
            Collection<Attributepoint> attributepointCollectionOld = persistentCharacter.getAttributepointCollection();
            Collection<Attributepoint> attributepointCollectionNew = character.getAttributepointCollection();
            List<String> illegalOrphanMessages = null;
            for (EquippedSkill equippedSkillCollectionOldEquippedSkill : equippedSkillCollectionOld) {
                if (!equippedSkillCollectionNew.contains(equippedSkillCollectionOldEquippedSkill)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain EquippedSkill " + equippedSkillCollectionOldEquippedSkill + " since its character field is not nullable.");
                }
            }
            for (Weaponset weaponsetCollectionOldWeaponset : weaponsetCollectionOld) {
                if (!weaponsetCollectionNew.contains(weaponsetCollectionOldWeaponset)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Weaponset " + weaponsetCollectionOldWeaponset + " since its character field is not nullable.");
                }
            }
            for (Attributepoint attributepointCollectionOldAttributepoint : attributepointCollectionOld) {
                if (!attributepointCollectionNew.contains(attributepointCollectionOldAttributepoint)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Attributepoint " + attributepointCollectionOldAttributepoint + " since its character field is not nullable.");
                }
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            if (secondaryProfessionNew != null) {
                secondaryProfessionNew = em.getReference(secondaryProfessionNew.getClass(), secondaryProfessionNew.getId());
                character.setSecondaryProfession(secondaryProfessionNew);
            }
            if (primaryProfessionNew != null) {
                primaryProfessionNew = em.getReference(primaryProfessionNew.getClass(), primaryProfessionNew.getId());
                character.setPrimaryProfession(primaryProfessionNew);
            }
            if (levelNew != null) {
                levelNew = em.getReference(levelNew.getClass(), levelNew.getLevel());
                character.setLevel(levelNew);
            }
            if (lastOutpostNew != null) {
                lastOutpostNew = em.getReference(lastOutpostNew.getClass(), lastOutpostNew.getId());
                character.setLastOutpost(lastOutpostNew);
            }
            if (equipmentPackNew != null) {
                equipmentPackNew = em.getReference(equipmentPackNew.getClass(), equipmentPackNew.getId());
                character.setEquipmentPack(equipmentPackNew);
            }
            if (equipmentNew != null) {
                equipmentNew = em.getReference(equipmentNew.getClass(), equipmentNew.getId());
                character.setEquipment(equipmentNew);
            }
            if (beltpouchNew != null) {
                beltpouchNew = em.getReference(beltpouchNew.getClass(), beltpouchNew.getId());
                character.setBeltpouch(beltpouchNew);
            }
            if (bag2New != null) {
                bag2New = em.getReference(bag2New.getClass(), bag2New.getId());
                character.setBag2(bag2New);
            }
            if (bag1New != null) {
                bag1New = em.getReference(bag1New.getClass(), bag1New.getId());
                character.setBag1(bag1New);
            }
            if (backpackNew != null) {
                backpackNew = em.getReference(backpackNew.getClass(), backpackNew.getId());
                character.setBackpack(backpackNew);
            }
            if (accountIDNew != null) {
                accountIDNew = em.getReference(accountIDNew.getClass(), accountIDNew.getEMail());
                character.setAccountID(accountIDNew);
            }
            Collection<Skill> attachedSkillCollectionNew = new ArrayList<Skill>();
            for (Skill skillCollectionNewSkillToAttach : skillCollectionNew) {
                skillCollectionNewSkillToAttach = em.getReference(skillCollectionNewSkillToAttach.getClass(), skillCollectionNewSkillToAttach.getId());
                attachedSkillCollectionNew.add(skillCollectionNewSkillToAttach);
            }
            skillCollectionNew = attachedSkillCollectionNew;
            character.setSkillCollection(skillCollectionNew);
            Collection<Profession> attachedProfessionCollectionNew = new ArrayList<Profession>();
            for (Profession professionCollectionNewProfessionToAttach : professionCollectionNew) {
                professionCollectionNewProfessionToAttach = em.getReference(professionCollectionNewProfessionToAttach.getClass(), professionCollectionNewProfessionToAttach.getId());
                attachedProfessionCollectionNew.add(professionCollectionNewProfessionToAttach);
            }
            professionCollectionNew = attachedProfessionCollectionNew;
            character.setProfessionCollection(professionCollectionNew);
            Collection<EquippedSkill> attachedEquippedSkillCollectionNew = new ArrayList<EquippedSkill>();
            for (EquippedSkill equippedSkillCollectionNewEquippedSkillToAttach : equippedSkillCollectionNew) {
                equippedSkillCollectionNewEquippedSkillToAttach = em.getReference(equippedSkillCollectionNewEquippedSkillToAttach.getClass(), equippedSkillCollectionNewEquippedSkillToAttach.getEquippedSkillPK());
                attachedEquippedSkillCollectionNew.add(equippedSkillCollectionNewEquippedSkillToAttach);
            }
            equippedSkillCollectionNew = attachedEquippedSkillCollectionNew;
            character.setEquippedSkillCollection(equippedSkillCollectionNew);
            Collection<Weaponset> attachedWeaponsetCollectionNew = new ArrayList<Weaponset>();
            for (Weaponset weaponsetCollectionNewWeaponsetToAttach : weaponsetCollectionNew) {
                weaponsetCollectionNewWeaponsetToAttach = em.getReference(weaponsetCollectionNewWeaponsetToAttach.getClass(), weaponsetCollectionNewWeaponsetToAttach.getWeaponsetPK());
                attachedWeaponsetCollectionNew.add(weaponsetCollectionNewWeaponsetToAttach);
            }
            weaponsetCollectionNew = attachedWeaponsetCollectionNew;
            character.setWeaponsetCollection(weaponsetCollectionNew);
            Collection<Item> attachedItemCollectionNew = new ArrayList<Item>();
            for (Item itemCollectionNewItemToAttach : itemCollectionNew) {
                itemCollectionNewItemToAttach = em.getReference(itemCollectionNewItemToAttach.getClass(), itemCollectionNewItemToAttach.getId());
                attachedItemCollectionNew.add(itemCollectionNewItemToAttach);
            }
            itemCollectionNew = attachedItemCollectionNew;
            character.setItemCollection(itemCollectionNew);
            Collection<Attributepoint> attachedAttributepointCollectionNew = new ArrayList<Attributepoint>();
            for (Attributepoint attributepointCollectionNewAttributepointToAttach : attributepointCollectionNew) {
                attributepointCollectionNewAttributepointToAttach = em.getReference(attributepointCollectionNewAttributepointToAttach.getClass(), attributepointCollectionNewAttributepointToAttach.getAttributepointPK());
                attachedAttributepointCollectionNew.add(attributepointCollectionNewAttributepointToAttach);
            }
            attributepointCollectionNew = attachedAttributepointCollectionNew;
            character.setAttributepointCollection(attributepointCollectionNew);
            character = em.merge(character);
            if (secondaryProfessionOld != null && !secondaryProfessionOld.equals(secondaryProfessionNew)) {
                secondaryProfessionOld.getCharacterCollection().remove(character);
                secondaryProfessionOld = em.merge(secondaryProfessionOld);
            }
            if (secondaryProfessionNew != null && !secondaryProfessionNew.equals(secondaryProfessionOld)) {
                secondaryProfessionNew.getCharacterCollection().add(character);
                secondaryProfessionNew = em.merge(secondaryProfessionNew);
            }
            if (primaryProfessionOld != null && !primaryProfessionOld.equals(primaryProfessionNew)) {
                primaryProfessionOld.getCharacterCollection().remove(character);
                primaryProfessionOld = em.merge(primaryProfessionOld);
            }
            if (primaryProfessionNew != null && !primaryProfessionNew.equals(primaryProfessionOld)) {
                primaryProfessionNew.getCharacterCollection().add(character);
                primaryProfessionNew = em.merge(primaryProfessionNew);
            }
            if (levelOld != null && !levelOld.equals(levelNew)) {
                levelOld.getCharacterCollection().remove(character);
                levelOld = em.merge(levelOld);
            }
            if (levelNew != null && !levelNew.equals(levelOld)) {
                levelNew.getCharacterCollection().add(character);
                levelNew = em.merge(levelNew);
            }
            if (lastOutpostOld != null && !lastOutpostOld.equals(lastOutpostNew)) {
                lastOutpostOld.getCharacterCollection().remove(character);
                lastOutpostOld = em.merge(lastOutpostOld);
            }
            if (lastOutpostNew != null && !lastOutpostNew.equals(lastOutpostOld)) {
                lastOutpostNew.getCharacterCollection().add(character);
                lastOutpostNew = em.merge(lastOutpostNew);
            }
            if (equipmentPackOld != null && !equipmentPackOld.equals(equipmentPackNew)) {
                equipmentPackOld.getCharacterCollection().remove(character);
                equipmentPackOld = em.merge(equipmentPackOld);
View Full Code Here

TOP

Related Classes of gwlpr.database.entities.Map

Copyright © 2018 www.massapicom. 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.