Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f48a8e1e

Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt

  • ID f48a8e1eec8950636df05926348e896f4c650c2e
  • Vorgänger f16e1bd3
  • Nachfolger ae497991

doxygen comments

Unterschiede anzeigen:

src/entitymanager.cpp
return this->mergeObject(entity, merged, withRelations, validate);
}
/**
* @brief EntityManager::create
* Will persist an entity in the database. Before its persisted it has the id -1(invalid id). If database persisting was succesfull it has a valid id.
* @param entity
* @param persistRelations
* @param checkDuplicate
* @param validate
* @return
*/
bool EntityManager::create(QSharedPointer<Entity> &entity,
const bool persistRelations, const bool checkDuplicate, const bool validate) {
auto merged = QList<Entity *>();
return this->createObject(entity, merged, persistRelations,
checkDuplicate, validate);
}
/**
* @brief EntityManager::save
* If the entity has no valid ID, this method will call the create() method. Else it would call the merge method.
* @param entity
* @param persistRelations
* @param ignoreHasChanged
* @param validate
* @return bool
*/
bool EntityManager::save(QSharedPointer<Entity> &entity,
const bool persistRelations, const bool ignoreHasChanged, const bool validate) {
auto merged = QList<Entity *>();
......
entities.append(entity);
} else {
qWarning() << "startup of version " << version << " failed";
qWarning() << "erroneous entity:" << (var == 0 ? "null, this should not happen!" : toInitialize.at(
var - 1));
qWarning() << "erroneous entity:" << (var == 0 ?
"null, this should not happen!" : toInitialize.at(
var - 1));
break;
}
}
......
return this->db->exec(query);
}
/**
* @brief EntityManager::checkTable
* Checks if a table has been already created, if not it will create it
* @param entity
* @return
*/
bool EntityManager::checkTable(const QSharedPointer<Entity> &entity) {
bool rc = true;
if (!this->schema->containsTable(entity->getTablename())
......
return schema;
}
/**
* @brief EntityManager::refresh
* fetches an entity again from the database
* @param entity
*/
void EntityManager::refresh(QSharedPointer<Entity> &entity) {
entity = this->findById(entity->getProperty(
entity->getPrimaryKey()).toLongLong(),
......
return rc;
}
/**
* @brief EntityManager::validate
* This validates an entity. Its uses the validationRules() method of the specified entity.
* If there are validation errors, this method will set these errors in the entity object.
* You can check them with entity->hasErrors(), entity->getErrors() or entity->getErrorsAsString()
* @param entity
* @return true if it has no validation errors, false if it has errors
*/
bool EntityManager::validate(QSharedPointer<Entity> &entity) {
QList<ValidationRule> rules = entity->validationRules();
QList<ErrorMsg> list = QList<ErrorMsg>();
......
return propertyIsValid;
}
/**
* @brief EntityManager::generateObjectName
* Generates a object name with this scheme: em[anyNumber]
* @return
*/
QString EntityManager::generateObjectName() {
int i = 0;
QString name = "em[";

Auch abrufbar als: Unified diff