Migrates Participant and OperatorManagement to generated rtiddsgen API

Converts accessor calls to plain member access in ppm and opm services and plugins.
This commit is contained in:
berrux-dev committed 2026-09-21 02:46:44 +02:00
1 parent bdb2461737
commit 95071993f5
36 files changed
+513 -529

No files matched your search

@@ -153,7 +153,7 @@ void OpmTests::tryRemove()
m_eTestStep = eRemove;
OperatorRemoveRequest data;
data.id(m_operatorId);
data.id = m_operatorId;
INFO_LOG(m_logger) << "trying to send remove request";
if (!m_ftc->operatorRemoveRequest(data, this))
@@ -172,23 +172,23 @@ void OpmTests::tryLogin()
m_eTestStep = eLogin;
OperatorLoginRequest data;
data.id(m_operatorId);
data.id = m_operatorId;
std::string pass("ctc");
const QByteArray ba(QByteArray::fromRawData(pass.c_str(), pass.size()));
//pass = QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex().data();
data.password(pass);
data.workstationIp(-1);
data.workstationId(301);
data.force(false);
data.password = pass;
data.workstationIp = -1;
data.workstationId = 301;
data.force = false;
NOTICE_LOG(m_logger) << "trying to send OperatorLoginRequest"
<< ", operatorId:" << m_operatorId
<< ", pass:" << pass
<< ", workstationIp:" << data.workstationIp()
<< ", workstationId:" << data.workstationId()
<< ", force:" << data.force();
<< ", workstationIp:" << data.workstationIp
<< ", workstationId:" << data.workstationId
<< ", force:" << data.force;
if (!m_ftc->operatorLoginRequest(data, this))
{
ERROR_LOG(m_logger) << "Error login operator id " << m_operatorId << " on workstation 1";
@@ -203,16 +203,16 @@ void OpmTests::tryLoginForce()
m_eTestStep = eLogin;
OperatorLoginRequest data;
data.id(m_operatorId);
data.id = m_operatorId;
std::string pass("password");
const QByteArray ba(QByteArray::fromRawData(pass.c_str(), pass.size()));
pass = QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex().data();
data.password(pass);
data.workstationIp(-1);
data.workstationId(4);
data.force(true);
data.password = pass;
data.workstationIp = -1;
data.workstationId = 4;
data.force = true;
INFO_LOG(m_logger) << "trying to send OperatorLoginRequest";
if (!m_ftc->operatorLoginRequest(data, this))
@@ -229,7 +229,7 @@ void OpmTests::tryLogout()
m_eTestStep = eLogout;
OperatorLogoutRequest data;
data.id(m_operatorId);
data.id = m_operatorId;
INFO_LOG(m_logger) << "trying to send OperatorLogoutRequest";
if (!m_ftc->operatorLogoutRequest(data, this))
@@ -283,7 +283,7 @@ void OpmTests::tryGetAllOperators()
for(auto it = opMap.begin(); it != opMap.end(); ++it)
{
INFO_LOG(m_logger) << "opm(" << it.key() << ") :"
<< " name:" << it.value().name()
<< " name:" << it.value().name
// << " password:" << it.value().password()
// << " effectiveACLs:" << it.value().effectiveAcls()
;
@@ -311,15 +311,15 @@ void OpmTests::tryGetOperator()
m_dtc->waitForHistoricalDataUser();
OperatorManagement::User op = m_dtc->user(m_operatorId);
if(op.id() <= 0)
if(op.id <= 0)
{
ERROR_LOG(m_logger) << "Error receiving data for operatorId " << m_operatorId << " returnVal:" << op.id();
ERROR_LOG(m_logger) << "Error receiving data for operatorId " << m_operatorId << " returnVal:" << op.id;
failExit();
}
else
{
INFO_LOG(m_logger) << "opm(" << op.id() << ") :"
<< " name: " << op.name()
INFO_LOG(m_logger) << "opm(" << op.id << ") :"
<< " name: " << op.name
// << " password: " << data.password()
// << " effectiveACLs:" << it.value().effectiveAcls()
;
@@ -455,9 +455,9 @@ void OpmTests::onOperatorLogoutReply(const Core::FunctionReplyObject &replyObjec
void OpmTests::onReceiveOperatorChanged(const User &data, DataModification modType)
{
// Check signal/slot connection
if (m_operatorId == data.id())
if (m_operatorId == data.id)
{
TRACE_LOG(m_logger) << "Check signal/slot connection for DTC. Data for id = " << data.id() << " received";
TRACE_LOG(m_logger) << "Check signal/slot connection for DTC. Data for id = " << data.id << " received";
TRACE_LOG(m_logger) << "ModificationType: = " << (int)modType << " received";
}
} // end of onReceiveOperatorData()
@@ -468,7 +468,7 @@ void OpmTests::onReceiveGroupChanged(const Group &data, DataModification modType
// Check signal/slot connection
// if (m_operatorId == data.id())
// {
TRACE_LOG(m_logger) << "Check signal/slot connection for DTC. Data for id = " << data.id() << " received";
TRACE_LOG(m_logger) << "Check signal/slot connection for DTC. Data for id = " << data.id << " received";
TRACE_LOG(m_logger) << "ModificationType: = " << (int)modType << " received";
// }
} // end of onReceiveOperatorData()
@@ -480,20 +480,20 @@ void OpmTests::getOperatorCreateRequestData(OperatorCreateModifyRequest &data) c
if(m_testId == 0)
currentTime = currentTime/10;
data.name(std::string("TestOperatorCreate" + std::to_string(currentTime)));
data.name = std::string("TestOperatorCreate" + std::to_string(currentTime));
std::string pass("password");
const QByteArray ba(QByteArray::fromRawData(pass.c_str(), pass.size()));
pass = QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex().data();
data.password(pass);
data.description(std::string("Description"));
data.password = pass;
data.description = std::string("Description");
// Todo: test anpassen
PartiesByExercise pbe;
pbe.exerciseId(0);
pbe.visibleParties().set({0,1,2,3,4,5,6,7,8,9,10,11,12});
data.visiblePartiesByExercise().push_back(pbe);
data.rolePresetId(1001);
pbe.exerciseId = 0;
pbe.visibleParties.set({0,1,2,3,4,5,6,7,8,9,10,11,12});
data.visiblePartiesByExercise.push_back(pbe);
data.rolePresetId = 1001;
} // end of getOperatorCreateRequestData()
@@ -504,32 +504,32 @@ void OpmTests::getOperatorModifyRequestData(OperatorCreateModifyRequest &data) c
if(m_testId == 0)
currentTime = currentTime/10;
data.id(m_operatorId);
data.id = m_operatorId;
// data.name(std::string("Operator"+std::to_string(m_operatorId)));
// only changing the description
data.description(std::string("Description" + std::to_string(m_operatorId)));
data.description = std::string("Description" + std::to_string(m_operatorId));
} // end of getOperatorChangeNameRequestData()
//-----------------------------------------------------------------------------
bool OpmTests::onCompareCreatedData(User &data)
{
DEBUG_LOG(m_logger) << "start onCompareCreatedData() for id :" << data.id();
DEBUG_LOG(m_logger) << "start onCompareCreatedData() for id :" << data.id;
OperatorCreateModifyRequest createData;
getOperatorCreateRequestData(createData);
if (createData.name() != data.name())
if (createData.name != data.name)
return false;
// if(createData.password() != data.password())
// return false;
if (data.description() != createData.description())
if (data.description != createData.description)
return false;
DEBUG_LOG(m_logger) << "successfull finished onCompareCreatedData() for id :" << data.id();
DEBUG_LOG(m_logger) << "successfull finished onCompareCreatedData() for id :" << data.id;
return true;
} // end of onCompareCreatedData()
@@ -537,22 +537,22 @@ bool OpmTests::onCompareCreatedData(User &data)
//-----------------------------------------------------------------------------
bool OpmTests::onCompareModifiedData(User &data)
{
DEBUG_LOG(m_logger) << "start onCompareModifiedData() for id :" << data.id();
DEBUG_LOG(m_logger) << "start onCompareModifiedData() for id :" << data.id;
OperatorCreateModifyRequest modifyData;
getOperatorModifyRequestData(modifyData);
if (modifyData.id() != data.id())
if (modifyData.id != data.id)
return false;
if (modifyData.name() != data.name())
if (modifyData.name != data.name)
return false;
if (data.description() != modifyData.description())
if (data.description != modifyData.description)
return false;
DEBUG_LOG(m_logger) << "successfully finished onCompareModifiedData() for id :" << data.id();
DEBUG_LOG(m_logger) << "successfully finished onCompareModifiedData() for id :" << data.id;
return true;
} // end of onCompareModifiedData()
@@ -53,10 +53,10 @@ void HandlerActiveApps::cleanupOperator(int operatorId)
while (it != m_activeApps.end())
{
const ActiveApp &item = it.value();
if (item.operatorId() == operatorId)
if (item.operatorId == operatorId)
{
INFO_LOG(m_logger) << "cleanupOperator operatorId: " << operatorId << " ActiveApp=" << item;
dtsPtr->removeActiveAppByKey(item.id());
dtsPtr->removeActiveAppByKey(item.id);
it = m_activeApps.erase(it);
}
else
@@ -70,7 +70,7 @@ void HandlerActiveApps::cleanup()
{
auto dtsPtr = dts();
for (const ActiveApp &item : qAsConst(m_activeApps))
dtsPtr->removeActiveAppByKey(item.id());
dtsPtr->removeActiveAppByKey(item.id);
m_activeApps.clear();
}
@@ -79,10 +79,10 @@ void HandlerActiveApps::removeZombieEntry(const ActiveApp &request)
for (auto it = m_activeApps.begin(); it != m_activeApps.end(); ++it)
{
const ActiveApp &item = it.value();
if ((item.operatorId() == request.operatorId()) &&
(item.screenId() == request.screenId()))
if ((item.operatorId == request.operatorId) &&
(item.screenId == request.screenId))
{
dts()->removeActiveAppByKey(item.id());
dts()->removeActiveAppByKey(item.id);
m_activeApps.erase(it);
break;
}
@@ -102,13 +102,13 @@ void HandlerActiveApps::onActiveAppUpdateRequest(const rti::core::SampleIdentity
Core::FunctionReplyObject HandlerActiveApps::activeAppUpdateRequest(const ActiveApp &request)
{
const int reqId = request.id();
const int reqId = request.id;
// handle 'remove' :
if (request.appId() < 0) // LtsSession::App::Login is -1 but ok
if (request.appId < 0) // LtsSession::App::Login is -1 but ok
{
Core::RemoveElementRequest removeRequest;
removeRequest.id(reqId);
removeRequest.id = reqId;
return activeAppRemoveRequest(removeRequest);
}
// : handle 'remove'
@@ -122,7 +122,7 @@ Core::FunctionReplyObject HandlerActiveApps::activeAppUpdateRequest(const Active
removeZombieEntry(request);
it = m_activeApps.insert(++s_idCounter, request);
it.value().id(s_idCounter);
it.value().id = s_idCounter;
}
else
{
@@ -137,7 +137,7 @@ Core::FunctionReplyObject HandlerActiveApps::activeAppUpdateRequest(const Active
}
DEBUG_LOG(m_logger) << "onActiveAppUpdateRequest - publish new data: " << it.value();
dts()->publish(it.value());
return Core::FunctionReplyObject(it.value().id());
return Core::FunctionReplyObject(it.value().id);
}
void HandlerActiveApps::onActiveAppRemoveRequest(const rti::core::SampleIdentity &cookie,
@@ -152,7 +152,7 @@ void HandlerActiveApps::onActiveAppRemoveRequest(const rti::core::SampleIdentity
Core::FunctionReplyObject HandlerActiveApps::activeAppRemoveRequest(const Core::RemoveElementRequest &request)
{
const int reqId = request.id();
const int reqId = request.id;
if (m_activeApps.remove(reqId) <= 0)
return Core::FunctionReplyObject(reqId, tr_lts("dds", "ActiveApp with id %1 not found")).arg(reqId);
@@ -120,13 +120,13 @@ void HandlerGroup::updateRolePresetId(const int operatorId, const int rolePreset
Core::FunctionReplyObject HandlerGroup::changeMembership(const OperatorManagement::GroupChangeMembersRequest &request)
{
ObjectGroup *ifs = m_groupObjMap.value(request.id());
ObjectGroup *ifs = m_groupObjMap.value(request.id);
if (!ifs)
return Core::FunctionReplyObject(0, tr_lts("dds", "No valid group id for changing memberships."));
Core::FunctionReplyObject fro;
if (request.memberships().size() > 0)
fro = ifs->updateMemberships(request.memberships());
if (request.memberships.size() > 0)
fro = ifs->updateMemberships(request.memberships);
else
fro = ifs->removeAllMemberships();
@@ -141,8 +141,8 @@ void HandlerGroup::onGroupChangeMembershipsRequest(const rti::core::SampleIdenti
{
DEBUG_LOG(m_logger) << "onGroupChangeMembershipsRequest " << request;
Core::FunctionReplyObject ret = changeMembership(request);
if (request.operatorId().is_set() && request.rolePresetId().is_set())
updateRolePresetId(request.operatorId().get(), request.rolePresetId().get());
if (request.operatorId.is_set() && request.rolePresetId.is_set())
updateRolePresetId(request.operatorId.get(), request.rolePresetId.get());
if (ret.error())
WARNING_LOG(m_logger) << ret();
m_mainHandler->fts()->groupChangeMembershipsReply(cookie, ret);
@@ -151,18 +151,18 @@ void HandlerGroup::onGroupChangeMembershipsRequest(const rti::core::SampleIdenti
Core::FunctionReplyObject HandlerGroup::create(const GroupCreateRequest &request)
{
Database::OpmGroup group;
group.name = QString::fromStdString(request.name());
group.name = QString::fromStdString(request.name);
for (const ObjectGroup *g : qAsConst(m_groupObjMap))
{
if (g->name().compare(group.name, Qt::CaseInsensitive) == 0)
return Core::FunctionReplyObject(-1, tr_lts("dds", "Name '%1' already exists")).arg(group.name);
}
group.description = QString::fromStdString(request.description());
group.typeId = request.type();
group.isHidden = request.isHidden().is_set() ? request.isHidden().get() : false;
group.description = QString::fromStdString(request.description);
group.typeId = request.type;
group.isHidden = request.isHidden.is_set() ? request.isHidden.get() : false;
ObjectGroup *ifs(new ObjectGroup(m_mainHandler));
Core::FunctionReplyObject ret = ifs->createObject(group, request.memberships().is_set() ? request.memberships().get() : std::vector<int32_t>());
Core::FunctionReplyObject ret = ifs->createObject(group, request.memberships.is_set() ? request.memberships.get() : std::vector<int32_t>());
if (ret.error())
{
delete ifs;
@@ -185,13 +185,13 @@ void HandlerGroup::onGroupCreateRequest(const rti::core::SampleIdentity &cookie,
Core::FunctionReplyObject HandlerGroup::changeName(const OperatorManagement::GroupChangeNameRequest &request)
{
ObjectGroup *ifs = m_groupObjMap.value(request.id());
ObjectGroup *ifs = m_groupObjMap.value(request.id);
if (!ifs)
return Core::FunctionReplyObject(0, tr_lts("dds", "No valid group id for renaming."));
Database::OpmGroup group = ifs->data();
group.name = QString::fromStdString(request.name());
group.description = QString::fromStdString(request.description());
group.name = QString::fromStdString(request.name);
group.description = QString::fromStdString(request.description);
for (const ObjectGroup *g : qAsConst(m_groupObjMap))
{
@@ -210,7 +210,7 @@ void HandlerGroup::onGroupChangeNameRequest(const rti::core::SampleIdentity &coo
DEBUG_LOG(m_logger) << "onGroupChangeNameRequest" << request;
Core::FunctionReplyObject ret;
ObjectGroup *ifs = m_groupObjMap.value(request.id());
ObjectGroup *ifs = m_groupObjMap.value(request.id);
if (!ifs)
{
ret = Core::FunctionReplyObject(0, tr_lts("dds", "No valid group id for renaming."));
@@ -219,7 +219,7 @@ void HandlerGroup::onGroupChangeNameRequest(const rti::core::SampleIdentity &coo
}
Database::OpmGroup group = ifs->data();
if (group.typeId == GroupType_def::OperatorGroup && (group.name != QString::fromStdString(request.name())))
if (group.typeId == GroupType::OperatorGroup && (group.name != QString::fromStdString(request.name)))
{
ret = Core::FunctionReplyObject(0, tr_lts("dds", "Operator group may not be renamed."));
m_mainHandler->fts()->groupChangeNameReply(cookie, ret);
@@ -231,23 +231,23 @@ void HandlerGroup::onGroupChangeNameRequest(const rti::core::SampleIdentity &coo
Core::FunctionReplyObject HandlerGroup::remove(const Core::RemoveElementRequest &request)
{
ObjectGroup *ifs = m_groupObjMap.value(request.id());
ObjectGroup *ifs = m_groupObjMap.value(request.id);
if (!ifs)
return Core::FunctionReplyObject(0, tr_lts("dds", "No valid group id for deleting."));
OperatorManagement::Group ddsData;
ddsData.id(request.id());
ddsData.id = request.id;
if (m_mainHandler->dds()->topicLockMaster()->isLocked(ddsData, 0))
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Group '%1' is used by another user!")).arg(ifs->name());
return Core::FunctionReplyObject(request.id, tr_lts("dds", "Group '%1' is used by another user!")).arg(ifs->name());
Core::FunctionReplyObject ret = ifs->removeObject();
if (ret.error())
return ret;
m_groupObjMap.remove(request.id());
m_groupGroupMap.remove(request.id());
m_groupObjMap.remove(request.id);
m_groupGroupMap.remove(request.id);
for (auto it = m_groupGroupMap.begin(); it != m_groupGroupMap.end();)
if (it.value() == request.id())
if (it.value() == request.id)
it = m_groupGroupMap.erase(it);
else
++it;
@@ -125,13 +125,13 @@ void HandlerLockedTopics::onTryLockEntityRequest(const rti::core::SampleIdentity
dumpLockedTopics(__LINE__);
auto ret = tryLock(request);
if (!ret.errorString().empty())
if (!ret.errorString.empty())
{
WARNING_LOG(m_logger) << Core::FunctionReplyObject(ret.FunctionReply::id(), ret.errorString(), ret.errorParams()).translated() << " - " << request;
WARNING_LOG(m_logger) << Core::FunctionReplyObject(ret.FunctionReply::id(), ret.errorString, ret.errorParams).translated() << " - " << request;
}
else if (ret.alreadyLocked())
else if (ret.alreadyLocked)
{
WARNING_LOG(m_logger) << "onTryLockEntityRequest failed because the topic was already locked by ws " << ret.alreadyLocked().get().workstationName() << " and op " << ret.alreadyLocked().get().operatorName() << " - " << request;
WARNING_LOG(m_logger) << "onTryLockEntityRequest failed because the topic was already locked by ws " << ret.alreadyLocked.get().workstationName << " and op " << ret.alreadyLocked.get().operatorName << " - " << request;
}
m_ftsTryLockEntity->sendReply(cookie, ret);
@@ -158,9 +158,9 @@ Core::TryLockEntityReply HandlerLockedTopics::tryLock(const Core::TryLockEntityR
{
DEBUG_LOG(m_logger) << "tryLock : " << request;
const auto topicId = request.entityId();
const auto topicId = request.entityId;
const Core::key k(request.entityId(), request.exerciseId(), QString::fromStdString(request.entityTypeName()));
const Core::key k(request.entityId, request.exerciseId, QString::fromStdString(request.entityTypeName));
Database::OpmLockedTopics dbStruct(toDb(request));
auto it = m_lockedTopics.constFind(k);
if (it == m_lockedTopics.constEnd())
@@ -173,9 +173,9 @@ Core::TryLockEntityReply HandlerLockedTopics::tryLock(const Core::TryLockEntityR
}
m_lockedTopics.insert(k, dbStruct);
Core::LockedEntity lckEntity(request.operatorId(), request.workstationId(),
request.exerciseId(), request.entityId(),
request.entityTypeName(), dbStruct.id);
Core::LockedEntity lckEntity(request.operatorId, request.workstationId,
request.exerciseId, request.entityId,
request.entityTypeName, dbStruct.id);
publishLockedEntity(lckEntity);
return lockSuccessReply(dbStruct);
}
@@ -185,7 +185,7 @@ Core::TryLockEntityReply HandlerLockedTopics::tryLock(const Core::TryLockEntityR
// already locked by another user
const Database::OpmLockedTopics &data = *it;
const auto opName = m_mainHandler.getHandlerOperator()->operatorNameById(data.operatorId);
const auto wsName = m_mainHandler.dds()->dtcAsm()->asset(data.workstationId).name();
const auto wsName = m_mainHandler.dds()->dtcAsm()->asset(data.workstationId).name;
return lockAlreadyLockedReply(wsName, opName);
}
@@ -304,9 +304,9 @@ void HandlerLockedTopics::onTryUnlockEntityRequest(const rti::core::SampleIdenti
dumpLockedTopics(__LINE__);
auto ret = tryUnlock(request);
if (!ret.errorString().empty())
if (!ret.errorString.empty())
{
WARNING_LOG(m_logger) << Core::FunctionReplyObject(ret.FunctionReply::id(), ret.errorString(), ret.errorParams()).translated() << " - " << request;
WARNING_LOG(m_logger) << Core::FunctionReplyObject(ret.FunctionReply::id(), ret.errorString, ret.errorParams).translated() << " - " << request;
}
m_ftsTryUnlockEntity->sendReply(cookie, ret);
@@ -318,7 +318,7 @@ Core::FunctionReply HandlerLockedTopics::tryUnlock(const Core::TryUnlockEntityRe
{
DEBUG_LOG(m_logger) << "tryUnlock: " << request;
const auto lockEntityId = request.id();
const auto lockEntityId = request.id;
auto lockedTopicIt = std::find_if(m_lockedTopics.constBegin(), m_lockedTopics.constEnd(),
[lockEntityId](const Database::OpmLockedTopics &lockedTopic)
@@ -352,11 +352,11 @@ Database::OpmLockedTopics HandlerLockedTopics::toDb(const Core::LockedEntityBase
{
Database::OpmLockedTopics ret;
ret.locked = true;
ret.entityId = request.entityId();
ret.entityTypeName = QString::fromStdString(request.entityTypeName());
ret.operatorId = request.operatorId();
ret.workstationId = request.workstationId();
ret.exerciseId = request.exerciseId() ? QVariant(request.exerciseId()) : QVariant();
ret.entityId = request.entityId;
ret.entityTypeName = QString::fromStdString(request.entityTypeName);
ret.operatorId = request.operatorId;
ret.workstationId = request.workstationId;
ret.exerciseId = request.exerciseId ? QVariant(request.exerciseId) : QVariant();
return ret;
}
@@ -367,20 +367,20 @@ bool HandlerLockedTopics::publishLockedEntity(const Core::LockedEntity &entity)
m_dtsLockedEntity->write(entity);
return true;
}
ERROR_LOG(m_logger) << "Publishing LockedEntity " << entity.id() << " failed: DTS not available!";
ERROR_LOG(m_logger) << "Publishing LockedEntity " << entity.id << " failed: DTS not available!";
return false;
}
bool HandlerLockedTopics::removeLockedEntity(int64_t id)
{
Core::LockedEntity entity;
entity.id(id);
entity.id = id;
if (m_dtsLockedEntity)
{
m_dtsLockedEntity->remove(entity);
return true;
}
ERROR_LOG(m_logger) << "Removing LockedEntity " << entity.id() << " failed: DTS not available!";
ERROR_LOG(m_logger) << "Removing LockedEntity " << entity.id << " failed: DTS not available!";
return false;
}
@@ -74,7 +74,7 @@ bool HandlerOperator::init()
INFO_LOG(m_logger) << "------- opMap size" << opMap.size();
OperatorManagement::OperatorWorkstationAlive alive;
alive.lastAlive(QDateTime::currentMSecsSinceEpoch());
alive.lastAlive = QDateTime::currentMSecsSinceEpoch();
for (const Database::OpmOperator &op : qAsConst(dataVec))
{
ObjectOperator *ifs(new ObjectOperator(m_mainHandler));
@@ -99,8 +99,8 @@ bool HandlerOperator::init()
m_operatorObjMap.insert(ifs->getId(), ifs);
if (!op.workstationId.isNull())
{
alive.operatorId(op.id);
alive.workstationId(op.workstationId.toInt());
alive.operatorId = op.id;
alive.workstationId = op.workstationId.toInt();
onOperatorWorkstationAliveChanged(alive, DataModification::eAdded);
}
}
@@ -139,7 +139,7 @@ void HandlerOperator::onOperatorChangePasswordRequest(const rti::core::SampleIde
const OperatorChangePasswordRequest &request)
{
DEBUG_LOG(m_logger) << "onOperatorChangePasswordRequest()";
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
if (!ifs)
{
m_mainHandler->fts()->operatorChangePasswordReply(cookie,
@@ -150,15 +150,15 @@ void HandlerOperator::onOperatorChangePasswordRequest(const rti::core::SampleIde
Core::FunctionReplyObject ret;
Database::OpmOperator op = ifs->data();
const auto &pw = request.oldPassword();
const auto &pw = request.oldPassword;
const QByteArray ba(QByteArray::fromRawData(pw.c_str(), pw.size()));
const QString enteredPassword(QString::fromLatin1(QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex()));
const auto &pwNew = request.password();
const auto &pwNew = request.password;
const QByteArray baNew(QByteArray::fromRawData(pwNew.c_str(), pwNew.size()));
const QString enteredPasswordNew(QString::fromLatin1(QCryptographicHash::hash(baNew, QCryptographicHash::Md5).toHex()));
if (request.forceSet() || op.password == enteredPassword)
if (request.forceSet || op.password == enteredPassword)
{
if (enteredPassword == enteredPasswordNew)
ret = Core::FunctionReplyObject(0, tr_lts("dds", "Password is identical to old password."));
@@ -185,7 +185,7 @@ void HandlerOperator::onOperatorCreateModifyRequest(const rti::core::SampleIdent
{
Core::FunctionReplyObject ret;
DEBUG_LOG(m_logger) << "onOperatorCreateModifyRequest()";
if (!request.id().is_set())
if (!request.id.is_set())
ret = operatorCreateRequest(request);
else
ret = operatorModifyRequest(request);
@@ -197,15 +197,15 @@ void HandlerOperator::onOperatorCreateModifyRequest(const rti::core::SampleIdent
Core::FunctionReplyObject HandlerOperator::operatorCreateRequest(const OperatorCreateModifyRequest &request)
{
if (!request.name().is_set() ||
!request.password().is_set())
if (!request.name.is_set() ||
!request.password.is_set())
return Core::FunctionReplyObject(tr_lts("dds", "Can not create operator - name or password is empty."));
// Group anlegen
GroupCreateRequest groupRequest;
groupRequest.name(request.name().get());
groupRequest.description(request.description().get());
groupRequest.type(GroupType_def::OperatorGroup);
groupRequest.name = request.name.get();
groupRequest.description = request.description.get();
groupRequest.type = GroupType::OperatorGroup;
const Core::FunctionReplyObject groupRet = m_mainHandler->getHandlerGroup()->create(groupRequest);
if (groupRet.error())
@@ -213,33 +213,33 @@ Core::FunctionReplyObject HandlerOperator::operatorCreateRequest(const OperatorC
// Operator anlegen
Database::OpmOperator op;
op.name = QString::fromStdString(request.name().get());
if (request.description().is_set())
op.description = QString::fromStdString(request.description().get());
op.name = QString::fromStdString(request.name.get());
if (request.description.is_set())
op.description = QString::fromStdString(request.description.get());
const auto &pw = request.password().get();
const auto &pw = request.password.get();
const QByteArray ba(QByteArray::fromRawData(pw.c_str(), pw.size()));
const QString enteredPassword(QString::fromLatin1(QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex()));
op.password = enteredPassword;
op.primaryGroupId = groupRet.id();
if (request.image().is_set())
op.image = LtsUtils::toQByteArray(request.image().get());
const auto vpbe = request.visiblePartiesByExercise();
if (request.image.is_set())
op.image = LtsUtils::toQByteArray(request.image.get());
const auto vpbe = request.visiblePartiesByExercise;
for (const auto &pbe : vpbe)
{
if (!pbe.visibleParties().is_set() || pbe.exerciseId() != 0) //has_value not support on windows yet so we need depricated is_set
if (!pbe.visibleParties.is_set() || pbe.exerciseId != 0) //has_value not support on windows yet so we need depricated is_set
continue;
op.visibleParties = LtsUtils::IntArray(pbe.visibleParties().get());
op.visibleParties = LtsUtils::IntArray(pbe.visibleParties.get());
}
if (request.rolePresetId().is_set())
if (request.rolePresetId.is_set())
{
op.rolePresetId = request.rolePresetId().get();
op.rolePresetId = request.rolePresetId.get();
}
op.projectionPriority = request.projectionPriority().is_set() ? request.projectionPriority().get() : 1;
op.audioChannelPriority = request.audioChannelPriority().is_set() ? request.audioChannelPriority().get() : 1;
op.projectionPriority = request.projectionPriority.is_set() ? request.projectionPriority.get() : 1;
op.audioChannelPriority = request.audioChannelPriority.is_set() ? request.audioChannelPriority.get() : 1;
ObjectOperator *ifs(new ObjectOperator(m_mainHandler));
const Core::FunctionReplyObject ret = ifs->createObject(op, {});
@@ -250,14 +250,14 @@ Core::FunctionReplyObject HandlerOperator::operatorCreateRequest(const OperatorC
delete ifs;
return ret;
}
if (request.visibleExercises().is_set())
ifs->updateExercises(request.visibleExercises().get());
if (request.visibleExercises.is_set())
ifs->updateExercises(request.visibleExercises.get());
if (request.operatorRights().is_set())
if (request.operatorRights.is_set())
{
GroupChangeMembersRequest grChReq;
grChReq.id(op.primaryGroupId);
grChReq.memberships(request.operatorRights().get());
grChReq.id = op.primaryGroupId;
grChReq.memberships = request.operatorRights.get();
// We don't actually care, if this fails...
m_mainHandler->getHandlerGroup()->changeMembership(grChReq);
ifs->reloadAcls(true);
@@ -286,18 +286,18 @@ void HandlerOperator::operatorModifyRolePresetId( int operatorId, int rolePreset
Core::FunctionReplyObject HandlerOperator::operatorModifyRequest(const OperatorCreateModifyRequest &request)
{
if (request.password().is_set())
if (request.password.is_set())
return Core::FunctionReplyObject(tr_lts("dds", "Can not modify operator password with this function."));
ObjectOperator *ifs = m_operatorObjMap.value(request.id().get());
ObjectOperator *ifs = m_operatorObjMap.value(request.id.get());
if (!ifs)
return Core::FunctionReplyObject(request.id().get(), tr_lts("dds", "No valid operator id given."));
return Core::FunctionReplyObject(request.id.get(), tr_lts("dds", "No valid operator id given."));
Database::OpmOperator op = ifs->data();
if (request.name().is_set())
if (request.name.is_set())
{
op.name = QString::fromStdString(request.name().get());
op.name = QString::fromStdString(request.name.get());
for (const ObjectOperator *o : qAsConst(m_operatorObjMap))
{
@@ -308,32 +308,32 @@ Core::FunctionReplyObject HandlerOperator::operatorModifyRequest(const OperatorC
}
}
if (request.description().is_set())
op.description = QString::fromStdString(request.description().get());
if (request.image().is_set())
op.image = LtsUtils::toQByteArray(request.image().get());
const auto vpbe = request.visiblePartiesByExercise();
if (request.description.is_set())
op.description = QString::fromStdString(request.description.get());
if (request.image.is_set())
op.image = LtsUtils::toQByteArray(request.image.get());
const auto vpbe = request.visiblePartiesByExercise;
for (const auto &pbe : vpbe)
{
// only ex0 updated
if (!pbe.visibleParties().is_set() || pbe.exerciseId() != 0) //has_value not support on windows yet so we need depricated is_set
if (!pbe.visibleParties.is_set() || pbe.exerciseId != 0) //has_value not support on windows yet so we need depricated is_set
continue;
op.visibleParties = LtsUtils::IntArray(pbe.visibleParties().get());
op.visibleParties = LtsUtils::IntArray(pbe.visibleParties.get());
}
if (request.rolePresetId().is_set())
if (request.rolePresetId.is_set())
{
op.rolePresetId = request.rolePresetId().get();
op.rolePresetId = request.rolePresetId.get();
}
if (request.visibleExercises().is_set())
ifs->updateExercises(request.visibleExercises().get());
if (request.projectionPriority().is_set())
op.projectionPriority = request.projectionPriority().get();
if (request.audioChannelPriority().is_set())
op.audioChannelPriority = request.audioChannelPriority().get();
op.properties = QString::fromStdString(request.properties());
if (request.visibleExercises.is_set())
ifs->updateExercises(request.visibleExercises.get());
if (request.projectionPriority.is_set())
op.projectionPriority = request.projectionPriority.get();
if (request.audioChannelPriority.is_set())
op.audioChannelPriority = request.audioChannelPriority.get();
op.properties = QString::fromStdString(request.properties);
return ifs->updateObject(op);
}
@@ -343,7 +343,7 @@ void HandlerOperator::onOperatorRemoveRequest(const rti::core::SampleIdentity &c
{
DEBUG_LOG(m_logger) << "onOperatorRemoveRequest()" << request;
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
if (!ifs)
{
m_mainHandler->fts()->operatorRemoveReply(cookie,
@@ -359,12 +359,12 @@ void HandlerOperator::onOperatorRemoveRequest(const rti::core::SampleIdentity &c
}
OperatorManagement::User ddsData;
ddsData.id(request.id());
ddsData.id = request.id;
if (m_mainHandler->dds()->topicLockMaster()->isLocked(ddsData, 0))
{
m_mainHandler->fts()->operatorRemoveReply(cookie,
Core::FunctionReplyObject(request.id(), tr_lts("dds", "Operator '%1' is used by another user!")).arg(ifs->name()));
Core::FunctionReplyObject(request.id, tr_lts("dds", "Operator '%1' is used by another user!")).arg(ifs->name()));
return;
}
@@ -391,7 +391,7 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
{
DEBUG_LOG(m_logger) << "OperatorLoginRequest: " << request;
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
if (!ifs)
{
m_mainHandler->fts()->operatorLoginReply(cookie,
@@ -399,7 +399,7 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
return;
}
const auto &pw = request.password();
const auto &pw = request.password;
const QByteArray ba(QByteArray::fromRawData(pw.c_str(), pw.size()));
const QString enteredPassword(QString::fromLatin1(QCryptographicHash::hash(ba, QCryptographicHash::Md5).toHex()));
if (enteredPassword != ifs->data().password)
@@ -415,16 +415,16 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
if (!ifs->data().workstationId.isNull() && ifs->data().workstationId.toInt() > 0)
// operator already logged in
{
if (ifs->data().workstationId == request.workstationId())
if (ifs->data().workstationId == request.workstationId)
{
// do nothing if same operator claims same workstation
}
else if (!request.force())
else if (!request.force)
{
// Already claimed: Return WSid as ID
const auto ws = m_mainHandler->dds()->dtcAsm()->asset(ifs->data().workstationId.toInt());
ret = Core::FunctionReplyObject(ifs->data().workstationId.toInt(),
tr_lts("dds", "Operator already logged in on workstation %1.")).arg(QString::fromStdString(ws.name()));
tr_lts("dds", "Operator already logged in on workstation %1.")).arg(QString::fromStdString(ws.name));
}
else
{
@@ -436,13 +436,13 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
if (other)
{
OperatorLogoutRequest req;
req.id(otherOperatorId);
req.id = otherOperatorId;
onOperatorLogoutRequest(cookie, req);
}
}
Database::OpmOperator op = ifs->data();
op.workstationIp = request.workstationIp();
op.workstationId = request.workstationId();
op.workstationIp = request.workstationIp;
op.workstationId = request.workstationId;
ret = ifs->updateObject(op);
}
}
@@ -450,7 +450,7 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
// operator not logged in on any workstation
{
// if other operator is logged in on same WS -> logout other operator and login our operator
int otherOperatorId = getLoggedOperatorId(request.workstationId());
int otherOperatorId = getLoggedOperatorId(request.workstationId);
if (otherOperatorId != 0 && otherOperatorId != ifs->data().id)
{
@@ -458,15 +458,15 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
if (other)
{
OperatorLogoutRequest req;
req.id(otherOperatorId);
req.id = otherOperatorId;
onOperatorLogoutRequest(cookie, req);
WARNING_LOG(m_logger) << "Logged out operator " << otherOperatorId << " on workstation id " << request.workstationId();
WARNING_LOG(m_logger) << "Logged out operator " << otherOperatorId << " on workstation id " << request.workstationId;
}
}
// Claim WS:
Database::OpmOperator op = ifs->data();
op.workstationIp = request.workstationIp();
op.workstationId = request.workstationId();
op.workstationIp = request.workstationIp;
op.workstationId = request.workstationId;
ret = ifs->updateObject(op);
}
@@ -474,8 +474,8 @@ void HandlerOperator::onOperatorLoginRequest(const rti::core::SampleIdentity &co
WARNING_LOG(m_logger) << ret();
else
{
m_mainHandler->getHandlerLockedTopics()->operatorLoggedIn(request.id(), request.workstationId());
m_mainHandler->getHandlerActiveApps()->cleanupOperator(request.id());
m_mainHandler->getHandlerLockedTopics()->operatorLoggedIn(request.id, request.workstationId);
m_mainHandler->getHandlerActiveApps()->cleanupOperator(request.id);
}
m_mainHandler->fts()->operatorLoginReply(cookie, ret);
@@ -493,7 +493,7 @@ void HandlerOperator::onOperatorLogoutRequest(const rti::core::SampleIdentity &c
{
DEBUG_LOG(m_logger) << "OperatorLogoutRequest: " << request;
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
if (!ifs)
{
m_mainHandler->fts()->operatorLogoutReply(cookie, Core::FunctionReplyObject(0, tr_lts("dds", "No valid operator id for logout.")));
@@ -509,7 +509,7 @@ void HandlerOperator::onOperatorLogoutRequest(const rti::core::SampleIdentity &c
op.workstationIp = 0;
op.workstationId = QVariant();
m_mainHandler->getHandlerLockedTopics()->operatorLoggedOut(request.id()); // workstationId = 0 -> logout
m_mainHandler->getHandlerLockedTopics()->operatorLoggedOut(request.id); // workstationId = 0 -> logout
m_mainHandler->getHandlerActiveApps()->cleanupOperator(op.id);
m_mainHandler->fts()->operatorLogoutReply(cookie, ifs->updateObject(op));
@@ -520,45 +520,45 @@ void HandlerOperator::onOperatorGetSetSettingsRequest(const rti::core::SampleIde
{
Core::FunctionReplyObject fro;
OperatorGetSetSettingsReply reply;
reply.id(request.id());
reply.id = request.id;
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
if (ifs)
{
if (request.settings().is_set())
if (request.settings.is_set())
{
const auto &data = request.settings().get();
const auto &data = request.settings.get();
const QByteArray settings(QByteArray(reinterpret_cast<const char*>(&data[0]), data.size()));
if (!ifs->saveSettings(settings))
fro = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Error saving settings in database.") );
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "Error saving settings in database.") );
}
else
{
QByteArray settings;
if (!ifs->loadSettings(settings))
{
fro = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Error loading settings from database.") );
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "Error loading settings from database.") );
}
else
{
if (!settings.isEmpty())
{
reply.settings().set({});
reply.settings().get() = LtsUtils::convert<std::vector<uint8_t>>(settings);
reply.settings.set({});
reply.settings.get() = LtsUtils::convert<std::vector<uint8_t>>(settings);
}
}
}
}
else
{
fro = Core::FunctionReplyObject(request.id(), tr_lts("dds", "No valid operator id for retrieving settings."));
fro = Core::FunctionReplyObject(request.id, tr_lts("dds", "No valid operator id for retrieving settings."));
}
if (fro.error())
{
reply.id(fro.id());
reply.errorString(fro.str());
reply.errorParams(fro.args());
reply.id = fro.id();
reply.errorString = fro.str();
reply.errorParams = fro.args();
}
m_mainHandler->fts()->operatorGetSetSettingsReply(cookie, reply);
@@ -575,11 +575,11 @@ void HandlerOperator::onOperatorApplyForeignAclsRequest(const rti::core::SampleI
Core::FunctionReplyObject HandlerOperator::operatorApplyForeignAclsRequest(const OperatorApplyForeignAclsRequest &request)
{
ObjectOperator *receiver = m_operatorObjMap.value(request.id());
ObjectOperator *receiver = m_operatorObjMap.value(request.id);
if (!receiver)
return Core::FunctionReplyObject(0, tr_lts("dds", "Receiving operator not present."));
ObjectOperator *remoteOperator = m_operatorObjMap.value(request.remoteOperatorId());
ObjectOperator *remoteOperator = m_operatorObjMap.value(request.remoteOperatorId);
if (!remoteOperator)
return Core::FunctionReplyObject(0, tr_lts("dds", "Remote operator not present."));
@@ -599,20 +599,20 @@ void HandlerOperator::onOperatorUpdateVisiblePartiesByExerciseRequest(const rti:
Core::FunctionReplyObject HandlerOperator::operatorUpdateVisiblePartiesByExerciseRequest(const OperatorUpdateVisiblePartiesByExerciseRequest &request)
{
ObjectOperator *ifs = m_operatorObjMap.value(request.id());
ObjectOperator *ifs = m_operatorObjMap.value(request.id);
if (!ifs)
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "No valid operator id given."));
return Core::FunctionReplyObject(request.id, tr_lts("dds", "No valid operator id given."));
Database::OpmOperatorExercise opEx;
opEx.operatorId = request.id();
opEx.exerciseId = request.exerciseId();
opEx.operatorId = request.id;
opEx.exerciseId = request.exerciseId;
std::vector<int> hiddenParties;
if (request.hiddenParties().is_set())
opEx.hiddenParties = LtsUtils::IntArray(request.hiddenParties().get());
if (request.visibleParties().is_set())
opEx.visibleParties = LtsUtils::IntArray(request.visibleParties().get());
if (request.hiddenParties.is_set())
opEx.hiddenParties = LtsUtils::IntArray(request.hiddenParties.get());
if (request.visibleParties.is_set())
opEx.visibleParties = LtsUtils::IntArray(request.visibleParties.get());
opEx.properties = QString::fromStdString(request.properties());
opEx.properties = QString::fromStdString(request.properties);
return ifs->updateOperatorExercise(opEx);
}
@@ -626,13 +626,13 @@ void HandlerOperator::reloadAcls()
void HandlerOperator::onOperatorWorkstationAliveChanged(const OperatorManagement::OperatorWorkstationAlive &data, DataModification modType)
{
INFO_LOG(m_logger) << "onOperatorWorkstationAliveChanged: " << data << ", " << modType;
if (data.operatorId() < 0)
if (data.operatorId < 0)
{
m_aliveData.remove(data.workstationId());
m_aliveData.remove(data.workstationId);
return;
}
auto &events = m_aliveData[data.workstationId()];
auto &events = m_aliveData[data.workstationId];
events.push_back(data);
// do not store more than 30 history events
if (events.size() > 30)
@@ -651,7 +651,7 @@ void HandlerOperator::onCheckAliveTimeout()
{
DEBUG_LOG(m_logger) << "Checking alive for workstation " << it.key();
auto &events = it.value();
if (events.isEmpty() || events.last().lastAlive() >= tTimeoutTime)
if (events.isEmpty() || events.last().lastAlive >= tTimeoutTime)
{
++it;
continue;
@@ -659,14 +659,14 @@ void HandlerOperator::onCheckAliveTimeout()
// no reference, will be a dangling one after m_aliveData.erase(it) !
const OperatorWorkstationAlive owa = events.last();
WARNING_LOG(m_logger) << "Timeout for workstation " << owa.workstationId()
<< " and operator " << owa.operatorId() << " - logging out";
WARNING_LOG(m_logger) << "Timeout for workstation " << owa.workstationId
<< " and operator " << owa.operatorId << " - logging out";
if (m_logger.isDebugEnabled())
{
for (const auto &event : events)
DEBUG_LOG(m_logger) << "Alive history: " << event;
}
ObjectOperator *ifs = m_operatorObjMap.value(owa.operatorId());
ObjectOperator *ifs = m_operatorObjMap.value(owa.operatorId);
it = m_aliveData.erase(it);
if (!ifs)
@@ -674,8 +674,8 @@ void HandlerOperator::onCheckAliveTimeout()
Database::OpmOperator op = ifs->data();
op.workstationIp = 0;
op.workstationId = QVariant();
m_mainHandler->getHandlerLockedTopics()->operatorLoggedOut(owa.operatorId()); // workstationId = 0 -> logout
m_mainHandler->getHandlerActiveApps()->cleanupOperator(owa.operatorId());
m_mainHandler->getHandlerLockedTopics()->operatorLoggedOut(owa.operatorId); // workstationId = 0 -> logout
m_mainHandler->getHandlerActiveApps()->cleanupOperator(owa.operatorId);
ifs->updateObject(op);
}
@@ -123,7 +123,7 @@ bool MainHandler::initWebSocketHandler()
ERROR_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler failed.";
return false;
}
m_ddsHandler->pacemaker()->addPort(m_handlerWebSocket->serverWebSocketPort(), Core::PortType::WebSocketServer);
m_ddsHandler->pacemaker()->addPort(m_handlerWebSocket->serverWebSocketPort(), Core::CorePortType::WebSocketServer);
DEBUG_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler succesful.";
return true;
@@ -51,9 +51,9 @@ void ObjectAccessControlLevel::onPublishData()
OperatorManagement::AccessControlLevel ddsData;
ddsData.id(m_data.id);
ddsData.name(m_data.name.toStdString());
ddsData.description(m_data.description.toStdString());
ddsData.id = m_data.id;
ddsData.name = m_data.name.toStdString();
ddsData.description = m_data.description.toStdString();
// Todo: Copy as above
INFO_LOG(m_logger) << "Publish OpmAccessControlLevel-data to dds (" << m_data.id << ") ...";
@@ -220,14 +220,14 @@ void ObjectGroup::onPublishData()
{
OperatorManagement::Group ddsData;
ddsData.id(m_data.id);
ddsData.name(m_data.name.toStdString());
ddsData.description(m_data.description.toStdString());
ddsData.aclAllow(m_aclAllow);
ddsData.aclDeny(m_aclDeny);
ddsData.isHidden(m_data.isHidden);
ddsData.type(m_data.typeId);
ddsData.isMemberOf(m_isMemberOf);
ddsData.id = m_data.id;
ddsData.name = m_data.name.toStdString();
ddsData.description = m_data.description.toStdString();
ddsData.aclAllow = m_aclAllow;
ddsData.aclDeny = m_aclDeny;
ddsData.isHidden = m_data.isHidden;
ddsData.type = m_data.typeId;
ddsData.isMemberOf = m_isMemberOf;
INFO_LOG(m_logger) << "Publish OpmGroup-data to dds (" << m_data.id << ") ...";
@@ -307,12 +307,12 @@ void ObjectOperator::onPublishData()
{
OperatorManagement::User op;
op.id(m_data.id);
op.name(m_data.name.toStdString());
op.description(m_data.description.toStdString());
op.primaryGroupId(m_data.primaryGroupId);
op.rolePresetId(m_data.rolePresetId);
op.effectiveAcls() = LtsUtils::convert<std::vector<int32_t>>(m_effectiveAcls);
op.id = m_data.id;
op.name = m_data.name.toStdString();
op.description = m_data.description.toStdString();
op.primaryGroupId = m_data.primaryGroupId;
op.rolePresetId = m_data.rolePresetId;
op.effectiveAcls = LtsUtils::convert<std::vector<int32_t>>(m_effectiveAcls);
auto vpbe = toDdsData(m_dataExercise);
// Append Visible Parties Template (= exId == 0)
@@ -325,16 +325,16 @@ void ObjectOperator::onPublishData()
vpbe.push_back(OperatorManagement::PartiesByExercise(0, m_data.visibleParties(), std::vector<int>(),
adlerAllowedDocument.toJson(QJsonDocument::Compact).toStdString()));
op.visiblePartiesByExercise(vpbe);
op.visiblePartiesByExercise = vpbe;
op.exerciseIds(m_exercises);
op.image() = LtsUtils::convert<std::vector<uint8_t>>(m_data.image);
op.workstationIp(m_data.workstationIp);
op.workstationId(m_data.workstationId.toInt());
op.projectionPriority(m_data.projectionPriority);
op.audioChannelPriority(m_data.audioChannelPriority);
op.rolePresetId(m_data.rolePresetId);
op.properties(m_data.properties.toStdString());
op.exerciseIds = m_exercises;
op.image = LtsUtils::convert<std::vector<uint8_t>>(m_data.image);
op.workstationIp = m_data.workstationIp;
op.workstationId = m_data.workstationId.toInt();
op.projectionPriority = m_data.projectionPriority;
op.audioChannelPriority = m_data.audioChannelPriority;
op.rolePresetId = m_data.rolePresetId;
op.properties = m_data.properties.toStdString();
INFO_LOG(m_logger) << "Publish OpmOperator-data to dds (" << m_data.id
<< " rolePresetId =" << m_data.rolePresetId
@@ -351,22 +351,22 @@ std::vector<OperatorManagement::PartiesByExercise> ObjectOperator::toDdsData(con
for (const Database::OpmOperatorExercise &ooe : dbData)
{
PartiesByExercise pbe;
pbe.exerciseId(ooe.exerciseId);
pbe.visibleParties();
pbe.hiddenParties();
pbe.exerciseId = ooe.exerciseId;
pbe.visibleParties;
pbe.hiddenParties;
std::vector<int> visibleParty;
for (const auto &elem : ooe.visibleParties())
{
visibleParty.push_back(elem);
}
pbe.visibleParties().set(visibleParty);
pbe.visibleParties.set(visibleParty);
std::vector<int> hiddenParty;
for (const auto &elem : ooe.hiddenParties())
{
hiddenParty.push_back(elem);
}
pbe.hiddenParties().set(hiddenParty);
pbe.properties(ooe.properties.toStdString());
pbe.hiddenParties.set(hiddenParty);
pbe.properties = ooe.properties.toStdString();
ddsData.push_back(pbe);
}
return ddsData;
@@ -27,20 +27,20 @@ DtcImplCustom::DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &
{
}
std::vector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
QVector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
{
std::vector<int> ret;
QVector<int> ret;
DEBUG_LOG(m_logger) << "OperatorRight: " << operatorRight;
for (const User &user : std::as_const(m_userCont))
{
for (int acl : user.effectiveAcls())
for (int acl : user.effectiveAcls)
{
if (operatorRight != acl)
continue;
DEBUG_LOG(m_logger) << "Found acl in Operator " << user.id() << ", operatorRight=" << operatorRight << ", acl=" << acl;
ret.push_back(user.id());
DEBUG_LOG(m_logger) << "Found acl in Operator " << user.id << ", operatorRight=" << operatorRight << ", acl=" << acl;
ret.push_back(user.id);
break;
}
}
@@ -48,31 +48,31 @@ std::vector<int> DtcImplCustom::getOperatorsByOperatorRight(int operatorRight)
return ret;
}
std::vector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int partyId)
QVector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int partyId)
{
std::vector<int> ret;
QVector<int> ret;
DEBUG_LOG(m_logger) << LOGFUNCTION << " exerciseId: " << exerciseId << ", partyId: " << partyId;
for (const User &user : std::as_const(m_userCont))
{
const auto visiblePartiesByExercise = user.visiblePartiesByExercise();
const auto visiblePartiesByExercise = user.visiblePartiesByExercise;
for (const auto &pbe : visiblePartiesByExercise)
{
if (pbe.exerciseId() != exerciseId)
if (pbe.exerciseId != exerciseId)
continue;
if (!pbe.visibleParties().has_value())
if (!pbe.visibleParties.has_value())
continue;
std::vector<int> hiddenParties;
if (pbe.hiddenParties().has_value())
if (pbe.hiddenParties.has_value())
{
const auto& hiddenQVec = pbe.hiddenParties().value();
const auto& hiddenQVec = pbe.hiddenParties.value();
hiddenParties = std::vector<int>(hiddenQVec.begin(), hiddenQVec.end());
}
for (const auto &id : pbe.visibleParties().value())
for (const auto &id : pbe.visibleParties.value())
{
if (id != partyId)
continue;
@@ -86,7 +86,7 @@ std::vector<int> DtcImplCustom::operatorForExerciseParty(int exerciseId, int par
}
if (!isHidden)
ret.push_back(user.id());
ret.push_back(user.id);
}
}
}
@@ -164,17 +164,17 @@ bool DtcImplCustom::sendAdlerNotification(const QString &jsonStr, const int exer
return !found;
}
std::vector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, const int partyId, const int operatorRight, const int notificationType)
QVector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, const int partyId, const int operatorRight, const int notificationType)
{
const std::vector<int> operatorsByOperatorRight = getOperatorsByOperatorRight(operatorRight);
std::vector<int> operatorIds;
const QVector<int> operatorsByOperatorRight = getOperatorsByOperatorRight(operatorRight);
QVector<int> operatorIds;
for (const auto &userId : operatorsByOperatorRight)
{
bool inExercise = false;
const auto user = m_userCont.value(userId);
// Only include operators who are assigned to the exercise.
const auto& exerciseIds = user.exerciseIds();
const auto& exerciseIds = user.exerciseIds;
for (const auto &exerciseIdUser : exerciseIds)
{
if (exerciseIdUser == exerciseId)
@@ -185,13 +185,13 @@ std::vector<int> DtcImplCustom::getNotificationRecipents(const int exerciseId, c
}
if (!inExercise)
{
DEBUG_LOG(m_logger) << "Operator name=" << user.name() << " not in Exercise id=" << exerciseId;
DEBUG_LOG(m_logger) << "Operator name=" << user.name << " not in Exercise id=" << exerciseId;
continue;
}
DEBUG_LOG(m_logger) << "getNotificationRecipents OperatorId" << user.id() << ", Name=" << user.name() << ", properties=" << user.properties();
if (isAdlerAllowedParty(exerciseId, partyId, user.id()) &&
sendAdlerNotification(user.properties(), exerciseId, partyId, notificationType))
operatorIds.push_back(user.id());
DEBUG_LOG(m_logger) << "getNotificationRecipents OperatorId" << user.id << ", Name=" << user.name << ", properties=" << user.properties;
if (isAdlerAllowedParty(exerciseId, partyId, user.id) &&
sendAdlerNotification(QString::fromStdString(user.properties), exerciseId, partyId, notificationType))
operatorIds.push_back(user.id);
}
return operatorIds;
}
@@ -201,13 +201,13 @@ bool DtcImplCustom::isAdlerAllowedParty(int exerciseId, int partyId, int operato
DEBUG_LOG(m_logger) << LOGFUNCTION << " exerciseId: " << exerciseId << ", partyId: "
<< partyId << ", operatorId: " << operatorId;
const auto visiblePartiesByExercise = m_userCont[operatorId].visiblePartiesByExercise();
const auto visiblePartiesByExercise = m_userCont[operatorId].visiblePartiesByExercise;
for (const auto &pbe : visiblePartiesByExercise)
{
if (pbe.exerciseId() != exerciseId)
if (pbe.exerciseId != exerciseId)
continue;
const QJsonObject propsObj(QJsonDocument::fromJson(pbe.properties().toUtf8()).object());
const QJsonObject propsObj(QJsonDocument::fromJson(QString::fromStdString(pbe.properties).toUtf8()).object());
const QJsonArray parties = propsObj.value(QStringLiteral("adlerAllowed")).toArray();
for (const QJsonValue &val : parties)
@@ -23,9 +23,9 @@ public:
explicit DtcImplCustom(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);
// custom procs, body must be implemented by user
std::vector<int> getOperatorsByOperatorRight(int operatorRight) override;
std::vector<int> operatorForExerciseParty(int exerciseId, int partyId) override;
std::vector<int> getNotificationRecipents (const int exerciseId, const int partyId, const int operatorRight, const int notificationType) override;
QVector<int> getOperatorsByOperatorRight(int operatorRight) override;
QVector<int> operatorForExerciseParty(int exerciseId, int partyId) override;
QVector<int> getNotificationRecipents (const int exerciseId, const int partyId, const int operatorRight, const int notificationType) override;
bool isAdlerAllowedParty(int exerciseId, int partyId, int operatorId) override;
private: