Package at.bestsolution.efxclipse.runtime.examples.e4.model

Examples of at.bestsolution.efxclipse.runtime.examples.e4.model.Person


    }
  }
 
  public Person findPerson( int id )
  {
    Person person = new Person();
   
    for (Person tmp : listPerson)
    {
      if ( tmp.getId()==id )
      {
View Full Code Here


 
  public Person getNewPerson()
  {
    int id=0;
   
    Person person = new Person();
   
    try
    {
      model.Connect();
      id=model.MaxId();
      model.Disconnect();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    person.setId(id+1);

    return person;
  }
View Full Code Here

    return person;
  }
 
  public Person newPerson( HttpServletRequest request )
  {
    Person person = new Person();
    ArrayList<Phone> phones = new ArrayList<Phone>();
    String phone = "phone[0].phone";;
    int i=0;
   
    person.setId( Integer.parseInt(request.getParameter("id")) );
    person.setFistname(request.getParameter("fistname"));
    person.setSurname(request.getParameter("surname"));
    person.setAge( Integer.parseInt(request.getParameter("age")) );
   
    while(request.getParameter(phone)!=null)
    {
      phones.add(new Phone( request.getParameter(phone) ));
      phone = "phone["+i+"].phone";
      i++;
    }
   
    if (!phones.isEmpty())
    {
      phones.remove(0);
    }
   
    person.setPhone(phones);
   
    return person;
  }
View Full Code Here

  @Override
  public Person Read(int id) throws SQLException
  {
    statement = connection.createStatement();
    Person person=null;
    ArrayList<Phone> phones = null;
   
    query="SELECT * FROM PERSONS WHERE ID="+id+";";
    result = statement.executeQuery(query);
    result.next();
   
    if (result.getRow()==1)
    {
      person = new Person();  
      person.setId(result.getInt("ID"));
      person.setFistname(result.getNString("FISTNAME"));
      person.setSurname(result.getNString("SURNAME"));
      person.setAge(result.getInt("AGE"));
     
      Statement statementPhone = connection.createStatement();

      query="SELECT * FROM PHONES WHERE PERSONID="+id+";";
      ResultSet resultPhone = statementPhone.executeQuery(query);
      phones = new ArrayList<Phone>();
     
      while (resultPhone.next())
      { 
        Phone phone = new Phone();
        phone.setPhone(resultPhone.getNString("PHONE"));
        phones.add(phone);
      }
      statementPhone.close();
      person.setPhone(phones);
    }
    statement.close();
    return person;
  }
View Full Code Here

  public ArrayList<Person> ReadAll() throws SQLException
  {
    statement = connection.createStatement();
    ArrayList<Person> list = new ArrayList<Person>();
    ArrayList<Phone> phones;
    Person person;
   
    query="SELECT * FROM PERSONS;";
    result = statement.executeQuery(query);
 
    while ( result.next() )
    {  
      person = new Person();
      person.setId(result.getInt("ID"));
      person.setFistname(result.getNString("FISTNAME"));
      person.setSurname(result.getNString("SURNAME"));
      person.setAge(result.getInt("AGE"));
     
      phones = new ArrayList<Phone>();
     
      query="SELECT * FROM PHONES WHERE PERSONID="+person.getId()+";";
      Statement statementPhone = connection.createStatement();
      ResultSet resultPhone = statementPhone.executeQuery(query);
     
      while (resultPhone.next())
      { 
        Phone phone = new Phone();
        phone.setPhone(resultPhone.getNString("PHONE"));
        phones.add(phone);
      }
      resultPhone.close();
      person.setPhone(phones);
      list.add(person);
    }
    statement.close();
    return list;
  }
View Full Code Here

 
  private List<Person> createList() {
    List<Person> rv = new ArrayList<Person>();
   
    {
      Person p = new Person("Tom","Schindl");
      p.setStreet("Bahnhofstrasse 1");
      p.setZip("6020");
      p.setCity("Innsbruck");
      rv.add(p)
    }
   
    {
      Person p = new Person("John","Doe");
      p.setStreet("Mainstreet 1");
      p.setZip("E10E4");
      p.setCity("San Francisco");
      rv.add(p);
    }
   
    return rv;
  }
View Full Code Here

        Map<String, ?> data = loadPersonData(personId);
        if (data.containsKey("not_found")) {
            throw new RuntimeException("Data for Person " + personId + " not found.");
        }
        movieDbJsonMapper.mapToPerson(data, person);
        Person persistentPerson = em.find(Person.class, person.getId());
        if (persistentPerson == null) {
            em.persist(person);
        }
    }
View Full Code Here

TOP

Related Classes of at.bestsolution.efxclipse.runtime.examples.e4.model.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.