Package entity

Examples of entity.Tag


    public Tag getTag() {
        if(tag == null) {
            tag = (Tag)JsfUtil.getObjectFromRequestParameter("jsfcrud.currentTag", converter, null);
        }
        if(tag == null) {
            tag = new Tag();
        }
        return tag;
    }
View Full Code Here


    public String getAsString(FacesContext context, UIComponent component, Object value) {
        if (value == null) {
            return null;
        }
        if (value instanceof Tag) {
            Tag o = (Tag) value;
            return o.getId() == null ? "" : o.getId().toString();
        } else {
            throw new IllegalArgumentException("object " + value + " is of type " + value.getClass().getName() + "; expected type: entity.Tag");
        }
    }   
View Full Code Here

                attachedTagcorrelationsList1.add(tagcorrelationsList1TagcorrelationsToAttach);
            }
            tag.setTagcorrelationsList1(attachedTagcorrelationsList1);
            em.persist(tag);
            for (Coursetag coursetagListCoursetag : tag.getCoursetagList()) {
                Tag oldTagIdOfCoursetagListCoursetag = coursetagListCoursetag.getTagId();
                coursetagListCoursetag.setTagId(tag);
                coursetagListCoursetag = em.merge(coursetagListCoursetag);
                if (oldTagIdOfCoursetagListCoursetag != null) {
                    oldTagIdOfCoursetagListCoursetag.getCoursetagList().remove(coursetagListCoursetag);
                    oldTagIdOfCoursetagListCoursetag = em.merge(oldTagIdOfCoursetagListCoursetag);
                }
            }
            for (Tagcorrelations tagcorrelationsListTagcorrelations : tag.getTagcorrelationsList()) {
                Tag oldReferencedTagIdOfTagcorrelationsListTagcorrelations = tagcorrelationsListTagcorrelations.getReferencedTagId();
                tagcorrelationsListTagcorrelations.setReferencedTagId(tag);
                tagcorrelationsListTagcorrelations = em.merge(tagcorrelationsListTagcorrelations);
                if (oldReferencedTagIdOfTagcorrelationsListTagcorrelations != null) {
                    oldReferencedTagIdOfTagcorrelationsListTagcorrelations.getTagcorrelationsList().remove(tagcorrelationsListTagcorrelations);
                    oldReferencedTagIdOfTagcorrelationsListTagcorrelations = em.merge(oldReferencedTagIdOfTagcorrelationsListTagcorrelations);
                }
            }
            for (Tagcorrelations tagcorrelationsList1Tagcorrelations : tag.getTagcorrelationsList1()) {
                Tag oldMainTagIdOfTagcorrelationsList1Tagcorrelations = tagcorrelationsList1Tagcorrelations.getMainTagId();
                tagcorrelationsList1Tagcorrelations.setMainTagId(tag);
                tagcorrelationsList1Tagcorrelations = em.merge(tagcorrelationsList1Tagcorrelations);
                if (oldMainTagIdOfTagcorrelationsList1Tagcorrelations != null) {
                    oldMainTagIdOfTagcorrelationsList1Tagcorrelations.getTagcorrelationsList1().remove(tagcorrelationsList1Tagcorrelations);
                    oldMainTagIdOfTagcorrelationsList1Tagcorrelations = em.merge(oldMainTagIdOfTagcorrelationsList1Tagcorrelations);
                }
            }
            em.getTransaction().commit();
        } finally {
View Full Code Here

    public void edit(Tag tag) throws IllegalOrphanException, NonexistentEntityException, Exception {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Tag persistentTag = em.find(Tag.class, tag.getId());
            List<Coursetag> coursetagListOld = persistentTag.getCoursetagList();
            List<Coursetag> coursetagListNew = tag.getCoursetagList();
            List<Tagcorrelations> tagcorrelationsListOld = persistentTag.getTagcorrelationsList();
            List<Tagcorrelations> tagcorrelationsListNew = tag.getTagcorrelationsList();
            List<Tagcorrelations> tagcorrelationsList1Old = persistentTag.getTagcorrelationsList1();
            List<Tagcorrelations> tagcorrelationsList1New = tag.getTagcorrelationsList1();
            List<String> illegalOrphanMessages = null;
            for (Coursetag coursetagListOldCoursetag : coursetagListOld) {
                if (!coursetagListNew.contains(coursetagListOldCoursetag)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Coursetag " + coursetagListOldCoursetag + " since its tagId field is not nullable.");
                }
            }
            for (Tagcorrelations tagcorrelationsListOldTagcorrelations : tagcorrelationsListOld) {
                if (!tagcorrelationsListNew.contains(tagcorrelationsListOldTagcorrelations)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Tagcorrelations " + tagcorrelationsListOldTagcorrelations + " since its referencedTagId field is not nullable.");
                }
            }
            for (Tagcorrelations tagcorrelationsList1OldTagcorrelations : tagcorrelationsList1Old) {
                if (!tagcorrelationsList1New.contains(tagcorrelationsList1OldTagcorrelations)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Tagcorrelations " + tagcorrelationsList1OldTagcorrelations + " since its mainTagId field is not nullable.");
                }
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            List<Coursetag> attachedCoursetagListNew = new ArrayList<Coursetag>();
            for (Coursetag coursetagListNewCoursetagToAttach : coursetagListNew) {
                coursetagListNewCoursetagToAttach = em.getReference(coursetagListNewCoursetagToAttach.getClass(), coursetagListNewCoursetagToAttach.getId());
                attachedCoursetagListNew.add(coursetagListNewCoursetagToAttach);
            }
            coursetagListNew = attachedCoursetagListNew;
            tag.setCoursetagList(coursetagListNew);
            List<Tagcorrelations> attachedTagcorrelationsListNew = new ArrayList<Tagcorrelations>();
            for (Tagcorrelations tagcorrelationsListNewTagcorrelationsToAttach : tagcorrelationsListNew) {
                tagcorrelationsListNewTagcorrelationsToAttach = em.getReference(tagcorrelationsListNewTagcorrelationsToAttach.getClass(), tagcorrelationsListNewTagcorrelationsToAttach.getId());
                attachedTagcorrelationsListNew.add(tagcorrelationsListNewTagcorrelationsToAttach);
            }
            tagcorrelationsListNew = attachedTagcorrelationsListNew;
            tag.setTagcorrelationsList(tagcorrelationsListNew);
            List<Tagcorrelations> attachedTagcorrelationsList1New = new ArrayList<Tagcorrelations>();
            for (Tagcorrelations tagcorrelationsList1NewTagcorrelationsToAttach : tagcorrelationsList1New) {
                tagcorrelationsList1NewTagcorrelationsToAttach = em.getReference(tagcorrelationsList1NewTagcorrelationsToAttach.getClass(), tagcorrelationsList1NewTagcorrelationsToAttach.getId());
                attachedTagcorrelationsList1New.add(tagcorrelationsList1NewTagcorrelationsToAttach);
            }
            tagcorrelationsList1New = attachedTagcorrelationsList1New;
            tag.setTagcorrelationsList1(tagcorrelationsList1New);
            tag = em.merge(tag);
            for (Coursetag coursetagListNewCoursetag : coursetagListNew) {
                if (!coursetagListOld.contains(coursetagListNewCoursetag)) {
                    Tag oldTagIdOfCoursetagListNewCoursetag = coursetagListNewCoursetag.getTagId();
                    coursetagListNewCoursetag.setTagId(tag);
                    coursetagListNewCoursetag = em.merge(coursetagListNewCoursetag);
                    if (oldTagIdOfCoursetagListNewCoursetag != null && !oldTagIdOfCoursetagListNewCoursetag.equals(tag)) {
                        oldTagIdOfCoursetagListNewCoursetag.getCoursetagList().remove(coursetagListNewCoursetag);
                        oldTagIdOfCoursetagListNewCoursetag = em.merge(oldTagIdOfCoursetagListNewCoursetag);
                    }
                }
            }
            for (Tagcorrelations tagcorrelationsListNewTagcorrelations : tagcorrelationsListNew) {
                if (!tagcorrelationsListOld.contains(tagcorrelationsListNewTagcorrelations)) {
                    Tag oldReferencedTagIdOfTagcorrelationsListNewTagcorrelations = tagcorrelationsListNewTagcorrelations.getReferencedTagId();
                    tagcorrelationsListNewTagcorrelations.setReferencedTagId(tag);
                    tagcorrelationsListNewTagcorrelations = em.merge(tagcorrelationsListNewTagcorrelations);
                    if (oldReferencedTagIdOfTagcorrelationsListNewTagcorrelations != null && !oldReferencedTagIdOfTagcorrelationsListNewTagcorrelations.equals(tag)) {
                        oldReferencedTagIdOfTagcorrelationsListNewTagcorrelations.getTagcorrelationsList().remove(tagcorrelationsListNewTagcorrelations);
                        oldReferencedTagIdOfTagcorrelationsListNewTagcorrelations = em.merge(oldReferencedTagIdOfTagcorrelationsListNewTagcorrelations);
                    }
                }
            }
            for (Tagcorrelations tagcorrelationsList1NewTagcorrelations : tagcorrelationsList1New) {
                if (!tagcorrelationsList1Old.contains(tagcorrelationsList1NewTagcorrelations)) {
                    Tag oldMainTagIdOfTagcorrelationsList1NewTagcorrelations = tagcorrelationsList1NewTagcorrelations.getMainTagId();
                    tagcorrelationsList1NewTagcorrelations.setMainTagId(tag);
                    tagcorrelationsList1NewTagcorrelations = em.merge(tagcorrelationsList1NewTagcorrelations);
                    if (oldMainTagIdOfTagcorrelationsList1NewTagcorrelations != null && !oldMainTagIdOfTagcorrelationsList1NewTagcorrelations.equals(tag)) {
                        oldMainTagIdOfTagcorrelationsList1NewTagcorrelations.getTagcorrelationsList1().remove(tagcorrelationsList1NewTagcorrelations);
                        oldMainTagIdOfTagcorrelationsList1NewTagcorrelations = em.merge(oldMainTagIdOfTagcorrelationsList1NewTagcorrelations);
                    }
                }
            }
            em.getTransaction().commit();
View Full Code Here

    public void create(Tagcorrelations tagcorrelations) {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Tag referencedTagId = tagcorrelations.getReferencedTagId();
            if (referencedTagId != null) {
                referencedTagId = em.getReference(referencedTagId.getClass(), referencedTagId.getId());
                tagcorrelations.setReferencedTagId(referencedTagId);
            }
            Tag mainTagId = tagcorrelations.getMainTagId();
            if (mainTagId != null) {
                mainTagId = em.getReference(mainTagId.getClass(), mainTagId.getId());
                tagcorrelations.setMainTagId(mainTagId);
            }
            em.persist(tagcorrelations);
            if (referencedTagId != null) {
                referencedTagId.getTagcorrelationsList().add(tagcorrelations);
                referencedTagId = em.merge(referencedTagId);
            }
            if (mainTagId != null) {
                mainTagId.getTagcorrelationsList().add(tagcorrelations);
                mainTagId = em.merge(mainTagId);
            }
            em.getTransaction().commit();
        } finally {
            if (em != null) {
View Full Code Here

        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Tagcorrelations persistentTagcorrelations = em.find(Tagcorrelations.class, tagcorrelations.getId());
            Tag referencedTagIdOld = persistentTagcorrelations.getReferencedTagId();
            Tag referencedTagIdNew = tagcorrelations.getReferencedTagId();
            Tag mainTagIdOld = persistentTagcorrelations.getMainTagId();
            Tag mainTagIdNew = tagcorrelations.getMainTagId();
            if (referencedTagIdNew != null) {
                referencedTagIdNew = em.getReference(referencedTagIdNew.getClass(), referencedTagIdNew.getId());
                tagcorrelations.setReferencedTagId(referencedTagIdNew);
            }
            if (mainTagIdNew != null) {
                mainTagIdNew = em.getReference(mainTagIdNew.getClass(), mainTagIdNew.getId());
                tagcorrelations.setMainTagId(mainTagIdNew);
            }
            tagcorrelations = em.merge(tagcorrelations);
            if (referencedTagIdOld != null && !referencedTagIdOld.equals(referencedTagIdNew)) {
                referencedTagIdOld.getTagcorrelationsList().remove(tagcorrelations);
                referencedTagIdOld = em.merge(referencedTagIdOld);
            }
            if (referencedTagIdNew != null && !referencedTagIdNew.equals(referencedTagIdOld)) {
                referencedTagIdNew.getTagcorrelationsList().add(tagcorrelations);
                referencedTagIdNew = em.merge(referencedTagIdNew);
            }
            if (mainTagIdOld != null && !mainTagIdOld.equals(mainTagIdNew)) {
                mainTagIdOld.getTagcorrelationsList().remove(tagcorrelations);
                mainTagIdOld = em.merge(mainTagIdOld);
            }
            if (mainTagIdNew != null && !mainTagIdNew.equals(mainTagIdOld)) {
                mainTagIdNew.getTagcorrelationsList().add(tagcorrelations);
                mainTagIdNew = em.merge(mainTagIdNew);
            }
            em.getTransaction().commit();
        } catch (Exception ex) {
            String msg = ex.getLocalizedMessage();
View Full Code Here

                tagcorrelations = em.getReference(Tagcorrelations.class, id);
                tagcorrelations.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The tagcorrelations with id " + id + " no longer exists.", enfe);
            }
            Tag referencedTagId = tagcorrelations.getReferencedTagId();
            if (referencedTagId != null) {
                referencedTagId.getTagcorrelationsList().remove(tagcorrelations);
                referencedTagId = em.merge(referencedTagId);
            }
            Tag mainTagId = tagcorrelations.getMainTagId();
            if (mainTagId != null) {
                mainTagId.getTagcorrelationsList().remove(tagcorrelations);
                mainTagId = em.merge(mainTagId);
            }
            em.remove(tagcorrelations);
            em.getTransaction().commit();
        } finally {
View Full Code Here

            Courses courseId = coursetag.getCourseId();
            if (courseId != null) {
                courseId = em.getReference(courseId.getClass(), courseId.getCourseId());
                coursetag.setCourseId(courseId);
            }
            Tag tagId = coursetag.getTagId();
            if (tagId != null) {
                tagId = em.getReference(tagId.getClass(), tagId.getId());
                coursetag.setTagId(tagId);
            }
            List<Tagrates> attachedTagratesList = new ArrayList<Tagrates>();
            for (Tagrates tagratesListTagratesToAttach : coursetag.getTagratesList()) {
                tagratesListTagratesToAttach = em.getReference(tagratesListTagratesToAttach.getClass(), tagratesListTagratesToAttach.getId());
                attachedTagratesList.add(tagratesListTagratesToAttach);
            }
            coursetag.setTagratesList(attachedTagratesList);
            em.persist(coursetag);
            if (courseId != null) {
                courseId.getCoursetagList().add(coursetag);
                courseId = em.merge(courseId);
            }
            if (tagId != null) {
                tagId.getCoursetagList().add(coursetag);
                tagId = em.merge(tagId);
            }
            for (Tagrates tagratesListTagrates : coursetag.getTagratesList()) {
                Coursetag oldCourseTagIdOfTagratesListTagrates = tagratesListTagrates.getCourseTagId();
                tagratesListTagrates.setCourseTagId(coursetag);
View Full Code Here

            em = getEntityManager();
            em.getTransaction().begin();
            Coursetag persistentCoursetag = em.find(Coursetag.class, coursetag.getId());
            Courses courseIdOld = persistentCoursetag.getCourseId();
            Courses courseIdNew = coursetag.getCourseId();
            Tag tagIdOld = persistentCoursetag.getTagId();
            Tag tagIdNew = coursetag.getTagId();
            List<Tagrates> tagratesListOld = persistentCoursetag.getTagratesList();
            List<Tagrates> tagratesListNew = coursetag.getTagratesList();
            List<String> illegalOrphanMessages = null;
            for (Tagrates tagratesListOldTagrates : tagratesListOld) {
                if (!tagratesListNew.contains(tagratesListOldTagrates)) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("You must retain Tagrates " + tagratesListOldTagrates + " since its courseTagId field is not nullable.");
                }
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            if (courseIdNew != null) {
                courseIdNew = em.getReference(courseIdNew.getClass(), courseIdNew.getCourseId());
                coursetag.setCourseId(courseIdNew);
            }
            if (tagIdNew != null) {
                tagIdNew = em.getReference(tagIdNew.getClass(), tagIdNew.getId());
                coursetag.setTagId(tagIdNew);
            }
            List<Tagrates> attachedTagratesListNew = new ArrayList<Tagrates>();
            for (Tagrates tagratesListNewTagratesToAttach : tagratesListNew) {
                tagratesListNewTagratesToAttach = em.getReference(tagratesListNewTagratesToAttach.getClass(), tagratesListNewTagratesToAttach.getId());
                attachedTagratesListNew.add(tagratesListNewTagratesToAttach);
            }
            tagratesListNew = attachedTagratesListNew;
            coursetag.setTagratesList(tagratesListNew);
            coursetag = em.merge(coursetag);
            if (courseIdOld != null && !courseIdOld.equals(courseIdNew)) {
                courseIdOld.getCoursetagList().remove(coursetag);
                courseIdOld = em.merge(courseIdOld);
            }
            if (courseIdNew != null && !courseIdNew.equals(courseIdOld)) {
                courseIdNew.getCoursetagList().add(coursetag);
                courseIdNew = em.merge(courseIdNew);
            }
            if (tagIdOld != null && !tagIdOld.equals(tagIdNew)) {
                tagIdOld.getCoursetagList().remove(coursetag);
                tagIdOld = em.merge(tagIdOld);
            }
            if (tagIdNew != null && !tagIdNew.equals(tagIdOld)) {
                tagIdNew.getCoursetagList().add(coursetag);
                tagIdNew = em.merge(tagIdNew);
            }
            for (Tagrates tagratesListNewTagrates : tagratesListNew) {
                if (!tagratesListOld.contains(tagratesListNewTagrates)) {
                    Coursetag oldCourseTagIdOfTagratesListNewTagrates = tagratesListNewTagrates.getCourseTagId();
View Full Code Here

            Courses courseId = coursetag.getCourseId();
            if (courseId != null) {
                courseId.getCoursetagList().remove(coursetag);
                courseId = em.merge(courseId);
            }
            Tag tagId = coursetag.getTagId();
            if (tagId != null) {
                tagId.getCoursetagList().remove(coursetag);
                tagId = em.merge(tagId);
            }
            em.remove(coursetag);
            em.getTransaction().commit();
        } finally {
View Full Code Here

TOP

Related Classes of entity.Tag

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.