mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 16:20:39 +02:00
86 lines
2.2 KiB
C++
86 lines
2.2 KiB
C++
#include <utility>
|
|
|
|
#include "subject.h"
|
|
|
|
#include <QJsonArray>
|
|
|
|
QString Subject::getEmail() const {
|
|
return attributes["email"].toString();
|
|
}
|
|
|
|
void Subject::fromJSON(const QJsonObject &json) {
|
|
Entity::fromJSON(json);
|
|
|
|
attributes = json.value("attributes").toObject().value("items").toObject();
|
|
for (int i = 0; i < attributeTypes->length(); i++)
|
|
{
|
|
if (!attributes[attributeTypes[i]].toString().isEmpty()){
|
|
atr.append(qMakePair(attributeTypes[i], attributes[attributeTypes[i]].toString()));
|
|
}
|
|
}
|
|
const auto &tokenFlagsArray = json.value("tokenFlags").toArray();
|
|
for(const auto &flag : tokenFlagsArray){
|
|
tokenFlags.insert(flag.toString());
|
|
}
|
|
|
|
pin = json.value("pin").toString();
|
|
|
|
const auto &pinFlagsArray = json.value("pinFlags").toArray();
|
|
for(const auto &flag : pinFlagsArray){
|
|
pinFlags.insert(flag.toString());
|
|
}
|
|
|
|
}
|
|
|
|
QJsonObject Subject::toJSON() const {
|
|
QJsonObject json = Entity::toJSON();
|
|
|
|
QJsonObject items({{"items", attributes}});
|
|
json.value("atributes") = items;
|
|
json.value("tokenFlags") = QJsonArray::fromStringList(tokenFlags.toList());
|
|
json.value("pin") = pin;
|
|
json.value("pinFlags") = QJsonArray::fromStringList(pinFlags.toList());
|
|
|
|
return json;
|
|
}
|
|
|
|
const QJsonObject &Subject::getAttributes() const {
|
|
return attributes;
|
|
}
|
|
|
|
void Subject::setAttributes(const QJsonObject &attributes) {
|
|
Subject::attributes = attributes;
|
|
}
|
|
|
|
const QSet<QString> &Subject::getTokenFlags() const {
|
|
return tokenFlags;
|
|
}
|
|
|
|
void Subject::setTokenFlags(const QSet<QString> &tokenFlags) {
|
|
Subject::tokenFlags = tokenFlags;
|
|
}
|
|
|
|
const QString &Subject::getPin() const {
|
|
return pin;
|
|
}
|
|
|
|
void Subject::setPin(const QString &pin) {
|
|
Subject::pin = pin;
|
|
}
|
|
|
|
const QSet<QString> &Subject::getPinFlags() const {
|
|
return pinFlags;
|
|
}
|
|
|
|
void Subject::setPinFlags(const QSet<QString> &pinFlags) {
|
|
Subject::pinFlags = pinFlags;
|
|
}
|
|
|
|
const QList<QPair<QString, QString>> &Subject::getAtr() const {
|
|
return atr;
|
|
}
|
|
|
|
void Subject::setAtr(const QList<QPair<QString, QString>> &atr) {
|
|
this->atr = atr;
|
|
}
|