1/*
2* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3*
4* Licensed under the Apache License, Version 2.0 (the "License").
5* You may not use this file except in compliance with the License.
6* A copy of the License is located at
7*
8* http://aws.amazon.com/apache2.0
9*
10* or in the "license" file accompanying this file. This file is distributed
11* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12* express or implied. See the License for the specific language governing
13* permissions and limitations under the License.
14*/
15
16#include <aws/s3/model/SelectParameters.h>
17#include <aws/core/utils/xml/XmlSerializer.h>
18#include <aws/core/utils/StringUtils.h>
19#include <aws/core/utils/memory/stl/AWSStringStream.h>
20
21#include <utility>
22
23using namespace Aws::Utils::Xml;
24using namespace Aws::Utils;
25
26namespace Aws
27{
28namespace S3
29{
30namespace Model
31{
32
33SelectParameters::SelectParameters() :
34 m_inputSerializationHasBeenSet(false),
35 m_expressionType(ExpressionType::NOT_SET),
36 m_expressionTypeHasBeenSet(false),
37 m_expressionHasBeenSet(false),
38 m_outputSerializationHasBeenSet(false)
39{
40}
41
42SelectParameters::SelectParameters(const XmlNode& xmlNode) :
43 m_inputSerializationHasBeenSet(false),
44 m_expressionType(ExpressionType::NOT_SET),
45 m_expressionTypeHasBeenSet(false),
46 m_expressionHasBeenSet(false),
47 m_outputSerializationHasBeenSet(false)
48{
49 *this = xmlNode;
50}
51
52SelectParameters& SelectParameters::operator =(const XmlNode& xmlNode)
53{
54 XmlNode resultNode = xmlNode;
55
56 if(!resultNode.IsNull())
57 {
58 XmlNode inputSerializationNode = resultNode.FirstChild("InputSerialization");
59 if(!inputSerializationNode.IsNull())
60 {
61 m_inputSerialization = inputSerializationNode;
62 m_inputSerializationHasBeenSet = true;
63 }
64 XmlNode expressionTypeNode = resultNode.FirstChild("ExpressionType");
65 if(!expressionTypeNode.IsNull())
66 {
67 m_expressionType = ExpressionTypeMapper::GetExpressionTypeForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(expressionTypeNode.GetText()).c_str()).c_str());
68 m_expressionTypeHasBeenSet = true;
69 }
70 XmlNode expressionNode = resultNode.FirstChild("Expression");
71 if(!expressionNode.IsNull())
72 {
73 m_expression = Aws::Utils::Xml::DecodeEscapedXmlText(expressionNode.GetText());
74 m_expressionHasBeenSet = true;
75 }
76 XmlNode outputSerializationNode = resultNode.FirstChild("OutputSerialization");
77 if(!outputSerializationNode.IsNull())
78 {
79 m_outputSerialization = outputSerializationNode;
80 m_outputSerializationHasBeenSet = true;
81 }
82 }
83
84 return *this;
85}
86
87void SelectParameters::AddToNode(XmlNode& parentNode) const
88{
89 Aws::StringStream ss;
90 if(m_inputSerializationHasBeenSet)
91 {
92 XmlNode inputSerializationNode = parentNode.CreateChildElement("InputSerialization");
93 m_inputSerialization.AddToNode(inputSerializationNode);
94 }
95
96 if(m_expressionTypeHasBeenSet)
97 {
98 XmlNode expressionTypeNode = parentNode.CreateChildElement("ExpressionType");
99 expressionTypeNode.SetText(ExpressionTypeMapper::GetNameForExpressionType(m_expressionType));
100 }
101
102 if(m_expressionHasBeenSet)
103 {
104 XmlNode expressionNode = parentNode.CreateChildElement("Expression");
105 expressionNode.SetText(m_expression);
106 }
107
108 if(m_outputSerializationHasBeenSet)
109 {
110 XmlNode outputSerializationNode = parentNode.CreateChildElement("OutputSerialization");
111 m_outputSerialization.AddToNode(outputSerializationNode);
112 }
113
114}
115
116} // namespace Model
117} // namespace S3
118} // namespace Aws
119