DRDE/ACTK1_0/OTE/OteDomainModifyRegistrantCo...

95 lines
2.9 KiB
C++

#include "common/ErrorPkg.hpp"
#include "xml/XMLHelper.hpp"
#include "OTE/OteExtension.hpp"
#include "OTE/OteDomainModifyRegistrantCommand.hpp"
namespace {
OteExtension& oteExtension() {
static OteExtension* oteExtension = new OteExtension();
return *oteExtension;
}
}; // 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(
ErrorPkg::getMessage("se.domain.modify.ote.missing_arg"));
}
DOMElement* oteextUpdate = xmlWriter->appendChild(
xmlWriter->appendChild(command, "extension"),
"update",
oteExtension().getURI());
oteextUpdate->setAttribute(
XStr("xsi:schemaLocation").str(),
XStr(oteExtension().getSchemaLocation()).str());
DOMElement* oteProperties = xmlWriter->appendChild(oteextUpdate,
"oteProperties");
XMLHelper::setTextContent(
xmlWriter->appendChild(oteProperties, "registrantName"),
registrantName);
if (registrantID != NULL && registrantIDType != NULL)
{
xmlWriter->appendChild(
oteProperties,
"registrantID",
*registrantID,
"type",
*registrantIDType);
}
if (eligibilityType != NULL)
{
XMLHelper::setTextContent(
xmlWriter->appendChild(oteProperties, "eligibilityType"),
*eligibilityType);
}
if (eligibilityName != NULL)
{
XMLHelper::setTextContent(
xmlWriter->appendChild(oteProperties, "eligibilityName"),
*eligibilityName);
}
if (eligibilityID != NULL && eligibilityIDType != NULL)
{
xmlWriter->appendChild(
oteProperties,
"eligibilityID",
*eligibilityID,
"type",
*eligibilityIDType);
}
XMLHelper::setTextContent(
xmlWriter->appendChild(oteProperties, "policyReason"),
policyReason);
XMLHelper::setTextContent(
xmlWriter->appendChild(oteextUpdate, "explanation"),
explanation);
}