Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+27
-27
@@ -70,12 +70,12 @@ Core::FunctionReplyObject ObjectExercise::createObject(const Database::ExmExerci
|
||||
if (!m_db->insert(m_data))
|
||||
{
|
||||
QString errText = m_db->getLastError().databaseText();
|
||||
ERROR_LOG() << "Error inserting exercise into database: " << errText;
|
||||
ERROR_LOG(m_logger) << "Error inserting exercise into database: " << errText;
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting ExmExercise-data into database: %1")).arg(errText);
|
||||
}
|
||||
|
||||
// Id is serial -> will be generated by db => inside m_data after db-insert
|
||||
DEBUG_LOG() << "New exerciseId: " << m_data.id;
|
||||
DEBUG_LOG(m_logger) << "New exerciseId: " << m_data.id;
|
||||
|
||||
// Create exercise-schema
|
||||
if (!m_exTblGen->createExerciseSchema(m_data.id))
|
||||
@@ -94,7 +94,7 @@ Core::FunctionReplyObject ObjectExercise::createObject(const Database::ExmExerci
|
||||
if (m_logger.isDebugEnabled())
|
||||
m_exTblGen->writeExerciseServicesSql(m_data.id);
|
||||
|
||||
INFO_LOG() << "Exercise created sucessfully.";
|
||||
INFO_LOG(m_logger) << "Exercise created sucessfully.";
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -106,7 +106,7 @@ void ObjectExercise::initStateMachine()
|
||||
{
|
||||
// Start ExerciseStateMachine
|
||||
m_stateMachine->init();
|
||||
INFO_LOG() << "StateMachine: currentState" << m_stateMachine->getCurrentState();
|
||||
INFO_LOG(m_logger) << "StateMachine: currentState" << m_stateMachine->getCurrentState();
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject ObjectExercise::updateObject(const Database::ExmExercise &data)
|
||||
@@ -136,12 +136,12 @@ Core::FunctionReplyObject ObjectExercise::updateObject(const Database::ExmExerci
|
||||
|
||||
fixupTimeZone();
|
||||
|
||||
INFO_LOG() << "Trying to updateObject ExerciseData with id = " << data.id;
|
||||
INFO_LOG(m_logger) << "Trying to updateObject ExerciseData with id = " << data.id;
|
||||
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
QString errText = m_db->getLastError().databaseText();
|
||||
ERROR_LOG() << "Failed to update ExerciseData with id = " << data.id << ": " << m_db->getLastError().databaseText();
|
||||
ERROR_LOG(m_logger) << "Failed to update ExerciseData with id = " << data.id << ": " << m_db->getLastError().databaseText();
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Error updating ExmExercise-data in database: %1")).arg(errText);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ Core::FunctionReplyObject ObjectExercise::updateObject(const Database::ExmExerci
|
||||
return retOb;
|
||||
}
|
||||
|
||||
INFO_LOG() << "ExerciseData changed sucessfully.";
|
||||
INFO_LOG(m_logger) << "ExerciseData changed sucessfully.";
|
||||
|
||||
onPublishData();
|
||||
|
||||
@@ -175,14 +175,14 @@ Core::FunctionReplyObject ObjectExercise::removeObject(bool force)
|
||||
if (!m_db->removeExmExercise(m_data.id))
|
||||
{
|
||||
QString errText = m_db->getLastError().databaseText();
|
||||
ERROR_LOG() << "Cannot remove exercise id = " << m_data.id << "from database: " << errText;
|
||||
ERROR_LOG(m_logger) << "Cannot remove exercise id = " << m_data.id << "from database: " << errText;
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Exercise %1 (%2) can not be removed: %3")).arg(m_data.name).arg(m_data.id).arg(errText);
|
||||
}
|
||||
|
||||
m_ddsHandler->dts()->removeExerciseByKey(m_data.id);
|
||||
sendStateToServiceManagement(m_data.exerciseStateId); // terminated
|
||||
|
||||
INFO_LOG() << "Exercise dropped sucessfully.";
|
||||
INFO_LOG(m_logger) << "Exercise dropped sucessfully.";
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ bool ObjectExercise::setLinkedExerciseId(int newLinkedExerciseId)
|
||||
m_data.linkedExerciseId = newLinkedExerciseId;
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
ERROR_LOG() << "Failed to update ExerciseData with id = " << m_data.id << " : " << m_db->getLastError().text();
|
||||
ERROR_LOG(m_logger) << "Failed to update ExerciseData with id = " << m_data.id << " : " << m_db->getLastError().text();
|
||||
return false;
|
||||
}
|
||||
onPublishData();
|
||||
@@ -204,7 +204,7 @@ bool ObjectExercise::setSendToWms(bool bSend)
|
||||
m_data.sendToWms = bSend;
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
ERROR_LOG() << "Failed to update ExerciseData with id = " << m_data.id << " : " << m_db->getLastError().text();
|
||||
ERROR_LOG(m_logger) << "Failed to update ExerciseData with id = " << m_data.id << " : " << m_db->getLastError().text();
|
||||
return false;
|
||||
}
|
||||
onPublishData();
|
||||
@@ -219,12 +219,12 @@ bool ObjectExercise::setExerciseState(const ExerciseState &exerciseState)
|
||||
|
||||
if (!isValid() || !isEditable())
|
||||
{
|
||||
WARNING_LOG() << "Trying to update an already removed ExmExercise object";
|
||||
WARNING_LOG(m_logger) << "Trying to update an already removed ExmExercise object";
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "## m_data.exerciseStateId = " << m_data.exerciseStateId;
|
||||
DEBUG_LOG() << "## exerciseState = " << exerciseState;
|
||||
DEBUG_LOG(m_logger) << "## m_data.exerciseStateId = " << m_data.exerciseStateId;
|
||||
DEBUG_LOG(m_logger) << "## exerciseState = " << exerciseState;
|
||||
|
||||
m_data.exerciseStateId = exerciseState;
|
||||
if (m_data.exerciseStateId == ExerciseManagement::ExerciseState::Stopped ||
|
||||
@@ -242,7 +242,7 @@ bool ObjectExercise::setExerciseState(const ExerciseState &exerciseState)
|
||||
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
ERROR_LOG() << "Error updating ExmExercise-data in database (exerciseState) for exercise id = " << m_data.id << " : " << m_db->getLastError().text();;
|
||||
ERROR_LOG(m_logger) << "Error updating ExmExercise-data in database (exerciseState) for exercise id = " << m_data.id << " : " << m_db->getLastError().text();;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ bool ObjectExercise::setExerciseState(const ExerciseState &exerciseState)
|
||||
|
||||
// record exerciseStateChange
|
||||
if (!m_db->insert(stateChange))
|
||||
WARNING_LOG() << "Recording change of exerciseState failed: " << m_db->getLastError().text();;
|
||||
WARNING_LOG(m_logger) << "Recording change of exerciseState failed: " << m_db->getLastError().text();;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -265,10 +265,10 @@ bool ObjectExercise::setExerciseState(const ExerciseState &exerciseState)
|
||||
|
||||
void ObjectExercise::onPublishData()
|
||||
{
|
||||
INFO_LOG() << "Publish ExmExercise-data to dds (" << m_data.id << ", " << m_data.name << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish ExmExercise-data to dds (" << m_data.id << ", " << m_data.name << ") ...";
|
||||
|
||||
if (!m_ddsHandler->dts()->publish(convert(m_data)))
|
||||
ERROR_LOG() << "Error publishing ExmExercise-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing ExmExercise-data to dds";
|
||||
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ void ObjectExercise::fixupTimeZone()
|
||||
Core::FunctionReplyObject ObjectExercise::switchToState(const ExerciseState &newExerciseState, int operatorId, int workstationId)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
INFO_LOG() << "-------------- switchToState: " << newExerciseState
|
||||
INFO_LOG(m_logger) << "-------------- switchToState: " << newExerciseState
|
||||
<< ", currentState = " << m_stateMachine->getCurrentState();
|
||||
m_data.operatorId = operatorId;
|
||||
m_data.workstationId = workstationId;
|
||||
@@ -327,9 +327,9 @@ bool ObjectExercise::sendStateToServiceManagement(ExerciseState state)
|
||||
return false;
|
||||
|
||||
if (sgt != Core::ServiceGroupType::Master)
|
||||
DEBUG_LOG() << "Ex " << m_data.id << " - Trying to enable service group " << sgt;
|
||||
DEBUG_LOG(m_logger) << "Ex " << m_data.id << " - Trying to enable service group " << sgt;
|
||||
else
|
||||
DEBUG_LOG() << "Ex " << m_data.id << " - Trying to stop all services";
|
||||
DEBUG_LOG(m_logger) << "Ex " << m_data.id << " - Trying to stop all services";
|
||||
|
||||
// if there is an old group, stop them
|
||||
ServiceManagement::GroupRequest request(sgt,
|
||||
@@ -341,14 +341,14 @@ bool ObjectExercise::sendStateToServiceManagement(ExerciseState state)
|
||||
#ifndef EXM_OBJECT_EXERCISE_NO_HANDLER
|
||||
if (!m_exerciseHandler || !m_exerciseHandler->startGroupRequest(request))
|
||||
{
|
||||
ERROR_LOG() << "Ex " << m_data.id << " - Failed to start group " << sgt;
|
||||
ERROR_LOG(m_logger) << "Ex " << m_data.id << " - Failed to start group " << sgt;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
if (sgt != Core::ServiceGroupType::Master)
|
||||
DEBUG_LOG() << "Ex " << m_data.id << " - Sent start group " << sgt;
|
||||
DEBUG_LOG(m_logger) << "Ex " << m_data.id << " - Sent start group " << sgt;
|
||||
else
|
||||
DEBUG_LOG() << "Ex " << m_data.id << " - Sent stop all services";
|
||||
DEBUG_LOG(m_logger) << "Ex " << m_data.id << " - Sent stop all services";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ bool ObjectExercise::transferExerciseToEvaluationDb()
|
||||
Settings::evaluationDatabaseName()) ||
|
||||
!m_copyExercise->doCopy())
|
||||
{
|
||||
WARNING_LOG() << "Could not backup exercise database to evaluation server";
|
||||
WARNING_LOG(m_logger) << "Could not backup exercise database to evaluation server";
|
||||
return false;
|
||||
}
|
||||
NOTICE_LOG(m_logger) << "Ex " << m_data.id << " - Started copying exercise from "
|
||||
@@ -391,7 +391,7 @@ void ObjectExercise::onTransferDbFinished()
|
||||
|
||||
m_data.transferred = true;
|
||||
if (!m_db->update(m_data))
|
||||
ERROR_LOG() << "Error updating ExmExercise-data (transferred) in database (exerciseState) for exercise id = " << m_data.id << " : " << m_db->getLastError().text();;
|
||||
ERROR_LOG(m_logger) << "Error updating ExmExercise-data (transferred) in database (exerciseState) for exercise id = " << m_data.id << " : " << m_db->getLastError().text();;
|
||||
|
||||
delete m_copyExercise;
|
||||
m_copyExercise = nullptr;
|
||||
@@ -402,7 +402,7 @@ void ObjectExercise::onTransferDbFinished()
|
||||
|
||||
void ObjectExercise::onErrorOccured()
|
||||
{
|
||||
WARNING_LOG() << "Ex " << m_data.id << " - Copying exercise from "
|
||||
WARNING_LOG(m_logger) << "Ex " << m_data.id << " - Copying exercise from "
|
||||
<< Settings::serverDatabaseHost() << ":" << Settings::serverDatabaseName()
|
||||
<< " to " << Settings::evaluationDatabaseHost() << ":" << Settings::evaluationDatabaseName();
|
||||
delete m_copyExercise;
|
||||
|
||||
Reference in new issue
Block a user