All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.exactpro.sf.messages.oauth.HttpRequestMessage Maven / Gradle / Ivy

/******************************************************************************
 * Copyright 2009-2018 Exactpro (Exactpro Systems Limited)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.exactpro.sf.messages.oauth;

import com.exactpro.sf.common.impl.messages.DefaultMessageFactory;
import com.exactpro.sf.common.impl.messages.BaseMessage;
import com.exactpro.sf.common.messages.IMessageFactory;
import com.exactpro.sf.common.messages.IMessage;
import com.exactpro.sf.common.messages.FieldNotFoundException;
import com.exactpro.sf.aml.scriptutil.StaticUtil.IFilter;

import java.time.LocalDateTime;
import java.time.LocalDate;
import java.time.LocalTime;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.lang.Deprecated;

@SuppressWarnings("unused")
public class HttpRequestMessage extends BaseMessage
{
    public static final String MESSAGE_NAME = "HttpRequestMessage";
	

	public HttpRequestMessage(IMessageFactory messageFactory)
	{
		 this(messageFactory.createMessage(MESSAGE_NAME, (messageFactory.getNamespace() == null) ? "oauth" : messageFactory.getNamespace()));
	}

	/**
	 * @deprecated Please use {@link #HttpRequestMessage(IMessageFactory)}
	 */
	@Deprecated
	public HttpRequestMessage()
	{
		this(DefaultMessageFactory.getFactory());
	}

	/**
	 * @deprecated Please use {@link #HttpRequestMessage(IMessageFactory)}
	 */
	@Deprecated
    public HttpRequestMessage(String name, String namespace)
    {
        super(DefaultMessageFactory.getFactory().createMessage(name, namespace));
    }

	public HttpRequestMessage(IMessage msg)
	{
		super(msg);
	}

    @Override
    public HttpRequestMessage clone() {
        return (HttpRequestMessage)super.clone();
    }

	

	
		
			
				public HttpRequestMessage setMethod(String value)
				{
					this.msg.addField("Method", value);
					return this;
				}
	
				
	
				public String getMethod()
				{
					Object value = this.msg.getField("Method");
	
					
	
					return (String)value;
				}

                
                public Object getUntypedMethod()
                {
                    return this.msg.getField("Method");
                }
                
			
			
            public IFilter getMethodFilter()
            {
                return this.msg.getField("Method");
            }

            public HttpRequestMessage setMethodFilter(IFilter filter)
            {
                this.msg.addField("Method", filter);
                return this;
            }

            public HttpRequestMessage removeMethod()
            {
                this.msg.removeField("Method");
                return this;
            }

			public boolean isSetMethod()
			{
				return this.msg.getField("Method") != null;
			}

            public boolean isFilterMethod()
            {
                return this.msg.getField("Method") instanceof IFilter;
            }
		
			
				public HttpRequestMessage setUri(String value)
				{
					this.msg.addField("Uri", value);
					return this;
				}
	
				
	
				public String getUri()
				{
					Object value = this.msg.getField("Uri");
	
					
	
					return (String)value;
				}

                
                public Object getUntypedUri()
                {
                    return this.msg.getField("Uri");
                }
                
			
			
            public IFilter getUriFilter()
            {
                return this.msg.getField("Uri");
            }

            public HttpRequestMessage setUriFilter(IFilter filter)
            {
                this.msg.addField("Uri", filter);
                return this;
            }

            public HttpRequestMessage removeUri()
            {
                this.msg.removeField("Uri");
                return this;
            }

			public boolean isSetUri()
			{
				return this.msg.getField("Uri") != null;
			}

            public boolean isFilterUri()
            {
                return this.msg.getField("Uri") instanceof IFilter;
            }
		
			
				public HttpRequestMessage setBody(String value)
				{
					this.msg.addField("Body", value);
					return this;
				}
	
				
	
				public String getBody()
				{
					Object value = this.msg.getField("Body");
	
					
	
					return (String)value;
				}

                
                public Object getUntypedBody()
                {
                    return this.msg.getField("Body");
                }
                
			
			
            public IFilter getBodyFilter()
            {
                return this.msg.getField("Body");
            }

            public HttpRequestMessage setBodyFilter(IFilter filter)
            {
                this.msg.addField("Body", filter);
                return this;
            }

            public HttpRequestMessage removeBody()
            {
                this.msg.removeField("Body");
                return this;
            }

			public boolean isSetBody()
			{
				return this.msg.getField("Body") != null;
			}

            public boolean isFilterBody()
            {
                return this.msg.getField("Body") instanceof IFilter;
            }
		
			
				public HttpRequestMessage addHeaders(com.exactpro.sf.messages.oauth.HttpHeaderMessage value)
				{
					List list = this.msg.>getField("Headers");
	
					if(list == null){
						list = new ArrayList();
						this.msg.addField("Headers" ,list);
					}
	
					
					list.add(value.getMessage());
					return this;
					
				}
	
				public List getHeaders()
				{
					List value = this.msg.>getField("Headers");
    
                    if(value == null)
                    {
                        throw new FieldNotFoundException(" Headers ");
                    }
    
                    List list = new ArrayList();
	
					for( IMessage element : value )
					{
						list.add(new com.exactpro.sf.messages.oauth.HttpHeaderMessage((IMessage)element));
					}
	
					return list;
				}
				

                
	
			
			
            public IFilter getHeadersFilter()
            {
                return this.msg.getField("Headers");
            }

            public HttpRequestMessage setHeadersFilter(IFilter filter)
            {
                this.msg.addField("Headers", filter);
                return this;
            }

            public HttpRequestMessage removeHeaders()
            {
                this.msg.removeField("Headers");
                return this;
            }

			public boolean isSetHeaders()
			{
				return this.msg.getField("Headers") != null;
			}

            public boolean isFilterHeaders()
            {
                return this.msg.getField("Headers") instanceof IFilter;
            }
		
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy