Пример #1
0
SmartPtrCCmdlMetadataDoc CmdlMetadataXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("CmdlMetadataXml", "parse");

	SmartPtrCCmdlMetadataDoc cmdlMetadataDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string nameStrVal =
			thisXml->findRequiredAttribute("name");
		const std::string nameVal = nameStrVal;

		const SmartPtrCXmlElement valueXml =
			thisXml->findRequiredChild("value");

		std::string valueVal;
		if (! valueXml.IsNull()) {
			valueVal = valueXml->getValue();
		}

		cmdlMetadataDoc.CreateInstance();
		cmdlMetadataDoc->initialize(
			nameVal,
			valueVal);
	}
	CAF_CM_EXIT;

	return cmdlMetadataDoc;
}
Пример #2
0
SmartPtrCErrorResponseDoc ErrorResponseXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("ErrorResponseXml", "parse");

	SmartPtrCErrorResponseDoc errorResponseDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string clientIdStrVal =
			thisXml->findOptionalAttribute("clientId");
		UUID clientIdVal = CAFCOMMON_GUID_NULL;
		if (! clientIdStrVal.empty()) {
			BasePlatform::UuidFromString(clientIdStrVal.c_str(), clientIdVal);
		}

		const std::string requestIdStrVal =
			thisXml->findOptionalAttribute("requestId");
		UUID requestIdVal = CAFCOMMON_GUID_NULL;
		if (! requestIdStrVal.empty()) {
			BasePlatform::UuidFromString(requestIdStrVal.c_str(), requestIdVal);
		}

		const std::string pmeIdVal =
			thisXml->findOptionalAttribute("pmeId");

		const SmartPtrCXmlElement responseHeaderXml =
			thisXml->findOptionalChild("responseHeader");
		SmartPtrCResponseHeaderDoc responseHeaderVal;
		if (! responseHeaderXml.IsNull()) {
			responseHeaderVal = ResponseHeaderXml::parse(responseHeaderXml);
		}

		const SmartPtrCXmlElement errorMessageXml =
			thisXml->findOptionalChild("errorMessage");
		std::string errorMessageVal;
		if (! errorMessageXml.IsNull()) {
			errorMessageVal = errorMessageXml->getValue();
		}

		errorResponseDoc.CreateInstance();
		errorResponseDoc->initialize(
			clientIdVal,
			requestIdVal,
			pmeIdVal,
			responseHeaderVal,
			errorMessageVal);
	}
	CAF_CM_EXIT;

	return errorResponseDoc;
}
Пример #3
0
SmartPtrCPropertyDoc PropertyXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("PropertyXml", "parse");

	SmartPtrCPropertyDoc propertyDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string nameStrVal =
			thisXml->findRequiredAttribute("name");
		const std::string nameVal = nameStrVal;

		const std::string typeStrVal =
			thisXml->findRequiredAttribute("type");
		PROPERTY_TYPE typeVal = PROPERTY_NONE;
		if (! typeStrVal.empty()) {
			typeVal = EnumConvertersXml::convertStringToPropertyType(typeStrVal);
		}

		const CXmlElement::SmartPtrCElementCollection valueChildrenXml =
			thisXml->findRequiredChildren("value");

		std::deque<std::string> valueVal;
		if (! valueChildrenXml.IsNull() && ! valueChildrenXml->empty()) {
			for (TConstIterator<CXmlElement::CElementCollection> valueXmlIter(*valueChildrenXml);
				valueXmlIter; valueXmlIter++) {
				const SmartPtrCXmlElement valueXml = valueXmlIter->second;
				const std::string valueDoc = valueXml->getValue();
				valueVal.push_back(valueDoc);
			}
		}

		propertyDoc.CreateInstance();
		propertyDoc->initialize(
			nameVal,
			typeVal,
			valueVal);
	}
	CAF_CM_EXIT;

	return propertyDoc;
}
Пример #4
0
void CConfigProvider::createXmlPropertyCollection(
	const std::string& keyPath,
	const SmartPtrCXmlElement& thisXml,
	std::deque<std::pair<std::string, std::string> >& propertyCollection) const {
	CAF_CM_FUNCNAME_VALIDATE("createXmlPropertyCollection");

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_STRING(keyPath);
		CAF_CM_VALIDATE_SMARTPTR(thisXml);
		// propertyCollection is optional

		const CXmlElement::SmartPtrCAttributeCollection attributeCollection = thisXml->getAllAttributes();
		if (! attributeCollection.IsNull() && ! attributeCollection->empty()) {
			for (TConstIterator<CXmlElement::CAttributeCollection> attributeXmlIter(*attributeCollection);
				attributeXmlIter; attributeXmlIter++) {
				const std::string attributeName = attributeXmlIter->first;
				const std::string attributeValue = attributeXmlIter->second;

				const std::string newKeyPath = keyPath + _keyPathDelimStr + attributeName;
				propertyCollection.push_back(std::make_pair(newKeyPath, attributeValue));
			}
		}

		const CXmlElement::SmartPtrCElementCollection childrenXml = thisXml->getAllChildren();
		if (! childrenXml.IsNull() && ! childrenXml->empty()) {
			for (TConstIterator<CXmlElement::CElementCollection > childrenXmlIter(*childrenXml);
				childrenXmlIter; childrenXmlIter++) {
				const SmartPtrCXmlElement childXml = childrenXmlIter->second;
				const std::string newKeyPath = keyPath + _keyPathDelimStr + childXml->getName();

				const std::string value = childXml->getValue();
				if (! value.empty()) {
					propertyCollection.push_back(std::make_pair(newKeyPath, value));
				}

				createXmlPropertyCollection(newKeyPath, childXml, propertyCollection);
			}
		}
	}
	CAF_CM_EXIT;
}
Пример #5
0
SmartPtrCDiagDeleteValueDoc DiagDeleteValueXml::parse(
	const SmartPtrCXmlElement thisXml) {
	CAF_CM_STATIC_FUNC_VALIDATE("DiagDeleteValueXml", "parse");

	SmartPtrCDiagDeleteValueDoc diagDeleteValueDoc;

	CAF_CM_ENTER {
		CAF_CM_VALIDATE_SMARTPTR(thisXml);

		const std::string jobIdStrVal =
			thisXml->findRequiredAttribute("jobId");
		UUID jobIdVal = CAFCOMMON_GUID_NULL;
		if (! jobIdStrVal.empty()) {
			BasePlatform::UuidFromString(jobIdStrVal.c_str(), jobIdVal);
		}

		const std::string fileAliasStrVal =
			thisXml->findRequiredAttribute("fileAlias");
		const std::string fileAliasVal = fileAliasStrVal;

		const SmartPtrCXmlElement valueNameXml =
			thisXml->findRequiredChild("valueName");

		std::string valueNameVal;
		if (! valueNameXml.IsNull()) {
			valueNameVal = valueNameXml->getValue();
		}

		diagDeleteValueDoc.CreateInstance();
		diagDeleteValueDoc->initialize(
			jobIdVal,
			fileAliasVal,
			valueNameVal);
	}
	CAF_CM_EXIT;

	return diagDeleteValueDoc;
}