Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1bbd25fa

Von Sebastian Diel vor fast 8 Jahren hinzugefügt

  • ID 1bbd25fae3be299db961efe0c38a5ae048e89171
  • Vorgänger 57853172
  • Nachfolger 2a40e887

Working at last

Unterschiede anzeigen:

samples/simple/main.cpp
EntityInstanceFactory::registerClass<Person>();
EntityInstanceFactory::registerClass<Pupil>();
EntityInstanceFactory::registerClass<Group>();
// EntityInstanceFactory::registerClass<Occasion>();
// EntityInstanceFactory::registerClass<Incident>();
// EntityInstanceFactory::registerClass<RatingMarkDefinition>();
// EntityInstanceFactory::registerClass<RatingMarkIncident>();
// EntityInstanceFactory::registerClass<RatingMarkSystem>();
EntityInstanceFactory::registerClass<Occasion>();
EntityInstanceFactory::registerClass<Incident>();
EntityInstanceFactory::registerClass<RatingMarkDefinition>();
EntityInstanceFactory::registerClass<RatingMarkIncident>();
EntityInstanceFactory::registerClass<RatingMarkSystem>();
QSharedPointer<CuteEntityManager::EntityManager> e =
QSharedPointer<CuteEntityManager::EntityManager>(new
CuteEntityManager::EntityManager("QSQLITE",
QDir::currentPath() + "/db.sqlite"));
QSharedPointer<CuteEntityManager::EntityManager>(new
CuteEntityManager::EntityManager("QSQLITE",
QDir::currentPath() + "/db.sqlite"));
qDebug()<<QDir::currentPath();
QStringList inits = QStringList() << "Address" << "Contact" << "Person" << "Pupil" << "Group";
// << "Incident" << "Occasion" << "RatingMarkDefinition" << "RatingMarkIncident" << "RatingMarkSystem";
QStringList inits = QStringList() << "Address" << "Contact" << "Person" << "Pupil" << "Group" << "Incident" << "Occasion" << "RatingMarkDefinition" << "RatingMarkIncident" << "RatingMarkSystem";
e->startup("0.1", inits);
// auto entities = DataCreation::createRatingEntities();
// e->save(entities);
// QSharedPointer<Pupil> pupil = QSharedPointer<Pupil>(new Pupil("Vorname","Nachname","","","Keks"));
// e->save(pupil);
QSharedPointer<Pupil> pupil = QSharedPointer<Pupil>(new Pupil());
pupil->setLegalGuardianNote("note");
try {
e->save(QList<QSharedPointer<Entity>>()<<pupil);
} catch(QString s) {
qDebug()<<s;
}
// QSharedPointer<Person> person = QSharedPointer<Person>(new Person("Vorname","Nachname","","","Keks"));
// e->save(person);
auto entities = DataCreation::createRatingEntities();
e->save(entities);
/*
QSharedPointer<Pupil> pupil = QSharedPointer<Pupil>(new Pupil("Vorname","Nachname","","","Keks"));
pupil->setLegalGuardianNote("note");
QSharedPointer<Occasion> occasion = QSharedPointer<Occasion>(new Occasion("IrgendeinAnlass"));
QSharedPointer<RatingMarkIncident> inc = QSharedPointer<RatingMarkIncident>(new RatingMarkIncident());
inc->setAdditionalInfo("addInf");
inc->setBookedAt(QDateTime::currentDateTime());
inc->setBookedFor(QDateTime::currentDateTime());
inc->setOccasion(occasion);
// inc->setPupil(pupil);
inc->setRateable(true);
// inc->setRatingMarkSystem(system);
inc->setSymbol("z");
inc->setValue(23);
e->save(QList<QSharedPointer<Entity>>()<<pupil);
e->save(inc);
QSharedPointer<Occasion> occasion = QSharedPointer<Occasion>(new Occasion("IrgendeinAnlass"));
QSharedPointer<RatingMarkIncident> inc = QSharedPointer<RatingMarkIncident>(new RatingMarkIncident());
inc->setAdditionalInfo("addInf");
inc->setBookedAt(QDateTime::currentDateTime());
inc->setBookedFor(QDateTime::currentDateTime());
inc->setOccasion(occasion);
inc->setPupil(pupil);
inc->setRateable(true);
auto system = e->findAll<RatingMarkSystem>().first();
inc->setRatingMarkSystem(system);
inc->setSymbol("z");
inc->setValue(23);
e->save(inc);
*/
} catch(QString s) {
qDebug()<<s;
}
return 0;
}
samples/simple/person.cpp
const QHash<QString, CuteEntityManager::Relation> Person::getRelations() const {
auto hash = QHash<QString, CuteEntityManager::Relation>();
hash.insert("groups", CuteEntityManager::Relation("groups",
RelationType::MANY_TO_MANY,
QString("persons")));
RelationType::MANY_TO_MANY));
hash.insert("contacts", CuteEntityManager::Relation("contacts",
RelationType::MANY_TO_MANY));
hash.insert("addresses", CuteEntityManager::Relation("addresses",

Auch abrufbar als: Unified diff