Migrates remaining services and plugins to generated rtiddsgen API
Converts accessor calls to plain member access across the residual service set.
This commit is contained in:
104 files changed
+2424
-2430
No files matched your search
+92
-92
@@ -146,7 +146,7 @@ void NomTests::tryCreateHQ()
|
||||
qint64 expiryTime = currentTime + Settings::expiryIntervalMSec();
|
||||
NotificationManagement::NomNotification notif;
|
||||
|
||||
notif.title(tr("HQ Reports ").toStdString());
|
||||
notif.title = tr("HQ Reports ").toStdString();
|
||||
|
||||
// format: "[Open HQ Report Dialog](//flmHQReport/party=3&folder=51&file=12)"
|
||||
// Open HQ Report Dialog : this text link will display on notification and is clickable
|
||||
@@ -161,24 +161,24 @@ void NomTests::tryCreateHQ()
|
||||
QString linkName = QStringLiteral("Open HQ Report Dialog");
|
||||
QString content = QStringLiteral("[%1](//flmHQReport/?party=%2&folder=%3&file=%4)");
|
||||
content = content.arg(linkName).arg(partyId).arg(folderId).arg(fileId);
|
||||
notif.content(content.toStdString());
|
||||
notif.timeStamp(currentTime);
|
||||
notif.expiryTime(expiryTime);
|
||||
notif.content = content.toStdString();
|
||||
notif.timeStamp = currentTime;
|
||||
notif.expiryTime = expiryTime;
|
||||
|
||||
notif.priority(static_cast<NotificationManagement::Priority_def::type>(Settings::notificationPriority()));
|
||||
notif.processedPriority(NotificationManagement::Priority_def::Highest);
|
||||
notif.exerciseId(m_exerciseId);
|
||||
notif.priority = static_cast<NotificationManagement::Priority_def::type>(Settings::notificationPriority());
|
||||
notif.processedPriority = NotificationManagement::Priority::Highest;
|
||||
notif.exerciseId = m_exerciseId;
|
||||
|
||||
for (const auto &userId : m_opmDtc->getOperatorsByOperatorRight(OperatorRights::FileManagementFilesEdit))
|
||||
{
|
||||
NotificationManagement::Address addr;
|
||||
addr.addressId(userId);
|
||||
addr.isRead(false);
|
||||
addr.addressId = userId;
|
||||
addr.isRead = false;
|
||||
QString name = QStringLiteral("Operator ") + QString::number(userId);
|
||||
addr.name(name.toStdString());
|
||||
addr.addressType(NotificationManagement::AddressType_def::Operator);
|
||||
addr.addressSubId(userId+10);
|
||||
notif.recipientIds().push_back(addr);
|
||||
addr.name = name.toStdString();
|
||||
addr.addressType = NotificationManagement::AddressType::Operator;
|
||||
addr.addressSubId = userId+10;
|
||||
notif.recipientIds.push_back(addr);
|
||||
}
|
||||
|
||||
// NotificationManagement::Address addrSender;
|
||||
@@ -189,7 +189,7 @@ void NomTests::tryCreateHQ()
|
||||
// notif.sender(addrSender);
|
||||
|
||||
NotificationManagement::CreateNotificationRequest notifReq;
|
||||
notifReq.notification(notif);
|
||||
notifReq.notification = notif;
|
||||
|
||||
if (!m_ftc->createNotificationRequest(notifReq, this))
|
||||
ERROR_LOG(m_logger) << "Error requesting create Notification data";
|
||||
@@ -204,15 +204,15 @@ void NomTests::tryReadReceipt()
|
||||
m_dtc->waitForHistoricalDataNomNotification();
|
||||
NotificationManagement::NomNotification data = m_dtc->nomNotification(m_notificationId);
|
||||
|
||||
NotificationManagement::Address recipientAddress = data.recipientIds().front();
|
||||
NotificationManagement::Address recipientAddress = data.recipientIds.front();
|
||||
//NotificationManagement::Address recipientAddress = data.recipientIds().at(2);
|
||||
NotificationManagement::ReadReceiptRequest request;
|
||||
request.addressId(recipientAddress.id());
|
||||
request.operatorId(recipientAddress.addressId());
|
||||
request.workstationId(0);
|
||||
request.addressId = recipientAddress.id;
|
||||
request.operatorId = recipientAddress.addressId;
|
||||
request.workstationId = 0;
|
||||
|
||||
request.notificationIds({m_notificationId});
|
||||
request.processed(true);
|
||||
request.notificationIds = {m_notificationId};
|
||||
request.processed = true;
|
||||
|
||||
INFO_LOG(m_logger) << "trying to send CreateNotificationRequest";
|
||||
if (!m_ftc->readReceiptRequest(request, this))
|
||||
@@ -258,24 +258,24 @@ void NomTests::tryGetAllNotifications()
|
||||
for (const NomNotification ¬if : m_dtc->nomNotifications())
|
||||
{
|
||||
// needed for Test 11 tryGetNotification
|
||||
m_notificationId = notif.id();
|
||||
m_notificationId = notif.id;
|
||||
|
||||
INFO_LOG(m_logger) << "Nom(" << notif.id() << ") :"
|
||||
<< " title:" << notif.title()
|
||||
<< " content:" << notif.content()
|
||||
<< " timeStamp:" << notif.timeStamp()
|
||||
<< " priority:" << notif.priority()
|
||||
<< " processed: " << notif.processed()
|
||||
<< " processedTime: " << notif.processTime()
|
||||
<< " processPrio: " << notif.processedPriority()
|
||||
<< " recipient count:" << notif.recipientIds().size();
|
||||
INFO_LOG(m_logger) << "Nom(" << notif.id << ") :"
|
||||
<< " title:" << notif.title
|
||||
<< " content:" << notif.content
|
||||
<< " timeStamp:" << notif.timeStamp
|
||||
<< " priority:" << notif.priority
|
||||
<< " processed: " << notif.processed
|
||||
<< " processedTime: " << notif.processTime
|
||||
<< " processPrio: " << notif.processedPriority
|
||||
<< " recipient count:" << notif.recipientIds.size();
|
||||
|
||||
INFO_LOG(m_logger) << "SenderAddress(" << notif.sender().id() << ") :"
|
||||
<< " name: " << notif.sender().name()
|
||||
<< ", addressId: " << notif.sender().addressId()
|
||||
<< ", addressSubId: " << notif.sender().addressSubId()
|
||||
<< ", addressSubSubId: " << notif.sender().addressSubSubId()
|
||||
<< ", addressType: " << notif.sender().addressType();
|
||||
INFO_LOG(m_logger) << "SenderAddress(" << notif.sender.id << ") :"
|
||||
<< " name: " << notif.sender.name
|
||||
<< ", addressId: " << notif.sender.addressId
|
||||
<< ", addressSubId: " << notif.sender.addressSubId
|
||||
<< ", addressSubSubId: " << notif.sender.addressSubSubId
|
||||
<< ", addressType: " << notif.sender.addressType;
|
||||
}
|
||||
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
@@ -299,40 +299,40 @@ void NomTests::tryGetNotification()
|
||||
m_dtc->waitForHistoricalDataNomNotification();
|
||||
NotificationManagement::NomNotification notif = m_dtc->nomNotification(m_notificationId);
|
||||
|
||||
if (notif.id() <= 0)
|
||||
if (notif.id <= 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error receiving data for notificationId " << m_notificationId << " returnVal:" << notif.id();
|
||||
ERROR_LOG(m_logger) << "Error receiving data for notificationId " << m_notificationId << " returnVal:" << notif.id;
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(m_logger) << "NomNotification(" << notif.id() << ") :"
|
||||
<< " title:" << notif.title()
|
||||
<< " content:" << notif.content()
|
||||
<< " timeStamp:" << notif.timeStamp()
|
||||
<< " priority:" << notif.priority()
|
||||
<< " processed: " << notif.processed()
|
||||
<< " processedTime: " << notif.processTime()
|
||||
<< " processPrio: " << notif.processedPriority()
|
||||
<< " recipient count:" << notif.recipientIds().size();
|
||||
INFO_LOG(m_logger) << "NomNotification(" << notif.id << ") :"
|
||||
<< " title:" << notif.title
|
||||
<< " content:" << notif.content
|
||||
<< " timeStamp:" << notif.timeStamp
|
||||
<< " priority:" << notif.priority
|
||||
<< " processed: " << notif.processed
|
||||
<< " processedTime: " << notif.processTime
|
||||
<< " processPrio: " << notif.processedPriority
|
||||
<< " recipient count:" << notif.recipientIds.size();
|
||||
|
||||
for (const NotificationManagement::Address &addr : notif.recipientIds())
|
||||
for (const NotificationManagement::Address &addr : notif.recipientIds)
|
||||
{
|
||||
INFO_LOG(m_logger) << "Recipient(" << addr.id() << ") :"
|
||||
<< " name: " << addr.name()
|
||||
<< ", addressId: " << addr.addressId()
|
||||
<< ", addressSubId: " << addr.addressSubId()
|
||||
<< ", addressSubSubId: " << addr.addressSubSubId()
|
||||
<< ", addressType: " << addr.addressType()
|
||||
<< ", isRead: " << addr.isRead();
|
||||
INFO_LOG(m_logger) << "Recipient(" << addr.id << ") :"
|
||||
<< " name: " << addr.name
|
||||
<< ", addressId: " << addr.addressId
|
||||
<< ", addressSubId: " << addr.addressSubId
|
||||
<< ", addressSubSubId: " << addr.addressSubSubId
|
||||
<< ", addressType: " << addr.addressType
|
||||
<< ", isRead: " << addr.isRead;
|
||||
}
|
||||
|
||||
INFO_LOG(m_logger) << "SenderAddress(" << notif.sender().id() << ") :"
|
||||
<< " name: " << notif.sender().name()
|
||||
<< ", addressId: " << notif.sender().addressId()
|
||||
<< ", addressSubId: " << notif.sender().addressSubId()
|
||||
<< ", addressSubSubId: " << notif.sender().addressSubSubId()
|
||||
<< ", addressType: " << notif.sender().addressType();
|
||||
INFO_LOG(m_logger) << "SenderAddress(" << notif.sender.id << ") :"
|
||||
<< " name: " << notif.sender.name
|
||||
<< ", addressId: " << notif.sender.addressId
|
||||
<< ", addressSubId: " << notif.sender.addressSubId
|
||||
<< ", addressSubSubId: " << notif.sender.addressSubSubId
|
||||
<< ", addressType: " << notif.sender.addressType;
|
||||
}
|
||||
|
||||
if (m_testId == 0)
|
||||
@@ -442,15 +442,15 @@ void NomTests::onReceiveNotificationChanged(const NomNotification &data, DataMod
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
INFO_LOG(m_logger) << "*** NomNotification added received. notificationId:" << data.id();
|
||||
INFO_LOG(m_logger) << "*** NomNotification added received. notificationId:" << data.id;
|
||||
break;
|
||||
|
||||
case DataModification::eModified:
|
||||
INFO_LOG(m_logger) << "*** NomNotification modified received. notificationId:" << data.id();
|
||||
INFO_LOG(m_logger) << "*** NomNotification modified received. notificationId:" << data.id;
|
||||
break;
|
||||
|
||||
case DataModification::eRemoved:
|
||||
INFO_LOG(m_logger) << "*** NomNotification removed received. notificationId:" << data.id();
|
||||
INFO_LOG(m_logger) << "*** NomNotification removed received. notificationId:" << data.id;
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -466,47 +466,47 @@ void NomTests::getCreateNotificationRequestData(CreateNotificationRequest &data)
|
||||
qint64 expiryTime = currentTime + 100 * 1000;
|
||||
NotificationManagement::NomNotification notif;
|
||||
|
||||
notif.title("TestNotificationCreate");
|
||||
notif.content("Dies ist ein Test mit Content");
|
||||
notif.timeStamp(currentTime);
|
||||
notif.expiryTime(expiryTime);
|
||||
notif.priority(NotificationManagement::Priority_def::High);
|
||||
notif.processedPriority(NotificationManagement::Priority_def::Low);
|
||||
notif.exerciseId(m_exerciseId);
|
||||
notif.title = "TestNotificationCreate";
|
||||
notif.content = "Dies ist ein Test mit Content";
|
||||
notif.timeStamp = currentTime;
|
||||
notif.expiryTime = expiryTime;
|
||||
notif.priority = NotificationManagement::Priority::High;
|
||||
notif.processedPriority = NotificationManagement::Priority::Low;
|
||||
notif.exerciseId = m_exerciseId;
|
||||
|
||||
for (int i=10; i< 24; i++)
|
||||
{
|
||||
NotificationManagement::Address addr;
|
||||
addr.addressId(i);
|
||||
addr.isRead(false);
|
||||
addr.addressId = i;
|
||||
addr.isRead = false;
|
||||
QString name = QStringLiteral("Operator ") + QString::number(i);
|
||||
addr.name(name.toStdString());
|
||||
addr.addressType(NotificationManagement::AddressType_def::Operator);
|
||||
addr.addressSubId(i+10);
|
||||
notif.recipientIds().push_back(addr);
|
||||
addr.name = name.toStdString();
|
||||
addr.addressType = NotificationManagement::AddressType::Operator;
|
||||
addr.addressSubId = i+10;
|
||||
notif.recipientIds.push_back(addr);
|
||||
}
|
||||
|
||||
NotificationManagement::Address wsAddr;
|
||||
wsAddr.addressId(302);
|
||||
wsAddr.isRead(false);
|
||||
wsAddr.addressId = 302;
|
||||
wsAddr.isRead = false;
|
||||
QString name = QStringLiteral("Workstation 2 ");
|
||||
wsAddr.name(name.toStdString());
|
||||
wsAddr.addressType(NotificationManagement::AddressType_def::Workstation);
|
||||
notif.recipientIds().push_back(wsAddr);
|
||||
wsAddr.name = name.toStdString();
|
||||
wsAddr.addressType = NotificationManagement::AddressType::Workstation;
|
||||
notif.recipientIds.push_back(wsAddr);
|
||||
|
||||
NotificationManagement::Address addrSender;
|
||||
addrSender.addressId(ParticipantManagement::Offset);
|
||||
addrSender.name(QStringLiteral("svcParticipantManagement ").toStdString());
|
||||
addrSender.addressType(NotificationManagement::AddressType_def::Service);
|
||||
notif.sender(addrSender);
|
||||
addrSender.addressId = ParticipantManagement::Offset;
|
||||
addrSender.name = QStringLiteral("svcParticipantManagement ").toStdString();
|
||||
addrSender.addressType = NotificationManagement::AddressType::Service;
|
||||
notif.sender = addrSender;
|
||||
|
||||
data.notification(notif);
|
||||
data.notification = notif;
|
||||
} // end of getCreateNotificationRequestData()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool NomTests::onCompareCreatedData(NomNotification &data)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "start onCompareCreatedData() for id :" << data.id();
|
||||
DEBUG_LOG(m_logger) << "start onCompareCreatedData() for id :" << data.id;
|
||||
|
||||
// Vergleicht die zurueckgelesen Datan mit den statischen create Daten
|
||||
|
||||
@@ -514,14 +514,14 @@ bool NomTests::onCompareCreatedData(NomNotification &data)
|
||||
|
||||
getCreateNotificationRequestData(createData);
|
||||
|
||||
if (createData.notification().title() != data.title())
|
||||
if (createData.notification.title != data.title)
|
||||
return false;
|
||||
|
||||
if (createData.notification().priority() != data.priority())
|
||||
if (createData.notification.priority != data.priority)
|
||||
return false;
|
||||
if (createData.notification().content() != data.content())
|
||||
if (createData.notification.content != data.content)
|
||||
return false;
|
||||
if (createData.notification().processedPriority() != data.processedPriority())
|
||||
if (createData.notification.processedPriority != data.processedPriority)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -64,6 +64,6 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
qint64 DdsHandler::currentPartitionTime() const { return m_dtcCore->partitionTime().timeStamp(); }
|
||||
qint64 DdsHandler::currentPartitionTime() const { return m_dtcCore->partitionTime().timeStamp; }
|
||||
|
||||
} // Namespace NotificationManagement
|
||||
+13
-13
@@ -58,20 +58,20 @@ bool HandlerNotification::init()
|
||||
// Remove old notifications
|
||||
if (isRemoveable(notif))
|
||||
{
|
||||
INFO_LOG(m_logger) << "Remove old notification " << notif.title() << ", id = " << notif.id();
|
||||
removeNotificationIds.append(notif.id());
|
||||
INFO_LOG(m_logger) << "Remove old notification " << notif.title << ", id = " << notif.id;
|
||||
removeNotificationIds.append(notif.id);
|
||||
return;
|
||||
}
|
||||
|
||||
// alle Addressen zu der NomNotification eintragen
|
||||
for (const Database::NomAddress &addr : qAsConst(dataAddressVec))
|
||||
{
|
||||
if (addr.notificationId == notif.id())
|
||||
if (addr.notificationId == notif.id)
|
||||
{
|
||||
if (addr.isSender)
|
||||
notif.sender(ObjectNotification::toDdsData(addr));
|
||||
notif.sender = ObjectNotification::toDdsData(addr);
|
||||
else
|
||||
notif.recipientIds().push_back(ObjectNotification::toDdsData(addr));
|
||||
notif.recipientIds.push_back(ObjectNotification::toDdsData(addr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void HandlerNotification::onCreateNotificationRequest(const rti::core::SampleIde
|
||||
DEBUG_LOG(m_logger) << "onCreateNotificationRequest: " << request;
|
||||
|
||||
ObjectNotification *ifs(new ObjectNotification(m_ddsHandler, m_db));
|
||||
const Core::FunctionReplyObject ret = ifs->createObject(request.notification());
|
||||
const Core::FunctionReplyObject ret = ifs->createObject(request.notification);
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
@@ -152,7 +152,7 @@ void HandlerNotification::onReadReceiptRequest(const rti::core::SampleIdentity &
|
||||
DEBUG_LOG(m_logger) << "onReadReceiptRequest: " << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
for (const auto notificationId : request.notificationIds())
|
||||
for (const auto notificationId : request.notificationIds)
|
||||
{
|
||||
ObjectNotification *ifs = m_objectNotificationMap.value(notificationId);
|
||||
if (ifs == nullptr)
|
||||
@@ -173,7 +173,7 @@ void HandlerNotification::onDeleteMessageRequest(const rti::core::SampleIdentity
|
||||
DEBUG_LOG(m_logger) << "onDeleteMessageRequest: " << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
for (const auto notificationId : request.notificationIds())
|
||||
for (const auto notificationId : request.notificationIds)
|
||||
{
|
||||
ObjectNotification *ifs = m_objectNotificationMap.value(notificationId);
|
||||
if (ifs == nullptr)
|
||||
@@ -191,7 +191,7 @@ void HandlerNotification::onDeleteMessageRequest(const rti::core::SampleIdentity
|
||||
void HandlerNotification::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eAdded ||
|
||||
(modType == DataModification::eModified && data.state() != ExerciseManagement::ExerciseState::Stopped))
|
||||
(modType == DataModification::eModified && data.state != ExerciseManagement::ExerciseState::Stopped))
|
||||
return;
|
||||
|
||||
// Remove notification for given exercise
|
||||
@@ -200,7 +200,7 @@ void HandlerNotification::onExerciseChanged(const ExerciseManagement::Exercise &
|
||||
{
|
||||
it.next();
|
||||
ObjectNotification* obj = it.value();
|
||||
if (obj->notification().exerciseId() != data.id())
|
||||
if (obj->notification().exerciseId != data.id)
|
||||
continue;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Remove notification " << obj->id();
|
||||
@@ -244,15 +244,15 @@ void HandlerNotification::onCheckRemove()
|
||||
bool HandlerNotification::isRemoveable(const NomNotification ¬if)
|
||||
{
|
||||
// NomNotification from exercises will not be removed
|
||||
if (notif.exerciseId() != 0)
|
||||
if (notif.exerciseId != 0)
|
||||
return false;
|
||||
|
||||
qint64 expiryInterval = Settings::expiryIntervalMSec();
|
||||
qint64 currentTime = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
// Remove notification if expiryTime + expiryInterval / processTime + expiryInterval
|
||||
if (currentTime > ( notif.expiryTime() + expiryInterval) ||
|
||||
(notif.processed() > 0 && currentTime > ( notif.processTime() + expiryInterval)))
|
||||
if (currentTime > ( notif.expiryTime + expiryInterval) ||
|
||||
(notif.processed > 0 && currentTime > ( notif.processTime + expiryInterval)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
+92
-92
@@ -29,14 +29,14 @@ ObjectNotification::ObjectNotification(const std::shared_ptr<DdsHandler> &ddsHan
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ObjectNotification::~ObjectNotification() { m_ddsHandler->dts()->removeNomNotificationByKey(m_dataNotificationObject.id()); } // end of dtor()
|
||||
ObjectNotification::~ObjectNotification() { m_ddsHandler->dts()->removeNomNotificationByKey(m_dataNotificationObject.id); } // end of dtor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Core::FunctionReplyObject ObjectNotification::createObject(const NomNotification &data)
|
||||
{
|
||||
m_dataNotificationObject = data;
|
||||
|
||||
if (data.id() <= 0)
|
||||
if (data.id <= 0)
|
||||
{
|
||||
Database::NomNotification dbDataNotification = toDbData(data);
|
||||
dbDataNotification.timeStamp = QDateTime::currentMSecsSinceEpoch();
|
||||
@@ -45,15 +45,15 @@ Core::FunctionReplyObject ObjectNotification::createObject(const NomNotification
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting NomNotification-data into database"));
|
||||
|
||||
// Neue DB Id in lokale Struktur uebernehmen
|
||||
m_dataNotificationObject.id(dbDataNotification.id);
|
||||
m_dataNotificationObject.id = dbDataNotification.id;
|
||||
DEBUG_LOG(m_logger) << "New NotificationId: " << dbDataNotification.id;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Handle Address for notificationId:" << dbDataNotification.id << " number of depending recipients: " << data.recipientIds().size();
|
||||
DEBUG_LOG(m_logger) << "Handle Address for notificationId:" << dbDataNotification.id << " number of depending recipients: " << data.recipientIds.size();
|
||||
|
||||
// Behandlung von Recipients
|
||||
for (size_t i = 0; i < data.recipientIds().size(); ++i)
|
||||
for (size_t i = 0; i < data.recipientIds.size(); ++i)
|
||||
{
|
||||
Address &recipientAddress = m_dataNotificationObject.recipientIds()[i];
|
||||
Address &recipientAddress = m_dataNotificationObject.recipientIds[i];
|
||||
Database::NomAddress dbDataRecipientAddr = toDbData(recipientAddress);
|
||||
|
||||
// Struct Address vorbereiten
|
||||
@@ -64,10 +64,10 @@ Core::FunctionReplyObject ObjectNotification::createObject(const NomNotification
|
||||
if (!m_db->insert(dbDataRecipientAddr))
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting RecipientAddress-data into database"));
|
||||
// Neue DB Id in lokale Struktur uebernehmen
|
||||
recipientAddress.id(dbDataRecipientAddr.id);
|
||||
recipientAddress.id = dbDataRecipientAddr.id;
|
||||
}
|
||||
|
||||
Address &senderAddress = m_dataNotificationObject.sender();
|
||||
Address &senderAddress = m_dataNotificationObject.sender;
|
||||
Database::NomAddress dbDataSenderAddr = toDbData(senderAddress);
|
||||
|
||||
// Struct Address vorbereiten
|
||||
@@ -78,7 +78,7 @@ Core::FunctionReplyObject ObjectNotification::createObject(const NomNotification
|
||||
if (!m_db->insert(dbDataSenderAddr))
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting SenderAddress-data into database"));
|
||||
// Neue DB Id in lokale Struktur uebernehmen
|
||||
senderAddress.id(dbDataSenderAddr.id);
|
||||
senderAddress.id = dbDataSenderAddr.id;
|
||||
|
||||
trans.commit();
|
||||
}
|
||||
@@ -86,7 +86,7 @@ Core::FunctionReplyObject ObjectNotification::createObject(const NomNotification
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id());
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id);
|
||||
|
||||
} // end of createObject()
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -96,7 +96,7 @@ QString ObjectNotification::contentArgsToJson()
|
||||
int i = 1;
|
||||
QJsonArray jsonArray;
|
||||
|
||||
for (const std::string& arg : qAsConst(m_dataNotificationObject.contentArgs()))
|
||||
for (const std::string& arg : qAsConst(m_dataNotificationObject.contentArgs))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << ".arg() ersetzt immer den kleinsten freien Platzhalter"
|
||||
<< ", arg=" << arg;
|
||||
@@ -168,29 +168,29 @@ Core::FunctionReplyObject ObjectNotification::readReceipt(const ReadReceipt &dat
|
||||
|
||||
Database::NomAddress dbDataAddr;
|
||||
|
||||
for (const Address &recipientAddr : qAsConst(m_dataNotificationObject.recipientIds()))
|
||||
for (const Address &recipientAddr : qAsConst(m_dataNotificationObject.recipientIds))
|
||||
{
|
||||
if (data.operatorId() > 0 && recipientAddr.addressType() == AddressType_def::Operator && recipientAddr.addressId() != data.operatorId())
|
||||
if (data.operatorId > 0 && recipientAddr.addressType == AddressType::Operator && recipientAddr.addressId != data.operatorId)
|
||||
continue;
|
||||
|
||||
if (data.workstationId() > 0 && recipientAddr.addressType() == AddressType_def::Workstation && recipientAddr.addressId() != data.workstationId())
|
||||
if (data.workstationId > 0 && recipientAddr.addressType == AddressType::Workstation && recipientAddr.addressId != data.workstationId)
|
||||
continue;
|
||||
|
||||
dbDataAddr = toDbData(recipientAddr);
|
||||
DEBUG_LOG(m_logger) << "Found Operator " << data.operatorId() << " with repicpentID " << dbDataAddr.id;
|
||||
DEBUG_LOG(m_logger) << "Found Operator " << data.operatorId << " with repicpentID " << dbDataAddr.id;
|
||||
dbDataAddr.notificationId = dbDataNotification.id;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbDataAddr.id <= 0)
|
||||
return Core::FunctionReplyObject(data.addressId(), tr_lts("dds", "No Address found"));
|
||||
return Core::FunctionReplyObject(data.addressId, tr_lts("dds", "No Address found"));
|
||||
|
||||
dbDataAddr.isRead = true;
|
||||
|
||||
DBTransaction trans(m_db->database());
|
||||
// NomNotification shall be marked as processed
|
||||
if (data.processed())
|
||||
if (data.processed)
|
||||
{
|
||||
// but hasn't been so yet
|
||||
if (dbDataNotification.processed <= 0)
|
||||
@@ -216,25 +216,25 @@ Core::FunctionReplyObject ObjectNotification::readReceipt(const ReadReceipt &dat
|
||||
|
||||
trans.commit();
|
||||
|
||||
INFO_LOG(m_logger) << "Data changed for NotificationId: " << m_dataNotificationObject.id();
|
||||
INFO_LOG(m_logger) << "Data changed for NotificationId: " << m_dataNotificationObject.id;
|
||||
|
||||
const std::vector<Address> recipients = m_dataNotificationObject.recipientIds();
|
||||
const Address sender = m_dataNotificationObject.sender();
|
||||
const std::vector<Address> recipients = m_dataNotificationObject.recipientIds;
|
||||
const Address sender = m_dataNotificationObject.sender;
|
||||
m_dataNotificationObject = toDdsData(dbDataNotification);
|
||||
m_dataNotificationObject.sender(sender);
|
||||
m_dataNotificationObject.sender = sender;
|
||||
|
||||
for (const Address &addr : qAsConst(recipients))
|
||||
{
|
||||
if (addr.id() == dbDataAddr.id)
|
||||
m_dataNotificationObject.recipientIds().push_back(toDdsData(dbDataAddr));
|
||||
if (addr.id == dbDataAddr.id)
|
||||
m_dataNotificationObject.recipientIds.push_back(toDdsData(dbDataAddr));
|
||||
else
|
||||
m_dataNotificationObject.recipientIds().push_back(addr);
|
||||
m_dataNotificationObject.recipientIds.push_back(addr);
|
||||
}
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id());
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id);
|
||||
} // end of updateObject()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -247,14 +247,14 @@ Core::FunctionReplyObject ObjectNotification::deleteMessage(const DeleteMessage
|
||||
|
||||
Database::NomAddress dbDataAddr;
|
||||
|
||||
for (const Address &recipientAddr : qAsConst(m_dataNotificationObject.recipientIds()))
|
||||
for (const Address &recipientAddr : qAsConst(m_dataNotificationObject.recipientIds))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "recipientAddr="
|
||||
<< ", id: " << recipientAddr.id() << ", addressId: " << recipientAddr.addressId() << ", isDeleted: " << recipientAddr.isDeleted();
|
||||
if (data.operatorId() > 0 && recipientAddr.addressType() == AddressType_def::Operator && recipientAddr.addressId() != data.operatorId())
|
||||
<< ", id: " << recipientAddr.id << ", addressId: " << recipientAddr.addressId << ", isDeleted: " << recipientAddr.isDeleted;
|
||||
if (data.operatorId > 0 && recipientAddr.addressType == AddressType::Operator && recipientAddr.addressId != data.operatorId)
|
||||
continue;
|
||||
|
||||
if (data.workstationId() > 0 && recipientAddr.addressType() == AddressType_def::Workstation && recipientAddr.addressId() != data.workstationId())
|
||||
if (data.workstationId > 0 && recipientAddr.addressType == AddressType::Workstation && recipientAddr.addressId != data.workstationId)
|
||||
continue;
|
||||
|
||||
dbDataAddr = toDbData(recipientAddr);
|
||||
@@ -264,7 +264,7 @@ Core::FunctionReplyObject ObjectNotification::deleteMessage(const DeleteMessage
|
||||
}
|
||||
|
||||
if (dbDataAddr.id <= 0)
|
||||
return Core::FunctionReplyObject(data.addressId(), tr_lts("dds", "No Address found"));
|
||||
return Core::FunctionReplyObject(data.addressId, tr_lts("dds", "No Address found"));
|
||||
|
||||
dbDataAddr.isDeleted = true;
|
||||
|
||||
@@ -275,60 +275,60 @@ Core::FunctionReplyObject ObjectNotification::deleteMessage(const DeleteMessage
|
||||
|
||||
trans.commit();
|
||||
|
||||
INFO_LOG(m_logger) << "Data changed for NotificationId: " << m_dataNotificationObject.id();
|
||||
INFO_LOG(m_logger) << "Data changed for NotificationId: " << m_dataNotificationObject.id;
|
||||
|
||||
std::vector<Address> recipients = m_dataNotificationObject.recipientIds();
|
||||
Address sender = m_dataNotificationObject.sender();
|
||||
std::vector<Address> recipients = m_dataNotificationObject.recipientIds;
|
||||
Address sender = m_dataNotificationObject.sender;
|
||||
m_dataNotificationObject = toDdsData(dbDataNotification);
|
||||
m_dataNotificationObject.sender(sender);
|
||||
m_dataNotificationObject.sender = sender;
|
||||
|
||||
for (const Address &addr : qAsConst(recipients))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "addr="
|
||||
<< ", id: " << addr.id() << ", addressId: " << addr.addressId() << ", isDeleted: " << addr.isDeleted();
|
||||
<< ", id: " << addr.id << ", addressId: " << addr.addressId << ", isDeleted: " << addr.isDeleted;
|
||||
|
||||
if (addr.id() == dbDataAddr.id)
|
||||
m_dataNotificationObject.recipientIds().push_back(toDdsData(dbDataAddr));
|
||||
if (addr.id == dbDataAddr.id)
|
||||
m_dataNotificationObject.recipientIds.push_back(toDdsData(dbDataAddr));
|
||||
else
|
||||
m_dataNotificationObject.recipientIds().push_back(addr);
|
||||
m_dataNotificationObject.recipientIds.push_back(addr);
|
||||
}
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id());
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id);
|
||||
} // end of updateObject()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Core::FunctionReplyObject ObjectNotification::deleteObject(const DeleteMessage &data, int notificationId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "ObjectNotification::deleteObject"
|
||||
<< ", notificationId: " << notificationId << ", addressId: " << data.addressId() << ", operatorId: " << data.operatorId()
|
||||
<< ", workstationId: " << data.workstationId();
|
||||
<< ", notificationId: " << notificationId << ", addressId: " << data.addressId << ", operatorId: " << data.operatorId
|
||||
<< ", workstationId: " << data.workstationId;
|
||||
deleteMessage(data, notificationId);
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id());
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject ObjectNotification::removeObject()
|
||||
{
|
||||
if (!m_db->removeNomNotification(m_dataNotificationObject.id()))
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id(), tr_lts("dds", "NomNotification with id %1 can not be removed from DB"))
|
||||
.arg(m_dataNotificationObject.id());
|
||||
if (!m_db->removeNomNotification(m_dataNotificationObject.id))
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id, tr_lts("dds", "NomNotification with id %1 can not be removed from DB"))
|
||||
.arg(m_dataNotificationObject.id);
|
||||
|
||||
if (!m_ddsHandler->dts()->removeNomNotificationByKey(m_dataNotificationObject.id()))
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id(), tr_lts("dds", "NomNotification with id %1 can not be removed from DDS"))
|
||||
.arg(m_dataNotificationObject.id());
|
||||
if (!m_ddsHandler->dts()->removeNomNotificationByKey(m_dataNotificationObject.id))
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id, tr_lts("dds", "NomNotification with id %1 can not be removed from DDS"))
|
||||
.arg(m_dataNotificationObject.id);
|
||||
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id());
|
||||
return Core::FunctionReplyObject(m_dataNotificationObject.id);
|
||||
} // end of removeObject()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool ObjectNotification::isValid() const { return m_dataNotificationObject.id() > 0; } // end of isValid()
|
||||
bool ObjectNotification::isValid() const { return m_dataNotificationObject.id > 0; } // end of isValid()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ObjectNotification::onPublishData()
|
||||
{
|
||||
INFO_LOG(m_logger) << "Publish NomNotification-data to dds notificationId:" << m_dataNotificationObject.id();
|
||||
INFO_LOG(m_logger) << "Publish NomNotification-data to dds notificationId:" << m_dataNotificationObject.id;
|
||||
|
||||
if (!m_ddsHandler->dts()->publish(m_dataNotificationObject))
|
||||
WARNING_LOG(m_logger) << "Error publishing NomNotification-data to dds";
|
||||
@@ -345,20 +345,20 @@ Database::NomNotification ObjectNotification::toDbData(const NomNotification &dd
|
||||
{
|
||||
Database::NomNotification dbData;
|
||||
|
||||
dbData.id = ddsData.id();
|
||||
dbData.exerciseId = ddsData.exerciseId();
|
||||
dbData.content = QString::fromStdString(ddsData.content());
|
||||
dbData.id = ddsData.id;
|
||||
dbData.exerciseId = ddsData.exerciseId;
|
||||
dbData.content = QString::fromStdString(ddsData.content);
|
||||
QString properties = contentArgsToJson();
|
||||
dbData.properties = properties;
|
||||
dbData.title = QString::fromStdString(ddsData.title());
|
||||
dbData.messageType = ddsData.messageType().underlying();
|
||||
dbData.notificationType = ddsData.notificationType().underlying();
|
||||
dbData.processTime = ddsData.processTime();
|
||||
dbData.processed = ddsData.processed();
|
||||
dbData.processedPriority = ddsData.processedPriority();
|
||||
dbData.expiryTime = ddsData.expiryTime();
|
||||
dbData.priorityId = ddsData.priority();
|
||||
dbData.timeStamp = ddsData.timeStamp();
|
||||
dbData.title = QString::fromStdString(ddsData.title);
|
||||
dbData.messageType = ddsData.messageType;
|
||||
dbData.notificationType = ddsData.notificationType;
|
||||
dbData.processTime = ddsData.processTime;
|
||||
dbData.processed = ddsData.processed;
|
||||
dbData.processedPriority = ddsData.processedPriority;
|
||||
dbData.expiryTime = ddsData.expiryTime;
|
||||
dbData.priorityId = ddsData.priority;
|
||||
dbData.timeStamp = ddsData.timeStamp;
|
||||
|
||||
return dbData;
|
||||
} // end of toDbData()
|
||||
@@ -369,20 +369,20 @@ NomNotification ObjectNotification::toDdsData(const Database::NomNotification &d
|
||||
{
|
||||
NomNotification ddsData;
|
||||
|
||||
ddsData.id(dbData.id);
|
||||
ddsData.content(dbData.content.toStdString());
|
||||
ddsData.id = dbData.id;
|
||||
ddsData.content = dbData.content.toStdString();
|
||||
std::vector< std::string > contentArgs = jsonToContentArgs(dbData.properties);
|
||||
ddsData.contentArgs(contentArgs);
|
||||
ddsData.title(dbData.title.toStdString());
|
||||
ddsData.messageType(static_cast<NotificationManagement::MessageType::inner_enum>(dbData.messageType));
|
||||
ddsData.notificationType(static_cast<NotificationManagement::NotificationType::inner_enum>(dbData.notificationType));
|
||||
ddsData.timeStamp(dbData.timeStamp);
|
||||
ddsData.priority(dbData.priorityId);
|
||||
ddsData.exerciseId(dbData.exerciseId);
|
||||
ddsData.expiryTime(dbData.expiryTime);
|
||||
ddsData.processTime(dbData.processTime);
|
||||
ddsData.processed(dbData.processed);
|
||||
ddsData.processedPriority(dbData.processedPriority.underlying());
|
||||
ddsData.contentArgs = contentArgs;
|
||||
ddsData.title = dbData.title.toStdString();
|
||||
ddsData.messageType = static_cast<NotificationManagement::MessageType>(dbData.messageType);
|
||||
ddsData.notificationType = static_cast<NotificationManagement::NotificationType>(dbData.notificationType);
|
||||
ddsData.timeStamp = dbData.timeStamp;
|
||||
ddsData.priority = dbData.priorityId;
|
||||
ddsData.exerciseId = dbData.exerciseId;
|
||||
ddsData.expiryTime = dbData.expiryTime;
|
||||
ddsData.processTime = dbData.processTime;
|
||||
ddsData.processed = dbData.processed;
|
||||
ddsData.processedPriority = dbData.processedPriority;
|
||||
|
||||
return ddsData;
|
||||
} // end of toDdsData()
|
||||
@@ -393,14 +393,14 @@ Database::NomAddress ObjectNotification::toDbData(const Address &ddsData)
|
||||
{
|
||||
Database::NomAddress dbData;
|
||||
|
||||
dbData.id = ddsData.id();
|
||||
dbData.addressId = ddsData.addressId();
|
||||
dbData.addressSubId = ddsData.addressSubId();
|
||||
dbData.addressSubSubId = ddsData.addressSubSubId();
|
||||
dbData.addressTypeId = ddsData.addressType().underlying();
|
||||
dbData.isRead = ddsData.isRead();
|
||||
dbData.isDeleted = ddsData.isDeleted();
|
||||
dbData.name = QString::fromStdString(ddsData.name());
|
||||
dbData.id = ddsData.id;
|
||||
dbData.addressId = ddsData.addressId;
|
||||
dbData.addressSubId = ddsData.addressSubId;
|
||||
dbData.addressSubSubId = ddsData.addressSubSubId;
|
||||
dbData.addressTypeId = ddsData.addressType;
|
||||
dbData.isRead = ddsData.isRead;
|
||||
dbData.isDeleted = ddsData.isDeleted;
|
||||
dbData.name = QString::fromStdString(ddsData.name);
|
||||
|
||||
return dbData;
|
||||
} // end of toDbData()
|
||||
@@ -411,14 +411,14 @@ Address ObjectNotification::toDdsData(const Database::NomAddress &dbData)
|
||||
{
|
||||
Address ddsData;
|
||||
|
||||
ddsData.id(dbData.id);
|
||||
ddsData.addressType(dbData.addressTypeId);
|
||||
ddsData.name(dbData.name.toStdString());
|
||||
ddsData.addressId(dbData.addressId);
|
||||
ddsData.addressSubId(dbData.addressSubId);
|
||||
ddsData.addressSubSubId(dbData.addressSubSubId);
|
||||
ddsData.isRead(dbData.isRead);
|
||||
ddsData.isDeleted(dbData.isDeleted);
|
||||
ddsData.id = dbData.id;
|
||||
ddsData.addressType = dbData.addressTypeId;
|
||||
ddsData.name = dbData.name.toStdString();
|
||||
ddsData.addressId = dbData.addressId;
|
||||
ddsData.addressSubId = dbData.addressSubId;
|
||||
ddsData.addressSubSubId = dbData.addressSubSubId;
|
||||
ddsData.isRead = dbData.isRead;
|
||||
ddsData.isDeleted = dbData.isDeleted;
|
||||
|
||||
return ddsData;
|
||||
} // end of toDdsData()
|
||||
|
||||
+2
-2
@@ -34,9 +34,9 @@ public:
|
||||
|
||||
Core::FunctionReplyObject setUsed(bool isUsed);
|
||||
|
||||
qint32 id() const { return m_dataNotificationObject.id(); }
|
||||
qint32 id() const { return m_dataNotificationObject.id; }
|
||||
NomNotification notification() const { return m_dataNotificationObject; }
|
||||
QString title() const { return QString::fromStdString(m_dataNotificationObject.title()); }
|
||||
QString title() const { return QString::fromStdString(m_dataNotificationObject.title); }
|
||||
|
||||
bool isValid() const;
|
||||
bool isUsed() const;
|
||||
|
||||
Reference in new issue
Block a user