示例#1
0
 /**
  * copy the person and the selected plan of the person
  *
  * @param person
  * @return
  */
 public static Person copyPerson(Person person) {
   Person newPerson = PersonImpl.createPerson(person.getId());
   PlanImpl newPlan = new PlanImpl();
   newPlan.copyFrom(person.getSelectedPlan());
   newPlan.setPerson(newPerson);
   newPerson.addPlan(newPlan);
   newPerson.setSelectedPlan(newPlan);
   PersonUtils.removeUnselectedPlans(newPerson);
   return newPerson;
 }
 private void startPerson(final Attributes atts) {
   String ageString = atts.getValue("age");
   //		int age = Integer.MIN_VALUE;
   Integer age = null;
   if (ageString != null) age = Integer.parseInt(ageString);
   this.currperson = PersonImpl.createPerson(Id.create(atts.getValue("id"), Person.class));
   PersonUtils.setSex(this.currperson, atts.getValue("sex"));
   PersonUtils.setAge(this.currperson, age);
   PersonUtils.setLicence(this.currperson, atts.getValue("license"));
   PersonUtils.setCarAvail(this.currperson, atts.getValue("car_avail"));
   String employed = atts.getValue("employed");
   if (employed == null) {
     PersonUtils.setEmployed(this.currperson, null);
   } else {
     PersonUtils.setEmployed(this.currperson, "yes".equals(employed));
   }
 }