DRDE/ACTK1_0/OTE/OteDomainTransferRegistrant...

93 lines
2.7 KiB
C++
Raw Normal View History

2014-01-15 18:29:15 +00:00
#include "se/OteDomainTransferRegistrantCommand.hpp"
#include "se/XMLGregorianCalendar.hpp"
#include "se/OteExtension.hpp"
#include "se/OteDomainObjectType.hpp"
#include "se/RegistrantTransferCommandType.hpp"
#include "se/CommandType.hpp"
#include "se/Period.hpp"
#include "common/ErrorPkg.hpp"
#include "se/EPPDateFormatter.hpp"
#include "xml/XMLHelper.hpp"
namespace {
*oteExtension() {
*oteExt = new OteExtension();
*oteExt;
}
const RegistrantTransferCommandType rtrnType;
*otedomType;
} // anonymous namespace
OteDomainTransferRegistrantCommand::OteDomainTransferRegistrantCommand (
const std::string& name,
const XMLGregorianCalendar& curExpDate,
const std::string& eligibilityType,
int policyReason,
const std::string& registrantName,
const std::string& explanation,
const std::string* registrantID,
const std::string* registrantIDType,
const std::string* eligibilityName,
const std::string* eligibilityID,
const std::string* eligibilityIDType,
const Period* period) : ProtocolExtensionCommand(
*oteExtension())
{
if ((registrantID && registrantIDType == NULL)
|| (registrantIDType == NULL && registrantIDType)
|| (eligibilityName && (eligibilityID == NULL || eligibilityIDType == NULL))
|| (eligibilityName == NULL && (eligibilityID || eligibilityIDType)))
{
// If provided, a registrantID must have a type.
// If provided, an eligibilityName must have both an eligibilityID and type.
throw IllegalArgException(
*ote.missing_arg"));
}
DOMElement *element;
std::string curExpDateStr = EPPDateFormatter::toXSDate(curExpDate);
XMLHelper::setTextContent(
xmlWriter->appendChild(objElement, "curExpDate"), curExpDateStr);
if (period)
period->appendPeriod(xmlWriter, objElement);
*oteProperties");
XMLHelper::setTextContent(
*oteProperties, "registrantName"), registrantName);
if (registrantID)
{
*oteProperties, "registrantID");
XMLHelper::setTextContent(element, *registrantID);
XMLHelper::setAttribute(element, "type", *registrantIDType);
}
XMLHelper::setTextContent
*oteProperties, "eligibilityType"), eligibilityType);
if (eligibilityName)
{
XMLHelper::setTextContent(
*oteProperties, "eligibilityName"), *eligibilityName);
*oteProperties, "eligibilityID");
XMLHelper::setTextContent(element, *eligibilityID);
XMLHelper::setAttribute(element, "type", *eligibilityIDType);
}
XMLHelper::setTextContent(
*oteProperties, "policyReason"),
policyReason);
XMLHelper::setTextContent(
xmlWriter->appendChild(objElement, "explanation"),
explanation);
}