#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* 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* techContacts, const std::vector* adminContacts, const std::vector* billingContacts, const std::vector* 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); }