Files
qt5-legatus-legacy/Lts/Plugins/ParticipantManagement/Gui/MSDL/msdl/msdl_import.h
T
2026-08-13 18:33:10 +02:00

107 lines
3.5 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Klasse fuer das Importieren von MSDL-Dateien
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <nglwidgets/ngldialog.h>
#include "msdl_logging.h"
#include "msdl_types.h"
#include "zwmsmsdl_export.h"
#include <QModelIndex>
#include <Plugins/ParticipantManagement/Gui/Common/participant_edit_model.h>
#include <memory>
#include <ParticipantManagement/ppm_dtc.h>
#include <ParticipantManagement/ppm_ftc.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_participants_gui_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_templates_gui_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
namespace LtsSession
{
class LtsSession;
}
class Ui_MSDLImport;
namespace msdl
{
class ImportMsdlShow;
class ZWMSMSDL_EXPORT ImportMsdl : public NGLDialog, protected ParticipantManagement::Interface::Ftc::ModifyTypeReplyHandler
{
Q_OBJECT
public:
ImportMsdl(ParticipantManagement::ParticipantEditModel *pModel, const QModelIndex &index, QWidget *parent, LtsSession::LtsSession *pSession);
virtual ~ImportMsdl();
private slots:
void slotOpenImportDialog();
void slotStartImport();
private:
void onModifyTypeReply(const Core::FunctionReplyObject &replyObject) override { m_requestHelper->requestReply(replyObject); }
void createWorkingCopy(const QString &strImportFile);
bool schemaValidation();
ParticipantManagement::ParticipantData createParticipant(const MSDLParticipant &unit);
void insertParticipant(const MSDLParticipant &unit, const QModelIndex &index);
void insertParty(const MSDLParty &party);
void createNode(const ParticipantManagement::ParticipantData &participant, const QModelIndex &index, const QString &handle);
void checkParentlessUnits();
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ppmFtc;
// Exercise importing has the following call order
void importExerciseScenario();
void importPurpose();
QVector<MSDLParty> importParties();
void importOrganization();
QMap<QString, MSDLParticipant> importParticipants();
void importEquipment(QMap<QString, MSDLParticipant> &mapUnits);
QVector<MSDLParticipant> resolveImportMapping(const QMap<QString, MSDLParticipant> &mapUnits);
QVector<MSDLParticipant> showMappingDialog(const QMap<QString, QVector<MSDLParticipant> > &mapConflictMap, bool typeClassIsUnit);
void buildImportTreeView(QVector<MSDLParticipant> &vecUnitsWithValidDISTypes);
bool applyDISMappingChangesToDatabase();
QMap<QString, int32_t> m_mapMSDL_DIS_2TypeId; // E.g. "003001222001246001000" to "47"
QMap<qint32, ParticipantManagement::Type> m_mapTypes; // E.g. participant id "47" to type id
void mapParticipant2Type(MSDLParticipant &participant, qint32 mappedTypeId);
QSet<int32_t> m_setTouchedTypes;
// Used to create the treeview with the imported participants
QMap<QString, QModelIndex> m_parentIndexCache;
QMap<QString, MSDLParticipant> m_parentlessItems;
QModelIndex m_indexRoot; // Used to append parties/forces to the tree
ParticipantManagement::ParticipantEditModel *m_pModel;
LtsUtils::RequestHelper *m_requestHelper;
msdl::ImportMsdlShow *m_pMsdlImportShow; // Import debug view. Not visible for the actual user when compiling in release mode
Ui_MSDLImport *m_pUi;
msdl::LOGGER_T mLogger;
};
}