DRDE/ACTK1_0/OTE/LPECreateResponse.cpp

55 lines
1.5 KiB
C++
Raw Normal View History

2014-01-15 18:29:15 +00:00
#include "se/StandardObjectType.hpp"
#include "se/EPPDateFormatter.hpp"
#include "common/StringUtils.hpp"
2014-01-17 01:46:48 +00:00
#include "OTE/LPECreateResponse.hpp"
2014-01-15 18:29:15 +00:00
const std::string LPECreateResponse::DOM_CR_DATE_EXPR
(LPECreateResponse::exprReplace
(CreateResponse::CR_DATE_EXPR()));
const std::string LPECreateResponse::DOM_NAME_EXPR
(LPECreateResponse::exprReplace
(CreateResponse::CRE_DATA_EXPR()) +
"/domain:name/text()");
const std::string LPECreateResponse::DOM_EX_DATE_EXPR
(LPECreateResponse::exprReplace
(CreateResponse::CRE_DATA_EXPR()) +
"/domain:exDate/text()");
LPECreateResponse::LPECreateResponse()
: CreateResponse(StandardObjectType::DOMAIN())
{
}
void LPECreateResponse::fromXML (XMLDocument *xmlDoc) throw (ParsingException)
{
CreateResponse::fromXML (xmlDoc);
if (!(resultArray[0].succeeded())) {
return;
}
try
{
name = xmlDoc->getNodeValue (DOM_NAME_EXPR);
std::string exDateStr = xmlDoc->getNodeValue (DOM_EX_DATE_EXPR);
exDate = std::auto_ptr<XMLGregorianCalendar>(EPPDateFormatter::fromXSDateTime(exDateStr));
}
catch (XPathExpressionException& e)
{
maintLogger->warning(e.getMessage());
ParsingException pe;
pe.causedBy(e);
throw pe;
}
}
std::string LPECreateResponse::exprReplace (const std::string &expr)
{
return StringUtils::replaceAll (expr,
CreateResponse::OBJ(),
StandardObjectType::DOMAIN()->getName());
}