Commit 08e3d7d3 authored by Karel Slaný's avatar Karel Slaný Committed by Martin Straka

Updated Gov::SrvcSzrRosVv.

parent 25da1a15
......@@ -24,7 +24,7 @@
#include "src/datovka_shared/gov_services/service/gov_mv_ir_vp.h"
static const char xml_template[] =
"<?xml version='1.0' encoding='utf-8'?>"
"<?xml version='1.0' encoding='utf-8'?>""\n"
"<d:root xmlns:d=\"http://software602.cz/sample\" ancestor_id=\"\" "
"folder_id=\"\" formdata_id=\"\" fsuser_id=\"\" institute_type=\"\" "
"ldapPass=\"\" nazev=\"\" page=\"0\" page_id=\"\" query_seq=\"1\" "
......
......@@ -23,44 +23,170 @@
#include "src/datovka_shared/gov_services/service/gov_szr_ros_vv.h"
#define SRVC_SHORT_NAME "GovSzrRosVv"
#define SRVC_FULL_NAME "Veřejný výpis z registru osob"
#define SRVC_XML_TEMPLATE "<?xml version='1.0' encoding='utf-8'?>" \
"<d:FormularData xmlns:d=\"http://software602.cz/formulare\" " \
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " \
"xmlns:date=\"http://exslt.org/dates-and-times\" " \
"xsi:schemaLocation=\"http://software602.cz/formulare FormularData_ZRDS11.xsd\" " \
"version=\"1.3o\">" \
"<d:Identifikace><d:Formular>ZRDS3</d:Formular><d:Zadatel><d:Aifo/>" \
"<d:Idds/><d:DatumNarozeni/><d:Jmeno/><d:MistoNarozeniNazev/>" \
"<d:Prijmeni/><d:Doklady><d:Cislo/><d:Druh/></d:Doklady><d:AdresaPobytu>" \
"<d:OkresNazev/><d:ObecNazev/><d:CastObceNazev/><d:UliceNazev/>" \
"<d:PostaKod/><d:TypCislaDomovnihoKod/><d:CisloDomovni/>" \
"<d:CisloOrientacni/><d:CisloOrientacniPismeno/></d:AdresaPobytu></d:Zadatel>" \
"<d:Osoba><d:Ico>xICO-ICO</d:Ico><d:NazevOsoby/><d:AdresaSidla>" \
"<d:AdresaTextem/><d:OkresNazev/><d:ObecNazev/><d:CastObceNazev/>" \
"<d:UliceNazev/><d:PostaKod/><d:TypCislaDomovnihoKod/><d:CisloDomovni/>" \
"<d:CisloOrientacni/><d:CisloOrientacniPismeno/></d:AdresaSidla></d:Osoba>" \
"</d:Identifikace><d:Parametry/></d:FormularData>"
GovSzrRosVv::GovSzrRosVv(void)
: GovService(QStringLiteral(SRVC_SHORT_NAME),
QStringLiteral(SRVC_FULL_NAME), QStringLiteral(GOV_SZR_FULL_NAME),
QStringLiteral(GOV_SZR_DB_ID), QStringLiteral(SRVC_FULL_NAME), QString(),
QStringLiteral(GOV_SZR_XML_FILE_NAME), QStringLiteral(GOV_SRV_XML_ICO))
static const char xml_template[] =
"<?xml version='1.0' encoding='utf-8'?>""\n"
"<d:FormularData xmlns:d=\"http://software602.cz/formulare\" "
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
"xmlns:date=\"http://exslt.org/dates-and-times\" "
"xsi:schemaLocation=\"http://software602.cz/formulare FormularData_ZRDS11.xsd\" "
"version=\"1.3o\">""\n"
" <d:Identifikace>""\n"
" <d:Formular>ZRDS3</d:Formular>""\n"
" <d:Zadatel>""\n"
" <d:Aifo/>""\n"
" <d:Idds/>""\n"
" <d:DatumNarozeni/>""\n"
" <d:Jmeno/>""\n"
" <d:MistoNarozeniNazev/>""\n"
" <d:Prijmeni/>""\n"
" <d:Doklady>""\n"
" <d:Cislo/>""\n"
" <d:Druh/>""\n"
" </d:Doklady>""\n"
" <d:AdresaPobytu>""\n"
" <d:OkresNazev/>""\n"
" <d:ObecNazev/>""\n"
" <d:CastObceNazev/>""\n"
" <d:UliceNazev/>""\n"
" <d:PostaKod/>""\n"
" <d:TypCislaDomovnihoKod/>""\n"
" <d:CisloDomovni/>""\n"
" <d:CisloOrientacni/>""\n"
" <d:CisloOrientacniPismeno/>""\n"
" </d:AdresaPobytu>""\n"
" </d:Zadatel>""\n"
" <d:Osoba>""\n"
" <d:Ico>__repl_ICO_ICO__</d:Ico>""\n"
" <d:NazevOsoby/>""\n"
" <d:AdresaSidla>""\n"
" <d:AdresaTextem/>""\n"
" <d:OkresNazev/>""\n"
" <d:ObecNazev/>""\n"
" <d:CastObceNazev/>""\n"
" <d:UliceNazev/>""\n"
" <d:PostaKod/>""\n"
" <d:TypCislaDomovnihoKod/>""\n"
" <d:CisloDomovni/>""\n"
" <d:CisloOrientacni/>""\n"
" <d:CisloOrientacniPismeno/>""\n"
" </d:AdresaSidla>""\n"
" </d:Osoba>""\n"
" </d:Identifikace>""\n"
" <d:Parametry/>""\n"
"</d:FormularData>";
Gov::SrvcSzrRosVv::SrvcSzrRosVv(void)
: m_ic()
{
}
const QString &Gov::SrvcSzrRosVv::internalId(void) const
{
static const QString shortName("SrvcSzrRosVv");
return shortName;
}
const QString &Gov::SrvcSzrRosVv::fullName(void) const
{
static const QString fullName(tr("Public printout from the person register"));
// "Veřejný výpis z registru osob"
return fullName;
}
const QString &Gov::SrvcSzrRosVv::instituteName(void) const
{
static const QString instituteName(GOV_SZR_FULL_NAME);
return instituteName;
}
const QString &Gov::SrvcSzrRosVv::boxId(void) const
{
static const QString boxId(GOV_SZR_DB_ID);
return boxId;
}
const QString &Gov::SrvcSzrRosVv::dmAnnotation(void) const
{
static const QString dmAnnotation("Veřejný výpis z registru osob");
return dmAnnotation;
}
const QString &Gov::SrvcSzrRosVv::dmSenderIdent(void) const
{
static const QString dmSenderIdent; /* Null string. */
return dmSenderIdent;
}
const QString &Gov::SrvcSzrRosVv::dmFileDescr(void) const
{
static const QString dmFileDescr(GOV_SZR_XML_FILE_NAME);
return dmFileDescr;
}
bool Gov::SrvcSzrRosVv::canSend(enum Isds::Type::DbType dbType) const
{
switch (dbType) {
case Isds::Type::BT_OVM_FO:
case Isds::Type::BT_OVM_PFO:
case Isds::Type::BT_OVM_PO:
case Isds::Type::BT_PO:
case Isds::Type::BT_PO_ZAK:
case Isds::Type::BT_PO_REQ:
case Isds::Type::BT_PFO:
case Isds::Type::BT_PFO_ADVOK:
case Isds::Type::BT_PFO_DANPOR:
case Isds::Type::BT_PFO_INSSPR:
case Isds::Type::BT_PFO_AUDITOR:
case Isds::Type::BT_FO:
return true;
break;
default:
return false;
break;
}
}
#define IC_KEY "ic"
QList<Gov::RequiredInput> Gov::SrvcSzrRosVv::requiredFields(void) const
{
QList<RequiredInput> formList;
{
RequiredInput ri;
ri.key = IC_KEY;
ri.val = m_ic;
ri.descr = tr("Subject ID (IČ)");
ri.placeholder = tr("Enter subject ID (IČ)");
ri.mandatory = true;
formList.append(ri);
}
return formList;
}
bool Gov::SrvcSzrRosVv::setRequiredField(const QString &key, const QString &val)
{
if (key != IC_KEY) {
return false;
}
m_ic = val;
return true;
}
GovSzrRosVv::~GovSzrRosVv(void)
bool Gov::SrvcSzrRosVv::haveAllMandatoryFields(void) const
{
return !m_ic.isEmpty();
}
const QByteArray GovSzrRosVv::createXmlAttachment(
const Isds::DbOwnerInfo &dbOwnerInfo, XmlRequiredFileds reqFields)
QByteArray Gov::SrvcSzrRosVv::binaryXmlContent(
const Isds::DbOwnerInfo &dbOwnerInfo) const
{
Q_UNUSED(dbOwnerInfo);
QString xml(QStringLiteral(SRVC_XML_TEMPLATE));
xml.replace("xICO-ICO", reqFields.ic);
QString xml(xml_template);
xml.replace("__repl_ICO_ICO__", m_ic);
return xml.toUtf8();
}
......@@ -23,38 +23,66 @@
#pragma once
#include "src/datovka_shared/gov_services/service/gov_service.h"
#include <QCoreApplication> /* Q_DECLARE_TR_FUNCTIONS */
/*!
* GOV SZR service
* Name: Veřejný výpis z registru osob
* DS: 4h8cxph - Automat ZR (Správa základních registrů)
* XML: zrds.xml - nutno zadat IČ do xml.
* Source DS type: FO, PFO, PO
*/
class GovSzrRosVv : public GovService {
#include "src/datovka_shared/gov_services/service/gov_service.h"
public:
namespace Gov {
/*!
* @brief Constructor.
* GOV SZR service
* Name: Veřejný výpis z registru osob
* DS: 4h8cxph - Automat ZR (Správa základních registrů)
* XML: zrds.xml - nutno zadat IČ do xml.
* Source DS type: FO, PFO, PO
*/
GovSzrRosVv(void);
class SrvcSzrRosVv : public Service {
Q_DECLARE_TR_FUNCTIONS(SrvcSzrRosVv)
/*!
* @brief Destructor.
*/
virtual
~GovSzrRosVv(void) Q_DECL_OVERRIDE;
public:
/*!
* @brief Constructor.
*/
SrvcSzrRosVv(void);
/*!
* @brief Create and fill XML attachment content.
*
* @param[in] dbOwnerInfo DS owner info.
* @param[in] reqFields Gov service required information.
* @return XML string for attachment.
*/
virtual
const QByteArray createXmlAttachment(const Isds::DbOwnerInfo &dbOwnerInfo,
XmlRequiredFileds reqFields) Q_DECL_OVERRIDE;
};
virtual
const QString &internalId(void) const Q_DECL_OVERRIDE;
virtual
const QString &fullName(void) const Q_DECL_OVERRIDE;
virtual
const QString &instituteName(void) const Q_DECL_OVERRIDE;
virtual
const QString &boxId(void) const Q_DECL_OVERRIDE;
virtual
const QString &dmAnnotation(void) const Q_DECL_OVERRIDE;
virtual
const QString &dmSenderIdent(void) const Q_DECL_OVERRIDE;
virtual
const QString &dmFileDescr(void) const Q_DECL_OVERRIDE;
virtual
bool canSend(enum Isds::Type::DbType dbType) const Q_DECL_OVERRIDE;
virtual
QList<RequiredInput> requiredFields(void) const Q_DECL_OVERRIDE;
virtual
bool setRequiredField(const QString &key, const QString &val) Q_DECL_OVERRIDE;
virtual
bool haveAllMandatoryFields(void) const Q_DECL_OVERRIDE;
virtual
QByteArray binaryXmlContent(const Isds::DbOwnerInfo &dbOwnerInfo) const Q_DECL_OVERRIDE;
private:
QString m_ic; /*!< Identification number. */
};
}
......@@ -33,7 +33,7 @@
#include "src/datovka_shared/gov_services/service/gov_service.h"
#include "src/datovka_shared/gov_services/service/gov_szr_rob_vu.h"
#include "src/datovka_shared/gov_services/service/gov_szr_rob_vvu.h"
//#include "src/datovka_shared/gov_services/service/gov_szr_ros_vv.h"
#include "src/datovka_shared/gov_services/service/gov_szr_ros_vv.h"
#include "src/datovka_shared/isds/message_interface.h"
#include "src/datovka_shared/log/log.h"
#include "src/datovka_shared/log/memory_log.h"
......@@ -171,9 +171,19 @@ void GovWrapper::initGovServices(void)
}
}
// /* Veřejný výpis z registru osob */
// GovSzrRosVv *gs3 = new GovSzrRosVv();
// m_govServices.insert(gs3->serviceId(), gs3);
/* Veřejný výpis z registru osob */
gs = new (std::nothrow) Gov::SrvcSzrRosVv;
if (gs != Q_NULLPTR) {
const QString &key(gs->internalId());
if (!m_govServices.contains(key)) {
m_govServices.insert(key, gs);
} else {
logError(
"Key '%s' already exists in gov services container.",
key.toUtf8().constData());
delete gs;
}
}
// /* Výpis z živnostenského rejstříku */
// GovMvZrVp *gs7 = new GovMvZrVp();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment