133 lines
3.7 KiB
C++
133 lines
3.7 KiB
C++
|
#include "se/OteLPECreateCommand.hpp"
|
||
|
#include "xml/XMLHelper.hpp"
|
||
|
#include "se/OteExtension.hpp"
|
||
|
#include "common/ErrorPkg.hpp"
|
||
|
|
||
|
namespace {
|
||
|
*oteExtension() {
|
||
|
*oteExtension = new OteExtension();
|
||
|
*oteExtension;
|
||
|
}
|
||
|
}; // anonymous namespace
|
||
|
|
||
|
OteLPECreateCommand::OteLPECreateCommand (
|
||
|
const std::string& name,
|
||
|
const std::string& pw,
|
||
|
const std::string* registrantID,
|
||
|
const std::vector<std::string>* techContacts,
|
||
|
*oteEligibilityType,
|
||
|
*otePolicyReason,
|
||
|
*oteRegistrantName) : LPECreateCommand (
|
||
|
name, pw, registrantID, techContacts)
|
||
|
{
|
||
|
*oteRegistrantName);
|
||
|
}
|
||
|
|
||
|
OteLPECreateCommand::OteLPECreateCommand (
|
||
|
const std::string& name,
|
||
|
const std::string& pw,
|
||
|
const std::string* registrantID,
|
||
|
const std::vector<std::string>* techContacts,
|
||
|
const std::vector<std::string>* adminContacts,
|
||
|
const std::vector<std::string>* billingContacts,
|
||
|
const std::vector<std::string>* nameservers,
|
||
|
const Period* period,
|
||
|
*oteEligibilityType,
|
||
|
*otePolicyReason,
|
||
|
*oteRegistrantName,
|
||
|
*oteRegistrantID,
|
||
|
*oteRegistrantIDType,
|
||
|
*oteEligibilityName,
|
||
|
*oteEligibilityID,
|
||
|
*oteEligibilityIDType) : LPECreateCommand (
|
||
|
name, pw, registrantID, techContacts, nameservers,
|
||
|
adminContacts, billingContacts, period)
|
||
|
{
|
||
|
*otePolicyReason,
|
||
|
*oteRegistrantIDType,
|
||
|
*oteEligibilityIDType);
|
||
|
}
|
||
|
|
||
|
void OteLPECreateCommand::setExtension (const std::string& eligibilityType,
|
||
|
int policyReason,
|
||
|
const std::string& registrantName)
|
||
|
{
|
||
|
setExtension (eligibilityType, policyReason, registrantName,
|
||
|
NULL, NULL, NULL, NULL, NULL);
|
||
|
}
|
||
|
|
||
|
void OteLPECreateCommand::setExtension (
|
||
|
const std::string& eligibilityType,
|
||
|
int policyReason,
|
||
|
const std::string ®istrantName,
|
||
|
const std::string* registrantID,
|
||
|
const std::string ®istrantIDType)
|
||
|
{
|
||
|
setExtension (eligibilityType, policyReason, registrantName,
|
||
|
registrantID, ®istrantIDType, NULL, NULL, NULL);
|
||
|
}
|
||
|
|
||
|
void OteLPECreateCommand::setExtension (
|
||
|
const std::string& eligibilityType,
|
||
|
int policyReason,
|
||
|
const std::string& registrantName,
|
||
|
const std::string* registrantID,
|
||
|
const std::string* registrantIDType,
|
||
|
const std::string* eligibilityName,
|
||
|
const std::string* eligibilityID,
|
||
|
const std::string* eligibilityIDType)
|
||
|
{
|
||
|
if ((registrantID && registrantIDType == NULL)
|
||
|
|| (registrantID == NULL && registrantIDType)
|
||
|
|| (eligibilityID && eligibilityIDType == NULL)
|
||
|
|| (eligibilityID == NULL && eligibilityIDType))
|
||
|
{
|
||
|
throw IllegalArgException(ErrorPkg::getMessage(
|
||
|
*ote.missing_ar"));
|
||
|
}
|
||
|
|
||
|
*oteextCreate = xmlWriter->appendChild(
|
||
|
xmlWriter->appendChild(
|
||
|
command,
|
||
|
"extension"),
|
||
|
"create",
|
||
|
*oteExtension().getURI());
|
||
|
|
||
|
*oteextCreate,
|
||
|
"xsi:schemaLocation",
|
||
|
*oteExtension().getSchemaLocation());
|
||
|
|
||
|
*oteProperties = xmlWriter->appendChild(
|
||
|
*oteProperties");
|
||
|
|
||
|
XMLHelper::setTextContent(
|
||
|
*oteProperties, "registrantName"),
|
||
|
registrantName);
|
||
|
|
||
|
if (registrantID && registrantIDType)
|
||
|
*oteProperties,
|
||
|
"registrantID", *registrantID,
|
||
|
"type", *registrantIDType);
|
||
|
|
||
|
XMLHelper::setTextContent(
|
||
|
*oteProperties, "eligibilityType"),
|
||
|
eligibilityType);
|
||
|
|
||
|
if (eligibilityName)
|
||
|
{
|
||
|
XMLHelper::setTextContent(
|
||
|
*oteProperties, "eligibilityName"),
|
||
|
*eligibilityName);
|
||
|
|
||
|
if (eligibilityID && eligibilityIDType)
|
||
|
*oteProperties,
|
||
|
"eligibilityID", *eligibilityID,
|
||
|
"type", *eligibilityIDType);
|
||
|
}
|
||
|
|
||
|
XMLHelper::setTextContent(
|
||
|
*oteProperties, "policyReason"),
|
||
|
policyReason);
|
||
|
}
|
||
|
|