Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+25
-25
@@ -38,7 +38,7 @@ HandlerReportData::HandlerReportData(const std::shared_ptr<DdsHandler> &ddsHandl
|
||||
//-----------------------------------------------------------------------------
|
||||
bool HandlerReportData::init()
|
||||
{
|
||||
INFO_LOG() << "start init() DTC HandlerReportData ";
|
||||
INFO_LOG(m_logger) << "start init() DTC HandlerReportData ";
|
||||
|
||||
bool bRet = true;
|
||||
auto cbReport = [this, &bRet](Database::RepReport dbData)
|
||||
@@ -49,7 +49,7 @@ bool HandlerReportData::init()
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ bool HandlerReportData::init()
|
||||
m_ppmDtc = ParticipantManagement::Interface::Dtc::create(m_ddsHandler->ddsConnector());
|
||||
if (m_ppmDtc == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Could not create PPM DTC";
|
||||
ERROR_LOG(m_logger) << "Could not create PPM DTC";
|
||||
return false;
|
||||
}
|
||||
m_ppmDtc->enableParticipant();
|
||||
@@ -72,7 +72,7 @@ bool HandlerReportData::init()
|
||||
m_aesDtc = AreaEffectSimulation::Interface::Dtc::create(m_ddsHandler->ddsConnector());
|
||||
if (m_aesDtc == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Could not create AES DTC";
|
||||
ERROR_LOG(m_logger) << "Could not create AES DTC";
|
||||
return false;
|
||||
}
|
||||
m_aesDtc->enableMineArea();
|
||||
@@ -97,7 +97,7 @@ QString HandlerReportData::intVecToString(const std::vector<int> &intVec)
|
||||
void HandlerReportData::onCreateModifyReportRequest(const rti::core::SampleIdentity &cookie,
|
||||
const CreateModifyReportRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onCreateModifyReportRequest" << request;
|
||||
DEBUG_LOG(m_logger) << "onCreateModifyReportRequest" << request;
|
||||
|
||||
m_updateReportCookie = cookie;
|
||||
|
||||
@@ -118,12 +118,12 @@ void HandlerReportData::onCreateModifyReportRequest(const rti::core::SampleIdent
|
||||
ReportType repType = request.reportType(); // assuming this cannot be changed by this request
|
||||
ok = removeReportData(reportId, repType); // remove old data
|
||||
if (!ok)
|
||||
WARNING_LOG() << "Cannot remove old data for report id = " << reportId;
|
||||
WARNING_LOG(m_logger) << "Cannot remove old data for report id = " << reportId;
|
||||
}
|
||||
|
||||
if (!insertReportData(request, reportId))
|
||||
{
|
||||
ERROR_LOG() << "Error while creating report!";
|
||||
ERROR_LOG(m_logger) << "Error while creating report!";
|
||||
m_reply.errorString(tr_lts("dds","Error while creating report"));
|
||||
m_reply.replyState(Core::FtReplyState::Error);
|
||||
m_reply.currentTime(QDateTime::currentMSecsSinceEpoch());
|
||||
@@ -214,7 +214,7 @@ void HandlerReportData::onCreateModifyReportRequest(const rti::core::SampleIdent
|
||||
|
||||
default:
|
||||
{
|
||||
WARNING_LOG() << "Report Type unknown, not generating.";
|
||||
WARNING_LOG(m_logger) << "Report Type unknown, not generating.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ void HandlerReportData::onCreateModifyReportRequest(const rti::core::SampleIdent
|
||||
objRep->removeObject();
|
||||
m_objReportMap.remove(reportId);
|
||||
|
||||
ERROR_LOG() << "Error generating report with type " << request.reportType();
|
||||
ERROR_LOG(m_logger) << "Error generating report with type " << request.reportType();
|
||||
m_reply.errorString(tr_lts("dds", "Error generating report"));
|
||||
m_reply.replyState(Core::FtReplyState::Error);
|
||||
m_reply.currentTime(QDateTime::currentMSecsSinceEpoch());
|
||||
@@ -244,7 +244,7 @@ void HandlerReportData::onCreateModifyReportRequest(const rti::core::SampleIdent
|
||||
void HandlerReportData::onRemoveReportRequest(const rti::core::SampleIdentity &cookie,
|
||||
const Core::RemoveElementRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onRemoveReportRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onRemoveReportRequest " << request;
|
||||
|
||||
int reportId = request.id();
|
||||
|
||||
@@ -262,7 +262,7 @@ void HandlerReportData::onRemoveReportRequest(const rti::core::SampleIdentity &c
|
||||
ret = ifs->removeObject();
|
||||
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
// delete ObjectReportInfo
|
||||
@@ -281,7 +281,7 @@ void HandlerReportData::onRemoveReportRequest(const rti::core::SampleIdentity &c
|
||||
//-----------------------------------------------------------------------------
|
||||
bool HandlerReportData::removeReportData(int reportId, ReportType repType)
|
||||
{
|
||||
INFO_LOG() << "IN removeReportData";
|
||||
INFO_LOG(m_logger) << "IN removeReportData";
|
||||
|
||||
bool ok = true;
|
||||
|
||||
@@ -363,13 +363,13 @@ bool HandlerReportData::removeReportData(int reportId, ReportType repType)
|
||||
}
|
||||
default:
|
||||
{
|
||||
WARNING_LOG() << "Report Type unknown, cannot remove generated data";
|
||||
WARNING_LOG(m_logger) << "Report Type unknown, cannot remove generated data";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
WARNING_LOG() << "Could not remove old generated data for report id = " << reportId;
|
||||
WARNING_LOG(m_logger) << "Could not remove old generated data for report id = " << reportId;
|
||||
|
||||
return ok;
|
||||
}
|
||||
@@ -378,7 +378,7 @@ bool HandlerReportData::removeReportData(int reportId, ReportType repType)
|
||||
void HandlerReportData::onReportChangeStatusRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ReportChangeStatusRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onReportChangeStatusRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onReportChangeStatusRequest " << request;
|
||||
ObjectReportInfo *ifs = m_objReportMap.value(request.id());
|
||||
if (ifs == nullptr)
|
||||
{
|
||||
@@ -388,7 +388,7 @@ void HandlerReportData::onReportChangeStatusRequest(const rti::core::SampleIdent
|
||||
}
|
||||
Core::FunctionReplyObject ret = ifs->changeStatus(request);
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
|
||||
m_ddsHandler->fts()->reportChangeStatusReply(cookie, ret);
|
||||
}
|
||||
@@ -496,7 +496,7 @@ bool HandlerReportData::insertReportData(const CreateModifyReportRequest &reques
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
return false;
|
||||
}
|
||||
m_objReportMap.insert(ifs->getId(), ifs);
|
||||
@@ -509,14 +509,14 @@ bool HandlerReportData::insertReportData(const CreateModifyReportRequest &reques
|
||||
ObjectReportInfo *ifs = m_objReportMap.value(reportId);
|
||||
if (!ifs)
|
||||
{
|
||||
ERROR_LOG() << "Report not found - report id = " << reportId;
|
||||
ERROR_LOG(m_logger) << "Report not found - report id = " << reportId;
|
||||
return false;
|
||||
}
|
||||
Core::FunctionReplyObject ret = ifs->updateObject(data);
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -526,7 +526,7 @@ bool HandlerReportData::insertReportData(const CreateModifyReportRequest &reques
|
||||
// -----------------------------------------------------------------------------------
|
||||
bool HandlerReportData::removeReportDataResult(int reportId, const QString &tableName)
|
||||
{
|
||||
DEBUG_LOG() << "Start removeReportDataResult";
|
||||
DEBUG_LOG(m_logger) << "Start removeReportDataResult";
|
||||
|
||||
DBTransaction trans(m_db->database());
|
||||
NSqlQuery q(m_db->database());
|
||||
@@ -536,17 +536,17 @@ bool HandlerReportData::removeReportDataResult(int reportId, const QString &tabl
|
||||
q.prepare(stmt);
|
||||
q.bindValue(QStringLiteral(":reportId"), reportId);
|
||||
|
||||
DEBUG_LOG() << "Statement: " << stmt;
|
||||
DEBUG_LOG(m_logger) << "Statement: " << stmt;
|
||||
|
||||
if (!q.exec())
|
||||
{
|
||||
ERROR_LOG() << "Error removing report data for report id = " << reportId;
|
||||
ERROR_LOG(m_logger) << "Error removing report data for report id = " << reportId;
|
||||
return false;
|
||||
}
|
||||
|
||||
trans.commit();
|
||||
|
||||
DEBUG_LOG() << " END removeReportDataResult";
|
||||
DEBUG_LOG(m_logger) << " END removeReportDataResult";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ bool HandlerReportData::removeReportDataResult(int reportId, const QString &tabl
|
||||
// -----------------------------------------------------------------------------------
|
||||
void HandlerReportData::checkElapsedTimer(QElapsedTimer &t)
|
||||
{
|
||||
TRACE_LOG() << "checkElapsedTimer ...";
|
||||
TRACE_LOG(m_logger) << "checkElapsedTimer ...";
|
||||
if (t.elapsed() > 5 * 1000)
|
||||
{
|
||||
t.start();
|
||||
@@ -565,7 +565,7 @@ void HandlerReportData::checkElapsedTimer(QElapsedTimer &t)
|
||||
// -----------------------------------------------------------------------------------
|
||||
void HandlerReportData::updateReportReply()
|
||||
{
|
||||
DEBUG_LOG() << "updateReportReply: " << m_reply;
|
||||
DEBUG_LOG(m_logger) << "updateReportReply: " << m_reply;
|
||||
m_reply.currentTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_ddsHandler->fts()->createModifyReportReply(m_updateReportCookie, m_reply);
|
||||
m_ddsHandler->pacemaker()->publishState();
|
||||
|
||||
+2
@@ -192,6 +192,8 @@ class HandlerReportData final
|
||||
bool init();
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
static QString intVecToString(const std::vector<int> &intVec);
|
||||
void onCreateModifyReportRequest(const rti::core::SampleIdentity &cookie, const CreateModifyReportRequest &request) override final;
|
||||
void onRemoveReportRequest(const rti::core::SampleIdentity &cookie, const Core::RemoveElementRequest &request) override final;
|
||||
|
||||
+5
-5
@@ -42,7 +42,7 @@ void HandlerReportGetData::onGetReportDataRequest(const rti::core::SampleIdentit
|
||||
if (ret.errorString().size() != 0)
|
||||
{
|
||||
Core::FunctionReplyObject fro(ret.id(), ret.errorString(), ret.errorParams());
|
||||
WARNING_LOG() << "error: " << fro();
|
||||
WARNING_LOG(m_logger) << "error: " << fro();
|
||||
}
|
||||
m_ddsHandler->fts()->getReportDataReply(cookie, ret);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ void HandlerReportGetData::onGetReportDataRequest(const rti::core::SampleIdentit
|
||||
//-----------------------------------------------------------------------------
|
||||
GetReportDataReply HandlerReportGetData::getReportDataRequest(const GetReportDataRequest &request)
|
||||
{
|
||||
INFO_LOG() << "IN onGetReportDataRequest";
|
||||
INFO_LOG(m_logger) << "IN onGetReportDataRequest";
|
||||
|
||||
// Get data per reportType
|
||||
QByteArray reportData;
|
||||
@@ -104,7 +104,7 @@ GetReportDataReply HandlerReportGetData::getReportDataRequest(const GetReportDat
|
||||
reportData = getTreatmentTimelineResult(request.reportId());
|
||||
break;
|
||||
default:
|
||||
WARNING_LOG() << "Report Type unknown, no generating.";
|
||||
WARNING_LOG(m_logger) << "Report Type unknown, no generating.";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -445,14 +445,14 @@ QByteArray HandlerReportGetData::getSanitationMaterialResult(int reportId) const
|
||||
|
||||
QString stmt = QLatin1String("SELECT id, material_id, sanitation_unique_id, qualification, amount_start, amount_resupplied, amount_end, amount_used, duration FROM "
|
||||
"rep_sanitation_material_result WHERE report_id = :reportId ORDER BY sanitation_unique_id, qualification, material_id");
|
||||
DEBUG_LOG() << " stmt: " << stmt;
|
||||
DEBUG_LOG(m_logger) << " stmt: " << stmt;
|
||||
|
||||
qSelect.prepare(stmt);
|
||||
qSelect.bindValue(QLatin1String(":reportId"), reportId);
|
||||
|
||||
if (!qSelect.exec())
|
||||
{
|
||||
ERROR_LOG() << "Couldn't select sanitation material result ";
|
||||
ERROR_LOG(m_logger) << "Couldn't select sanitation material result ";
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -32,6 +32,8 @@ public:
|
||||
bool init();
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onGetReportDataRequest(const rti::core::SampleIdentity &cookie,
|
||||
const GetReportDataRequest &request) override final;
|
||||
GetReportDataReply getReportDataRequest(const GetReportDataRequest &request);
|
||||
|
||||
+3
-4
@@ -18,12 +18,11 @@
|
||||
namespace ReportManagement
|
||||
{
|
||||
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
MainHandler::MainHandler(QObject *parent) : QObject(parent)
|
||||
, m_ddsHandler(nullptr)
|
||||
, m_dbHandler(nullptr)
|
||||
, m_preService(nullptr)
|
||||
{}
|
||||
, m_preService(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
std::shared_ptr<HandlerReportData> m_reportData;
|
||||
|
||||
+7
-8
@@ -20,11 +20,10 @@ namespace ReportManagement
|
||||
{
|
||||
ObjectReportInfo::ObjectReportInfo(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<DatabaseInterface> &db,
|
||||
QObject *parent)
|
||||
: QObject(parent)
|
||||
QObject *parent) : QObject(parent)
|
||||
, m_ddsHandler(ddsHandler)
|
||||
, m_db(db)
|
||||
{
|
||||
, m_db(db),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -50,7 +49,7 @@ Core::FunctionReplyObject ObjectReportInfo::createObject(Database::RepReport &db
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting RepReport-data into database"));
|
||||
|
||||
m_data.id = dbData.id;
|
||||
DEBUG_LOG() << "New reportId: " << m_data.id;
|
||||
DEBUG_LOG(m_logger) << "New reportId: " << m_data.id;
|
||||
}
|
||||
|
||||
// Publish Data via DTS
|
||||
@@ -69,7 +68,7 @@ Core::FunctionReplyObject ObjectReportInfo::updateObject(const Database::RepRepo
|
||||
return Core::FunctionReplyObject(dbData.id, tr_lts("dds", "Error updating RepReport-data into database"));
|
||||
|
||||
m_data = dbData;
|
||||
DEBUG_LOG() << "Data changed for reportId: " << m_data.id;
|
||||
DEBUG_LOG(m_logger) << "Data changed for reportId: " << m_data.id;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -110,11 +109,11 @@ Core::FunctionReplyObject ObjectReportInfo::changeStatus(const ReportChangeStatu
|
||||
//------------------------------------------------------------------------------
|
||||
void ObjectReportInfo::onPublishData()
|
||||
{
|
||||
INFO_LOG() << "Publish ReportInfo-data to dds (" << m_data.id << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish ReportInfo-data to dds (" << m_data.id << ") ...";
|
||||
ReportInfo data = toDdsData(m_data);
|
||||
|
||||
if (!m_ddsHandler->dts()->publish(data))
|
||||
ERROR_LOG() << "Error publishing ReportInfo-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing ReportInfo-data to dds";
|
||||
}
|
||||
|
||||
// TODO: add in LtsUtils ?
|
||||
|
||||
Reference in new issue
Block a user