DRDE/ACTK1_0/OTE/OteDomainModifyRegistrantCo...

95 lines
2.9 KiB
C++
Raw Normal View History

2014-01-15 18:29:15 +00:00
#include "common/ErrorPkg.hpp"
#include "xml/XMLHelper.hpp"
2014-01-17 01:46:48 +00:00
#include "OTE/OteExtension.hpp"
#include "OTE/OteDomainModifyRegistrantCommand.hpp"
2014-01-15 18:29:15 +00:00
namespace {
2014-01-15 21:41:16 +00:00
OteExtension& oteExtension() {
static OteExtension* oteExtension = new OteExtension();
return *oteExtension;
2014-01-15 18:29:15 +00:00
}
}; // anonymous namespace
OteDomainModifyRegistrantCommand::OteDomainModifyRegistrantCommand(
const std::string& name,
const std::string& registrantName,
const std::string& explanation,
const std::string* eligibilityType,
int policyReason,
const std::string* registrantID,
const std::string* registrantIDType,
const std::string* eligibilityName,
const std::string* eligibilityID,
const std::string* eligibilityIDType) : DomainUpdateCommand(name)
{
if (eligibilityType == NULL
|| (registrantID == NULL && registrantIDType != NULL)
|| (registrantID != NULL && registrantIDType == NULL)
|| (eligibilityID == NULL && eligibilityIDType != NULL)
|| (eligibilityID != NULL && eligibilityIDType == NULL))
{
throw IllegalArgException(
2014-01-15 21:41:16 +00:00
ErrorPkg::getMessage("se.domain.modify.ote.missing_arg"));
2014-01-15 18:29:15 +00:00
}
2014-01-15 21:41:16 +00:00
DOMElement* oteextUpdate = xmlWriter->appendChild(
2014-01-15 18:29:15 +00:00
xmlWriter->appendChild(command, "extension"),
"update",
2014-01-15 21:41:16 +00:00
oteExtension().getURI());
2014-01-15 18:29:15 +00:00
2014-01-15 21:41:16 +00:00
oteextUpdate->setAttribute(
2014-01-15 18:29:15 +00:00
XStr("xsi:schemaLocation").str(),
2014-01-15 21:41:16 +00:00
XStr(oteExtension().getSchemaLocation()).str());
2014-01-15 18:29:15 +00:00
2014-01-15 21:41:16 +00:00
DOMElement* oteProperties = xmlWriter->appendChild(oteextUpdate,
"oteProperties");
2014-01-15 18:29:15 +00:00
XMLHelper::setTextContent(
2014-01-15 21:41:16 +00:00
xmlWriter->appendChild(oteProperties, "registrantName"),
2014-01-15 18:29:15 +00:00
registrantName);
if (registrantID != NULL && registrantIDType != NULL)
{
xmlWriter->appendChild(
2014-01-15 21:41:16 +00:00
oteProperties,
2014-01-15 18:29:15 +00:00
"registrantID",
*registrantID,
"type",
*registrantIDType);
}
if (eligibilityType != NULL)
{
XMLHelper::setTextContent(
2014-01-15 21:41:16 +00:00
xmlWriter->appendChild(oteProperties, "eligibilityType"),
2014-01-15 18:29:15 +00:00
*eligibilityType);
}
if (eligibilityName != NULL)
{
XMLHelper::setTextContent(
2014-01-15 21:41:16 +00:00
xmlWriter->appendChild(oteProperties, "eligibilityName"),
2014-01-15 18:29:15 +00:00
*eligibilityName);
}
if (eligibilityID != NULL && eligibilityIDType != NULL)
{
xmlWriter->appendChild(
2014-01-15 21:41:16 +00:00
oteProperties,
2014-01-15 18:29:15 +00:00
"eligibilityID",
*eligibilityID,
"type",
*eligibilityIDType);
}
XMLHelper::setTextContent(
2014-01-15 21:41:16 +00:00
xmlWriter->appendChild(oteProperties, "policyReason"),
2014-01-15 18:29:15 +00:00
policyReason);
XMLHelper::setTextContent(
2014-01-15 21:41:16 +00:00
xmlWriter->appendChild(oteextUpdate, "explanation"),
2014-01-15 18:29:15 +00:00
explanation);
}