Revision 139a9b5e
Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt
src/entitymanager.cpp | ||
---|---|---|
checkDuplicate, validate, relationsIgnoreHasChanged);
|
||
}
|
||
|
||
bool EntityManager::create(QList<QSharedPointer<Entity> > entities,
|
||
bool EntityManager::create(QList<QSharedPointer<Entity> > &entities,
|
||
const bool persistRelations, const bool validate,
|
||
const bool relationsIgnoreHasChanged, const bool checkDuplicate) {
|
||
bool ok = true;
|
||
... | ... | |
const bool persistRelations, const bool ignoreHasChanged, const bool validate,
|
||
const bool relationsIgnoreHasChanged) {
|
||
bool ok = true;
|
||
auto merged = QList<Entity *>();
|
||
foreach (QSharedPointer<Entity> entity, entities) {
|
||
auto merged = QList<Entity *>();
|
||
ok = this->saveObject(entity, merged, persistRelations,
|
||
ignoreHasChanged, validate, relationsIgnoreHasChanged);
|
||
if (!ok) {
|
src/entitymanager.h | ||
---|---|---|
* @param entities
|
||
* @return
|
||
*/
|
||
bool create(QList<QSharedPointer<Entity>> entities,
|
||
bool create(QList<QSharedPointer<Entity>> &entities,
|
||
const bool persistRelations = true, const bool validate = true,
|
||
const bool relationsIgnoreHasChanged = false,
|
||
const bool checkDuplicate = false);
|
||
... | ... | |
return false;
|
||
}
|
||
|
||
template<class T> QList<QSharedPointer<T>> convertList(const
|
||
QList<QSharedPointer<Entity>> &list) {
|
||
QList<QSharedPointer<T>> newList = QList<QSharedPointer<T>>();
|
||
for (int i = 0; i < list.size(); ++i) {
|
||
newList.append(list.at(i).objectCast<T>());
|
||
}
|
||
return newList;
|
||
}
|
||
|
||
template<class T> QList<QSharedPointer<Entity>> convertToEntityList(
|
||
const QList<QSharedPointer<T>> &list) {
|
||
QList<QSharedPointer<Entity>> newList = QList<QSharedPointer<Entity>>();
|
||
for (int i = 0; i < list.size(); ++i) {
|
||
QSharedPointer<T> entity = list.at(i);
|
||
newList.append(entity);
|
||
}
|
||
return newList;
|
||
}
|
||
|
||
protected:
|
||
bool saveObject(QSharedPointer<Entity> &entity, QList<Entity *> &mergedObjects,
|
||
const bool persistRelations = true,
|
||
... | ... | |
QList<Entity *> &mergedObjects, const bool persistRelations,
|
||
const bool checkDuplicate, const bool validate,
|
||
const bool relationsIgnoreHasChanged = false);
|
||
template<class T> QList<QSharedPointer<T>> convertList(const
|
||
QList<QSharedPointer<Entity>> &list) {
|
||
QList<QSharedPointer<T>> newList = QList<QSharedPointer<T>>();
|
||
for (int i = 0; i < list.size(); ++i) {
|
||
newList.append(list.at(i).objectCast<T>());
|
||
}
|
||
return newList;
|
||
}
|
||
|
||
void init(bool inspect, const MsgType msgType);
|
||
QList<QHash<QString, QVariant> > findAll(const QSharedPointer<Entity> &e);
|
||
void resolveRelations(const QSharedPointer<Entity> &entity,
|
Auch abrufbar als: Unified diff
improvements