Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+128
View File
@@ -0,0 +1,128 @@
#
# $Id$
# $HeadURL$
# $Author$
#
INCLUDE(MacroRTIDDSGen)
INCLUDE(MacroCodeGenIdl)
SET(xml_FILE pre_service.xml)
#
# --- Library svcPreCommon --------------------------------------------------------------------------------
#
SET(SRCS_common
pre_export.h
logger.cpp
logger.h
)
# Generate pre_enums.idl / pre.idl
CODEGEN_IDL_SVC(SRCS_common ${xml_FILE})
# Generate pre_db_impl.cpp/.h, pre_db.h
CODEGEN_DATABASE(SRCS_common ${xml_FILE})
# Generate *.cpp/*.hpp from idl
RTIDDSGEN(SRCS_common pre_enums.idl)
RTIDDSGEN(SRCS_common pre.idl)
# Generate pre_dt[s,c]_types.h, pre_ft[s,c]_types.h
CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
# generate pre_[d|f]tc.h
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
NGL_ADD_LIBRARY(AAR SV WS svcPreCommon SHARED ${SRCS_common})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPreCommon
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
NGL_TARGET_LINK_LIBRARIES(svcPreCommon
PRIVATE
RTI::nddscpp2
PUBLIC
Qt5::Core
ddscore
NGLLogger
ngldb
)
NGL_INSTALL_TARGET(svcPreCommon)
#
# --- Library svcPreClient --------------------------------------------------------------------------------
#
SET(SRCS_client
pre_export.h
)
# generate pre_[d|f]tc_impl.[cpp|h]
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
NGL_ADD_LIBRARY(AAR SV WS svcPreClient SHARED ${SRCS_client})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPreClient
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
NGL_TARGET_LINK_LIBRARIES(svcPreClient
PRIVATE
RTI::nddscpp2
ddsconnector
PUBLIC
svcPreCommon
ddsftc
)
NGL_INSTALL_TARGET(svcPreClient)
#
# --- Library svcPreServer --------------------------------------------------------------------------------
#
SET(SRCS_server
initialization.cpp
initialization.h
dds_handler.cpp
dds_handler.h
handler_presentation.cpp
handler_presentation.h
object_presentation.cpp
object_presentation.h
pre_export.h
settings.cpp
settings.h
)
# generate pre_[d|f]ts.h, pre_[d|f]ts_impl.[cpp|h]
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
# Generate pre.sql, pre.xml
CODEGEN_SQL(SRCS_server ${xml_FILE})
NGL_ADD_LIBRARY(AAR SV svcPreServer SHARED ${SRCS_server})
NGL_TARGET_INCLUDE_DIRECTORIES(svcPreServer
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../
${CMAKE_CURRENT_BINARY_DIR}/../
)
NGL_TARGET_LINK_LIBRARIES(svcPreServer
PRIVATE
RTI::nddscpp2
ddsconnector
ddsfts
nglsettings
ngltools
svcCoreClient
PUBLIC
svcPreCommon
ngldb
)
NGL_INSTALL_TARGET(svcPreServer)
#
# --- Topic Type Plugin --------------------------------------------------------------
#
CREATE_TOPIC_TYPE_PLUGIN(${xml_FILE})
# Uncomment if necessary
#ADD_SUBDIRECTORY(UnitTests)
ADD_SUBDIRECTORY(ModuleTests)
@@ -0,0 +1,36 @@
#
# $Id$
# $HeadURL$
# $Author$
#
SET(SRCS_FT_TEST
pre_tests.cpp
)
SET(HDRS_FT_TEST
pre_tests.h
)
IF(BUILD_TESTING)
IF(TARGET svcPreClient)
# Testing FunctionTopic Functionality (FTC)
ADD_EXECUTABLE(preTests ${SRCS_FT_TEST} ${HDRS_FT_TEST})
TARGET_LINK_LIBRARIES(preTests
Qt5::Core
Qt5::Test
RTI::nddscpp2
svcPreClient
LtsCommandLineParser
ddsconnector
nglcoreapplication
)
IF(NOT BUILD_RPM)
NGL_INSTALL(SV TARGETS preTests DESTINATION bin/test)
#NGL_INSTALL(AAR SV FILES ../log4cxx_pre.props DESTINATION bin/test)
ENDIF()
ENDIF()
ENDIF()
@@ -0,0 +1,388 @@
/**
* EXM Function Topic test executable
* $Id$
* $HeadURL$
* $Author$
*
* Created by Hanna E. Rathje, SLSE, 2015-09-10
*/
#include "pre_tests.h"
#include <nglapplication/nglcoreapplication.h>
#include <LtsCommandLineParser/LtsCommandLineParser.h>
#include <QTimer>
#include <QTest>
#include <PresentationManagement/pre_ftc.h>
namespace PresentationManagement
{
//----------------------------------------------------------------------------------
PreTests::PreTests(QObject *parent)
: QObject(parent)
, m_exerciseId(0)
, m_testId(0)
, m_presentationId(0)
, m_bTestsSuccessful(true)
, m_logger(getLogger("Test"))
{
qRegisterMetaType<Core::FunctionReply>("Core::FunctionReply");
}
//----------------------------------------------------------------------------------
bool PreTests::init(int domainId, int exerciseId, int testId, int presentationId)
{
INFO_LOG(m_logger) << "init begin";
m_testId = testId;
m_exerciseId = exerciseId;
m_presentationId = presentationId;
// initialize DDS
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Exercise, m_exerciseId));
if (!m_ddsConnector->init())
return false;
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
m_ddsConnector->initPublisherSubscriber();
DEBUG_LOG(m_logger) << "create ftc PRE";
m_ftc = PresentationManagement::Interface::Ftc::create(m_ddsConnector);
DEBUG_LOG(m_logger) << "init ftc PRE";
bool bRet = m_ftc->enableAll();
DEBUG_LOG(m_logger) << "init end PRE - bRet = " << bRet;
DEBUG_LOG(m_logger) << "Domain Id = " << domainId;
DEBUG_LOG(m_logger) << "Exercise Id = " << exerciseId;
DEBUG_LOG(m_logger) << "Test Id = " << testId;
//TODO: add connects
return bRet;
}
//----------------------------------------------------------------------------------
void PreTests::startTest()
{
INFO_LOG(m_logger) << "startTest";
switch (m_testId)
{
case 1:
tryCreate();
break;
case 2:
tryModify();
break;
case 3:
tryGetContent();
break;
case 4:
tryDelete();
break;
case 5:
tryChangeStatus();
break;
default:
ERROR_LOG(m_logger) << "Unknown test case !";
failExit();
break;
}
INFO_LOG(m_logger) << "********* endTest **************";
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
//----------------------------------------------------------------------------------
void PreTests::tryCreate()
{
INFO_LOG(m_logger) << "trying to send createRequest Presentation";
m_presentationId = -1;
PresentationModifyRequest request;
request.name("Test Presentation");
request.description("Description Presentation");
request.operatorId(100);
request.lastModified(QDateTime(QDate(2017,2,14), QTime(9,34)).toMSecsSinceEpoch());
std::vector<PresentationContent> vectorPc;
vectorPc.resize(2);
vectorPc[0].presentationTopicType("pdf");
vectorPc[0].channel("1V");
vectorPc[0].duration(30);
vectorPc[0].startTime(QDateTime(QDate(2017,2,13), QTime(12,34)).toMSecsSinceEpoch());
vectorPc[1].presentationTopicType("text");
vectorPc[1].channel("2V");
vectorPc[1].duration(30);
vectorPc[1].startTime(QDateTime(QDate(2017,2,14), QTime(9,45)).toMSecsSinceEpoch());
request.content(vectorPc);
if (!m_ftc->presentationModifyRequest(request, this))
{
ERROR_LOG(m_logger) << "Error requesting create data";
failExit();
}
QTest::qWait(1000);
}
//----------------------------------------------------------------------------------
void PreTests::tryModify()
{
PresentationModifyRequest request;
request.id(m_presentationId);
request.name("Presentation Modify");
request.description("Description Presentation Modify");
request.operatorId(102);
request.lastModified(QDateTime(QDate(2017,2,16), QTime(10,34)).toMSecsSinceEpoch());
std::vector<PresentationContent> &vectorPc = request.content();
vectorPc.resize(2);
vectorPc[0].presentationTopicType("pdf");
vectorPc[0].channel("1V2");
vectorPc[0].duration(60);
vectorPc[0].startTime(QDateTime(QDate(2017,2,13), QTime(12,34)).toMSecsSinceEpoch());
vectorPc[1].presentationTopicType("text");
vectorPc[1].channel("2V");
vectorPc[1].duration(60);
vectorPc[1].startTime(QDateTime(QDate(2017,2,14), QTime(9,45)).toMSecsSinceEpoch());
INFO_LOG(m_logger) << "trying to send modify request for presentation Id = " << m_presentationId;
if (!m_ftc->presentationModifyRequest(request, this))
{
ERROR_LOG(m_logger) << "Error requesting modify data";
failExit();
}
QTest::qWait(1000);
}
//----------------------------------------------------------------------------------
void PreTests::tryDelete()
{
PresentationRemoveRequest request;
request.id(m_presentationId);
INFO_LOG(m_logger) << "trying to send delete request for presentation Id = " << m_presentationId;
if (!m_ftc->presentationRemoveRequest(request, this))
{
ERROR_LOG(m_logger) << "Error requesting delete data";
failExit();
}
}
//----------------------------------------------------------------------------------
void PreTests::tryGetContent()
{
GetPresentationContentRequest request;
request.presentationId(m_presentationId);
INFO_LOG(m_logger) << "trying to send content request for presentation Id = " << m_presentationId;
if (!m_ftc->getPresentationContentRequest(request, this))
{
ERROR_LOG(m_logger) << "Error requesting content for presentationId: " << m_presentationId;
failExit();
}
QTest::qWait(1000);
}
//----------------------------------------------------------------------------------
void PreTests::tryChangeStatus()
{
PresentationChangeStatusRequest request;
request.id(m_presentationId);
request.operatorId(101);
request.lastModified(QDateTime::currentMSecsSinceEpoch());
request.fileStatus(FileStatus::Deleted);
INFO_LOG(m_logger) << "trying to send change status request for presentation Id = " << m_presentationId;
if (!m_ftc->presentationChangeStatusRequest(request, this))
{
ERROR_LOG(m_logger) << "Error requesting change status";
failExit();
}
QTest::qWait(1000);
}
//----------------------------------------------------------------------------------
void PreTests::failExit()
{
ERROR_LOG(m_logger) << "FAIL EXIT !";
m_bTestsSuccessful = false;
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
//----------------------------------------------------------------------------------
void PreTests::onPresentationCreateReply(const Core::FunctionReplyObject &replyObject)
{
DEBUG_LOG(m_logger) << "END (onPresentationCreateReply)";
if (replyObject.error())
{
ERROR_LOG(m_logger) << "Got onPresentationCreateReply error: " << replyObject();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
return;
}
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
m_presentationId = replyObject.id();
if(m_testId == 0)
QTimer::singleShot(0, this, &PreTests::tryModify);
else
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
//----------------------------------------------------------------------------------
void PreTests::onPresentationModifyReply(const Core::FunctionReplyObject &replyObject)
{
if (m_presentationId == -1)
return onPresentationCreateReply(replyObject);
DEBUG_LOG(m_logger) << "END (onPresentationModifyReply)";
if (replyObject.error())
{
ERROR_LOG(m_logger) << "Got onPresentationModifyReply error: " << replyObject();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
return;
}
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
m_presentationId = replyObject.id();
if(m_testId == 0)
QTimer::singleShot(0, this, &PreTests::tryChangeStatus);
else
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
//----------------------------------------------------------------------------------
void PreTests::onPresentationChangeStatusReply(const Core::FunctionReplyObject &replyObject)
{
DEBUG_LOG(m_logger) << "END (onPresentationChangeStatusReply)";
if (replyObject.error())
{
ERROR_LOG(m_logger) << "Got onPresentationChangeStatusReply error: " << replyObject();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
return;
}
INFO_LOG(m_logger) << "Got changeStatusReply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
m_presentationId = replyObject.id();
if(m_testId == 0)
QTimer::singleShot(0, this, &PreTests::tryGetContent);
else
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
//----------------------------------------------------------------------------------
void PreTests::onPresentationRemoveReply(const Core::FunctionReplyObject &replyObject)
{
DEBUG_LOG(m_logger) << "END (onPresentationRemoveReply)";
if (replyObject.error())
{
ERROR_LOG(m_logger) << "Got onPresentationRemoveReply error: " << replyObject();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
return;
}
INFO_LOG(m_logger) << "Got reply with id " << replyObject.id()
<< " and errorString " << replyObject.translated();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
//----------------------------------------------------------------------------------
void PreTests::onGetPresentationContentReply(const GetPresentationContentReply &replyObject)
{
DEBUG_LOG(m_logger) << "END (onGetPresentationContentReply)";
if (replyObject.errorString().size() > 0)
{
ERROR_LOG(m_logger) << "Got onGetPresentationContentReply error: " << replyObject.errorString();
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
return;
}
INFO_LOG(m_logger) << "Got reply with id " << replyObject.id()
<< " and errorString " << replyObject.errorString()
<< " and content size " << replyObject.content().size();
if(m_testId == 0)
QTimer::singleShot(0, this, &PreTests::tryDelete);
else
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
}
}
// ------------------------------------------------------------------
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
{
public:
CmdLineParser()
: LtsCommandLineParser()
{
addOption( { QStringList() << QLatin1String("t") << QLatin1String("testId")
, QLatin1String("TestId.")
, QLatin1String("Default: 0 (all tests)")
, QLatin1String("0")
} );
addOption( { QStringList() << QLatin1String("p") << QLatin1String("presentationId")
, QLatin1String("PresentationId")
, QLatin1String("Default: 0 ")
, QLatin1String("0")
} );
}
int testId() const { return isSet(QLatin1String("t")) ? value(QLatin1String("t")).toInt() : -1; }
int presentationId() const { return isSet(QLatin1String("p")) ? value(QLatin1String("p")).toInt() : -1; }
};
// ------------------------------------------------------------------
int main(int argc, char **argv)
{
int iRet = -1;
NGLCoreApplication app(argc, argv);
app.createLogger("PRE", 0);
CmdLineParser options;
if (!options.init())
return iRet;
std::unique_ptr<PresentationManagement::PreTests> PreTests(new PresentationManagement::PreTests);
if (!PreTests->init(options.domainId(), options.exerciseId(), options.testId(), options.presentationId()))
return iRet;
QTimer::singleShot(0, PreTests.get(), &PresentationManagement::PreTests::startTest);
STARTUP_LOG(app.baseLogger());
app.exec();
iRet = PreTests->testsSuccessful() ? 0 : 1;
fprintf(stderr, "\n%d\n\n", iRet);
INFO_LOG(app.baseLogger()) << "** TEST result = " << iRet;
SHUTDOWN_LOG(app.baseLogger());
return iRet;
}
@@ -0,0 +1,77 @@
/**
* @RDE_HEADER@
*
* EXM Function Topic test executable
*
* ModuleTests for create/modify/remove exercise
* ---------------------------------------------------
* Client FTC is implemented
*
* => (!) Preconditon:
* - Service sExeMgmt running
*
* -------------------------------------------------
*
* $Id$
* $HeadURL$
* $Author$
*
* Created by Hanna E. Rathje, SLSE, 2015-09-10
*/
#pragma once
#include <PresentationManagement/pre_ftc.h>
#include <PresentationManagement/pre_ftc_types.h>
#include <PresentationManagement/logger.h>
#include <DDS/DDSConnector/dds_connector.h>
#include <QObject>
namespace PresentationManagement
{
class PreTests : public QObject
, protected PresentationManagement::Interface::Ftc::PresentationModifyReplyHandler
, protected PresentationManagement::Interface::Ftc::PresentationRemoveReplyHandler
, protected PresentationManagement::Interface::Ftc::GetPresentationContentReplyHandler
, protected PresentationManagement::Interface::Ftc::PresentationChangeStatusReplyHandler
{
Q_OBJECT
public:
explicit PreTests(QObject *parent = nullptr);
bool init(int domainId, int exerciseId, int testId, int presentationId);
bool testsSuccessful() const { return m_bTestsSuccessful; }
public Q_SLOTS:
void startTest();
protected Q_SLOTS:
void tryCreate();
void tryModify();
void tryDelete();
void tryGetContent();
void tryChangeStatus();
protected:
void onPresentationCreateReply(const Core::FunctionReplyObject &replyObject);
void onPresentationModifyReply(const Core::FunctionReplyObject &replyObject) override final;
void onPresentationRemoveReply(const Core::FunctionReplyObject &replyObject) override final;
void onGetPresentationContentReply(const GetPresentationContentReply &replyObject) override final;
void onPresentationChangeStatusReply(const Core::FunctionReplyObject &replyObject) override final;
void failExit();
private:
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<PresentationManagement::Interface::Ftc> m_ftc;
qint32 m_exerciseId;
int m_testId;
int m_presentationId;
bool m_bTestsSuccessful;
LOGGER_T m_logger;
};
} // namespace PresentationManagement
+47
View File
@@ -0,0 +1,47 @@
/**
* DdsHandler for DDS
* $Id$
* $HeadURL$
* $Author$
* Created by Hanna E. Rathje, SLSE, 2017-02-09
*/
#include "dds_handler.h"
namespace PresentationManagement
{
DdsHandler::DdsHandler(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector)
: m_ddsConnector(ddsConnector)
, m_logger(getLogger("DdsHandler"))
{
DEBUG_LOG(m_logger) << "DdsHandler(" << m_ddsConnector->getDomainId() << ") for partition: " << m_ddsConnector->getDefaultPartition();
}
bool DdsHandler::init(const QStringList &qosFileList)
{
if(!m_ddsConnector->init(qosFileList))
{
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
return false;
}
// default initialize Publisher and Subscriber
m_ddsConnector->initPublisherSubscriber();
// Pacemaker
m_topicLockMaster = std::make_shared<Core::TopicLockMaster>(m_ddsConnector);
m_ddsDts = PresentationManagement::Interface::Dts::create(m_ddsConnector);
m_ddsFts = PresentationManagement::Interface::Fts::create(m_ddsConnector);
bool bRet = m_ddsDts->enableAll();
INFO_LOG(m_logger) << "Dts initialised";
bRet &= m_ddsFts->enableAll();
INFO_LOG(m_logger) << "Fts initialised";
return bRet;
}
} // Namespace PresentationManagement
+56
View File
@@ -0,0 +1,56 @@
/**
* DdsHandler for DDS
* $Id$
* $HeadURL$
* $Author$
* Created by Hanna E. Rathje, SLSE, 2015-09-02
*/
#pragma once
#include <DDS/DDSConnector/dds_connector.h>
#include <DDS/Core/topic_lock_master.h>
#include <PresentationManagement/pre_dts.h>
#include <PresentationManagement/pre_fts.h>
#include "logger.h"
namespace Core
{
namespace Interface
{
class Dts;
}
}
namespace PresentationManagement
{
class DdsHandler final
{
public:
explicit DdsHandler(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector);
~DdsHandler() = default;
bool init(const QStringList &qosFileList = QStringList());
std::shared_ptr<Core::TopicLockMaster> topicLockMaster() const { return m_topicLockMaster; }
std::shared_ptr<DDSConnector::DdsConnector> ddsConnector() const { return m_ddsConnector; }
std::shared_ptr<PresentationManagement::Interface::Dts> dts() const
{
return m_ddsDts;
}
std::shared_ptr<PresentationManagement::Interface::Fts> fts() const
{
return m_ddsFts;
}
private:
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
std::shared_ptr<PresentationManagement::Interface::Dts> m_ddsDts;
std::shared_ptr<PresentationManagement::Interface::Fts> m_ddsFts;
NGL::INGLLogger &m_logger;
};
}
@@ -0,0 +1,220 @@
/**
* @RDE_HEADER@
* ISM Handler Presentations
* $Id$
* $HeadURL$
* $Author$
* Created by Iuliana Ojog, SLSE, 2016-11-26
*/
#include "handler_presentation.h"
#include "object_presentation.h"
#include "initialization.h"
#include "dds_handler.h"
namespace PresentationManagement
{
//---------------------------------------------------------------------------------------------------------------------------------------------------
HandlerPresentation::HandlerPresentation(Initialization *mainHandler)
: Interface::Fts::PresentationModifyRequestHandler(mainHandler->dds()->fts())
, Interface::Fts::PresentationRemoveRequestHandler(mainHandler->dds()->fts())
, Interface::Fts::GetPresentationContentRequestHandler(mainHandler->dds()->fts())
, Interface::Fts::PresentationChangeStatusRequestHandler(mainHandler->dds()->fts())
, m_mainHandler(mainHandler)
, m_logger(getLogger("HandlerPresentation"))
{
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
HandlerPresentation::~HandlerPresentation()
{
qDeleteAll(m_objectPresentationMap);
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
bool HandlerPresentation::init()
{
{
// create presentation objects
auto cb = [this](const Database::PrePresentation &data)
{
const PresentationManagement::Presentation ddsData = ObjectPresentation::toDdsData(data);
ObjectPresentation *ifs(new ObjectPresentation(ddsData, m_mainHandler));
m_objectPresentationMap.insert(ifs->getId(), ifs);
};
if (!m_mainHandler->db()->select(cb))
{
ERROR_LOG(m_logger) << "Error reading data from database!";
return false;
}
DEBUG_LOG(m_logger) << "m_objectPresentationMap.size() = " << m_objectPresentationMap.size();
}
{
// add presentationContent to presentation
auto cb = [this] (const Database::PrePresentationContent &data)
{
ObjectPresentation *objPre = m_objectPresentationMap.value(data.presentationId);
if (!objPre || !objPre->isValid())
{
WARNING_LOG(m_logger) << "Cannot find presentation Id = " << data.presentationId
<< " for presentationContent " << data.id;
return;
}
objPre->addPresentationContent(ObjectPresentation::toDdsData(data));
};
if (!m_mainHandler->db()->select(cb))
{
ERROR_LOG(m_logger) << "Error reading data from database!";
return false;
}
}
// publish
for (ObjectPresentation *objPre : qAsConst(m_objectPresentationMap))
objPre->onPublishData();
return true;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
void HandlerPresentation::onPresentationModifyRequest(const rti::core::SampleIdentity &cookie,
const PresentationModifyRequest &request)
{
DEBUG_LOG(m_logger) << "onPresentationModifyRequest: " << request;
auto ret = request.id() > 0 ? presentationModifyRequest(request) : presentationCreateRequest(request);
if (ret.error())
WARNING_LOG(m_logger) << ret();
m_mainHandler->dds()->fts()->presentationModifyReply(cookie, ret);
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
Core::FunctionReplyObject HandlerPresentation::presentationCreateRequest(const PresentationModifyRequest &request)
{
PresentationManagement::ObjectPresentation *ifs(new ObjectPresentation(m_mainHandler));
Core::FunctionReplyObject ret = ifs->createObject(request);
if (ret.error())
{
delete ifs;
return ret;
}
m_objectPresentationMap.insert(ifs->getId(), ifs);
// publish
ifs->onPublishData();
return ret;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
Core::FunctionReplyObject HandlerPresentation::presentationModifyRequest(const PresentationModifyRequest &request)
{
PresentationManagement::ObjectPresentation *ifs = m_objectPresentationMap.value(request.id());
if (ifs == nullptr)
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Presentation with id %1 not found")).arg(request.id());
int oldId = request.id();
Core::FunctionReplyObject ret = ifs->updateObject(request);
if (ret.error())
return ret;
m_objectPresentationMap.remove(oldId);
m_objectPresentationMap.insert(ifs->getId(), ifs);
return ret;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
void HandlerPresentation::onPresentationRemoveRequest(const rti::core::SampleIdentity &cookie,
const Core::RemoveElementRequest &request)
{
DEBUG_LOG(m_logger) << "onPresentationRemoveRequest: " << request;
Core::FunctionReplyObject ret;
int presentationId = request.id();
// gest presentation object
PresentationManagement::ObjectPresentation *ifs = m_objectPresentationMap.value(presentationId);
if (ifs == nullptr)
{
ret = Core::FunctionReplyObject(presentationId, tr_lts("dds", "Presentation with id %1 not found")).arg(presentationId);
m_mainHandler->dds()->fts()->presentationRemoveReply(cookie, ret);
return;
}
if (m_mainHandler->dds()->topicLockMaster()->isLocked(ifs->getData(), m_mainHandler->exerciseId()))
{
ret = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Presentation '%1' is used by another user!")).arg(ifs->getName());
m_mainHandler->dds()->fts()->presentationRemoveReply(cookie, ret);
return;
}
DEBUG_LOG(m_logger) << "Deleting presentation id = " << presentationId;
ret = ifs->removeObject(); // removes all from db due to fk
if (ret.error())
ERROR_LOG(m_logger) << ret();
// delete ObjectPresentation (including Map)
delete ifs;
m_objectPresentationMap.remove(presentationId);
m_mainHandler->dds()->dts()->removePresentationByKey(presentationId);
m_mainHandler->dds()->fts()->presentationRemoveReply(cookie, ret);
return;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
void HandlerPresentation::onGetPresentationContentRequest(const rti::core::SampleIdentity &cookie,
const GetPresentationContentRequest &request)
{
Core::FunctionReplyObject fro;
GetPresentationContentReply reply;
ObjectPresentation *ifs = m_objectPresentationMap.value(request.presentationId());
if (ifs)
{
reply.id(ifs->getId());
/*
if (ifs->getContent().size() <= 0)
fro = Core::FunctionReplyObject(request.presentationId(), tr_lts("dds", "No content for presentation "));
else
*/
reply.content(ifs->getContent());
}
else
fro = Core::FunctionReplyObject(request.presentationId(), tr_lts("dds", "No valid presentation id for retrieving presentation content"));
if (fro.error())
{
reply.id(fro.id());
reply.errorString(fro.str());
reply.errorParams(fro.args());
}
m_mainHandler->dds()->fts()->getPresentationContentReply(cookie, reply);
}
//----------------------------------------------------------------------------------------------------------------------------
void HandlerPresentation::onPresentationChangeStatusRequest(const rti::core::SampleIdentity &cookie,
const PresentationChangeStatusRequest &request)
{
ObjectPresentation *ifs = m_objectPresentationMap.value(request.id());
if (ifs == nullptr)
{
Core::FunctionReplyObject ret = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Presentation with id %1 not found")).arg(request.id());
m_mainHandler->dds()->fts()->presentationChangeStatusReply(cookie, ret);
return;
}
Core::FunctionReplyObject ret = ifs->changeStatus(request);
if (ret.error())
ERROR_LOG(m_logger) << ret();
m_mainHandler->dds()->fts()->presentationChangeStatusReply(cookie, ret);
}
//---------------------------------------------------------------------------------------------------------------------------------------------------
} // Namespace PresentationManagement
+63
View File
@@ -0,0 +1,63 @@
/**
* @RDE_HEADER@
* PRE Handler Presentations
* $Id$
* $HeadURL$
* $Author$
* Created by Iuliana Ojog, SLSE, 2016-11-26
*/
#pragma once
#include <QMap>
#include <QSet>
#include <PresentationManagement/pre_fts.h>
#include "logger.h"
//-------------------------------------------------------------------------------------------------------------
namespace PresentationManagement
{
class ObjectPresentation;
class Initialization;
class HandlerPresentation final :
protected Interface::Fts::PresentationModifyRequestHandler
, protected Interface::Fts::PresentationRemoveRequestHandler
, protected Interface::Fts::GetPresentationContentRequestHandler
, protected Interface::Fts::PresentationChangeStatusRequestHandler
{
public:
explicit HandlerPresentation(Initialization *mainHandler);
~HandlerPresentation();
bool init();
QMap<int, ObjectPresentation *> getPresenstationsMap() const
{
return m_objectPresentationMap;
}
ObjectPresentation *getPresentation(int presentationId)
{
return m_objectPresentationMap.value(presentationId);
}
private:
void onPresentationModifyRequest(const rti::core::SampleIdentity &cookie,
const PresentationModifyRequest &request) override;
Core::FunctionReplyObject presentationCreateRequest(const PresentationModifyRequest &request);
Core::FunctionReplyObject presentationModifyRequest(const PresentationModifyRequest &request);
void onPresentationRemoveRequest(const rti::core::SampleIdentity &cookie,
const Core::RemoveElementRequest &request) override;
void onGetPresentationContentRequest(const rti::core::SampleIdentity &cookie,
const GetPresentationContentRequest &request) override;
void onPresentationChangeStatusRequest(const rti::core::SampleIdentity &cookie,
const PresentationChangeStatusRequest &request) override;
private:
Initialization *m_mainHandler;
QMap<int, ObjectPresentation *> m_objectPresentationMap;
NGL::INGLLogger &m_logger;
};
}
+73
View File
@@ -0,0 +1,73 @@
/**
* Initialization for Presentation
* $Id$
* $HeadURL$
* $Author$
*/
#include "initialization.h"
#include "settings.h"
#include "dds_handler.h"
#include "handler_presentation.h"
#include <DDS/DDSConnector/dds_connector.h>
#include <ngldb/db_service_handler.h>
#include <memory>
namespace PresentationManagement
{
Initialization::Initialization(QObject *parent)
: QObject(parent)
, m_logger(getLogger("Initialization"))
{
qsrand(time(nullptr));
}
Initialization::~Initialization()
{
m_handlerPresentation = nullptr;
m_dbHandler = nullptr;
m_ddsHandler = nullptr;
}
bool Initialization::initialize(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector, const QSqlDatabase &sqlDb)
{
// initialize DDS
m_ddsHandler = std::make_shared<DdsHandler>(ddsConnector);
if (!m_ddsHandler->init())
return false;
// initialize database
m_dbHandler = std::make_shared<DbHandler>();
if (!m_dbHandler->init(ddsConnector->getPartitionId(), sqlDb))
return false;
// read project specific data from database
// publish project specific data
m_handlerPresentation = std::make_shared<HandlerPresentation>(this);
return true;
}
bool Initialization::loadFromDatabase()
{
if (!m_handlerPresentation->init())
return false;
return true;
}
std::shared_ptr<DatabaseInterface> Initialization::db() const
{
return m_dbHandler->db();
}
int Initialization::exerciseId() const
{
if (dds())
return dds()->ddsConnector()->getPartitionId();
return -1;
}
} // namespace PresentationManagement
+50
View File
@@ -0,0 +1,50 @@
/**
* MainHandler for Presentation
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QObject>
#include <PresentationManagement/pre_db.h>
#include "logger.h"
namespace NGLDB
{
template <typename DB> class DbServiceHandler;
}
namespace DDSConnector
{
class DdsConnector;
}
namespace PresentationManagement
{
class DdsHandler;
class HandlerPresentation;
using DbHandler = NGLDB::DbServiceHandler<DatabaseInterface>;
class PRE_SERVER_EXPORT Initialization : public QObject
{
Q_OBJECT
public:
explicit Initialization(QObject *parent = nullptr);
~Initialization();
bool initialize(const std::shared_ptr<DDSConnector::DdsConnector> &ddsConnector, const QSqlDatabase &sqlDb);
bool loadFromDatabase();
std::shared_ptr<DdsHandler> dds() const { return m_ddsHandler; }
std::shared_ptr<DatabaseInterface> db() const;
int exerciseId() const;
private:
std::shared_ptr<DdsHandler> m_ddsHandler;
std::shared_ptr<DbHandler> m_dbHandler;
std::shared_ptr<HandlerPresentation> m_handlerPresentation;
LOGGER_T m_logger;
};
} // namespace AreaEffectSimulation
+37
View File
@@ -0,0 +1,37 @@
/**
* @RDE_HEADER@
* Building Config - logging facility
* $Id$
* $HeadURL$
* $Author$
*/
#include "logger.h"
#include <NGLLogger/NGLLoggerBootstrap.h>
namespace PresentationManagement
{
LOGGER_T getLogger(const char *name)
{
static const char ns[] = "PRE.";
std::string loggerName;
const size_t len = strlen(name);
loggerName.reserve(sizeof(ns) + len);
loggerName.append(ns, sizeof(ns) - 1);
loggerName.append(name, len);
try
{
return NGL::NGLLoggerBootstrap::getNGLRootLogger().
getNGLLogger(loggerName);
}
catch (const std::exception &ex)
{
fprintf(stderr, "Error retrieving logger: %s", ex.what());
abort();
}
}
} // namespace PresentationManagement
+23
View File
@@ -0,0 +1,23 @@
/**
* @RDE_HEADER@
* Logging for PresentationManagement
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <NGLLogger/INGLLogger.h>
#include "pre_export.h"
namespace PresentationManagement
{
using LOGGER_T = NGL::INGLLogger &;
PRE_COMMON_EXPORT LOGGER_T getLogger(const char *name);
inline LOGGER_T getLogger(const QString &loggerName)
{
return getLogger(loggerName.toUtf8().constData());
}
} // namespace PresentationManagement
+268
View File
@@ -0,0 +1,268 @@
/**
* @RDE_HEADER@
* ISM Object Main Structure Element
* $Id$
* $HeadURL$
* $Author$
* Created by Iuliana Ojog, SLSE, 2016-11-26
*/
#include "object_presentation.h"
#include "initialization.h"
#include "dds_handler.h"
#include <ngldb/dbtransaction.h>
namespace PresentationManagement
{
//----------------------------------------------------------------------------------------------------
ObjectPresentation::ObjectPresentation(Initialization *mainHandler)
: m_mainHandler(mainHandler)
, m_logger(getLogger("ObjectPresentation"))
{
}
ObjectPresentation::ObjectPresentation(const Presentation &data, Initialization *mainHandler)
: m_mainHandler(mainHandler)
, m_data(data)
, m_logger(getLogger("ObjectPresentation"))
{
}
//------------------------------------------------------------------------------------------------------------
ObjectPresentation::~ObjectPresentation()
{
}
//------------------------------------------------------------------------------------------------------------
bool ObjectPresentation::isValid() const
{
return m_data.id() > 0;
}
void ObjectPresentation::addPresentationContent(PresentationContent &&data)
{
m_content.push_back(std::move(data));
}
//------------------------------------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectPresentation::createObject(const PresentationModifyRequest &request)
{
m_data = Presentation();
m_content.clear();
m_data.name(request.name());
m_data.description(request.description());
m_data.operatorId(request.operatorId());
m_data.lastModified(request.lastModified());
m_content = request.content();
//for(auto it = request.content().begin(); it != request.content().end(); ++it)
// m_content.append(*it);
DBTransaction trans(m_mainHandler->db()->database());
// Insert Presentation
Database::PrePresentation dbData(toDbData(m_data));
if (!m_mainHandler->db()->insert(dbData))
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting Presentation-data into database"));
m_data.id(dbData.id);
// Insert PresentationContent
for (PresentationContent &conData : m_content)
{
conData.presentationId(m_data.id());
Database::PrePresentationContent conDbData = toDbData(conData);
conDbData.id = 0;
conDbData.presentationId = m_data.id();
if (!m_mainHandler->db()->insert(conDbData))
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting PresentationContent-data into database"));
else
{
DEBUG_LOG(m_logger) << "New presentation content id : " << conDbData.id;
conData.id(conDbData.id);
}
}
DEBUG_LOG(m_logger) << "New Id: " << m_data.id();
trans.commit();
onPublishData();
return Core::FunctionReplyObject(m_data.id());
}
//------------------------------------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectPresentation::updateObject(const PresentationModifyRequest &request)
{
if (!isValid())
return Core::FunctionReplyObject(request.id(), tr_lts("dds", "Object not valid/blocked"));
m_data.id(request.id());
m_data.name(request.name());
m_data.description(request.description());
m_data.operatorId(request.operatorId());
m_data.lastModified(request.lastModified());
m_data.fileStatus(request.fileStatus());
DBTransaction trans(m_mainHandler->db()->database());
Database::PrePresentation dbData(toDbData(m_data));
if (!m_mainHandler->db()->update(dbData))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "Error updating Presentation-data into database"));
for (const auto &content : qAsConst(m_content))
{
if (m_mainHandler->db()->removePrePresentationContent(content.id()))
DEBUG_LOG(m_logger) << "Removed presentation content id " << content.id();
else
ERROR_LOG(m_logger) << "Failed to remove presentation content id " << content.id();
}
m_content = request.content();
for (PresentationContent &conData : m_content)
{
conData.presentationId(m_data.id());
Database::PrePresentationContent conDbData = toDbData(conData);
conDbData.presentationId = m_data.id();
conDbData.id = 0;
if (!m_mainHandler->db()->insert(conDbData))
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting PresentationContent-data into database"));
else
{
DEBUG_LOG(m_logger) << "New presentation content id : " << conDbData.id;
conData.id(conDbData.id);
}
}
trans.commit();
onPublishData();
return Core::FunctionReplyObject(m_data.id());
}
//------------------------------------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectPresentation::removeObject()
{
// remove also presentationContent data via foreign key
if (!m_mainHandler->db()->removePrePresentation(m_data.id()))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "Presentation with id %1 can not be removed from DB")).arg(m_data.id());
int id = m_data.id();
m_content.clear();
m_data = Presentation();
return Core::FunctionReplyObject(id);
}
//------------------------------------------------------------------------------------------------------------
Core::FunctionReplyObject ObjectPresentation::changeStatus(const PresentationChangeStatusRequest &request)
{
if (!isValid())
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "Trying to update an already removed Presentation object"));
m_data.fileStatus(request.fileStatus());
m_data.operatorId(request.operatorId());
m_data.lastModified(request.lastModified());
Database::PrePresentation dbData(toDbData(m_data));
if (!m_mainHandler->db()->update(dbData))
return Core::FunctionReplyObject(m_data.id(), tr_lts("dds", "Error updating Presentation-data into database"));
// Publish Data via DTS
onPublishData();
return Core::FunctionReplyObject(m_data.id());
}
//------------------------------------------------------------------------------------------------------------
void ObjectPresentation::onPublishData()
{
INFO_LOG(m_logger) << "Publish Presentation-data to dds (" << m_data.id() << ") ...";
m_mainHandler->dds()->dts()->publish(m_data);
}
// -------------------------------------------------------------------------------------------------------
// convert methods
// -------------------------------------------------------------------------------------------------------
// PresentationManagement::Presentation => Database::PrePresentation
Database::PrePresentation ObjectPresentation::toDbData(const Presentation &ddsData)
{
Database::PrePresentation dbData;
dbData.id = ddsData.id();
dbData.name = QString::fromStdString(ddsData.name());
dbData.description = QString::fromStdString(ddsData.description());
dbData.lastModified = ddsData.lastModified();
dbData.operatorId = ddsData.operatorId();
dbData.fileStatusId = ddsData.fileStatus();
return dbData;
}
// -------------------------------------------------------------------------------------------------------
// Database::PrePresentation => PresentationManagement::Presentation
Presentation ObjectPresentation::toDdsData(const Database::PrePresentation &dbData)
{
Presentation ddsData;
ddsData.id(dbData.id);
ddsData.name(dbData.name.toStdString());
ddsData.description(dbData.description.toStdString());
ddsData.operatorId(dbData.operatorId);
ddsData.lastModified(dbData.lastModified);
ddsData.fileStatus(dbData.fileStatusId);
// init data not in db
ddsData.isDeleted(false);
ddsData.isUsed(false);
return ddsData;
}
Database::PrePresentationContent ObjectPresentation::toDbData(const PresentationContent &ddsData)
{
Database::PrePresentationContent dbData;
dbData.id = ddsData.id();
dbData.presentationId = ddsData.presentationId();
dbData.presentationTopicType = QString::fromStdString(ddsData.presentationTopicType());
dbData.channel = QString::fromStdString(ddsData.channel());
dbData.description = QString::fromStdString(ddsData.description());
dbData.duration = ddsData.duration();
dbData.startTime = ddsData.startTime();
dbData.attributes = QString::fromStdString(ddsData.attributes());
dbData.x = ddsData.x();
dbData.y = ddsData.y();
dbData.width = ddsData.width();
dbData.height = ddsData.height();
dbData.index = ddsData.index();
return dbData;
}
PresentationContent ObjectPresentation::toDdsData(const Database::PrePresentationContent &dbData)
{
PresentationContent ddsData;
ddsData.id(dbData.id);
ddsData.presentationId(dbData.presentationId);
ddsData.presentationTopicType(dbData.presentationTopicType.toStdString());
ddsData.channel(dbData.channel.toStdString());
ddsData.description(dbData.description.toStdString());
ddsData.startTime(dbData.startTime);
ddsData.attributes(dbData.attributes.toStdString());
ddsData.duration(dbData.duration);
ddsData.x(dbData.x);
ddsData.y(dbData.y);
ddsData.width(dbData.width);
ddsData.height(dbData.height);
ddsData.index(dbData.index);
return ddsData;
}
} // namespace PresentationManagement
+62
View File
@@ -0,0 +1,62 @@
/**
* @RDE_HEADER@
* ISM Object Main Structure Element
* $Id$
* $HeadURL$
* $Author$
* Created by Iuliana Ojog, SLSE, 2016-11-26
*/
#pragma once
#include <QMap>
#include <DDS/Core/function_reply_object.h>
#include <PresentationManagement/pre_db.h>
#include <PresentationManagement/pre.hpp>
#include "logger.h"
//-------------------------------------------------------------------------------------------------------------
namespace PresentationManagement
{
class Initialization;
class ObjectPresentation
{
public:
explicit ObjectPresentation(Initialization *mainHandler);
ObjectPresentation(const Presentation &data, Initialization *mainHandler);
~ObjectPresentation();
Core::FunctionReplyObject createObject(const PresentationModifyRequest &request);
Core::FunctionReplyObject updateObject(const PresentationModifyRequest &request);
Core::FunctionReplyObject removeObject();
Core::FunctionReplyObject changeStatus(const PresentationChangeStatusRequest &request);
qint32 getId() const { return m_data.id(); }
QString getName() const { return QString::fromStdString(m_data.name()); }
const std::vector<PresentationContent> &getContent() const { return m_content; }
const Presentation &getData() const { return m_data; }
bool isValid() const;
void addPresentationContent(PresentationContent &&data);
// convert methods
static Database::PrePresentation toDbData(const Presentation &ddsData); // dds -> db
static Presentation toDdsData(const Database::PrePresentation &dbData); // db -> dds
static Database::PrePresentationContent toDbData(const PresentationContent &ddsData); // dds -> db
static PresentationContent toDdsData(const Database::PrePresentationContent &dbData); // db -> dds
void onPublishData();
private:
Initialization *m_mainHandler;
Presentation m_data;
std::vector<PresentationContent> m_content;
NGL::INGLLogger &m_logger;
};
}
+52
View File
@@ -0,0 +1,52 @@
/**
* Export definitions
* $Id$
* $HeadURL$
* $Author$
* Created by Hanna E. Rathje, SLSE, 2015-08-04
*/
#pragma once
#include <QtCore/qglobal.h>
#ifndef PRE_COMMON_EXPORT
# ifdef BUILD_STATIC_LIBRARIES
# define PRE_COMMON_EXPORT
# else
# if defined(MAKE_SVCPRECOMMON_LIB)
# define PRE_COMMON_EXPORT Q_DECL_EXPORT
# ifndef WIN32
# ifdef NDDSUSERDllExport
# undef NDDSUSERDllExport
# endif
# define NDDSUSERDllExport Q_DECL_EXPORT
# endif
# else
# define PRE_COMMON_EXPORT Q_DECL_IMPORT
# endif
# endif
#endif
#ifndef PRE_CLIENT_EXPORT
# ifdef BUILD_STATIC_LIBRARIES
# define PRE_CLIENT_EXPORT
# else
# if defined(MAKE_SVCPRECLIENT_LIB)
# define PRE_CLIENT_EXPORT Q_DECL_EXPORT
# else
# define PRE_CLIENT_EXPORT Q_DECL_IMPORT
# endif
# endif
#endif
#ifndef PRE_SERVER_EXPORT
# ifdef BUILD_STATIC_LIBRARIES
# define PRE_SERVER_EXPORT
# else
# if defined(MAKE_SVCPRESERVER_LIB)
# define PRE_SERVER_EXPORT Q_DECL_EXPORT
# else
# define PRE_SERVER_EXPORT Q_DECL_IMPORT
# endif
# endif
#endif
+140
View File
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<service namespace="PresentationManagement" abbreviation="PRE" procNames="PresentationManagement" exerciseDependency="Exercise">
<rcs>
<Id Id="$Id$"/>
<HeadURL HeadURL="$HeadURL$"/>
<Author Author="$Author$"/>
</rcs>
<operatorRights offset="28">
<guiPlugin name="PresentationEdit" offset="1">
<operatorRightGroup name="Presentation" description="Edit Presentation Scripts">
<operatorRight right="PresentationScriptsShow" value="1" description="Show Presentations Scripts"/>
<operatorRight right="PresentationScriptsEdit" value="2" description="Edit Presentation Scripts"/>
<operatorRight right="PresentationScriptsAdmin" value="3" description="Administrative rights to remove / restore presentation scripts"/>
</operatorRightGroup>
</guiPlugin>
<guiPlugin name="ScriptEditor" offset="2">
<operatorRightGroup name="Script Editor" description="Edit Presentation Scripts and Topic Designer Items in Script Editor">
<operatorRight right="ScriptEditorShow" value="1" description="Show Presentation Script Editor"/>
<operatorRight right="ScriptEditorEdit" value="2" description="Edit Presentation Scripts in Script Editor"/>
<operatorRight right="TopicDesignerShow" value="3" description="Show Presentation Script Topic Designer Items"/>
<operatorRight right="TopicDesignerEdit" value="4" description="Edit Presentation Script Topic Designer Items"/>
</operatorRightGroup>
</guiPlugin>
<guiPlugin name="ScriptPlayer" offset="3">
<operatorRightGroup name="Script Player" description="Show Presentation Script Player">
<operatorRight right="ScriptPlayerShow" value="1" description="Show Presentation Script Player"/>
</operatorRightGroup>
</guiPlugin>
</operatorRights>
<tables>
<table name="pre_file_status">
<column name="id" datatype="integer" isPrimaryKey="1">
<sequence start="1" increment="1"/>
</column>
<column name="name" datatype="text"/>
</table>
<table name="pre_presentation">
<column name="id" datatype="integer" isPrimaryKey="1">
<sequence start="1" increment="1"/>
</column>
<column name="name" datatype="text"/>
<column name="description" datatype="text"/>
<column name="operator_id" datatype="integer" isForeignKey="1"/>
<column name="last_modified" datatype="bigint"/>
<column name="file_status_id" datatype="integer" isForeignKey="1"/>
<foreignKey name="FK_pre_presentation_pre_file_status">
<source table="pre_presentation" column="file_status_id"/>
<destination table="pre_file_status" column="id"/>
</foreignKey>
<foreignKey name="FK_pre_presentation_opm_operator">
<source table="pre_presentation" column="operator_id"/>
<destination service="OperatorManagement" serviceAbbr="opm" schema="opm" table="opm_operator" column="id"/>
</foreignKey>
</table>
<table name="pre_presentation_content">
<column name="id" datatype="integer" isPrimaryKey="1">
<sequence start="1" increment="1"/>
</column>
<column name="presentation_id" datatype="integer" isForeignKey="1"/>
<column name="presentation_topic_type" datatype="text"/>
<column name="channel" datatype="text"/>
<column name="start_time" datatype="bigint"/>
<column name="duration" datatype="integer"/>
<column name="attributes" datatype="jsonb"/>
<column name="x" datatype="real"/>
<column name="y" datatype="real"/>
<column name="width" datatype="real"/>
<column name="height" datatype="real"/>
<column name="index" datatype="integer"/>
<column name="description" datatype="text"/>
<foreignKey name="FK_presentation_content_presentation">
<source table="pre_presentation_content" column="presentation_id"/>
<destination table="pre_presentation" column="id"/>
</foreignKey>
</table>
</tables>
<views/>
<dbServiceStructs>
<serviceStruct name="PrePresentation" table="pre_presentation"/>
<serviceStruct name="PrePresentationContent" table="pre_presentation_content"/>
<table name="pre_presentation"/>
<table name="pre_presentation_content"/>
</dbServiceStructs>
<topicTypes>
<topicType name="GetPresentationContentReply" baseValueType="Core::FunctionReply">
<column name="content" idlType="sequence&lt;PresentationContent&gt;"/>
</topicType>
<topicType name="GetPresentationContentRequest">
<column name="presentationId" idlType="long"/>
</topicType>
<topicType name="Presentation" isDataObject="1" autosubscribe="1" routeToClient="1" routeToServer="0" routeInReplay="1" baseValueType="Core::BaseEntity">
<column name="description" idlType="string"/>
<column name="operatorId" idlType="long"/>
<column name="lastModified" idlType="long long"/>
<column name="fileStatus" idlType="FileStatus"/>
</topicType>
<topicType name="PresentationChangeStatusRequest">
<column name="id" idlType="long"/>
<column name="operatorId" idlType="long"/>
<column name="lastModified" idlType="long long"/>
<column name="fileStatus" idlType="FileStatus"/>
</topicType>
<topicType name="PresentationContent">
<column name="attributes" idlType="string"/>
<column name="channel" idlType="string"/>
<column name="description" idlType="string"/>
<column name="duration" idlType="long"/>
<column name="height" idlType="double"/>
<column name="id" idlType="long" isKey="1"/>
<column name="index" idlType="long"/>
<column name="presentationId" idlType="long"/>
<column name="presentationTopicType" idlType="string"/>
<column name="startTime" idlType="long long"/>
<column name="width" idlType="double"/>
<column name="x" idlType="double"/>
<column name="y" idlType="double"/>
</topicType>
<topicType name="PresentationModifyRequest">
<column name="id" idlType="long" isKey="1"/>
<column name="name" idlType="string"/>
<column name="description" idlType="string"/>
<column name="operatorId" idlType="long"/>
<column name="lastModified" idlType="long long"/>
<column name="fileStatus" idlType="FileStatus"/>
<column name="content" idlType="sequence&lt;PresentationContent&gt;"/>
</topicType>
</topicTypes>
<functionTopics>
<functionTopic name="GetPresentationContent" requestTopicType="GetPresentationContentRequest" replyTopicType="GetPresentationContentReply" requestTopicName="GetPresentationContentRequest" replyTopicName="GetPresentationContentReply" routeInReplay="1"/>
<functionTopic name="PresentationChangeStatus" requestTopicType="PresentationChangeStatusRequest" replyTopicType="Core::FunctionReply" requestTopicName="PresentationChangeStatusRequest" replyTopicName="PresentationChangeStatusReply" routeInReplay="0"/>
<functionTopic name="PresentationModify" requestTopicType="PresentationModifyRequest" replyTopicType="Core::FunctionReply" requestTopicName="PresentationModifyRequest" replyTopicName="PresentationModifyReply" routeInReplay="0"/>
<functionTopic name="PresentationRemove" requestTopicType="Core::RemoveElementRequest" replyTopicType="Core::FunctionReply" requestTopicName="PresentationRemoveRequest" replyTopicName="PresentationRemoveReply" routeInReplay="0"/>
</functionTopics>
<enumerations>
<enumeration name="FileStatus" table="pre_file_status">
<attribute key="Valid" value="0"/>
<attribute key="Deleted" value="1"/>
</enumeration>
</enumerations>
</service>
+42
View File
@@ -0,0 +1,42 @@
/**
* Settings for PresentationManagement
* $Id$
* $HeadURL$
* $Author$
*/
#include "settings.h"
#include <QtCore/QSettings>
#include <nglsettings/nglsettings_settings.h>
#include <ngltools/ngltools_filesystem.h>
namespace PresentationManagement
{
class NGLSettingsClass : public NGL::Settings
{
public:
NGLSettingsClass()
: NGL::Settings(s_iniFile.isEmpty() ? NGL::findProjectConfigFile() : s_iniFile)
{}
static void setIniFile(const QString &fn)
{
s_iniFile = fn;
}
static QString s_iniFile;
};
QString NGLSettingsClass::s_iniFile;
Q_GLOBAL_STATIC(NGLSettingsClass, s)
//-----------------------------------------------------------------------------
NGL::Settings *Settings::settings()
{
return s();
}
//-----------------------------------------------------------------------------
void Settings::setIniFile(const QString &ini)
{
NGLSettingsClass::setIniFile(ini);
}
} // namespace PresentationManagement
+24
View File
@@ -0,0 +1,24 @@
/**
* Settings for PresentationManagement
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QString>
namespace NGL
{
class Settings;
}
namespace PresentationManagement
{
namespace Settings
{
NGL::Settings *settings();
void setIniFile(const QString &ini);
}
} // namespace PresentationManagement