[mhk] r1056 committed - Families on FamilyWorker thread @mhk_families

1 view
Skip to first unread message

codesite...@google.com

unread,
May 2, 2013, 5:31:00 PM5/2/13
to mhk-dis...@googlegroups.com
Revision: 1056
Author: tbc...@gmail.com
Date: Thu May 2 14:30:39 2013
Log: Families on FamilyWorker thread @mhk_families
http://code.google.com/p/mhk/source/detail?r=1056

Modified:
/branches/mhk_families/idb/etc/template/new/rperson_show.vm
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/geneology/FamilyWorker.java

/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings.properties

/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings_pt.properties

=======================================
--- /branches/mhk_families/idb/etc/template/new/rperson_show.vm Fri Aug 5
11:28:45 2011
+++ /branches/mhk_families/idb/etc/template/new/rperson_show.vm Thu May 2
14:30:39 2013
@@ -69,7 +69,7 @@
<li><a
href="${uri}?dbname=$db.dbname&action=exec&script=rperson_acts.vm&rid=$Entity.id&name=$!Entity.description">$mhks.get('rperson.all.acts')</a></li>
<li><a
href="${uri}?dbname=$db.dbname&action=exec&script=rperson_related.vm&rid=$Entity.id&name=$!Entity.description">$mhks.get('rperson.related')</a></li>
<li><a
href="${uri}?dbname=$db.dbname&action=exec&script=rperson_identification.vm&rid=$Entity.id&name=$!Entity.description">$mhks.get('rperson.identification')</a></li>
- ##<li><a
href="${uri}?dbname=$db.dbname&action=exec&script=rperson_family.vm&rid=$Entity.id&name=$!Entity.description">Family</a></li>
+ <li><a
href="${uri}?dbname=$db.dbname&action=exec&script=rperson_family.vm&rid=$Entity.id&name=$!Entity.description">$mhks.get('rperson.family')</a></li>
</ul>

</div>
=======================================
---
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/geneology/FamilyWorker.java
Mon Nov 29 10:12:47 2010
+++
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/geneology/FamilyWorker.java
Thu May 2 14:30:39 2013
@@ -34,128 +34,386 @@
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Vector;
+

import pt.uc.cisuc.jrc.mhk.rch.DBSystem;
import pt.uc.cisuc.jrc.mhk.thread.BackgroundThread;
import pt.uc.cisuc.jrc.mhk.thread.Worker;
+import pt.uc.cisuc.jrc.mhk.objects.*;

public class FamilyWorker implements Worker {
-
+ Connection conn;
+ DBSystem system;
+ HashMap <String,String> locked_child_ids;
+
@Override
public void exec(Hashtable task, BackgroundThread bg) throws Exception {
// TODO Auto-generated method stub
-
- DBSystem system= (DBSystem) task.get("db");
- Connection conn;
- ResultSet rs;
- ResultSet rs2;
- Statement stmt ;
- Statement stmt2 ;
- Statement stmt3 ;
- String pn, mn,n;
- String father,mother,child;
+ System.out.println("FAMILY WORKER ");

- boolean hasRealPerson = false;
-
- String user = system.getMhkUser();
+ system= (DBSystem) task.get("db");

- //System.out.println("entering insertRfamilies with "+user);
- bg.output_message("FamilyWorker: inserting Families with "+user);
-
+ createFamilies();
+
+
+// DBSystem system= (DBSystem) task.get("db");
+// Connection conn;
+// ResultSet rs;
+// ResultSet rs2;
+// Statement stmt ;
+// Statement stmt2 ;
+// Statement stmt3 ;
+// String pn, mn,n;
+// String father,mother,child;
+//
+// boolean hasRealPerson = false;
+//
+// String user = system.getMhkUser();
+//
+// //System.out.println("entering insertRfamilies with "+user);
+// bg.output_message("FamilyWorker: inserting Families with "+user);
+//
+// conn = system.getConn();
+//
+// try {
+//
+// stmt3 = conn.createStatement();
+// stmt = conn.createStatement();
+// rs = stmt.executeQuery("SELECT * FROM families F");
+//
+// while(rs.next()){
+//
+// /**
+// * Assigns the id of the ocurrence to each family member
+// */
+// mother = mn = rs.getString("mn");
+// father = pn = rs.getString("pn");
+// child = n = rs.getString("n");
+//
+// //System.out.println("father -> "+father);
+//
+// /**
+// * If one of the ocurrences is connnected to a real person the id of
the ocurrence is replaced with the rid of that person
+// */
+//
+// /**
+// * tabelas com associação aos utilizadores .. meter o id referente
ao utilizador que o identificou.
+// *
+// *
+// */
+//
+// /**
+// * all the queries are done regarding the actual user
+// */
+// stmt2 = conn.createStatement();
+// if((rs2=(stmt2.executeQuery("SELECT * FROM lpersons l where
id='"+pn+"' AND rid IS NOT NULL"))).next()){// AND user = '"+user+"' OR
user = 'eiras' OR user = NULL "))).next()){
+// //System.out.println("real father -> "+pn+" name
-> "+rs2.getString("name"));
+// father=rs2.getString("rid");
+// hasRealPerson=true;
+// }
+// if((rs2=(stmt2.executeQuery("SELECT * FROM lpersons l where
id='"+mn+"' AND rid IS NOT NULL"))).next()){// AND user = '"+user+"' OR
user = 'eiras' OR user = NULL "))).next()){
+// //System.out.println("real mother -> "+mn+" name
-> "+rs2.getString("name"));
+// mother=rs2.getString("rid");
+// hasRealPerson=true;
+// }
+// if((rs2=(stmt2.executeQuery("SELECT * FROM lpersons l where
id='"+n+"' AND rid IS NOT NULL"))).next()){// AND user = '"+user+"' OR user
= 'eiras' OR user = NULL "))).next()){
+// //System.out.println("real child -> "+n+" name
-> "+rs2.getString("name"));
+// child=rs2.getString("rid");
+// }
+//
+// //System.out.println("family -> "+father+" "+mother+" "+child);
+//
+// /**
+// *If the father nor the mother is a real person the family isn't
inserted..
+// */
+// if(hasRealPerson){
+//
+// hasRealPerson=false;
+//
+// /**
+// * Checks if the Family and the child is already in the RFamily and
in the RChildren tables
+// */
+// if(!((stmt2.executeQuery("SELECT * FROM rfamily WHERE
rid_pn='"+father+"' AND rid_mn='"+mother+"'")).next())){// AND user
= '"+user+"' ")).next())){
+// ResultSet aux = stmt3.executeQuery("SELECT * FROM rfamily");
+// //TODO refazer esta parte do codigo
+// String id = null;
+// if ( aux != null && aux.next() ) {
+// aux.last();
+// String x = aux.getString("id");
+// x=x.replace("Rfam-", "");
+// id = "Rfam-"+(Integer.parseInt(x)+1);
+// }else{
+// //System.out.println("pois");
+// id = "Rfam-1";
+// }
+//
+// java.sql.Date sqlDate = new java.sql.Date(new
java.util.Date().getTime());
+// stmt2.executeUpdate("INSERT INTO rfamily
(id,rid_pn,rid_mn,Date_proc,user) VALUES
('"+id+"','"+father+"' , '"+mother+"','"+sqlDate+"','"+user+"')");
+// }
+//
+// /**
+// * tenho que verificar se o filho já está inserido, pode
detectar-se a mesma ocorrencia num baptizado e num casamento inserindo 2as
xs a mesma criança
+// *
+// */
+// if(!((stmt2.executeQuery("SELECT * FROM rchildren WHERE
rid='"+child+"'")).next())){
+// (rs2=(stmt2.executeQuery("SELECT * FROM rfamily WHERE
rid_pn='"+father+"' AND rid_mn='"+mother+"'"))).next();
+// stmt2.executeUpdate("INSERT INTO rchildren (rfamily_id,rid,user)
VALUES ('"+rs2.getString("id")+"','"+child+"','"+user+"')");
+// }
+//
+// }
+// }
+//
+// } catch (Exception e) {e.printStackTrace();}
+// system.closeConn(conn);
+// bg.output_message("FamilyWorker: finished inserting Families
with "+user);
+
+ }
+
+ public void createFamilies(){
+ ResultSet persons=null,relations=null;
+ Statement stmt;
conn = system.getConn();
-
+ Vector <Person> persons_vec=new Vector<Person>();
+ HashMap <String,String> persons_hash=new HashMap<String,String>();
+ Vector <Relation> relations_vec=new Vector<Relation>();
try {
-
- stmt3 = conn.createStatement();
stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT * FROM families F");
-
- while(rs.next()){
-
- /**
- * Assigns the id of the ocurrence to each family member
- */
- mother = mn = rs.getString("mn");
- father = pn = rs.getString("pn");
- child = n = rs.getString("n");
-
- //System.out.println("father -> "+father);
-
- /**
- * If one of the ocurrences is connnected to a real person the id of
the ocurrence is replaced with the rid of that person
- */
-
- /**
- * tabelas com associação aos utilizadores .. meter o id referente
ao utilizador que o identificou.
- *
- *
- */
-
- /**
- * all the queries are done regarding the actual user
- */
- stmt2 = conn.createStatement();
- if((rs2=(stmt2.executeQuery("SELECT * FROM lpersons l where
id='"+pn+"' AND rid IS NOT NULL"))).next()){// AND user = '"+user+"' OR
user = 'eiras' OR user = NULL "))).next()){
- //System.out.println("real father -> "+pn+" name
-> "+rs2.getString("name"));
- father=rs2.getString("rid");
- hasRealPerson=true;
+ persons = stmt.executeQuery("SELECT * FROM persons");
+ stmt = conn.createStatement();
+ relations = stmt.executeQuery("SELECT * FROM relations");
+ try{
+ while(persons.next()){
+ Person p=new Person();
+ p.id=persons.getString("id");
+ p.sex=persons.getString("sex");
+ if(p.sex==null)
+ p.sex="N/A";
+ persons_vec.add(p);
+ persons_hash.put(p.id,p.sex);
}
- if((rs2=(stmt2.executeQuery("SELECT * FROM lpersons l where
id='"+mn+"' AND rid IS NOT NULL"))).next()){// AND user = '"+user+"' OR
user = 'eiras' OR user = NULL "))).next()){
- //System.out.println("real mother -> "+mn+" name
-> "+rs2.getString("name"));
- mother=rs2.getString("rid");
- hasRealPerson=true;
+
+ while(relations.next()){
+ Relation r=new Relation();
+ r.origin=relations.getString("origin");
+ r.destination=relations.getString("destination");
+ r.value=relations.getString("the_value");
+ if(persons_hash.containsKey(r.origin) &&
persons_hash.containsKey(r.destination))
+ relations_vec.add(r);
}
- if((rs2=(stmt2.executeQuery("SELECT * FROM lpersons l where id='"+n+"'
AND rid IS NOT NULL"))).next()){// AND user = '"+user+"' OR user = 'eiras'
OR user = NULL "))).next()){
- //System.out.println("real child -> "+n+" name
-> "+rs2.getString("name"));
- child=rs2.getString("rid");
+ }catch(Exception e) {e.printStackTrace();}
+ } catch (Exception e) {e.printStackTrace();}
+
+ System.out.println("Persons size="+persons_vec.size());
+ System.out.println("Relations size="+relations_vec.size());
+
+// for(int i=0;i<relations_vec.size();i++){
+//
System.out.println(relations_vec.get(i).origin+" "+relations_vec.get(i).destination+" "+relations_vec.get(i).value);
+// }
+// System.out.println("");
+// for(int i=0;i<persons_vec.size();i++){
+// System.out.println(persons_vec.get(i).id+" "+persons_vec.get(i).sex);
+// }
+
+
+ //family algorithm
+ HashMap <String,PersonFamilies> person_families=new
HashMap<String,PersonFamilies>();
+ for(int i=0;i<persons_vec.size();i++){
+ String person_id=persons_vec.get(i).id;
+ String person_sex=persons_vec.get(i).sex;
+
+ // familias em que person e filho/filha (uma) ou em que foi ou e
marido/mulher sem filhos
+ PersonFamilies pf=new PersonFamilies(person_id,person_sex);
+ Family family=new Family();
+ family.setChild(person_id);
+ int count_relations=0;
+ //System.out.println("PERSON "+person_id);
+ for(int j=0;j<relations_vec.size();j++){
+ //System.out.println("TESTE rel "+j);
+ if(relations_vec.get(j).destination.equals(person_id)){//-----relacao
comeca no destino
+ if(relations_vec.get(j).value.equalsIgnoreCase("pai"))
+ family.setFather(relations_vec.get(j).origin);
+ else if(relations_vec.get(j).value.equalsIgnoreCase("mae"))
+ family.setMother(relations_vec.get(j).origin);
+ else if((relations_vec.get(j).value.equalsIgnoreCase("mulher") ||
relations_vec.get(j).value.equalsIgnoreCase("foi-mulher")) &&
persons_hash.get(relations_vec.get(j).destination).equalsIgnoreCase("F")){
+ //System.out.println("MULHER 1");
+ Family f=new Family();
+ f.setMother(relations_vec.get(j).destination);
+ f.setFather(relations_vec.get(j).origin);
+ pf.getFamiliesWh().add(f);
+ }
+ else if((relations_vec.get(j).value.equalsIgnoreCase("marido") ||
relations_vec.get(j).value.equalsIgnoreCase("foi-marido")) &&
persons_hash.get(relations_vec.get(j).destination).equalsIgnoreCase("M")){
+ //System.out.println("MARIDO 1");
+ Family f=new Family();
+ f.setMother(relations_vec.get(j).origin);
+ f.setFather(relations_vec.get(j).destination);
+ pf.getFamiliesWh().add(f);
+ }
}
-
- //System.out.println("family -> "+father+" "+mother+" "+child);
-
- /**
- *If the father nor the mother is a real person the family isn't
inserted..
- */
- if(hasRealPerson){
-
- hasRealPerson=false;
-
- /**
- * Checks if the Family and the child is already in the RFamily and
in the RChildren tables
- */
- if(!((stmt2.executeQuery("SELECT * FROM rfamily WHERE
rid_pn='"+father+"' AND rid_mn='"+mother+"'")).next())){// AND user
= '"+user+"' ")).next())){
- ResultSet aux = stmt3.executeQuery("SELECT * FROM rfamily");
- //TODO refazer esta parte do codigo
- String id = null;
- if ( aux != null && aux.next() ) {
- aux.last();
- String x = aux.getString("id");
- x=x.replace("Rfam-", "");
- id = "Rfam-"+(Integer.parseInt(x)+1);
- }else{
- //System.out.println("pois");
- id = "Rfam-1";
+ else if(relations_vec.get(j).origin.equals(person_id)){//-----relacao
comeca na origem
+ String father_id=null,mother_id=null,parent_id=null;
+ if((relations_vec.get(j).value.equalsIgnoreCase("marido") ||
relations_vec.get(j).value.equalsIgnoreCase("foi-marido")) &&
persons_hash.get(relations_vec.get(j).origin).equalsIgnoreCase("M")){
+ //System.out.println("MARIDO 2");
+ Family f=new Family();
+ f.setMother(relations_vec.get(j).destination);
+ f.setFather(relations_vec.get(j).origin);
+ pf.getFamiliesWh().add(f);
+ }
+ else if((relations_vec.get(j).value.equalsIgnoreCase("mulher") ||
relations_vec.get(j).value.equalsIgnoreCase("foi-mulher")) &&
persons_hash.get(relations_vec.get(j).origin).equalsIgnoreCase("F")){
+ //System.out.println("MULHER 2");
+ Family f=new Family();
+ f.setMother(relations_vec.get(j).origin);
+ f.setFather(relations_vec.get(j).destination);
+ pf.getFamiliesWh().add(f);
+ }
+ else if(relations_vec.get(j).value.equalsIgnoreCase("filho") ||
relations_vec.get(j).value.equalsIgnoreCase("filha")){
+
if(persons_hash.get(relations_vec.get(j).destination).equalsIgnoreCase("M"))
+ father_id=relations_vec.get(j).destination;
+ else
if(persons_hash.get(relations_vec.get(j).destination).equalsIgnoreCase("F"))
+ mother_id=relations_vec.get(j).destination;
+ else
if(persons_hash.get(relations_vec.get(j).destination).equalsIgnoreCase("N/A"))
+ parent_id=relations_vec.get(j).destination;
+ }
+ //trata parente generico(sem sexo definido) como homem
+ if(parent_id!=null)
+ father_id=parent_id;
+
+ if(mother_id!=null)
+ family.setMother(mother_id);
+ if(father_id!=null)
+ family.setFather(father_id);
+ }
+ }
+ pf.getFamiliesN().add(family);
+ if(person_sex.equalsIgnoreCase("M") ||
person_sex.equalsIgnoreCase("N/A")){//-----familias em que person e pai
+ //System.out.println("PERSON "+person_id);
+ // familias em que person e pai
+ locked_child_ids=new HashMap <String,String>();
+ for(int j=0;j<relations_vec.size();j++){
+ if(relations_vec.get(j).origin.equals(person_id)
&& !locked_child_ids.containsKey(relations_vec.get(j).destination)){
+ //System.out.println("ENTRA");
+ if(relations_vec.get(j).value.equalsIgnoreCase("pai")){
+
//System.out.println("PAI->FILHO "+relations_vec.get(j).origin+" "+person_id+" "+j);
+ family=new Family();
+ family.setFather(person_id);
+ family.setChild(relations_vec.get(j).destination);
+ locked_child_ids.put(relations_vec.get(j).destination,"");
+ for(int k=0;k<relations_vec.size();k++){
+
if(relations_vec.get(k).destination.equals(relations_vec.get(j).destination)){
+ if(relations_vec.get(k).value.equalsIgnoreCase("mae")){
+ family.setMother(relations_vec.get(k).origin);
+ break;
+ }
+ }
+ }
+ pf.getFamiliesMpn().add(family);
}
-
- java.sql.Date sqlDate = new java.sql.Date(new
java.util.Date().getTime());
- stmt2.executeUpdate("INSERT INTO rfamily
(id,rid_pn,rid_mn,Date_proc,user) VALUES
('"+id+"','"+father+"' , '"+mother+"','"+sqlDate+"','"+user+"')");
}
-
- /**
- * tenho que verificar se o filho já está inserido, pode
detectar-se a mesma ocorrencia num baptizado e num casamento inserindo 2as
xs a mesma criança
- *
- */
- if(!((stmt2.executeQuery("SELECT * FROM rchildren WHERE
rid='"+child+"'")).next())){
- (rs2=(stmt2.executeQuery("SELECT * FROM rfamily WHERE
rid_pn='"+father+"' AND rid_mn='"+mother+"'"))).next();
- stmt2.executeUpdate("INSERT INTO rchildren (rfamily_id,rid,user)
VALUES ('"+rs2.getString("id")+"','"+child+"','"+user+"')");
+ else if(relations_vec.get(j).destination.equals(person_id)
&& !locked_child_ids.containsKey(relations_vec.get(j).origin)){
+ if((relations_vec.get(j).value.equalsIgnoreCase("filho") ||
relations_vec.get(j).value.equalsIgnoreCase("filha"))){
+
//System.out.println("FILHO->PAI "+relations_vec.get(j).origin+" "+person_id);
+ family=new Family();
+ family.setFather(person_id);
+ family.setChild(relations_vec.get(j).origin);
+ locked_child_ids.put(relations_vec.get(j).origin,"");
+ for(int k=0;k<relations_vec.size();k++){
+
if(relations_vec.get(k).destination.equals(relations_vec.get(j).origin)){
+ if(relations_vec.get(k).value.equalsIgnoreCase("mae")){
+ family.setMother(relations_vec.get(k).origin);
+ break;
+ }
+ }
+ }
+ pf.getFamiliesMpn().add(family);
+ }
}
-
}
+ person_families.put(person_id,pf);
}
-
+ if(person_sex!=null &&
person_sex.equalsIgnoreCase("F")){//-----familias em que person e mae
+ // familias em que person e mae
+ locked_child_ids=new HashMap <String,String>();
+ for(int j=0;j<relations_vec.size();j++){
+ if(relations_vec.get(j).origin.equals(person_id)
&& !locked_child_ids.containsKey(relations_vec.get(j).destination)){
+ if(relations_vec.get(j).value.equalsIgnoreCase("mae")){
+
//System.out.println("MAE->FILHO "+relations_vec.get(j).origin+" "+person_id+" "+j);
+ family=new Family();
+ family.setMother(person_id);
+ family.setChild(relations_vec.get(j).destination);
+ locked_child_ids.put(relations_vec.get(j).destination,"");
+ for(int k=0;k<relations_vec.size();k++){
+
if(relations_vec.get(k).destination.equals(relations_vec.get(j).destination)){
+ if(relations_vec.get(k).value.equalsIgnoreCase("pai")){
+ family.setFather(relations_vec.get(k).origin);
+ break;
+ }
+ }
+ }
+ pf.getFamiliesMpn().add(family);
+ }
+ }
+ else if(relations_vec.get(j).destination.equals(person_id)
&& !locked_child_ids.containsKey(relations_vec.get(j).origin)){
+ if((relations_vec.get(j).value.equalsIgnoreCase("filho") ||
relations_vec.get(j).value.equalsIgnoreCase("filha"))){
+
//System.out.println("FILHO->MAE "+relations_vec.get(j).origin+" "+person_id);
+ family=new Family();
+ family.setMother(person_id);
+ family.setChild(relations_vec.get(j).origin);
+ locked_child_ids.put(relations_vec.get(j).origin,"");
+ for(int k=0;k<relations_vec.size();k++){
+
if(relations_vec.get(k).destination.equals(relations_vec.get(j).origin)){
+ if(relations_vec.get(k).value.equalsIgnoreCase("pai")){
+ family.setFather(relations_vec.get(k).origin);
+ break;
+ }
+ }
+ }
+ pf.getFamiliesMpn().add(family);
+ }
+ }
+ }
+ person_families.put(person_id,pf);
+ }
+ }
+
+// System.out.println(person_families.size());
+// //print all person families found
+// for(PersonFamilies pf : person_families.values()){
+// System.out.println("PERSON "+pf.getId()+" "+pf.getSex());
+// System.out.println("FAMILIAS EM QUE E FILHO");
+// for(int j=0;j<pf.getFamiliesN().size();j++)
+// System.out.println("CHILD="+pf.getFamiliesN().get(j).getChild()+"
FATHER="+pf.getFamiliesN().get(j).getFather()+"
MOTHER="+pf.getFamiliesN().get(j).getMother());
+// System.out.println("FAMILIAS EM QUE E PAI OU MAE");
+// for(int j=0;j<pf.getFamiliesMpn().size();j++)
+// System.out.println("CHILD="+pf.getFamiliesMpn().get(j).getChild()+"
FATHER="+pf.getFamiliesMpn().get(j).getFather()+"
MOTHER="+pf.getFamiliesMpn().get(j).getMother());
+// System.out.println("FAMILIAS EM QUE E OU FOI MARIDO OU MULHER");
+// for(int j=0;j<pf.getFamiliesWh().size();j++)
+// System.out.println("CHILD="+pf.getFamiliesWh().get(j).getChild()+"
FATHER="+pf.getFamiliesWh().get(j).getFather()+"
MOTHER="+pf.getFamiliesWh().get(j).getMother());
+// System.out.println("");
+// }
+
+ //write families on DB
+ HashMap <String,String> locked_families=new HashMap<String,String>();
+ try {
+ stmt = conn.createStatement();
+ stmt.executeUpdate("DELETE FROM FAMILY");
+ for(PersonFamilies family : person_families.values()){
+ for(int i=0;i<family.getFamiliesN().size();i++){
+
if(!locked_families.containsKey(family.getFamiliesN().get(i).getChild()+","+family.getFamiliesN().get(i).getFather()+","+family.getFamiliesN().get(i).getMother())){
+ stmt = conn.createStatement();
+ stmt.executeUpdate("INSERT INTO family (id_n,id_pn,id_mn)
values('"+family.getFamiliesN().get(i).getChild()+"','"+family.getFamiliesN().get(i).getFather()+"','"+family.getFamiliesN().get(i).getMother()+"')");
+
locked_families.put(family.getFamiliesN().get(i).getChild()+","+family.getFamiliesN().get(i).getFather()+","+family.getFamiliesN().get(i).getMother(),"");
+ }
+ }
+ for(int i=0;i<family.getFamiliesMpn().size();i++){
+
if(!locked_families.containsKey(family.getFamiliesMpn().get(i).getChild()+","+family.getFamiliesMpn().get(i).getFather()+","+family.getFamiliesMpn().get(i).getMother())){
+ stmt = conn.createStatement();
+ stmt.executeUpdate("INSERT INTO family (id_n,id_pn,id_mn)
values('"+family.getFamiliesMpn().get(i).getChild()+"','"+family.getFamiliesMpn().get(i).getFather()+"','"+family.getFamiliesMpn().get(i).getMother()+"')");
+
locked_families.put(family.getFamiliesMpn().get(i).getChild()+","+family.getFamiliesMpn().get(i).getFather()+","+family.getFamiliesMpn().get(i).getMother(),"");
+ }
+ }
+ }
} catch (Exception e) {e.printStackTrace();}
- system.closeConn(conn);
- bg.output_message("FamilyWorker: finished inserting Families
with "+user);
-
}

@Override
=======================================
---
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings.properties
Tue Mar 5 15:33:16 2013
+++
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings.properties
Thu May 2 14:30:39 2013
Binary file, no diff available.
=======================================
---
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings_pt.properties
Thu Mar 7 06:56:41 2013
+++
/branches/mhk_families/idb/pt/uc/cisuc/jrc/mhk/resources/MHKStrings_pt.properties
Thu May 2 14:30:39 2013
Binary file, no diff available.
Reply all
Reply to author
Forward
0 new messages