Herunterladen als
root/src/relation.cpp @ 5c3d9487
c22391b2 | Christian Ehringfeld | /*
|
|
* Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
|
|||
*
|
|||
* This program is free software; you can redistribute it and/or modify it
|
|||
* under the terms of the GNU Lesser General Public License as published by
|
|||
* the Free Software Foundation.
|
|||
*
|
|||
* This program is distributed in the hope that it will be useful, but
|
|||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|||
* for more details.
|
|||
*
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
|||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
|||
24c5480c | Christian Ehringfeld | #include "relation.h"
|
|
033279c9 | SebastianDiel | #include <QDebug>
|
|
24c5480c | Christian Ehringfeld | using namespace CuteEntityManager;
|
|
Relation::Relation() {
|
|||
}
|
|||
033279c9 | SebastianDiel | Relation::Relation(QString propertyName, bool optional, RelationType type) {
|
|
24c5480c | Christian Ehringfeld | this->propertyName = propertyName;
|
|
this->type = type;
|
|||
this->optional = optional;
|
|||
e24791d7 | Christian Ehringfeld | this->cascadeType = {MERGE,
|
|
47f9301a | Christian Ehringfeld | PERSIST,
|
|
REFRESH
|
|||
};
|
|||
ba800d6d | Christian Ehringfeld | }
|
|
e0e1ead8 | Christian Ehringfeld | Relation::Relation(QString propertyName, RelationType type, QString mappedBy,
|
|
91ed1164 | Christian Ehringfeld | QList<CascadeType> cascadeType) {
|
|
ba800d6d | Christian Ehringfeld | this->propertyName = propertyName;
|
|
this->type = type;
|
|||
this->mappedBy = mappedBy;
|
|||
this->optional = true;
|
|||
e24791d7 | Christian Ehringfeld | if (this->type == ONE_TO_ONE) {
|
|
91ed1164 | Christian Ehringfeld | this->cascadeType = {ALL};
|
|
f4e3904b | Christian Ehringfeld | } else {
|
|
this->cascadeType = cascadeType;
|
|||
}
|
|||
24c5480c | Christian Ehringfeld | }
|
|
Relation::~Relation() {
|
|||
}
|
|||
RelationType Relation::getType() const {
|
|||
return type;
|
|||
}
|
|||
void Relation::setType(const RelationType &value) {
|
|||
type = value;
|
|||
}
|
|||
QString Relation::getPropertyName() const {
|
|||
return propertyName;
|
|||
}
|
|||
void Relation::setPropertyName(const QString &value) {
|
|||
propertyName = value;
|
|||
}
|
|||
bool Relation::getOptional() const {
|
|||
return optional;
|
|||
}
|
|||
void Relation::setOptional(bool value) {
|
|||
optional = value;
|
|||
}
|
|||
ba800d6d | Christian Ehringfeld | QString Relation::getMappedBy() const {
|
|
return mappedBy;
|
|||
}
|
|||
void Relation::setMappedBy(const QString &value) {
|
|||
mappedBy = value;
|
|||
}
|
|||
91ed1164 | Christian Ehringfeld | QList<CascadeType> Relation::getCascadeType() const {
|
|
ba800d6d | Christian Ehringfeld | return cascadeType;
|
|
}
|
|||
91ed1164 | Christian Ehringfeld | void Relation::setCascadeType(const QList<CascadeType> &value) {
|
|
ba800d6d | Christian Ehringfeld | cascadeType = value;
|
|
}
|
|||