Package su.litvak.moviedb.entity

Examples of su.litvak.moviedb.entity.Person


        for (PersonPanel pp : lstPP) {
            if (pp.fld.getText().trim().isEmpty()) {
                continue;
            }

            Person p = new Person();
            p.name = pp.fld.getText().trim();
            newPersons.add(p);
        }

        for (Iterator<Person> it = persons.iterator(); it.hasNext(); ) {
View Full Code Here


    }

    private Set<Person> processNewPerson(Set<Person> persons) {
        Set<Person> toAdd = new HashSet<Person>();
        for (Person person : persons) {
            Person existing = (Person) Sessions.getSession().createCriteria(Person.class).add(Restrictions.eq("name", person.name)).uniqueResult();
            if (existing == null) {
                Sessions.getSession().save(person);
                toAdd.add(person);
            } else {
                person.id = existing.id;
View Full Code Here

            return;
        }
        s = s.trim();
        try {
            Sessions.beginTransaction();
            Person existing = (Person) Sessions.getSession().createCriteria(Person.class).add(Restrictions.eq("name", s)).uniqueResult();
            if (existing != null) {
                Sessions.rollbackTransaction();
                JOptionPane.showMessageDialog(this, "Person '" + existing + "' already exists.", "Add person", JOptionPane.WARNING_MESSAGE);
                return;
            }

            Person newPerson = new Person();
            newPerson.name = s;
            Sessions.getSession().save(newPerson);

            Sessions.commitTransaction();
View Full Code Here

    private void update() {
        if (tblPeople.getSelectedRow() < 0) {
            return;
        }

        Person person = tblModel.people.get(tblPeople.getSelectedRow());
        String s = JOptionPane.showInputDialog(PeoplePanel.this, "Enter new name for '" + person + "'",  person.name);
        if (s == null || s.trim().isEmpty()) {
            return;
        }
        s = s.trim();
        try {
            Sessions.beginTransaction();
            Person existing = (Person) Sessions.getSession().createCriteria(Person.class).add(Restrictions.eq("name", s)).uniqueResult();
            if (existing != null && existing.id != person.id) {
                Sessions.rollbackTransaction();
                JOptionPane.showMessageDialog(this, "Person '" + existing + "' already exists.", "Add person", JOptionPane.WARNING_MESSAGE);
                return;
            }
View Full Code Here

        int row = tblPeople.getSelectedRow();
        if (row < 0) {
            return;
        }

        Person person = tblModel.people.get(row);
        if (JOptionPane.showConfirmDialog(this, "Are you sure you want to delete '" + person + "'?", "Delete person", JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
            return;
        }
        Sessions.beginTransaction();
        try {
View Full Code Here

    }

    private void showPersonInfo() {
        JDialog dialog = new JDialog(getFrame(), "Person info", true);
        Sessions.beginTransaction();
        Person person = tblModel.people.get(tblPeople.getSelectedRow());
        PersonInfoPanel panel = new PersonInfoPanel((Person) Sessions.getSession().get(Person.class, person.id));
        Sessions.rollbackTransaction();

        /**
         * Show dialog
View Full Code Here

            return 1;
        }

        @Override
        public Object getValueAt(int rowIndex, int columnIndex) {
            Person person = people.get(rowIndex);

            switch (columnIndex) {
                case 0:
                    return person.name;
            }
View Full Code Here

TOP

Related Classes of su.litvak.moviedb.entity.Person

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.