Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 66704054

Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt

  • ID 667040543b00369aa9de9f48f1a87f14f70c4b2a
  • Vorgänger f682a8cb
  • Nachfolger 48245e6a

improvements

Unterschiede anzeigen:

samples/example/main.cpp
QTime t;
t.start();
CuteEntityManager::EntityManager *e = new
// CuteEntityManager::EntityManager("QSQLITE",
// QDir::currentPath() + "/db.sqlite");
CuteEntityManager::EntityManager("QSQLITE",
":memory:");
CuteEntityManager::EntityManager("QSQLITE",
QDir::currentPath() + "/db.sqlite");
// CuteEntityManager::EntityManager("QSQLITE",
// ":memory:");
/**
* @brief EntityInstanceFactory::registerClass<EntityClass>
......
QThread *entityManager = new QThread();
e->moveToThread(entityManager);
QStringList inits = QStringList() << "Contact" << "Address" <<
"Pupil" << "Group";
"Pupil" << "Group";
/**
* Instead of startup(version,qstringlist) you can call method createTable of EntityManager (e->create(sharedptr))
* startup will create tables inclusive relation tables for classes in QStringList inits
......
e->startup("0.1", inits);
QSharedPointer<CuteEntityManager::Entity> p =
QSharedPointer<CuteEntityManager::Entity>(new Person("Max", "Mustermann",
Person::Gender::MALE, "", "", "",
QDate::currentDate()));
QSharedPointer<CuteEntityManager::Entity>(new Person("Max", "Mustermann",
Person::Gender::MALE, "", "", "",
QDate::currentDate()));
/** ---------------------------------
* PERSIST
* ---------------------------------
......
gPtr->setName("9b");
QSharedPointer<Entity> groupPtr = gPtr.objectCast<Entity>();
QSharedPointer<Person> mainTeacher = QSharedPointer<Person>(new Person("Max",
"Mustermann", Person::Gender::MALE));
"Mustermann", Person::Gender::MALE));
gPtr->setMainTeacher(mainTeacher);
//Persons will also persisted
if(e->count(groupPtr->getTablename()) <= 0) {
if (e->count(groupPtr->getTablename()) <= 0) {
e->create(groupPtr, true, true);
}
......
qDebug() << "GroupSize:" << pers->getGroups().size();
/**
* or you can use following syntax:
* or you can use this syntax:
*/
qDebug() << "-----------------------------";
QSharedPointer<Person> foundMainTeacher = e->findById<Person *>
(1).objectCast<Person>();
qDebug() << "FoundMainTeacher:" << foundMainTeacher->toString();
qDebug() << "FoundMainTeacherGroupSize:" <<
foundMainTeacher->getMaintainedGroups().size();
foundMainTeacher->getMaintainedGroups().size();
qDebug() << "-----------------------------";
QSharedPointer<Pupil> foundPupil = e->findById<Pupil *>
(13).objectCast<Pupil>();
(13).objectCast<Pupil>();
qDebug() << "FoundPupil:" << foundPupil->toString();
qDebug() << "FoundPupilGroupSize:" <<
foundPupil->getGroups().size();
foundPupil->getGroups().size();
qDebug() << "-----------------------------";
samples/example/models/faker/createfakemodeldata.cpp
group->addPerson(new Person("Tim","Berg",Person::Gender::MALE,"Tim Berg.jpg",QString(),QString(),QDate(2000,7,13),0));
group->addPerson(new Person("Lena","Conrad",Person::Gender::FEMALE,"Lena Conrad.jpg",QString(),QString(),QDate(2000,7,13),0));
group->addPerson(new Person("Marcel","Dunst",Person::Gender::MALE,"Marcel Dunst.jpg",QString(),QString(),QDate(2000,7,13),0));
group->addPerson(new Person("Carsten","Ernst",Person::Gender::MALE,"Carsten Ernst.jpg",QString(),QString(),QDate(2000,7,13),0));
group->addPerson(new Person("Hannah","Eschborn",Person::Gender::FEMALE,"Hannah Eschborn.jpg",QString(),QString(),QDate(2000,7,13),0));
group->addPerson(new Person("Vera","Geseke",Person::Gender::FEMALE,"Vera Geseke.jpg",QString(),QString(),QDate(2000,4,1),0));
group->addPerson(new Person("Jann","Hagedorn",Person::Gender::MALE,"Jann Hagedorn.jpg",QString(),QString(),QDate(2000,8,16),0));
group->addPerson(new Person("Svenja","Hartmann",Person::Gender::FEMALE,"Svenja Hartmann.jpg",QString(),QString(),QDate(2000,2,2),0));
group->addPerson(new Person("Timo","Haufer",Person::Gender::MALE,"Timo Haufer.jpg",QString(),QString(),QDate(2000,2,28),0));
group->addPupil(new Pupil("Tim","Berg",Person::Gender::MALE,"Tim Berg.jpg",QString(),QString(),QDate(2000,7,13),"05c",0));
group->addPupil(new Pupil("Lena","Conrad",Person::Gender::FEMALE,"Lena Conrad.jpg",QString(),QString(),QDate(2000,7,13),"05c",0));
......
group->addPupil(new Pupil("Svenja","Hartmann",Person::Gender::FEMALE,"Svenja Hartmann.jpg",QString(),QString(),QDate(2000,2,2),"05c",0));
group->addPupil(new Pupil("Timo","Haufer",Person::Gender::MALE,"Timo Haufer.jpg",QString(),QString(),QDate(2000,2,28),"05c",0));
group->addPupil(new Pupil("Birthe","Jäger",Person::Gender::FEMALE,"Birthe Jaeger.jpg",QString(),QString(),QDate(2000,2,14),"05c",0));
group->addPupil(new Pupil("Torben","Kadatz",Person::Gender::MALE,"Torben Kadatz.jpg",QString(),QString(),QDate(2000,2,11),"05c",0));
group->addPupil(new Pupil("Julia","Kaiser",Person::Gender::FEMALE,"Julia Kaiser.jpg",QString(),QString(),QDate(2000,10,23),"05c",0));
group->addPupil(new Pupil("Nadine","Kersting",Person::Gender::FEMALE,"Nadine Kersting.jpg",QString(),QString(),QDate(2000,2,1),"05c",0));
group->addPupil(new Pupil("Friederike","Kerzel",Person::Gender::FEMALE,"Friederike Kerzel.jpg",QString(),QString(),QDate(2000,8,12),"05c",0));
group->addPupil(new Pupil("Miriam","Köller",Person::Gender::FEMALE,"Miriam Koeller.jpg",QString(),QString(),QDate(2000,6,27),"05c",0));
group->addPupil(new Pupil("Mara","Langenberg",Person::Gender::FEMALE,"Mara Langenberg.jpg",QString(),QString(),QDate(2000,7,14),"05c",0));
group->addPupil(new Pupil("Stefan","Maier",Person::Gender::MALE,"Stefan Maier.jpg",QString(),QString(),QDate(2000,3,26),"05c",0));
group->addPupil(new Pupil("Dana","Meerkat",Person::Gender::FEMALE,"Dana Meerkat.jpg",QString(),QString(),QDate(2000,3,10),"05c",0));
group->addPupil(new Pupil("Sibylle","Mentzel",Person::Gender::FEMALE,"Sibylle Mentzel.jpg",QString(),QString(),QDate(2001,4,26),"05c",0));
group->addPupil(new Pupil("Steffen","Niecke",Person::Gender::MALE,"Steffen Niecke.jpg",QString(),QString(),QDate(2000,3,2),"05c",0));
group->addPupil(new Pupil("Murat","Öztürk",Person::Gender::MALE,"Murat Oeztuerk.jpg",QString(),QString(),QDate(2000,10,27),"05c",0));
group->addPupil(new Pupil("Marie","Pieczonka",Person::Gender::FEMALE,"Marie Pieczonka.jpg",QString(),QString(),QDate(2000,2,12),"05c",0));
group->addPupil(new Pupil("Pit","Reining",Person::Gender::MALE,"Pit Reining.jpg",QString(),QString(),QDate(2000,7,20),"05c",0));
group->addPupil(new Pupil("Alexander","Richter",Person::Gender::MALE,"Alexander Richter .jpg",QString(),QString(),QDate(2001,4,14),"05c",0));
group->addPupil(new Pupil("Sina","Schneemann",Person::Gender::FEMALE,"Sina Schneemann.jpg",QString(),QString(),QDate(2000,9,2),"05c",0));
group->addPupil(new Pupil("Anne","Seweringsbeck",Person::Gender::FEMALE,"Anne Seweringsbeck.jpg",QString(),QString(),QDate(1999,11,23),"05c",0));
group->addPupil(new Pupil("Benedikt","Terstelen",Person::Gender::MALE,"Benedikt Terstelen.jpg",QString(),QString(),QDate(2000,1,6),"05c",0));
group->addPupil(new Pupil("Felix","Van Ophoven",Person::Gender::MALE,"Felix van Ophoven .jpg",QString(),QString(),QDate(1999,11,21),"05c",0));
group->addPupil(new Pupil("Heike","Vierseneck",Person::Gender::FEMALE,"Heike Vierseneck.jpg",QString(),QString(),QDate(2000,3,13),"05c",0));
group->addPupil(new Pupil("Beatrix","Weber",Person::Gender::FEMALE,"Beatrix Weber.jpg",QString(),QString(),QDate(2000,6,9),"05c",0));
group->addPupil(new Pupil("Thomas","Weber",Person::Gender::MALE,"Thomas Weber.jpg",QString(),QString(),QDate(1999,12,20),"05c",0));
// group->addPupil(new Pupil("Anna","Webern",Person::Gender::FEMALE,"Anna Webern.jpg",QString(),QString(),QDate(2000,12,7),"05c",0));
// group->addPupil(new Pupil("Lara","Bachmann",Person::Gender::FEMALE,"Lara Bachmann.jpg",QString(),QString(),QDate(2000,3,8),"08a",0));
// group->addPupil(new Pupil("Sandra","Böhmer",Person::Gender::FEMALE,"_Sandra Boehmer.jpg",QString(),QString(),QDate(2000,3,22),"08a",0));
// group->addPupil(new Pupil("Britta","Eschweger",Person::Gender::FEMALE,"Britta Eschweger.jpg",QString(),QString(),QDate(2000,7,10),"08a",0));
// group->addPupil(new Pupil("Annike","Gosekamp",Person::Gender::FEMALE,"_Annike Gosekamp.jpg",QString(),QString(),QDate(2000,7,28),"08a",0));
// group->addPupil(new Pupil("Katharina","Haarmann",Person::Gender::FEMALE,"Katharina Haarmann.jpg",QString(),QString(),QDate(2000,3,8),"08a",0));
// group->addPupil(new Pupil("Sebastian","Hohage",Person::Gender::MALE,"Sebastian Hohage.jpg",QString(),QString(),QDate(2000,5,1),"08a",0));
// group->addPupil(new Pupil("Markus","Kerzel",Person::Gender::MALE,"Markus Kerzel.jpg",QString(),QString(),QDate(2000,3,16),"08a",0));
// group->addPupil(new Pupil("Henning","König",Person::Gender::MALE,"Henning Koenig.jpg",QString(),QString(),QDate(2000,5,11),"08a",0));
// group->addPupil(new Pupil("Sandra","Lehmann",Person::Gender::FEMALE,"Sandra Lehmann.jpg",QString(),QString(),QDate(2000,9,3),"08a",0));
// group->addPupil(new Pupil("Yasmin","Lipinski",Person::Gender::FEMALE,"_Yasmin Lipinski .jpg",QString(),QString(),QDate(2000,3,27),"08a",0));
// group->addPupil(new Pupil("Jakob","Meilenberg",Person::Gender::MALE,"Jakob Meilenberg.jpg",QString(),QString(),QDate(2000,6,30),"08a",0));
// group->addPupil(new Pupil("Benedikt","Meyer",Person::Gender::MALE,"Benedikt Meyer.jpg",QString(),QString(),QDate(1999,12,28),"08a",0));
// group->addPupil(new Pupil("Stefan","Müller",Person::Gender::MALE,"Stefan Maier.jpg",QString(),QString(),QDate(2000,5,20),"08a",0));
// group->addPupil(new Pupil("Peter","Neumann",Person::Gender::MALE,"Peter Naumann.jpg",QString(),QString(),QDate(2000,5,27),"08a",0));
// group->addPupil(new Pupil("Philipp","Quäbicker",Person::Gender::MALE,"Phillip Quaebicker.jpg",QString(),QString(),QDate(2000,8,11),"08a",0));
// group->addPupil(new Pupil("Susanne","Regensburger",Person::Gender::FEMALE,"Susanne Regensburger.jpg",QString(),QString(),QDate(2000,8,6),"08a",0));
// group->addPupil(new Pupil("Beate","Schmidt",Person::Gender::FEMALE,"beate schmidt.jpg",QString(),QString(),QDate(2000,7,9),"08a",0));
// group->addPupil(new Pupil("Lisa","Schmidt",Person::Gender::FEMALE,"_Lisa Schmidt.jpg",QString(),QString(),QDate(1999,10,31),"08a",0));
// group->addPupil(new Pupil("Paul","Schmidt",Person::Gender::MALE,"Paul Schmidt.jpg",QString(),QString(),QDate(2000,4,26),"08a",0));
// group->addPupil(new Pupil("Tanja","Scholz",Person::Gender::FEMALE,"Tanja Scholz.jpg",QString(),QString(),QDate(2001,1,11),"08a",0));
// group->addPupil(new Pupil("Marina","Schulte",Person::Gender::FEMALE,"Marina Schulte.jpg",QString(),QString(),QDate(1999,12,2),"08a",0));
// group->addPupil(new Pupil("Kevin","Schulze",Person::Gender::MALE,"Kevin schulze.jpg",QString(),QString(),QDate(1999,2,20),"08a",0));
// group->addPupil(new Pupil("Antonia","Schwarz",Person::Gender::FEMALE,"Antonia Schwarz.jpg",QString(),QString(),QDate(1999,7,11),"08a",0));
// group->addPupil(new Pupil("Hendrik","Theissen",Person::Gender::MALE,"Hendrik Theissen.jpg",QString(),QString(),QDate(2000,3,11),"08a",0));
// group->addPupil(new Pupil("Carsten","Trompeter",Person::Gender::MALE,"Carsten Trompeter.jpg",QString(),QString(),QDate(1998,10,11),"08a",0));
// group->addPupil(new Pupil("Julia","Tworuschka",Person::Gender::FEMALE,"Julia Tworuschka.jpg",QString(),QString(),QDate(1999,7,15),"08a",0));
// group->addPupil(new Pupil("Sophie","Wedler",Person::Gender::FEMALE,"Sophie Wedler.jpg",QString(),QString(),QDate(2000,2,27),"08a",0));
// group->addPupil(new Pupil("Alice","Wellenstein",Person::Gender::FEMALE,"Alice Wellenstein.jpg",QString(),QString(),QDate(2000,11,11),"08a",0));
// group->addPupil(new Pupil("Gesa","Werthmann",Person::Gender::FEMALE,"Gesa Werthmann.jpg",QString(),QString(),QDate(2000,7,23),"08a",0));
// group->addPupil(new Pupil("Selma","Yildiz",Person::Gender::FEMALE,"_Selma Yildiz.jpg",QString(),QString(),QDate(1998,2,1),"08a",0));
// group->addPupil(new Pupil("Barbara","Anklang",Person::Gender::FEMALE,"Barbara Anklang.jpg",QString(),QString(),QDate(1997,12,25),"11",0));
// group->addPupil(new Pupil("Martin","Baack",Person::Gender::MALE,"Martin Baack.jpg",QString(),QString(),QDate(1998,1,1),"11",0));
// group->addPupil(new Pupil("Martin","Bergmann",Person::Gender::MALE,"Martin Bergmann.jpg",QString(),QString(),QDate(1999,5,29),"11",0));
// group->addPupil(new Pupil("Elisabeth","Blauwies",Person::Gender::FEMALE,"Elisabeth Blauwies.jpg",QString(),QString(),QDate(1998,4,9),"11",0));
// group->addPupil(new Pupil("Tim","Bösch",Person::Gender::MALE,"Tim Boesch.jpg",QString(),QString(),QDate(1998,9,27),"11",0));
// group->addPupil(new Pupil("Frank","Brinkhoff",Person::Gender::MALE,"Frank Brinkhoff.jpg",QString(),QString(),QDate(1998,1,15),"11",0));
// group->addPupil(new Pupil("Theresa","Christens",Person::Gender::FEMALE,"Theresa Christens.jpg",QString(),QString(),QDate(1998,3,14),"11",0));
// group->addPupil(new Pupil("Silke","Goisern",Person::Gender::FEMALE,"Silke Goisern.jpg",QString(),QString(),QDate(1998,3,15),"11",0));
// group->addPupil(new Pupil("Kerstin","Heineberg",Person::Gender::FEMALE,"Kerstin Heinenberg .jpg",QString(),QString(),QDate(1997,10,22),"11",0));
// group->addPupil(new Pupil("Jan","Heiner",Person::Gender::MALE,"Jan Heiner.jpg",QString(),QString(),QDate(1997,11,26),"11",0));
// group->addPupil(new Pupil("Annika","Henrichs",Person::Gender::FEMALE,"Annika Henrichs.jpg",QString(),QString(),QDate(1998,5,17),"11",0));
// group->addPupil(new Pupil("Fritzie","Herbst",Person::Gender::FEMALE,"Fritzie Herbst.jpg",QString(),QString(),QDate(1998,3,14),"11",0));
// group->addPupil(new Pupil("Leo","Hirsch",Person::Gender::MALE,"Leo Hirsch.jpg",QString(),QString(),QDate(1997,9,7),"11",0));
// group->addPupil(new Pupil("Justus","Markwort",Person::Gender::MALE,"Justus Markwort.jpg",QString(),QString(),QDate(1995,8,4),"11",0));
// group->addPupil(new Pupil("Christopher","Mauntz",Person::Gender::MALE,"Christopher Mauntz.jpg",QString(),QString(),QDate(1998,1,13),"11",0));
// group->addPupil(new Pupil("Kai","Maurer",Person::Gender::MALE,"Kai Maurer.jpg",QString(),QString(),QDate(1997,12,30),"11",0));
// group->addPupil(new Pupil("Florian","Neuhaus",Person::Gender::MALE,"Florian Neuhaus.jpg",QString(),QString(),QDate(1998,5,20),"11",0));
// group->addPupil(new Pupil("Sabine","Overkamp",Person::Gender::FEMALE,"Sabine Overkamp.jpg",QString(),QString(),QDate(1998,8,4),"11",0));
// group->addPupil(new Pupil("Frank","Paschen",Person::Gender::MALE,"Frank Paschen.jpg",QString(),QString(),QDate(1998,3,17),"11",0));
// group->addPupil(new Pupil("Petra","Schubert",Person::Gender::FEMALE,"Petra Schubert.jpg",QString(),QString(),QDate(1994,2,23),"11",0));
// group->addPupil(new Pupil("Verena","Schwarz",Person::Gender::FEMALE,"Verena Schwarz.jpg",QString(),QString(),QDate(1993,3,17),"11",0));
// group->addPupil(new Pupil("Helge","Stalter",Person::Gender::MALE,"Helge Stalter.jpg",QString(),QString(),QDate(1994,2,6),"11",0));
// group->addPupil(new Pupil("Lena","Swarovski",Person::Gender::FEMALE,"Lena Swarovski.jpg",QString(),QString(),QDate(1994,3,22),"11",0));
// Paths::setCustomPicturePathStatic("resources/");
// Paths::setPicturePathStatic("resources/");
group->pupilAt(0).data()->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(1).data()->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(2).data()->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(3).data()->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(4).data()->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(5).data()->addAddress(new Address("Erzieher","Auguste-Viktoria-Platz 193","77652","Offenburg"));
group->pupilAt(6).data()->addAddress(new Address("Erzieher","Bullenwinkel 467","74074","Heilbronn"));
group->pupilAt(7).data()->addAddress(new Address("Erzieher","Schinkelplatz 389","46236","Bottrop"));
group->pupilAt(8).data()->addAddress(new Address("Erzieher","Mentzelstraße 327","33617","Bielefeld"));
group->pupilAt(9).data()->addAddress(new Address("Erzieher","Bundesallee 252","49082","Osnabrück"));
group->pupilAt(10).data()->addAddress(new Address("Erzieher","Schreberplatz 93","33619","Bielefeld"));
group->pupilAt(11).data()->addAddress(new Address("Erzieher","Mühltaler Straße 252","45327","Essen"));
group->pupilAt(12).data()->addAddress(new Address("Erzieher","Köllnischer Wursthof 49","50996","Köln"));
group->pupilAt(13).data()->addAddress(new Address("Erzieher","Spinnpfad 38","40599","Düsseldorf"));
group->pupilAt(14).data()->addAddress(new Address("Erzieher","Schießgasse 122","85399","Hallbergmoos"));
group->pupilAt(15).data()->addAddress(new Address("Erzieher","Am Wiesenrain 156","69221","Dossenheim"));
group->pupilAt(16).data()->addAddress(new Address("Erzieher","Spindlersfelder Straße 201","40593","Düsseldorf"));
group->pupilAt(17).data()->addAddress(new Address("Erzieher","Schröderdamm 37","47169","Duisburg"));
group->pupilAt(18).data()->addAddress(new Address("Erzieher","Franklinstraße 390","48356","Nordwalde"));
group->pupilAt(19).data()->addAddress(new Address("Erzieher","Friedbergstraße 84","10555","Berlin"));
group->pupilAt(20).data()->addAddress(new Address("Erzieher","Mandrellaplatz 319","53119","Bonn"));
group->pupilAt(21).data()->addAddress(new Address("Erzieher","Müggelwerderweg 489","50823","Köln"));
group->pupilAt(22).data()->addAddress(new Address("Erzieher","Stralauer Straße 137","45478","Mülheim"));
group->pupilAt(23).data()->addAddress(new Address("Erzieher","Müggellandstraße 101","33611","Bielefeld"));
group->pupilAt(24).data()->addAddress(new Address("Erzieher","Müggelbergallee 455","60314","Frankfurt"));
group->pupilAt(25).data()->addAddress(new Address("Erzieher","Kirch-Gasse 96","53129","Bonn"));
group->pupilAt(26).data()->addAddress(new Address("Erzieher","Buchholzweg 278","51545","Waldbröl"));
group->pupilAt(27).data()->addAddress(new Address("Erzieher","Plattnerstraße 287","40233","Düsseldorf"));
group->pupilAt(28).data()->addAddress(new Address("Erzieher","Bolivarallee 28","41517","Grevenbroich"));
group->pupilAt(29).data()->addAddress(new Address("Erzieher","Große Allee 464","F-75011","Paris"));
group->pupilAt(30).data()->addAddress(new Address("Erzieher","Edisonstraße 496","53881","Euskirchen"));
// group->pupilAt(31).data()->addAddress(new Address("Erzieher","Erknerstraße 414","82194","Gröbenzell"));
// group->pupilAt(32).data()->addAddress(new Address("Erzieher","Friedrichplatz 339","57584","Wallmenroth"));
// group->pupilAt(33).data()->addAddress(new Address("Erzieher","Englische Straße 42","22926","Ahrensburg"));
// group->pupilAt(34).data()->addAddress(new Address("Erzieher","Oettingstraße 491","82140","Olching"));
// group->pupilAt(35).data()->addAddress(new Address("Erzieher","Erpetaler Weg 285","46519","Alpen"));
// group->pupilAt(36).data()->addAddress(new Address("Erzieher","Spreestraße 91","40235","Düsseldorf"));
// group->pupilAt(37).data()->addAddress(new Address("Erzieher","Carmerstraße 233","46397","Bocholt"));
// group->pupilAt(38).data()->addAddress(new Address("Erzieher","Emmy-Zehden-Weg 460","10435","Berlin"));
// group->pupilAt(39).data()->addAddress(new Address("Erzieher","Stubenrauchstraße 216","40210","Düsseldorf"));
// group->pupilAt(40).data()->addAddress(new Address("Erzieher","Kalkscheunenquergasse 210","46395","Bocholt"));
// group->pupilAt(41).data()->addAddress(new Address("Erzieher","Seestraße 430","59302","Oelde"));
// group->pupilAt(42).data()->addAddress(new Address("Erzieher","Amselhorst 257","60313","Frankfurt"));
// group->pupilAt(43).data()->addAddress(new Address("Erzieher","Nobels Hof 383","95326","Kulmbach"));
// group->pupilAt(44).data()->addAddress(new Address("Erzieher","Luisenstraße 375","45259","Essen"));
// group->pupilAt(45).data()->addAddress(new Address("Erzieher","Müllroser Straße 371","33428","Harsewinkel"));
// group->pupilAt(46).data()->addAddress(new Address("Erzieher","Bismarckstraße 251","24103","Kiel"));
// group->pupilAt(47).data()->addAddress(new Address("Erzieher","Militscher Weg 222","59077","Hamm"));
// group->pupilAt(48).data()->addAddress(new Address("Erzieher","Kleine Burgstraße 211","24111","Kiel"));
// group->pupilAt(49).data()->addAddress(new Address("Erzieher","Kirchgasse 166","47166","Duisburg"));
// group->pupilAt(50).data()->addAddress(new Address("Erzieher","Am Postfenn 448","81825","München"));
// group->pupilAt(51).data()->addAddress(new Address("Erzieher","Breite Straße 227","80993","München"));
// group->pupilAt(52).data()->addAddress(new Address("Erzieher","Gustloffstraße 292","45896","Gelsenkirchen"));
// group->pupilAt(53).data()->addAddress(new Address("Erzieher","Am Salzufer beim Speicher 10","53842","Troisdorf"));
// group->pupilAt(54).data()->addAddress(new Address("Erzieher","Strandweg 13","46359","Heiden"));
// group->pupilAt(55).data()->addAddress(new Address("Erzieher","Dickensweg 269","45899","Gelsenkirchen"));
// group->pupilAt(56).data()->addAddress(new Address("Erzieher","Birkweilerstraße 258","42389","Wuppertal"));
// group->pupilAt(57).data()->addAddress(new Address("Erzieher","Luisenplatz 33","48153","Münster"));
// group->pupilAt(58).data()->addAddress(new Address("Erzieher","Am Volkshaus 242","60529","Frankfurt"));
// group->pupilAt(59).data()->addAddress(new Address("Erzieher","Adlershofer Straße 357","37671","Höxter"));
// group->pupilAt(60).data()->addAddress(new Address("Erzieher","Semliner Straße 463","10245","Berlin"));
// group->pupilAt(61).data()->addAddress(new Address("Erzieher","Kirchplatz 254","76149","Karlsruhe"));
// group->pupilAt(62).data()->addAddress(new Address("Erzieher","Straße nach Fichtenau 408","52457","Aldenhoven"));
// group->pupilAt(63).data()->addAddress(new Address("Erzieher","Schützengasse 497","73460","Hüttlingen"));
// group->pupilAt(64).data()->addAddress(new Address("Erzieher","Bismarckstraße 194","28209","Bremen"));
// group->pupilAt(65).data()->addAddress(new Address("Erzieher","Am Bahnhof Jungfernheide 227","57299","Burbach"));
// group->pupilAt(66).data()->addAddress(new Address("Erzieher","Epiphanienweg 219","45149","Essen"));
// group->pupilAt(67).data()->addAddress(new Address("Erzieher","Scharnhorststraße 238","91054","Erlangen"));
// group->pupilAt(68).data()->addAddress(new Address("Erzieher","Baderseestraße 492","42899","Remscheid"));
// group->pupilAt(69).data()->addAddress(new Address("Erzieher","Enkenbacher Weg 473","53179","Bonn"));
// group->pupilAt(70).data()->addAddress(new Address("Erzieher","Siefersheimer Straße 379","50226","Frechen"));
// group->pupilAt(71).data()->addAddress(new Address("Erzieher","Gutsmuthsweg 197","59955","Winterberg"));
// group->pupilAt(72).data()->addAddress(new Address("Erzieher","Beutenweg 316","42329","Wuppertal"));
// group->pupilAt(73).data()->addAddress(new Address("Erzieher","Fahlenbergstraße 244","50667","Köln"));
// group->pupilAt(74).data()->addAddress(new Address("Erzieher","Cauerstraße 171","41068","Mönchengladbach"));
// group->pupilAt(75).data()->addAddress(new Address("Erzieher","Eichkatzweg 263","10999","Berlin"));
// group->pupilAt(76).data()->addAddress(new Address("Erzieher","Fasanenstraße 83","34127","Kassel"));
// group->pupilAt(77).data()->addAddress(new Address("Erzieher","Augsburger Straße 397","41748","Viersen"));
// group->pupilAt(78).data()->addAddress(new Address("Erzieher","Erlengrund 240","22393","Hamburg"));
// group->pupilAt(79).data()->addAddress(new Address("Erzieher","Müggelschlößchenweg 111","90762","Fürth"));
// group->pupilAt(80).data()->addAddress(new Address("Erzieher","Rautendeleinweg 233","60322","Frankfurt"));
// group->pupilAt(81).data()->addAddress(new Address("Erzieher","Plattnerstraße 448","33611","Bielefeld"));
// group->pupilAt(82).data()->addAddress(new Address("Erzieher","Falkendamm 174","44532","Lünen"));
// group->pupilAt(83).data()->addAddress(new Address("Erzieher","Beutenweg 46","40233","Düsseldorf"));
// group->pupilAt(84).data()->addAddress(new Address("Erzieher","Grolmanstraße 21","42105","Wuppertal"));
group->pupilAt(0).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(1).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(2).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(3).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(4).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(5).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-340678"));
group->pupilAt(6).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-697259"));
group->pupilAt(7).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-893457"));
group->pupilAt(8).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-329887"));
group->pupilAt(9).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-929597"));
group->pupilAt(10).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-796732"));
group->pupilAt(11).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-546859"));
group->pupilAt(12).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-595620"));
group->pupilAt(13).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-866276"));
group->pupilAt(14).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-460017"));
group->pupilAt(15).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-482789"));
group->pupilAt(16).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-572497"));
group->pupilAt(17).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-778335"));
group->pupilAt(18).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-373357"));
group->pupilAt(19).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-141325"));
group->pupilAt(20).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-479624"));
group->pupilAt(21).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-181349"));
group->pupilAt(22).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-292118"));
group->pupilAt(23).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-835081"));
group->pupilAt(24).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-177756"));
group->pupilAt(25).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-744508"));
group->pupilAt(26).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-966629"));
group->pupilAt(27).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-310955"));
group->pupilAt(28).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-557452"));
group->pupilAt(29).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-822892"));
group->pupilAt(30).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-146895"));
// group->pupilAt(31).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-140179"));
// group->pupilAt(32).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-748715"));
// group->pupilAt(33).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-511395"));
// group->pupilAt(34).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-451487"));
// group->pupilAt(35).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-427073"));
// group->pupilAt(36).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-636559"));
// group->pupilAt(37).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-952210"));
// group->pupilAt(38).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-273424"));
// group->pupilAt(39).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-371440"));
// group->pupilAt(40).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-620761"));
// group->pupilAt(41).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-976994"));
// group->pupilAt(42).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-884805"));
// group->pupilAt(43).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-664649"));
// group->pupilAt(44).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-860288"));
// group->pupilAt(45).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-756263"));
// group->pupilAt(46).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-471363"));
// group->pupilAt(47).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-381769"));
// group->pupilAt(48).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-449971"));
// group->pupilAt(49).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-167298"));
// group->pupilAt(50).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-125506"));
// group->pupilAt(51).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-295468"));
// group->pupilAt(52).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-288429"));
// group->pupilAt(53).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-838009"));
// group->pupilAt(54).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-460820"));
// group->pupilAt(55).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-280847"));
// group->pupilAt(56).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-864574"));
// group->pupilAt(57).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-496047"));
// group->pupilAt(58).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-448370"));
// group->pupilAt(59).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-371203"));
// group->pupilAt(60).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-395222"));
// group->pupilAt(61).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-984187"));
// group->pupilAt(62).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-726034"));
// group->pupilAt(63).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-848504"));
// group->pupilAt(64).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-384888"));
// group->pupilAt(65).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-816536"));
// group->pupilAt(66).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-959895"));
// group->pupilAt(67).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-805634"));
// group->pupilAt(68).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-884150"));
// group->pupilAt(69).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-614509"));
// group->pupilAt(70).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-204527"));
// group->pupilAt(71).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-936177"));
// group->pupilAt(72).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-851124"));
// group->pupilAt(73).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-780272"));
// group->pupilAt(74).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-193218"));
// group->pupilAt(75).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-863423"));
// group->pupilAt(76).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-505932"));
// group->pupilAt(77).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-193988"));
// group->pupilAt(78).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-284261"));
// group->pupilAt(79).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-354793"));
// group->pupilAt(80).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-150300"));
// group->pupilAt(81).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-935449"));
// group->pupilAt(82).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-241454"));
// group->pupilAt(83).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-263433"));
// group->pupilAt(84).data()->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-942203"));
group->pupilAt(0)->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(1)->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(2)->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(3)->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(4)->addAddress(new Address("Erzieher","Bukesweg 473","33330","Gütersloh"));
group->pupilAt(5)->addAddress(new Address("Erzieher","Auguste-Viktoria-Platz 193","77652","Offenburg"));
group->pupilAt(6)->addAddress(new Address("Erzieher","Bullenwinkel 467","74074","Heilbronn"));
group->pupilAt(7)->addAddress(new Address("Erzieher","Schinkelplatz 389","46236","Bottrop"));
group->pupilAt(8)->addAddress(new Address("Erzieher","Mentzelstraße 327","33617","Bielefeld"));
group->pupilAt(9)->addAddress(new Address("Erzieher","Bundesallee 252","49082","Osnabrück"));
group->pupilAt(0).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(1).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(2).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(3).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(4).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(5).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-791688"));
group->pupilAt(6).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-837199"));
group->pupilAt(7).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-194122"));
group->pupilAt(8).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-145996"));
group->pupilAt(9).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-446435"));
group->pupilAt(10).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-777240"));
group->pupilAt(11).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-957984"));
group->pupilAt(12).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-959035"));
group->pupilAt(13).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-646996"));
group->pupilAt(14).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-754644"));
group->pupilAt(15).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-691871"));
group->pupilAt(16).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-606116"));
group->pupilAt(17).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-560258"));
group->pupilAt(18).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-725004"));
group->pupilAt(19).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-836000"));
group->pupilAt(20).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-501271"));
group->pupilAt(21).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-495368"));
group->pupilAt(22).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-833977"));
group->pupilAt(23).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-999205"));
group->pupilAt(24).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-496463"));
group->pupilAt(25).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-901833"));
group->pupilAt(26).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-836660"));
group->pupilAt(27).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-565273"));
group->pupilAt(28).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-334976"));
group->pupilAt(29).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-586964"));
group->pupilAt(30).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-669576"));
// group->pupilAt(31).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-931698"));
// group->pupilAt(32).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-968447"));
// group->pupilAt(33).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-576603"));
// group->pupilAt(34).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-331963"));
// group->pupilAt(35).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-122682"));
// group->pupilAt(36).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-582439"));
// group->pupilAt(37).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-930372"));
// group->pupilAt(38).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-812512"));
// group->pupilAt(39).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-432765"));
// group->pupilAt(40).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-443758"));
// group->pupilAt(41).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-696010"));
// group->pupilAt(42).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-493309"));
// group->pupilAt(43).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-470076"));
// group->pupilAt(44).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-284998"));
// group->pupilAt(45).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-619313"));
// group->pupilAt(46).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-922854"));
// group->pupilAt(47).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-610450"));
// group->pupilAt(48).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-593422"));
// group->pupilAt(49).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-378564"));
// group->pupilAt(50).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-311956"));
// group->pupilAt(51).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-645321"));
// group->pupilAt(52).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-305341"));
// group->pupilAt(53).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-708486"));
// group->pupilAt(54).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-943784"));
// group->pupilAt(55).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-855304"));
// group->pupilAt(56).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-524665"));
// group->pupilAt(57).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-629998"));
// group->pupilAt(58).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-803833"));
// group->pupilAt(59).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-568313"));
// group->pupilAt(60).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-472579"));
// group->pupilAt(61).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-453570"));
// group->pupilAt(62).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-779747"));
// group->pupilAt(63).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-959740"));
// group->pupilAt(64).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-791460"));
// group->pupilAt(65).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-852067"));
// group->pupilAt(66).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-137234"));
// group->pupilAt(67).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-245563"));
// group->pupilAt(68).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-103207"));
// group->pupilAt(69).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-376089"));
// group->pupilAt(70).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-551473"));
// group->pupilAt(71).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-928563"));
// group->pupilAt(72).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-268328"));
// group->pupilAt(73).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-771549"));
// group->pupilAt(74).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-776219"));
// group->pupilAt(75).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-581444"));
// group->pupilAt(76).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-100392"));
// group->pupilAt(77).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-267220"));
// group->pupilAt(78).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-333075"));
// group->pupilAt(79).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-746235"));
// group->pupilAt(80).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-695127"));
// group->pupilAt(81).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-231127"));
// group->pupilAt(82).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-992639"));
// group->pupilAt(83).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-334154"));
// group->pupilAt(84).data()->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-100465"));
group->pupilAt(0)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(1)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(2)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(3)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(4)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-474466"));
group->pupilAt(5)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-340678"));
group->pupilAt(6)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-697259"));
group->pupilAt(7)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-893457"));
group->pupilAt(8)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-329887"));
group->pupilAt(9)->addContact(new Contact("Telefon 1",Contact::Category::LANDLINE,"01234-929597"));
group->pupilAt(0).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"TimmieB@smail.de_"));
group->pupilAt(1).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"lenalenalena3@smail.de_"));
group->pupilAt(2).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"marcel.dunst111@smail.de_"));
group->pupilAt(3).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"cernst@smail.de_"));
group->pupilAt(4).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"hannahsemail@smail.de_"));
group->pupilAt(5).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"vrgsk@smail.de_"));
group->pupilAt(6).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"hagedornjann@smail.de_"));
group->pupilAt(7).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"svenja_H@smail.de_"));
group->pupilAt(8).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"dertimohatmail@smail.de_"));
group->pupilAt(9).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"birthe-hunter@smail.de_"));
group->pupilAt(10).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"thor-ben@smail.de_"));
group->pupilAt(11).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"kaiserin_julia@smail.de_"));
group->pupilAt(12).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"dinikersting@smail.de_"));
group->pupilAt(13).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"rieke1234567@smail.de_"));
group->pupilAt(14).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"koellerkollerkiller@smail.de_"));
group->pupilAt(15).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"mara-longmountain@smail.de_"));
group->pupilAt(16).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"stefanowitschm@smail.de_"));
group->pupilAt(17).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"danameerkatze@smail.de_"));
group->pupilAt(18).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"BillieMentzel@smail.de_"));
group->pupilAt(19).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"steffenNIE@smail.de_"));
group->pupilAt(20).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"MuratÖzgür@smail.de_"));
group->pupilAt(21).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"MariechenPieczo@smail.de_"));
group->pupilAt(22).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"pit-cleaning@smail.de_"));
group->pupilAt(23).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"richter_alex1111@smail.de_"));
group->pupilAt(24).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"schneefrau@smail.de_"));
group->pupilAt(25).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"anne.seweringsbeck@smail.de_"));
group->pupilAt(26).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"benedikt_terstelen@smail.de_"));
group->pupilAt(27).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"happyfromophoven@smail.de_"));
group->pupilAt(28).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Heike.Vierseneck@smail.de_"));
group->pupilAt(29).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"BeaWeberNEU@smail.de_"));
group->pupilAt(30).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"ThomasWeberThomasWeber@smail.de_"));
// group->pupilAt(31).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"BellaAnnaWebern99@smail.de_"));
// group->pupilAt(32).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Larabach@smail.de_"));
// group->pupilAt(33).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Sboehmer@smail.de_"));
// group->pupilAt(34).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"BrEs@smail.de_"));
// group->pupilAt(35).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Annik-Gose@smail.de_"));
// group->pupilAt(36).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Kat_Haarmann@smail.de_"));
// group->pupilAt(37).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"SebiHohi2000@smail.de_"));
// group->pupilAt(38).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Kerzel.M@smail.de_"));
// group->pupilAt(39).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Hennig-the-King@smail.de_"));
// group->pupilAt(40).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"SandyLeh@smail.de_"));
// group->pupilAt(41).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Yasmin-Lipinski@smail.de_"));
// group->pupilAt(42).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"7-Meilen-Jakob@smail.de_"));
// group->pupilAt(43).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Big_Benny@smail.de_"));
// group->pupilAt(44).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Stefan.Mueller13@smail.de_"));
// group->pupilAt(45).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"PeterPanNeu@smail.de_"));
// group->pupilAt(46).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Quaebicker.Phil@smail.de_"));
// group->pupilAt(47).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Susi_Spielmacher@smail.de_"));
// group->pupilAt(48).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Schmidtty-Bea00@smail.de_"));
// group->pupilAt(49).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"MrsNeunmalklug@smail.de_"));
// group->pupilAt(50).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Paul.S.99@smail.de_"));
// group->pupilAt(51).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Scholz_Tanja_2@smail.de_"));
// group->pupilAt(52).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Meeresschulte99@smail.de_"));
// group->pupilAt(53).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Kev.Cool-13@smail.de_"));
// group->pupilAt(54).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"BlackAntony@smail.de_"));
// group->pupilAt(55).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Hendrik-Theissen-Jr@smail.de_"));
// group->pupilAt(56).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Carsten-Trumpet5@smail.de_"));
// group->pupilAt(57).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Julia.Tworuschka@smail.de_"));
// group->pupilAt(58).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"SophiesWelt2000@smial.de_"));
// group->pupilAt(59).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Alice-Wavestone@smail.de_"));
// group->pupilAt(60).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Leiden-der-jungen-Gesa@smail.de_"));
// group->pupilAt(61).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Selma-Yildiz13@smail.de_"));
// group->pupilAt(62).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Barbara-at-Sound@smail.de_"));
// group->pupilAt(63).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Baak.M.1234@smail.de_"));
// group->pupilAt(64).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Martin.Bergmann@smail.de_"));
// group->pupilAt(65).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"EinsteinElli@smail.de_"));
// group->pupilAt(66).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Ti-Boe@smail.de_"));
// group->pupilAt(67).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Zum-Wohl-Frank@smail.de_"));
// group->pupilAt(68).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Holy-Theresa@smail.de_"));
// group->pupilAt(69).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Silke.Goisern96@smail.de_"));
// group->pupilAt(70).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Kerstin_Heini@smail.de_"));
// group->pupilAt(71).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Jan-the-brain@smail.de_"));
// group->pupilAt(72).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Annika.Henrichs12@smail.de_"));
// group->pupilAt(73).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Fritzie-Coke@smail.de_"));
// group->pupilAt(74).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Hirsch-heisst-er@smail.de_"));
// group->pupilAt(75).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Just_Mark_Word@smail.de_"));
// group->pupilAt(76).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Chriscat95@smail.de_"));
// group->pupilAt(77).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Kai-Maurer-415@smail.de_"));
// group->pupilAt(78).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Neuhaus-1645@smail.de_"));
// group->pupilAt(79).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Sabine.Overkamp2@smail.de_"));
// group->pupilAt(80).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"PaschFrank@smail.de_"));
// group->pupilAt(81).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Petras_Winterreise@smail.de_"));
// group->pupilAt(82).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"BlackMamba5@smail.de_"));
// group->pupilAt(83).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Helges-Jazzclub@smail.de_"));
// group->pupilAt(84).data()->addContact(new Contact("Email",Contact::Category::EMAIL,"Swarovski.Lena4@smail.de_"));
group->pupilAt(0)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(1)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(2)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(3)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(4)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-755490"));
group->pupilAt(5)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-791688"));
group->pupilAt(6)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-837199"));
group->pupilAt(7)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-194122"));
group->pupilAt(8)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-145996"));
group->pupilAt(9)->addContact(new Contact("Telefon 2",Contact::Category::LANDLINE,"01234-446435"));
group->pupilAt(0)->addContact(new Contact("Email",Contact::Category::EMAIL,"TimmieB@smail.de_"));
group->pupilAt(1)->addContact(new Contact("Email",Contact::Category::EMAIL,"lenalenalena3@smail.de_"));
group->pupilAt(2)->addContact(new Contact("Email",Contact::Category::EMAIL,"marcel.dunst111@smail.de_"));
group->pupilAt(3)->addContact(new Contact("Email",Contact::Category::EMAIL,"cernst@smail.de_"));
group->pupilAt(4)->addContact(new Contact("Email",Contact::Category::EMAIL,"hannahsemail@smail.de_"));
group->pupilAt(5)->addContact(new Contact("Email",Contact::Category::EMAIL,"vrgsk@smail.de_"));
group->pupilAt(6)->addContact(new Contact("Email",Contact::Category::EMAIL,"hagedornjann@smail.de_"));
group->pupilAt(7)->addContact(new Contact("Email",Contact::Category::EMAIL,"svenja_H@smail.de_"));
group->pupilAt(8)->addContact(new Contact("Email",Contact::Category::EMAIL,"dertimohatmail@smail.de_"));
group->pupilAt(9)->addContact(new Contact("Email",Contact::Category::EMAIL,"birthe-hunter@smail.de_"));
group->pupilAt(0).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"info@berg-immobilien.com_"));
group->pupilAt(1).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"ClemensundAnja@DieConrads.de_"));
group->pupilAt(2).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"sales@dunst-aufzuege.de_"));
group->pupilAt(3).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"FamilieErnst@smail.de_"));
group->pupilAt(4).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"juergen.eschborn@smail.de_"));
group->pupilAt(5).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Britta_Geseke@smail.de_"));
group->pupilAt(6).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"familie@hagedorns.de_"));
group->pupilAt(7).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"hartmaenner@smail.de_"));
group->pupilAt(8).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Marco.Haufer@email.de_"));
group->pupilAt(9).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"aufzumfroehlichenjagen@email.de_"));
group->pupilAt(10).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"hwerdka@smail.de_"));
group->pupilAt(11).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"HalloHerrKaiser@smail.de_"));
group->pupilAt(12).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Kersting.Ute@smail.de_"));
group->pupilAt(13).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Kerzels@smail.de_"));
group->pupilAt(14).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"vera-koeller@smail.de_"));
group->pupilAt(15).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Sebastian.Langenberg@smail.de_"));
group->pupilAt(16).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Sabine_Maier_69@smail.de_"));
group->pupilAt(17).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"paul@familiemeerkat.de_"));
group->pupilAt(18).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"berndmentzel@smail.de_"));
group->pupilAt(19).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Ruediger_Niecke@smail.de_"));
group->pupilAt(20).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"OgulcanOeztuerk@smail.com.tk_"));
group->pupilAt(21).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"sales@beckertransporte.de_"));
group->pupilAt(22).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"mail@reining-tv.de_"));
group->pupilAt(23).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"GeroRichter@smail.de_"));
group->pupilAt(24).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"dieschneemaenner@smail.de_"));
group->pupilAt(25).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"familie@seweringsbeck.de_"));
group->pupilAt(26).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"terstelen@deinebank.de_"));
group->pupilAt(27).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"vanophovencarla@smail.de_"));
group->pupilAt(28).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"elternvonheike@smail.de_"));
group->pupilAt(29).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"WeberKnechte@smail.de_"));
group->pupilAt(30).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"WeberKnechte@smail.de_"));
// group->pupilAt(31).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"webern@elternmail.de_"));
// group->pupilAt(32).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Heiner.Bachmann@smail.de_"));
// group->pupilAt(33).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"L.Boehmer-Kapitza@smail.de_"));
// group->pupilAt(34).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Annette.Eschweger@smail.de_"));
// group->pupilAt(35).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Heiner.Gosekamp@smail.de_"));
// group->pupilAt(36).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"H@Haarmann.de_"));
// group->pupilAt(37).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"K.Hohage@smail.de_"));
// group->pupilAt(38).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"KaiKerzel@smail.de_"));
// group->pupilAt(39).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Maraike@FIrmaKoenig.de_"));
// group->pupilAt(40).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Kontakt@Lehmann-industries.de_"));
// group->pupilAt(41).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Silke_Lipinski@Stadtnet.de_"));
// group->pupilAt(42).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"HeikeUndWalter.Ernst@smail.de_"));
// group->pupilAt(43).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Klaus_Meyer@smail.de_"));
// group->pupilAt(44).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Support@MusikMueller.de_"));
// group->pupilAt(45).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Karin.Neumann@smail.de_"));
// group->pupilAt(46).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Bernd_Quäbicker@smail.de_"));
// group->pupilAt(47).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"FamilieRegensburger@smail.de_"));
// group->pupilAt(48).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Daphne-Schmidt@smail.de_"));
// group->pupilAt(49).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Info@KaisersLaden.de_"));
// group->pupilAt(50).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"ElenoreSchmidt2@smail.de_"));
// group->pupilAt(51).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"TanjasEltern@smail.de_"));
// group->pupilAt(52).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Schulte@SchulteGmbH-Co-KG.de_"));
// group->pupilAt(53).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,""));
// group->pupilAt(54).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"SchwarzWeiss@smail.de_"));
// group->pupilAt(55).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Hendrik-Theissen-Sr@smail.de_"));
// group->pupilAt(56).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Kurt@Instrumentenbau.de_"));
// group->pupilAt(57).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"S.K.Tworuschka@smail.de_"));
// group->pupilAt(58).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"HeinkeUndKarlWedler@smail.de_"));
// group->pupilAt(59).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Wellenstein@Wellenstein.net_"));
// group->pupilAt(60).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Dagma.Werthmann@smail.de_"));
// group->pupilAt(61).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"K@Yildiz-Industries.com_"));
// group->pupilAt(62).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Beate_Anklang4@smail.de_"));
// group->pupilAt(63).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"FamilieBaack@smail.de_"));
// group->pupilAt(64).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Katharina_Bergmann@smail.de_"));
// group->pupilAt(65).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Vorstand@Blauwies-Entertainment.de_"));
// group->pupilAt(66).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Ehepaar_Boesch@smail.de_"));
// group->pupilAt(67).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"DiethelmBrinkhoff@smail.de_"));
// group->pupilAt(68).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Kai.Christens-Lachmacher@smail.de_"));
// group->pupilAt(69).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Salome-Goisern@smail.de_"));
// group->pupilAt(70).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"HeinebergFamilie@smail.de_"));
// group->pupilAt(71).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Kurt@HeinerVerlag.de_"));
// group->pupilAt(72).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Dorothea_Henrichs@smail.de_"));
// group->pupilAt(73).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Herbstsaison@smail.de_"));
// group->pupilAt(74).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"GieselaHirsch@Hirsch.de_"));
// group->pupilAt(75).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,""));
// group->pupilAt(76).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Kathrin.Mauntz-Wirting@smail.de_"));
// group->pupilAt(77).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Maurer@Hausbau.de_"));
// group->pupilAt(78).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Isabell_Neuhaus@smail.de_"));
// group->pupilAt(79).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Overkamp@Overkamp.de_"));
// group->pupilAt(80).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"NilsUndBarbaraPaschen@smail.de_"));
// group->pupilAt(81).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Schubert@Boosey-and-Klawkes.de_"));
// group->pupilAt(82).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"IngoSchwarz@smail.de_"));
// group->pupilAt(83).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"SE@Stalter-Verkauf.net_"));
// group->pupilAt(84).data()->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Glitzerndes@Swarovski.net_"));
group->pupilAt(0)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"info@berg-immobilien.com_"));
group->pupilAt(1)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"ClemensundAnja@DieConrads.de_"));
group->pupilAt(2)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"sales@dunst-aufzuege.de_"));
group->pupilAt(3)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"FamilieErnst@smail.de_"));
group->pupilAt(4)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"juergen.eschborn@smail.de_"));
group->pupilAt(5)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Britta_Geseke@smail.de_"));
group->pupilAt(6)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"familie@hagedorns.de_"));
group->pupilAt(7)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"hartmaenner@smail.de_"));
group->pupilAt(8)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"Marco.Haufer@email.de_"));
group->pupilAt(9)->addContact(new Contact("Email Eltern",Contact::Category::EMAIL,"aufzumfroehlichenjagen@email.de_"));
}
samples/example/models/pupil.cpp
QString("pupils")));
return hash;
}
src/database.cpp
#include <QDir>
using namespace CuteEntityManager;
Database::Database(QSqlDatabase database, bool loggerActivated, bool logQueries, bool logErrors) {
Database::Database(QSqlDatabase database, bool loggerActivated, bool logQueries,
bool logErrors) {
this->database = database;
this->init();
this->connectionName = this->database.connectionName();
this->initLogger(loggerActivated,logQueries,logErrors);
this->initLogger(loggerActivated, logQueries, logErrors);
}
Database::Database(QString databaseType, QString connectionName,
QString hostname,
QString databasename,
QString username, QString password, qint64 port, bool loggerActivated, bool logQueries, bool logErrors) {
QString username, QString password, qint64 port, bool loggerActivated,
bool logQueries, bool logErrors) {
this->database = QSqlDatabase::addDatabase(databaseType, connectionName);
this->connectionName = connectionName;
if (hostname != QString("")) {
......
this->database.setPort(port);
}
this->init();
this->initLogger(loggerActivated,logQueries,logErrors);
this->initLogger(loggerActivated, logQueries, logErrors);
}
void Database::init() {
this->database.open();
this->supportTransactions = this->database.driver()->hasFeature(
QSqlDriver::Transactions);
QSqlDriver::Transactions);
}
void Database::initLogger(bool activated, bool logQueries, bool logErrors) {
this->logQueries = logQueries;
this->logErrors = logErrors;
if(activated) {
this->logger = new Logger(QDir::currentPath() + "/db" + this->connectionName + "db.log");
if (activated) {
this->logger = new Logger(QDir::currentPath() + "/db" + this->connectionName +
".log");
}
}
Database::~Database() {
if(this->logger) {
delete this->logger;
this->logger = nullptr;
if (this->logger) {
delete this->logger;
this->logger = nullptr;
}
if (this->database.isOpen()) {
this->database.close();
......
}
QSharedPointer<Schema> Database::getSchema(DatabaseType db,
QSharedPointer<Database> database) {
QSharedPointer<Database> database) {
switch (db) {
case DatabaseType::SQLITE:
return QSharedPointer<Schema>(new SqliteSchema(database));;
break;
// case PGSQL:
// return QSharedPointer<Schema>(new PgSqlSchema());
// break;
// case MYSQL:
// return QSharedPointer<Schema>(new MysqlSchema());
// break;
// case PGSQL:
// return QSharedPointer<Schema>(new PgSqlSchema());
// break;
// case MYSQL:
// return QSharedPointer<Schema>(new MysqlSchema());
// break;
default:
return QSharedPointer<Schema>(new SqliteSchema(database));
break;
......
}
void Database::debugQuery(const QSqlQuery &query) const {
if(this->logger) {
if(this->logErrors) {
this->logger->lastError(query,this->logQueries);
}
if (this->logger && this->logErrors) {
this->logger->lastError(query, this->logQueries);
} else {
qDebug() << query.executedQuery();
}
src/database.h
bool logErrors;
public:
Database(QSqlDatabase database, bool loggerActivated = true, bool logQueries=false, bool logErrors=true);
Database(QSqlDatabase database, bool loggerActivated = true,
bool logQueries = false, bool logErrors = true);
~Database();
Database(QString databaseType, QString connectionName = QString(""),
QString hostname = QString(""),
QString databasename = QString("") ,
QString username = QString(""), QString password = QString(""),
qint64 port = 0, bool loggerActivated = true, bool logQueries=false, bool logErrors=true);
qint64 port = 0, bool loggerActivated = true, bool logQueries = false,
bool logErrors = true);
QSqlDatabase getDatabase();
QString getConnectionName();
QSqlQuery getQuery();
src/databasemigration.cpp
void DatabaseMigration::setApplyTime(const QDateTime &value) {
applyTime = value;
}
src/entityhelper.cpp
#include "cache.h"
using namespace CuteEntityManager;
EntityHelper::EntityHelper()
{
EntityHelper::EntityHelper() {
}
const QHash<QString, Relation> EntityHelper::getNonInheritedRelations(const Entity *entity) {
const QHash<QString, Relation> EntityHelper::getNonInheritedRelations(
const Entity *entity) {
auto relations = entity->getRelations();
auto superObject = EntityInstanceFactory::newSuperClassInstance(entity);
if (superObject) {
......
}
const QList<const QMetaObject *> EntityHelper::superClasses(const Entity *entity,bool
stopAtSingleTableInheritance) {
const QList<const QMetaObject *> EntityHelper::superClasses(
const Entity *entity, bool
stopAtSingleTableInheritance) {
QList<const QMetaObject *> classes = QList<const QMetaObject *>();
auto superMetaObject = entity->metaObject()->superClass();
if (entity->getInheritanceStrategy() == InheritanceStrategy::JOINED_TABLE) {
Entity *e = nullptr;
while (superMetaObject && QString(superMetaObject->className()) !=
QString("CuteEntityManager::Entity")) {
QString("CuteEntityManager::Entity")) {
e = EntityInstanceFactory::createInstance(superMetaObject->className());
if (e) {
classes.append(superMetaObject);
......
return classes;
}
const QHash<QString, QMetaProperty> EntityHelper::getMetaProperties(const Entity *entity) {
const QHash<QString, QMetaProperty> EntityHelper::getMetaProperties(
const Entity *entity) {
return EntityHelper::getMetaProperties(entity->metaObject());
}
const QHash<QString, QMetaProperty> EntityHelper::getSuperMetaProperties(const Entity *entity) {
const QHash<QString, QMetaProperty> EntityHelper::getSuperMetaProperties(
const Entity *entity) {
auto superMetaObjectPropertyMap = QHash<QString, QMetaProperty>();
auto superMeta = entity->metaObject()->superClass();
if (QString(superMeta->className()) != QString("CuteEntityManager::Entity")
......
}
const QHash<QString, QMetaProperty> EntityHelper::getMetaProperties(
const QMetaObject *object) {
const QMetaObject *object) {
auto h = QHash<QString, QMetaProperty>();
for (int var = 0; var < object->propertyCount(); ++var) {
QMetaProperty m = object->property(var);
......
return h;
}
const QHash<QString, QMetaProperty> EntityHelper::getInheritedMetaProperties(const Entity *entity) {
const QHash<QString, QMetaProperty> EntityHelper::getInheritedMetaProperties(
const Entity *entity) {
auto classes = EntityHelper::superClasses(entity);
auto wholeProperties = QHash<QString, QMetaProperty>();
for (int var = classes.size() - 1; var >= 0; --var) {
......
return wholeProperties;
}
const QHash<Relation, QMetaProperty> EntityHelper::getRelationProperties(const Entity *entity) {
const QHash<Relation, QMetaProperty> EntityHelper::getRelationProperties(
const Entity *entity) {
auto h = QHash<Relation, QMetaProperty>();
auto relations = entity->getRelations();
for (int var = 0; var < entity->metaObject()->propertyCount(); ++var) {
......
return entity->metaObject()->className();
}
const QString EntityHelper::getClassName(const Entity *entity)
{
const QString EntityHelper::getClassName(const Entity *entity) {
return QString(entity->metaObject()->className());
}
void EntityHelper::setListProperty(const QSharedPointer<Entity> &entity,
QList<QSharedPointer<Entity> > &list,
const QMetaProperty &property) {
QList<QSharedPointer<Entity> > &list,
const QMetaProperty &property) {
QVariant var;
var.setValue<QList<QSharedPointer<Entity>>>(list);
property.write(entity.data(),var);
property.write(entity.data(), var);
}
void EntityHelper::addEntityToListProperty(const QSharedPointer<Entity>
......
}
void EntityHelper::setProperty(const QSharedPointer<Entity> &entity,
QSharedPointer<Entity> value,
const QMetaProperty &property) {
QSharedPointer<Entity> value,
const QMetaProperty &property) {
if (value && value->getProperty(value->getPrimaryKey()).toLongLong()
> -1) {
QVariant var;
......
}
}
void EntityHelper::setProperty(const QSharedPointer<Entity> &entity, QSharedPointer<Entity> value, const QString property) {
void EntityHelper::setProperty(const QSharedPointer<Entity> &entity,
QSharedPointer<Entity> value, const QString property) {
auto props = EntityHelper::getMetaProperties(entity.data());
if(props.contains(property)) {
if (props.contains(property)) {
QVariant var;
var.setValue<QSharedPointer<Entity>>(value);
entity->setProperty(property,var);
entity->setProperty(property, var);
}
}
src/entityhelper.h
class Relation;
class Entity;
class Cache;
class EntityHelper
{
public:
class EntityHelper {
public:
EntityHelper();
static const QHash<QString, Relation> getNonInheritedRelations(const Entity *entity);
static const QList<const QMetaObject *> superClasses(const Entity *entity,bool stopAtSingleTableInheritance
= false);
static const QHash<QString, QMetaProperty> getMetaProperties(const Entity *entity);
static const QHash<QString, QMetaProperty> getSuperMetaProperties(const Entity *entity);
static const QHash<QString, QMetaProperty> getMetaProperties(const QMetaObject *object);
static const QHash<QString, QMetaProperty> getInheritedMetaProperties(const Entity *entity);
static const QHash<Relation, QMetaProperty> getRelationProperties(const Entity *entity);
static const QHash<QString, Relation> getNonInheritedRelations(
const Entity *entity);
static const QList<const QMetaObject *> superClasses(const Entity *entity,
bool stopAtSingleTableInheritance
= false);
static const QHash<QString, QMetaProperty> getMetaProperties(
const Entity *entity);
static const QHash<QString, QMetaProperty> getSuperMetaProperties(
const Entity *entity);
static const QHash<QString, QMetaProperty> getMetaProperties(
const QMetaObject *object);
static const QHash<QString, QMetaProperty> getInheritedMetaProperties(
const Entity *entity);
static const QHash<Relation, QMetaProperty> getRelationProperties(
const Entity *entity);
static const char *getClassname(const Entity *entity);
static const QString getClassName(const Entity *entity);
static void addEntityToListProperty(const QSharedPointer<Entity> &entity,
QSharedPointer<Entity> add, const QMetaProperty &property);
QSharedPointer<Entity> add, const QMetaProperty &property);
static void setListProperty(const QSharedPointer<Entity> &entity,
QList<QSharedPointer<Entity>> &list,
const QMetaProperty &property);
QList<QSharedPointer<Entity>> &list,
const QMetaProperty &property);
static void setProperty(const QSharedPointer<Entity> &entity,
QSharedPointer<Entity> value,
const QMetaProperty &property);
QSharedPointer<Entity> value,
const QMetaProperty &property);
static void setProperty(const QSharedPointer<Entity> &entity,
QSharedPointer<Entity> value,
const QString property);
QSharedPointer<Entity> value,
const QString property);
static QMetaProperty mappedProperty(const Relation &r,
const QSharedPointer<Entity> &foreignEntity);
const QSharedPointer<Entity> &foreignEntity);
};
}
src/entityinstancefactory.cpp
prop.write(e, iterator.value());
}
} else {
qDebug() << prop.name() << "on Entity" << EntityHelper::getClassname(e) << "not writeable!";
qDebug() << prop.name() << "on Entity" << EntityHelper::getClassname(
e) << "not writeable!";
}
}
++iterator;
src/entitymanager.cpp
EntityManager::EntityManager(const QString &databaseType, QString databasename ,
QString hostname,
QString username,
QString password, QString port) : QObject() {
bool logQueries = false;
#ifdef QT_DEBUG
logQueries = true;
#endif
QString password, QString port, bool logQueries) : QObject() {
auto db = new Database(databaseType, this->createConnection(), hostname,
databasename, username,
password,
port.toInt(),true,logQueries);
port.toInt(), true, logQueries);
this->db = QSharedPointer<Database>(db);
this->init();
}
......
}
bool EntityManager::startup(QString version, QStringList toInitialize) {
QSharedPointer<Entity> dbm = QSharedPointer<DatabaseMigration>(new DatabaseMigration());
QSharedPointer<Entity> dbm = QSharedPointer<DatabaseMigration>
(new DatabaseMigration());
QHash<QString, QVariant> map = QHash<QString, QVariant>();
bool ok = true;
map.insert("version", version);
......
}
QSharedPointer<Entity> EntityManager::findById(const qint64 &id,
QSharedPointer<Entity> &e,
const bool refresh) {
QSharedPointer<Entity> &e,
const bool refresh) {
QSharedPointer<Entity> r;
if (!e.isNull() && (refresh
|| !(r = this->cache.get(id, EntityHelper::getClassname(e.data()))))) {
......
}
QSharedPointer<Entity> EntityManager::findById(const qint64 &id,
const QString &classname) {
const QString &classname) {
QSharedPointer<Entity> e = QSharedPointer<Entity>
(EntityInstanceFactory::createInstance(classname));
(EntityInstanceFactory::createInstance(classname));
return this->findById(id, e);
}
......
bool ok = false;
if ((convertedId = id.toLongLong(&ok)) && ok && convertedId > -1) {
QString className = EntityInstanceFactory::extractEntityType(
property.typeName());
property.typeName());
QSharedPointer<Entity> ptr = QSharedPointer<Entity>();
if (refresh || !(this->cache.contains(convertedId, className)
&& (ptr = this->cache.get(convertedId, className)) && ptr)) {
......
property.typeName())));
if (e) {
QSqlQuery q = this->schema->getQueryBuilder()->oneToMany(e->getTablename(),
this->schema->getQueryBuilder()->generateColumnNameID(r.getMappedBy()),
entity->getId());
this->schema->getQueryBuilder()->generateColumnNameID(r.getMappedBy()),
entity->getId());
auto listMap = this->convertQueryResult(q);
auto entities = this->convert(listMap, EntityHelper::getClassname(e.data()), refresh);
auto entities = this->convert(listMap, EntityHelper::getClassname(e.data()),
refresh);
EntityHelper::setListProperty(entity, entities, property);
}
}
......
EntityInstanceFactory::extractEntityType(property.typeName())));
if (e) {
QSqlQuery q = this->schema->getQueryBuilder()->oneToMany(
e->getTablename(),
this->schema->getQueryBuilder()->generateColumnNameID(
r.getMappedBy()),
entity->getProperty(entity->getPrimaryKey()).toLongLong(), 1);
e->getTablename(),
this->schema->getQueryBuilder()->generateColumnNameID(
r.getMappedBy()),
entity->getProperty(entity->getPrimaryKey()).toLongLong(), 1);
auto listMap = this->convertQueryResult(q);
auto entities = this->convert(listMap, EntityHelper::getClassname(e.data()), refresh);
auto entities = this->convert(listMap, EntityHelper::getClassname(e.data()),
refresh);
if (!entities.isEmpty()) {
QSharedPointer<Entity> ptr = entities.at(0);
EntityHelper::setProperty(entity, ptr, property);
......
}
void EntityManager::savePrePersistedRelations(const QSharedPointer<Entity>
&entity) {
&entity) {
auto relations = EntityHelper::getRelationProperties(entity.data());
auto iterator = relations.constBegin();
while (iterator != relations.constEnd()) {
......
auto e = EntityInstanceFactory::castQVariant(var);
if (this->shouldBeSaved(e, r)) {
this->save(e);
auto fkProp = EntityHelper::mappedProperty(r,e);
if(fkProp.isValid()) {
EntityHelper::addEntityToListProperty(e,entity,fkProp);
auto fkProp = EntityHelper::mappedProperty(r, e);
if (fkProp.isValid()) {
EntityHelper::addEntityToListProperty(e, entity, fkProp);
}
}
} else if (r.getType() == RelationType::ONE_TO_ONE && r.getMappedBy().isEmpty()) {
} else if (r.getType() == RelationType::ONE_TO_ONE
&& r.getMappedBy().isEmpty()) {
auto e = EntityInstanceFactory::castQVariant(var);
this->save(e);
auto prop = EntityHelper::mappedProperty(r,e);
if(prop.isValid()) {
EntityHelper::setProperty(e,entity,prop);
auto prop = EntityHelper::mappedProperty(r, e);
if (prop.isValid()) {
EntityHelper::setProperty(e, entity, prop);
}
}
}
......
}
void EntityManager::savePostPersistedRelations(const QSharedPointer<Entity>
&entity) {
&entity) {
auto relations = EntityHelper::getRelationProperties(entity.data());
auto iterator = relations.constBegin();
while (iterator != relations.constEnd()) {
......
this->persistManyToMany(entity, r, var);
} else if (this->canPersistRelation(r, RelationType::ONE_TO_MANY, var)) {
QList<QSharedPointer<Entity>> list = EntityInstanceFactory::castQVariantList(
var);
if(!list.isEmpty()) {
auto fkProp = EntityHelper::mappedProperty(r,list.at(0));
var);
if (!list.isEmpty()) {
auto fkProp = EntityHelper::mappedProperty(r, list.at(0));
for (int var = 0; var < list.size(); ++var) {
auto e = list.at(var);
if (this->shouldBeSaved(e, r)) {
this->save(e);
if(fkProp.isValid()) {
EntityHelper::addEntityToListProperty(e,entity,fkProp);
if (fkProp.isValid()) {
EntityHelper::addEntityToListProperty(e, entity, fkProp);
}
}
}
......
&& !r.getMappedBy().isEmpty()) {
auto e = EntityInstanceFactory::castQVariant(var);
this->save(e);
auto fkProp = EntityHelper::mappedProperty(r,e);
if(fkProp.isValid()) {
EntityHelper::addEntityToListProperty(e,entity,fkProp);
auto fkProp = EntityHelper::mappedProperty(r, e);
if (fkProp.isValid()) {
EntityHelper::addEntityToListProperty(e, entity, fkProp);
}
}
}
......
}
void EntityManager::persistMappedByRelation(const QList<QSharedPointer<Entity> >
&list, QSqlQuery &q, const QSharedPointer<Entity> &entity,
const QSharedPointer<Entity> &ptr, const Relation &r,
const QString &tblName) {
&list, QSqlQuery &q, const QSharedPointer<Entity> &entity,
const QSharedPointer<Entity> &ptr, const Relation &r,
const QString &tblName) {
q.clear();
QList<QSharedPointer<Entity>> saved = r.getCascadeType().contains(
CascadeType::ALL)
|| r.getCascadeType().contains(CascadeType::MERGE)
|| r.getCascadeType().contains(CascadeType::PERSIST) ?
this->saveRelationEntities(list,
r) : list;
QList<QSharedPointer<Entity>> saved =
r.getCascadeType().contains(CascadeType::ALL) ||
r.getCascadeType().contains(CascadeType::MERGE) ||
r.getCascadeType().contains(CascadeType::PERSIST) ?
this->saveRelationEntities(list, r) : list;
this->db->startTransaction();
auto builder = this->schema->getQueryBuilder();
q = builder->manyToManyInsert(tblName,
......
builder->generateManyToManyColumnName(ptr));
q.bindValue(0, entity->getProperty(entity->getPrimaryKey()));
auto prop = EntityHelper::mappedProperty(r, ptr);
bool propertyIsValid = this->isRelationPropertyValid(prop, r, entity, ptr);
QSharedPointer<Entity> item;
for (int var = 0; var < saved.size(); ++var) {
item = list.at(var);
if (item->getProperty(item->getPrimaryKey()).toLongLong() > -1) {
q.bindValue(1, item->getProperty(ptr->getPrimaryKey()));
this->schema->getDatabase()->exec(q);
if (prop.isReadable()) {
bool ok = this->db->exec(q);
if (ok && propertyIsValid) {
EntityHelper::addEntityToListProperty(item, entity, prop);
} else {
qDebug() << "Query exec for many to many relation failed." <<
q.lastError().text();
qDebug() << "Involved entities: " << EntityHelper::getClassName(entity.data()) <<
"(MainEntitiy) and " << EntityHelper::getClassName(ptr.data());
qDebug() << "Relation:" << r.getPropertyName();
}
}
}
......
}
}
bool EntityManager::isRelationPropertyValid(const QMetaProperty &prop,
const Relation &r, const QSharedPointer<Entity> &e,
const QSharedPointer<Entity> &relatedEntity) {
bool propertyIsValid = prop.isValid() && prop.isReadable() && prop.isWritable();
if (!propertyIsValid) {
qDebug() << "Relation is incomplete:" << r.getPropertyName();
qDebug() << "Involved entities: " << EntityHelper::getClassName(
e.data()) <<
"(MainEntitiy) and " << EntityHelper::getClassName(relatedEntity.data());
}
return propertyIsValid;
}
bool EntityManager::shouldBeSaved(QSharedPointer<Entity> &entity,
const Relation &r) {
return entity && (r.getCascadeType().contains(CascadeType::ALL)
......
}
void EntityManager::setNullEntityPropertyRelation(QVariant &var,
const Relation &r) {
const Relation &r) {
if (r.getCascadeType().contains(CascadeType::REMOVE)
|| r.getCascadeType().contains(CascadeType::ALL)) {
this->removeEntity(var);
......
auto e = EntityInstanceFactory::castQVariant(var);
auto metas = EntityHelper::getMetaProperties(e.data());
if (metas.contains(r.getMappedBy())) {
EntityHelper::setProperty(e, QSharedPointer<Entity>(), metas.value(r.getMappedBy()));
EntityHelper::setProperty(e, QSharedPointer<Entity>(),
metas.value(r.getMappedBy()));
this->save(e);
}
}
......
}
void EntityManager::removeManyToManyEntityList(const QSharedPointer<Entity> &e,
const Relation &r,
QVariant &var) {
const Relation &r,
QVariant &var) {
if (!var.isNull() && var.canConvert<QVariantList>()) {
auto list = EntityInstanceFactory::castQVariantList(var);
if (!list.isEmpty()) {
......
QString tblName = builder->generateManyToManyTableName(e, ptr, r);
if (this->schema->getTables().contains(tblName)) {
QSqlQuery q = builder->manyToManyDelete(
tblName, builder->generateManyToManyColumnName(e),
e->getProperty(e->getPrimaryKey()).toLongLong());
tblName, builder->generateManyToManyColumnName(e),
e->getProperty(e->getPrimaryKey()).toLongLong());
bool refresh = r.getCascadeType().contains(CascadeType::REFRESH)
|| r.getCascadeType().contains(CascadeType::ALL);
|| r.getCascadeType().contains(CascadeType::ALL);
bool remove = r.getCascadeType().contains(CascadeType::REMOVE)
|| r.getCascadeType().contains(CascadeType::ALL);
|| r.getCascadeType().contains(CascadeType::ALL);
if (this->schema->getDatabase()->exec(q)) {
for (int var = 0; var < list.size(); ++var) {
auto entity = list.at(var);
......
}
QList<QSharedPointer<Entity>> EntityManager::saveRelationEntities(
const QList<QSharedPointer<Entity> > &list, const Relation &r) {
const QList<QSharedPointer<Entity> > &list, const Relation &r) {
QList<QSharedPointer<Entity>> saved = QList<QSharedPointer<Entity>>();
QSharedPointer<Entity> ptr;
for (int var = 0; var < list.size(); ++var) {
......
QString tblName = builder->generateManyToManyTableName(entity, ptr, r);
if (this->schema->getTables().contains(tblName)) {
QSqlQuery q = builder->manyToManyDelete(
tblName, builder->generateManyToManyColumnName(entity),
entity->getProperty(entity->getPrimaryKey()).toLongLong());
tblName, builder->generateManyToManyColumnName(entity),
entity->getProperty(entity->getPrimaryKey()).toLongLong());
if (this->db->exec(q)) {
auto nList = EntityInstanceFactory::castQVariantList(property);
this->persistMappedByRelation(nList, q, entity, ptr, r, tblName);
}
} else {
qDebug() << "MANY_TO_MANY Table " << tblName << " not exists";
this->missingManyToManyTable(tblName, entity, r);
}
}
}
void EntityManager::missingManyToManyTable(const QString &tblName,
const QSharedPointer<Entity> &e, const Relation &r) {
qDebug() << "MANY_TO_MANY Table " << tblName << " is missing";
qDebug() << "Entity " << EntityHelper::getClassName(e.data()) << " is affected";
qDebug() << "Relation of property: " << r.getPropertyName();
/**
@todo wait for Qt 5.5.1
@see https://codereview.qt-project.org/#/c/122232/
*/
//qDebug() << "RelationType:" << r.getType() << " MappedBy:" << r.getMappedBy();
}
void EntityManager::manyToMany(const QSharedPointer<Entity> &entity,
const QMetaProperty &property, const Relation &relation, const bool refresh) {
QSharedPointer<Entity> secEntityPtr = QSharedPointer<Entity>
(EntityInstanceFactory::createInstance(EntityInstanceFactory::extractEntityType(
QString(property.typeName()))));
(EntityInstanceFactory::createInstance(EntityInstanceFactory::extractEntityType(
QString(property.typeName()))));
auto builder = this->schema->getQueryBuilder();
if (secEntityPtr) {
QString tblName = builder->generateManyToManyTableName(entity, secEntityPtr,
relation);
relation);
if (this->schema->getTables().contains(tblName)) {
QSqlQuery q = builder->manyToMany(tblName,
builder->generateManyToManyColumnName(entity),
......
auto id = listMap.at(var).value(builder->generateManyToManyColumnName(
secEntityPtr));
if (!refresh
&& this->cache.contains(id.toLongLong(), EntityHelper::getClassname(secEntityPtr.data()))) {
e = this->cache.get(id.toLongLong(), EntityHelper::getClassname(secEntityPtr.data()));
&& this->cache.contains(id.toLongLong(),
EntityHelper::getClassname(secEntityPtr.data()))) {
e = this->cache.get(id.toLongLong(),
EntityHelper::getClassname(secEntityPtr.data()));
} else {
e = this->findById(id.toLongLong(), EntityHelper::getClassname(secEntityPtr.data()));
e = this->findById(id.toLongLong(),
EntityHelper::getClassname(secEntityPtr.data()));
}
if(e) {
EntityHelper::addEntityToListProperty(entity,e,property);
if (e) {
EntityHelper::addEntityToListProperty(entity, e, property);
}
}
} else {
qDebug() << "MANY_TO_MANY Table " << tblName << " not exists";
this->missingManyToManyTable(tblName, entity, relation);
}
}
}
QList<QSharedPointer<Entity> > EntityManager::findEntityByAttributes(
const QSharedPointer<Entity>
&entity,
bool ignoreID) {
const QSharedPointer<Entity>
&entity,
bool ignoreID) {
auto maps = this->findAllByAttributes(entity, ignoreID);
return this->convert(maps, EntityHelper::getClassname(entity.data()));
}
......
}
this->db->startTransaction();
QList<QSqlQuery> q = this->schema->getQueryBuilder()->create(
entity);
entity);
bool first = true;
QVariant id = -1;
for (int var = 0; var < q.size(); ++var) {
......
}
rc = this->db->exec(query);
if (!rc) {
qDebug() << "Query failed:" << query.lastError().text() << " of class " <<
EntityHelper::getClassname(entity.data());
qDebug() << "class is erroneous:" << EntityHelper::getClassname(entity.data());
break;
}
if (first) {
......
}
this->db->startTransaction();
QList<QSqlQuery> q = this->schema->getQueryBuilder()->merge(
entity);
bool ok = true;
for (int var = 0; var < q.size(); ++var) {
auto query = q.at(var);
ok = this->db->exec(query);
if (!ok) {
qDebug() << query.lastError().text();
break;
}
}
entity);
bool ok = this->db->exec(q);
if (!ok || !this->db->commitTransaction()) {
this->db->rollbackTransaction();
return false;
......
}
QHash<QString, QVariant> EntityManager::findByPk(qint64 id,
const QSharedPointer<Entity>
&e) {
const QSharedPointer<Entity>
&e) {
QSqlQuery q = this->schema->getQueryBuilder()->find(id, e, 0,
e->getPrimaryKey());
e->getPrimaryKey());
auto listMap = this->convertQueryResult(q);
if (!listMap.isEmpty()) {
return listMap.at(0);
......
QList<QHash<QString, QVariant> > EntityManager::findAllByAttributes(
const QSharedPointer<Entity>
&entity,
bool ignoreID) {
const QSharedPointer<Entity>
&entity,
bool ignoreID) {
QSqlQuery q = this->schema->getQueryBuilder()->findByAttributes(
entity, ignoreID);
entity, ignoreID);
return this->convertQueryResult(q);
}
QList<QHash <QString, QVariant> > EntityManager::findAllByAttributes(
const QHash<QString, QVariant> &m, const QString &tblname, bool ignoreID) {
const QHash<QString, QVariant> &m, const QString &tblname, bool ignoreID) {
QSqlQuery q = this->schema->getQueryBuilder()->findByAttributes(m,
tblname, ignoreID);
tblname, ignoreID);
return this->convertQueryResult(q);
}
QList<QHash<QString, QVariant> > EntityManager::convertQueryResult(
QSqlQuery &q) {
QSqlQuery &q) {
QList<QHash <QString, QVariant> > listmap = QList<QHash <QString, QVariant> >();
this->db->select(q);
QSqlRecord rec = q.record();
......
}
QList<QHash <QString, QVariant> > EntityManager::findAll(
const QSharedPointer<Entity> &e) {
const QSharedPointer<Entity> &e) {
QSqlQuery q = this->schema->getQueryBuilder()->findAll(e);
return this->convertQueryResult(q);
}
......
const Relation r = iterator.key();
const QMetaProperty property = iterator.value();
QString colName = this->schema->getQueryBuilder()->generateColumnNameID(
r.getPropertyName());
r.getPropertyName());
switch (r.getType()) {
case RelationType::MANY_TO_ONE:
if (map.contains(colName)) {
......
this->db->startTransaction();
this->removeRelations(entity);
auto queries = this->schema->getQueryBuilder()->remove(entity);
bool ok = true;
for (int var = 0; var < queries.size(); ++var) {
auto q = queries.at(var);
if (!q.exec()) {
this->db->rollbackTransaction();
ok = false;
break;
}
}
bool ok = this->db->exec(queries);
if (ok && this->db->commitTransaction()) {
this->cache.remove(entity);
entity.clear();
rc = true;
} else {
this->db->rollbackTransaction();
}
return rc;
}
......
bool EntityManager::createTable(const QSharedPointer<Entity> &entity,
bool createRelationTables) {
return this->schema->getQueryBuilder()->createTable(entity,
createRelationTables);
createRelationTables);
}
qint8 EntityManager::count(const QSharedPointer<Entity> &entity,
bool ignoreID) {
qint8 rc = -1;
QSqlQuery q = this->schema->getQueryBuilder()->count(entity,
ignoreID);
ignoreID);
this->db->select(q);
if (q.next()) {
rc = q.value(0).toInt();
......
}
QSharedPointer<Entity> EntityManager::convert(const QHash<QString, QVariant>
&map,
const char *classname,const bool refresh) {
&map,
const char *classname, const bool refresh) {
auto ptr = QSharedPointer<Entity>(EntityInstanceFactory::createInstance(
classname, map));
this->cache.insert(ptr);
......
}
QList<QSharedPointer<Entity> > EntityManager::convert(
QList<QHash<QString, QVariant> > maps,
const char *classname,const bool refresh) {
QList<QHash<QString, QVariant> > maps,
const char *classname, const bool refresh) {
auto list = QList<QSharedPointer<Entity> >();
for (int var = 0; var < maps.size(); ++var) {
auto ptr = this->convert(maps.at(var), classname, refresh);
src/entitymanager.h
EntityManager(const QString &databaseType, QString databasename = "" ,
QString hostname = "",
QString username = "",
QString password = "", QString port = "");
QString password = "", QString port = "", bool logQueries = false);
~EntityManager();
static QStringList getConnectionNames();
/**
......
void oneToMany(const QSharedPointer<Entity> &entity, const Relation &r,
const QMetaProperty &property, const bool refresh = false);
void manyToMany(const QSharedPointer<Entity> &entity,
const QMetaProperty &property, const Relation &relation, const bool refresh = false);
const QMetaProperty &property, const Relation &relation,
const bool refresh = false);
void oneToOne(const QSharedPointer<Entity> &entity, const Relation &r,
const QMetaProperty &property, const bool refresh = false,
const QVariant &id = "");
......
void setNullOneToManyRelation(QVariant &var, const Relation &r);
void setNullEntityPropertyRelation(QVariant &var, const Relation &r);
QSharedPointer<Entity> convert(const QHash<QString, QVariant> &map,
const char *classname,const bool refresh = false);
const char *classname, const bool refresh = false);
QList<QSharedPointer<Entity>> convert(QList<QHash<QString, QVariant> > maps,
const char *classname,const bool refresh = false);
const char *classname, const bool refresh = false);
void missingManyToManyTable(const QString &tblName,
const QSharedPointer<Entity> &e, const Relation &r);
bool isRelationPropertyValid(const QMetaProperty &prop, const Relation &r,
const QSharedPointer<Entity> &e, const QSharedPointer<Entity> &relatedEntity);
private:
static QStringList connectionNames;
src/logger.cpp
}
void Logger::lastError(const QSqlQuery &q, bool logQuery) {
QFile log(this->getPath());
log.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
log.seek(log.size());
QTextStream stream(&log);
const QString errorMsg = this->generateLogMsg(q.lastError());
if (!errorMsg.isEmpty()) {
qDebug() << errorMsg;
stream << errorMsg;
}
if(logQuery || !errorMsg.isEmpty()) {
const QString query = this->generateLogMsg(q);
if(!query.isEmpty()) {
qDebug() << query;
stream << query;
if (logQuery || q.lastError().isValid()) {
QFile log(this->getPath());
log.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
log.seek(log.size());
QTextStream stream(&log);
const QString errorMsg = this->generateLogMsg(q.lastError());
if (!errorMsg.isEmpty()) {
qDebug() << errorMsg;
stream << errorMsg;
}
if (logQuery || !errorMsg.isEmpty()) {
const QString query = this->generateLogMsg(q);
if (!query.isEmpty()) {
qDebug() << query;
stream << query;
}
}
stream << "\n";
stream.flush();
log.close();
}
stream << "\n";
stream.flush();
log.close();
}
void Logger::lastError(const QSqlError &e) {
if(e.isValid()) {
if (e.isValid()) {
QFile log(this->getPath());
log.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append);
log.seek(log.size());
QTextStream stream(&log);
qDebug() << this->generateLogMsg(e);
stream << this->generateLogMsg(e);
stream << "\n";
stream.flush();
log.close();
}
}
QString Logger::generateLogMsg(const QSqlQuery &q, bool withValues) const {
QString r = "<" + q.executedQuery() + ">";
if(withValues) {
QMap<QString, QVariant> m = q.boundValues();
QMap<QString,QVariant>::iterator i;
if(!m.isEmpty()) {
r += "Values: ";
for (i = m.begin(); i != m.end(); ++i) {
r += "{" + i.key() + ":" + i.value().toString() + "}";
if (withValues) {
QMap<QString, QVariant> m = q.boundValues();
QMap<QString, QVariant>::iterator i;
if (!m.isEmpty()) {
r += "Values: ";
for (i = m.begin(); i != m.end(); ++i) {
r += "{" + i.key() + "=" + i.value().toString() + "}";
}
}
}
}
return r;
}
QString Logger::getPath() {
if(this->path.isEmpty()) {
if (this->path.isEmpty()) {
this->path = this->defaultPath();
}
return path;
......
}
QString Logger::generateLogMsg(const QSqlError &e) const {
if(e.isValid()) {
return "ErrorUTC:" + QDateTime::currentDateTime().toString("yyyy-MM-dd|hh:MM:ss") + "|" + e.driverText() + "|" + e.databaseText().toLatin1();
} else {
return "";
QString r = "";
if (e.isValid()) {
r = "ErrorUTC:" +
QDateTime::currentDateTime().toString("yyyy-MM-dd|hh:MM:ss") + "|" +
e.driverText() + "|" + e.databaseText().toLatin1();
}
return r;
}
src/logger.h
#include <QSqlError>
#include <QSqlQuery>
class Logger
{
public:
Logger(QString path="");
class Logger {
public:
Logger(QString path = "");
~Logger();
QString defaultPath() const;
void lastError(const QSqlError &e);
void lastError(const QSqlQuery &q, bool logQuery=false);
void lastError(const QSqlQuery &q, bool logQuery = false);
QString getPath();
void setPath(const QString &value);
protected:
protected:
QString generateLogMsg(const QSqlError &e) const;
QString generateLogMsg(const QSqlQuery &q, bool withValues=true) const;
QString generateLogMsg(const QSqlQuery &q, bool withValues = true) const;
private:
private:
QString path;
};
src/querybuilder.cpp
//cant believe that this could work in Qt
//https://github.com/yiisoft/yii2/blob/master/framework/db/QueryBuilder.php
QRegularExpression reg = QRegularExpression(
QRegularExpression::escape("/^(\\w+)\((.+?)\\)(.*)$/"));
QRegularExpression::escape("/^(\\w+)\\((.+?)\\)(.*)$/"));
reg.optimize();
QRegularExpressionMatchIterator i = reg.globalMatch(type, 0,
QRegularExpression::PartialPreferFirstMatch);
src/schema.cpp
QString Schema::getRawTable(QString name) {
if (name.indexOf("{{")) {
QRegularExpression re(QRegularExpression::escape("/\\{\{(.*?)\\}\\}/"));
QRegularExpression re(QRegularExpression::escape("/\\{\\{(.*?)\\}\\}/"));
return name.replace(re, QRegularExpression::escape("\\1"));
}
return name;
src/schema/sqliteschema.cpp
QSharedPointer<QHash<QString, QString>> SqliteSchema::getTypeMap() {
if (this->typeMap->empty()) {
this->typeMap->insert(TYPE_PK,
"integer PRIMARY KEY AUTOINCREMENT NOT NULL");
"integer PRIMARY KEY AUTOINCREMENT NOT NULL");
this->typeMap->insert(TYPE_BIGPK,
"integer PRIMARY KEY AUTOINCREMENT NOT NULL");
"integer PRIMARY KEY AUTOINCREMENT NOT NULL");
this->typeMap->insert(TYPE_BOOLEAN, "boolean");
this->typeMap->insert(TYPE_SMALLINT, "smallint");
this->typeMap->insert(TYPE_INTEGER, "integer");

Auch abrufbar als: Unified diff