text:
namespace Microsoft.AzureStack.Management.Subscriptions.Admin
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Net.Http;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// AcquiredPlansOperations operations.
    /// </summary>
    internal partial class AcquiredPlansOperations : IServiceOperations<SubscriptionsAdminClient>, IAcquiredPlansOperations
    {
        /// <summary>
        /// Initializes a new instance of the AcquiredPlansOperations class.
        /// </summary>
        /// <param name='client'>
        /// Reference to the service client.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        internal AcquiredPlansOperations(SubscriptionsAdminClient client)
        {
            if (client == null)
            {
                throw new System.ArgumentNullException("client");
            }
            Client = client;
        }

        /// <summary>
        /// Gets a reference to the SubscriptionsAdminClient
        /// </summary>
        public SubscriptionsAdminClient Client { get; private set; }

        /// <summary>
        /// Get a collection of all acquired plans that subscription has access to.
        /// </summary>
        /// <param name='targetSubscriptionId'>
        /// The target subscription ID.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<IPage<PlanAcquisition>>> ListWithHttpMessagesAsync(string targetSubscriptionId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (targetSubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "targetSubscriptionId");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("targetSubscriptionId", targetSubscriptionId);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Subscriptions.Admin/subscriptions/{targetSubscriptionId}/acquiredPlans").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{targetSubscriptionId}", System.Uri.EscapeDataString(targetSubscriptionId));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<IPage<PlanAcquisition>>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page1<PlanAcquisition>>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Gets the specified plan acquired by a subscription consuming the offer.
        /// </summary>
        /// <param name='targetSubscriptionId'>
        /// The target subscription ID.
        /// </param>
        /// <param name='planAcquisitionId'>
        /// The plan acquisition Identifier
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<PlanAcquisition>> GetWithHttpMessagesAsync(string targetSubscriptionId, string planAcquisitionId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (targetSubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "targetSubscriptionId");
            }
            if (planAcquisitionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "planAcquisitionId");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("targetSubscriptionId", targetSubscriptionId);
                tracingParameters.Add("planAcquisitionId", planAcquisitionId);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Subscriptions.Admin/subscriptions/{targetSubscriptionId}/acquiredPlans/{planAcquisitionId}").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{targetSubscriptionId}", System.Uri.EscapeDataString(targetSubscriptionId));
            _url = _url.Replace("{planAcquisitionId}", System.Uri.EscapeDataString(planAcquisitionId));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<PlanAcquisition>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<PlanAcquisition>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Deletes an acquired plan.
        /// </summary>
        /// <param name='targetSubscriptionId'>
        /// The target subscription ID.
        /// </param>
        /// <param name='planAcquisitionId'>
        /// The plan acquisition Identifier
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse> DeleteWithHttpMessagesAsync(string targetSubscriptionId, string planAcquisitionId, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (targetSubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "targetSubscriptionId");
            }
            if (planAcquisitionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "planAcquisitionId");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("targetSubscriptionId", targetSubscriptionId);
                tracingParameters.Add("planAcquisitionId", planAcquisitionId);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Subscriptions.Admin/subscriptions/{targetSubscriptionId}/acquiredPlans/{planAcquisitionId}").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{targetSubscriptionId}", System.Uri.EscapeDataString(targetSubscriptionId));
            _url = _url.Replace("{planAcquisitionId}", System.Uri.EscapeDataString(planAcquisitionId));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("DELETE");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200 && (int)_statusCode != 204)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Creates an acquired plan.
        /// </summary>
        /// <param name='targetSubscriptionId'>
        /// The target subscription ID.
        /// </param>
        /// <param name='planAcquisitionId'>
        /// The plan acquisition Identifier
        /// </param>
        /// <param name='newAcquiredPlan'>
        /// The new acquired plan.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<PlanAcquisition>> CreateWithHttpMessagesAsync(string targetSubscriptionId, string planAcquisitionId, PlanAcquisition newAcquiredPlan, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (Client.SubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
            }
            if (targetSubscriptionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "targetSubscriptionId");
            }
            if (planAcquisitionId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "planAcquisitionId");
            }
            if (Client.ApiVersion == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
            }
            if (newAcquiredPlan == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "newAcquiredPlan");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("targetSubscriptionId", targetSubscriptionId);
                tracingParameters.Add("planAcquisitionId", planAcquisitionId);
                tracingParameters.Add("newAcquiredPlan", newAcquiredPlan);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Subscriptions.Admin/subscriptions/{targetSubscriptionId}/acquiredPlans/{planAcquisitionId}").ToString();
            _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
            _url = _url.Replace("{targetSubscriptionId}", System.Uri.EscapeDataString(targetSubscriptionId));
            _url = _url.Replace("{planAcquisitionId}", System.Uri.EscapeDataString(planAcquisitionId));
            List<string> _queryParameters = new List<string>();
            if (Client.ApiVersion != null)
            {
                _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
            }
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("PUT");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            if(newAcquiredPlan != null)
            {
                _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(newAcquiredPlan, Client.SerializationSettings);
                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
                _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
            }
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200 && (int)_statusCode != 201)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<PlanAcquisition>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<PlanAcquisition>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            // Deserialize Response
            if ((int)_statusCode == 201)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<PlanAcquisition>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

        /// <summary>
        /// Get a collection of all acquired plans that subscription has access to.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="CloudException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task<AzureOperationResponse<IPage<PlanAcquisition>>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (nextPageLink == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
            }
            // Tracing
            bool _shouldTrace = ServiceClientTracing.IsEnabled;
            string _invocationId = null;
            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary<string, object> tracingParameters = new Dictionary<string, object>();
                tracingParameters.Add("nextPageLink", nextPageLink);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
            }
            // Construct URL
            string _url = "{nextLink}";
            _url = _url.Replace("{nextLink}", nextPageLink);
            List<string> _queryParameters = new List<string>();
            if (_queryParameters.Count > 0)
            {
                _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
            }
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;
            _httpRequest.Method = new HttpMethod("GET");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers
            if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
            {
                _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
            }
            if (Client.AcceptLanguage != null)
            {
                if (_httpRequest.Headers.Contains("accept-language"))
                {
                    _httpRequest.Headers.Remove("accept-language");
                }
                _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
            }

            if (customHeaders != null)
            {
                foreach(var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;
            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;
            if ((int)_statusCode != 200)
            {
                var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                    CloudError _errorBody =  Rest.Serialization.SafeJsonConvert.DeserializeObject<CloudError>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex = new CloudException(_errorBody.Message);
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_httpResponse.Headers.Contains("x-ms-request-id"))
                {
                    ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                }
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new AzureOperationResponse<IPage<PlanAcquisition>>();
            _result.Request = _httpRequest;
            _result.Response = _httpResponse;
            if (_httpResponse.Headers.Contains("x-ms-request-id"))
            {
                _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
            }
            // Deserialize Response
            if ((int)_statusCode == 200)
            {
                _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
                try
                {
                    _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject<Page1<PlanAcquisition>>(_responseContent, Client.DeserializationSettings);
                }
                catch (JsonException ex)
                {
                    _httpRequest.Dispose();
                    if (_httpResponse != null)
                    {
                        _httpResponse.Dispose();
                    }
                    throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
                }
            }
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return _result;
        }

    }
}


text:
<idea-plugin>
  <id>com.haskforce</id>
  <name>HaskForce</name>
  <vendor url="https://github.com/carymrobbins/intellij-haskforce">HaskForce on GitHub</vendor>

  <description>Plugin for Haskell language support.</description>

  <depends>org.jetbrains.plugins.yaml</depends>

  <!-- please see http://confluence.jetbrains.net/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
       on how to target different products -->
  <!-- uncomment to enable plugin in all products
  <depends>com.intellij.modules.lang</depends>
  -->

  <application-components>
    <!-- Add your application components here -->
  </application-components>

  <actions>
    <action id="Haskell.NewHaskellFile" class="com.haskforce.actions.CreateHaskellFileAction"
            text="Haskell File" description="Create new Haskell file">
      <add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewFile"/>
    </action>
    <action id="HaskForce.StylishFormat"
            class="com.haskforce.actions.HaskellStylishFormatAction"
            text="Reformat code with Stylish Haskell"
            description="Format current file with Stylish-Haskell formatter">
      <add-to-group group-id="CodeFormatGroup" anchor="last"/>
      <keyboard-shortcut keymap="$default" first-keystroke="shift ctrl alt E"/>
    </action>
    <action id="HaskForce.HindentFormat"
            class="com.haskforce.actions.HaskellHindentFormatAction"
            text="Reformat code with Hindent"
            description="Format current file with Hindent">
      <add-to-group group-id="CodeFormatGroup" anchor="last"/>
      <keyboard-shortcut keymap="$default" first-keystroke="shift ctrl alt D"/>
    </action>
    <action id="com.haskforce.actions.RestartGhcModi" class="com.haskforce.actions.RestartGhcModi"
            text="Restart ghc-modi" description="Restarts a disabled ghc-modi process">
      <add-to-group group-id="ToolsMenu" anchor="last"/>
    </action>
    <action id="TypeInfo" class="com.haskforce.actions.TypeInfoAction" text="Type Info">
      <add-to-group group-id="ViewMenu" anchor="first"/>
      <keyboard-shortcut first-keystroke="F11" keymap="Mac OS X"/>
      <keyboard-shortcut first-keystroke="F11" keymap="Mac OS X 10.5+"/>
      <keyboard-shortcut first-keystroke="alt EQUALS" keymap="$default"/>
    </action>
    <action id="com.haskforce.actions.cabal.AddCabalPackageAction"
            class="com.haskforce.actions.cabal.AddCabalPackageAction"
            text="Add Cabal Package"
            description="Adds a cabal file to your project and configures it as an IntelliJ module.">
      <add-to-group group-id="ToolsMenu" anchor="first"/>
    </action>
    <action id="com.haskforce.actions.cabal.DiscoverCabalPackagesAction"
            class="com.haskforce.actions.cabal.DiscoverCabalPackagesAction"
            text="Discover Cabal Packages"
            description="Finds Cabal packages in your project and imports them as Haskell modules.">
      <add-to-group group-id="ToolsMenu" anchor="first"/>
    </action>
  </actions>

  <extensions defaultExtensionNs="com.intellij">
      <applicationInitializedListener implementation="com.haskforce.ide.HaskForceInitializedListener"/>
    <!-- Haskell support -->
    <projectTemplatesFactory implementation="com.haskforce.haskell.project.template.HaskellProjectTemplatesFactory"/>
    <internalFileTemplate name="Haskell Module"/>
    <moduleType id="HASKELL_MODULE" implementationClass="com.haskforce.HaskellModuleType"/>
    <sdkType implementation="com.haskforce.HaskellSdkType"/>
    <fileTypeFactory implementation="com.haskforce.HaskellFileTypeFactory"/>
    <lang.syntaxHighlighterFactory language="Haskell"
                                   implementationClass="com.haskforce.highlighting.HaskellSyntaxHighlighterFactory"/>
    <lang.parserDefinition language="Haskell"
                           implementationClass="com.haskforce.HaskellParserDefinition"/>
    <lang.documentationProvider language="Haskell"
                                implementationClass="com.haskforce.highlighting.annotation.HaskellDocumentationProvider"/>
    <annotator language="Haskell"
               implementationClass="com.haskforce.highlighting.HaskellAnnotator"/>
    <externalAnnotator language="Haskell"
                       implementationClass="com.haskforce.highlighting.annotation.external.HaskellExternalAnnotator"/>
    <configurationType implementation="com.haskforce.run.HaskellApplicationConfigurationType"/>
    <configurationType implementation="com.haskforce.run.HaskellTestConfigurationType"/>
    <configurationType implementation="com.haskforce.run.stack.application.StackApplicationConfigurationType"/>
    <configurationType implementation="com.haskforce.run.stack.task.StackTaskConfigurationType"/>
    <programRunner implementation="com.haskforce.run.HaskellRunner"/>
    <codeStyleSettingsProvider
        implementation="com.haskforce.language.formatting.HaskellCodeStyleSettingsProvider"/>
    <langCodeStyleSettingsProvider
        implementation="com.haskforce.language.formatting.HaskellLanguageCodeStyleSettingsProvider"/>
    <highlightErrorFilter implementation="com.haskforce.codeInsight.highlighting.HaskellHighlightErrorFilter"/>
    <!-- Cache-->
    <projectService serviceImplementation="com.haskforce.codeInsight.HaskellCompletionCacheService"/>
    <projectService serviceImplementation="com.haskforce.tooling.ghcPkg.GhcPkgDumpProjectCacheService"/>

    <!-- Language injections -->
    <lang.elementManipulator forClass="com.haskforce.psi.HaskellQqblob"
                             implementationClass="com.haskforce.psi.impl.HaskellQqblobManipulator"/>

    <!-- Indexes -->
    <fileBasedIndex implementation="com.haskforce.index.HaskellModuleIndex"/>
    <stubIndex implementation="com.haskforce.stubs.index.HaskellAllNameIndex"/>

    <!-- Editing utils -->
    <lang.braceMatcher language="Haskell"
                       implementationClass="com.haskforce.features.HaskellBraceMatcher"/>
    <lang.commenter language="Haskell"
                    implementationClass="com.haskforce.features.HaskellCommenter"/>
    <quoteHandler fileType="Haskell" className="com.haskforce.features.HaskellQuoteHandler"/>
    <typedHandler implementation="com.haskforce.features.HaskellTypedHandler" id="HaskellFile"/>
    <lang.foldingBuilder language="Haskell"
                         implementationClass="com.haskforce.features.HaskellFoldingBuilder"/>
    <elementDescriptionProvider implementation="com.haskforce.features.HaskellDescriptionProvider"/>
    <completion.contributor language="Haskell"
                            implementationClass="com.haskforce.codeInsight.HaskellCompletionContributor"/>

    <!-- References/navigation -->
    <psi.referenceContributor
        implementation="com.haskforce.psi.references.HaskellReferenceContributor"/>
    <lang.findUsagesProvider language="Haskell"
                             implementationClass="com.haskforce.codeInsight.HaskellFindUsagesProvider"/>
    <gotoSymbolContributor implementation="com.haskforce.features.HaskellChooseByNameContributor"/>

    <!-- Language utilities -->
    <lang.namesValidator language="Haskell"
                         implementationClass="com.haskforce.language.HaskellNamesValidator"/>

    <!-- Refactoring -->
    <lang.refactoringSupport language="Haskell"
                             implementationClass="com.haskforce.refactoring.HaskellRefactoringSupportProvider"/>
    <renamePsiElementProcessor
        implementation="com.haskforce.refactoring.HaskellRenamePsiElementProcessor"/>

    <!-- Structure view on the left pane -->
    <lang.psiStructureViewFactory language="Haskell"
                                  implementationClass="com.haskforce.features.structureview.HaskellStructureViewFactory"/>

    <!-- Project settings -->

    <!-- Tab under compiler in IntelliJ -> Preferences -->
    <projectConfigurable instance="com.haskforce.settings.HaskellCompilerConfigurable"
                         parentId="project.propCompiler" id="Haskell compiler"
                         displayName="Haskell Compiler"/>
    <!-- Persistent data + build server communication for compiler settings -->
    <projectService serviceImplementation="com.haskforce.settings.HaskellBuildSettings"/>

    <!-- Tab in IntelliJ -> Preferences -->
    <projectConfigurable instance="com.haskforce.settings.HaskellToolsConfigurable"/>

    <projectConfigurable
      instance="com.haskforce.settings.experimental.HaskForceExperimentalConfigurable"
      groupId="language"
    />

    <!-- File -> Project Structure dialogue. -->
    <moduleConfigurationEditorProvider
        implementation="com.haskforce.settings.HaskellModuleConfigurationEditor" order="first"/>

    <!-- Tab in IntelliJ -> Preferences -->
    <colorSettingsPage implementation="com.haskforce.settings.HaskellColorSettingsPage"/>
    <colorSettingsPage implementation="com.haskforce.settings.CabalColorSettingsPage"/>

    <!-- Tool windows -->
    <toolWindow id="Haskell Tools Console" anchor="bottom"
                icon="/icons/haskell-13px.png"
                factoryClass="com.haskforce.ui.tools.HaskellToolsConsoleWindowFactory"
                conditionClass="com.haskforce.ui.tools.HaskellToolsConsoleWindowFactory"/>

    <!-- Cabal support -->
    <fileTypeFactory implementation="com.haskforce.cabal.CabalFileTypeFactory"/>
    <lang.commenter language="Cabal" implementationClass="com.haskforce.cabal.CabalCommenter"/>
    <lang.syntaxHighlighterFactory language="Cabal"
                                   implementationClass="com.haskforce.cabal.highlighting.CabalSyntaxHighlighterFactory"/>
    <lang.parserDefinition language="Cabal"
                           implementationClass="com.haskforce.cabal.lang.parser.CabalParserDefinition"/>
    <annotator language="Cabal"
               implementationClass="com.haskforce.cabal.highlighting.CabalAnnotator"/>
    <completion.contributor
        language="Cabal"
        implementationClass="com.haskforce.cabal.completion.CabalCompletionContributor" />

    <!-- Hamlet support -->
    <fileTypeFactory implementation="com.haskforce.yesod.shakespeare.hamlet.HamletFileTypeFactory"/>
    <lang.syntaxHighlighterFactory language="Hamlet"
                                   implementationClass="com.haskforce.yesod.shakespeare.hamlet.highlighting.HamletSyntaxHighlighterFactory"/>
    <lang.parserDefinition language="Hamlet"
                           implementationClass="com.haskforce.yesod.shakespeare.hamlet.HamletParserDefinition"/>

    <!-- Spelling support -->
    <spellchecker.support language="Haskell"
                          implementationClass="com.haskforce.spellchecker.HaskellSpellcheckingStrategy"/>
    <spellchecker.support language="Cabal"
                          implementationClass="com.haskforce.spellchecker.HaskellSpellcheckingStrategy"/>
    <spellchecker.bundledDictionaryProvider
        implementation="com.haskforce.spellchecker.HaskellBundledDictionaryProvider"/>

    <projectImportProvider
        implementation="com.haskforce.importWizard.stack.StackProjectImportProvider"/>
    <projectImportBuilder
        implementation="com.haskforce.importWizard.stack.StackProjectImportBuilder"/>

    <!-- External builder support -->
    <!-- Note that the classpath is needed for plugin deployment to export a zip archive. -->
    <compileServer.plugin classpath="jps-plugin.jar;jps-shared.jar"/>
    <buildProcess.parametersProvider implementation="com.haskforce.HaskForceBuildProcessParametersProvider"/>
  </extensions>
  <module-components>
    <component>
      <implementation-class>com.haskforce.highlighting.annotation.external.GhcModi</implementation-class>
      <interface-class>com.haskforce.highlighting.annotation.external.GhcModi</interface-class>
    </component>
  </module-components>
</idea-plugin>

redpajama_set_name: RedPajamaGithub


text:
package org.apache.camel.component.bean;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;

/**
 *
 */
public class RouteMethodCallStaticTest extends ContextTestSupport {

    @Test
    public void testStaticMethodCall() throws Exception {
        getMockEndpoint("mock:camel").expectedBodiesReceived("Hello Camel");
        getMockEndpoint("mock:other").expectedBodiesReceived("Hello World");

        template.sendBody("direct:start", "Hello World");
        template.sendBody("direct:start", "Hello Camel");

        assertMockEndpointsSatisfied();
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start").choice().when().method(MyStaticClass.class, "isCamel").to("mock:camel").otherwise().to("mock:other");
            }
        };
    }
}


text:
struct EncoderInfo {
    uint64_t section;
    uint32_t offset;
};

@interface DSBurnInfo : NSObject
{
    NSString *filepath;
    uint64_t storageCapacity;
    uint64_t postEncodedSize;

    @public
    int k;
}

- initWithFilepath: (NSString *) theFilepath;

- (uint64_t) sizeOfFork: (DRFileFork) fork;

- (void) recalculateParameters;

- (BOOL) canBurn;
- (BOOL) canBurnToCDROrHigher;
- (BOOL) canBurnToDVDOrHigher;
- (BOOL) canBurnToDVDPlusDoubleLayer;

- (int) kValue;
- (int) kValueForCD;
- (int) kValueForDVD;
- (int) kValueForDVDDL;

- (uint64_t) encodedFileSize;
- (uint64_t) sizeOfFork: (DRFileFork) fork;
- (uint64_t) fileSize;
- (void) setStorageCapacity: (uint64_t) theStorageCapacity;

- (struct EncoderInfo) encoderInfoForAddress: (uint64_t) address;

- (NSString *) filepath;

- (NSData *) iconData;

@end

inline
struct EncoderInfo
DSMakeEncoderInfo( uint64_t section, uint32_t offset );

#define KB 1024
#define MB (1024 * KB)
#define GB (1024 * MB)

#define MAX_CD_FILE_SIZE ((650 * MB) - (10 * MB))
#define MAX_DVD_FILE_SIZE (4700000000 - (10 * MB))
#define MAX_DVD_DOUBLE_LAYER_FILE_SIZE (8550000000 - (10 * MB))

// the two parameters you may want to adjust
#define N GF_BITS
#define INTERLEAVE 4

#define MAX_K (N - 1)

#define SECTOR_SIZE (2 * KB)
#define CELL_SIZE (SECTOR_SIZE / INTERLEAVE)

#define SECTORS_PER_SECTION INTERLEAVE
#define SECTION_SIZE (SECTOR_SIZE * SECTORS_PER_SECTION)
#define ENCODED_SECTION_SIZE (SECTION_SIZE * N)

// i.e. 128 KB
#define SUPER_SECTOR_SIZE ENCODED_SECTION_SIZE

// i.e. 256 cells
#define CELLS_PER_SUPER_SECTOR (SUPER_SECTOR_SIZE / CELL_SIZE)

#define MAXMIMUM_FILE_SIZE 2013265920 // = 15/16 of 2GB or 1.875 GB
#define MAXIMUM_UNLICENSED_FILE_SIZE ( 5 * MB )


text:
This release brings several improvements to search, primarily KBase data search, but also the cross-linking between jgi and data search. Auto-running of search via the "q" query parameter also comes along for the ride, enabling links into search which we previously supported. A recent release of the search indexes without ui support, which broke the search interface, instigated the addition of default index handling.

Internally integration tests have been implemented, and encompass the primary plugins (login, dashboard, search, catalog, etc.). This enables basic sanity testing before merging PRs and releases. Still many integration tests to write.

## CHANGES

### NEW

- data-search, jgi-search: new navbar provides links between these two search interfaces, carrying the current search query. This is a new feature for two beta tools, so is likely to change. (https://github.com/kbase/kbase-ui/pull/630)

### REMOVED

n/a

### UNRELEASED

n/a

### IMPROVEMENTS

- data-search: internal, performance improvements

- data-search: link scientific name to genome landing page

- data-search: move features tab, add prive/public filter (https://github.com/kbase/kbase-ui-plugin-data-search/pull/21)

- integration tests: integration testing is now conducted prior to all PR merges and releases; the set of integration tests is still low (14, and relatively shallow at that) but growing every week.

### FIXES

- data-search: add default index handling, avoids breaking the ui in the case of indexes released without support (https://github.com/kbase/kbase-ui/pull/626)

## Dependency Changes

- new knockout integration library


text:
/*globals require*/
/*jshint node:true, mocha:true, expr:true*/
/*jscs:disable maximumLineLength*/

/**
 * @author lattmann / https://github.com/lattmann
 * @author pmeijer / https://github.com/pmeijer
 */

var testFixture = require('../../../_globals.js');

describe('REST API', function () {
    'use strict';

    var gmeConfig = testFixture.getGmeConfig(),
        logger = testFixture.logger.fork('plugin.index.spec'),
        WebGME = testFixture.WebGME,
        expect = testFixture.expect,
        superagent = testFixture.superagent;

    describe('PLUGIN SPECIFIC API', function () {
        var gmeAuth,
            safeStorage,
            importResult;

        before(function (done) {
            testFixture.clearDBAndGetGMEAuth(gmeConfig)
                .then(function (gmeAuth_) {
                    gmeAuth = gmeAuth_;
                    safeStorage = testFixture.getMongoStorage(logger, gmeConfig, gmeAuth);
                    return safeStorage.openDatabase();
                })
                .then(function () {
                    return testFixture.importProject(safeStorage, {
                        projectSeed: 'seeds/EmptyProject.json',
                        projectName: 'PluginAPI_Test',
                        gmeConfig: gmeConfig,
                        logger: logger
                    });
                })
                .then(function (res) {
                    importResult = res;
                    return safeStorage.closeDatabase();
                })
                .nodeify(done);
        });

        after(function (done) {
            gmeAuth.unload()
                .nodeify(done);
        });

        describe('allowServerExecution=true, serverResultTimeout=10000', function () {
            var server,
                agent;

            before(function (done) {
                var gmeConfig = testFixture.getGmeConfig();
                gmeConfig.plugin.allowServerExecution = true;
                gmeConfig.plugin.serverResultTimeout = 10000;

                server = WebGME.standaloneServer(gmeConfig);
                server.start(done);
            });

            after(function (done) {
                server.stop(done);
            });

            beforeEach(function () {
                agent = superagent.agent();
            });

            it('should list all available plugins /api/plugins', function (done) {
                agent.get(server.getUrl() + '/api/v1/plugins/')
                    .end(function (err, res) {
                        expect(res.status).equal(200, err);
                        expect(res.body instanceof Array).to.equal(true);
                        expect(res.body).to.include('ExportImport', 'PluginGenerator');
                        done();
                    });
            });

            it('should get config via /api/plugins/ExportImport/config', function (done) {
                agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/config')
                    .end(function (err, res) {
                        expect(res.status).equal(200, err);
                        expect(res.body).to.deep.equal({
                            type: 'Export',
                            file: '',
                            assets: false
                        });
                        done();
                    });
            });

            it('should get configStructure via /api/plugins/ExportImport/configStructure', function (done) {
                agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/configStructure')
                    .end(function (err, res) {
                        expect(res.status).equal(200, err);
                        expect(res.body instanceof Array).to.equal(true);
                        expect(res.body.length).to.equal(3);
                        expect(res.body[0]).to.include.keys('name', 'value', 'description', 'valueType', 'displayName');
                        expect(res.body[1]).to.include.keys('name', 'value', 'description', 'valueType', 'displayName');
                        expect(res.body[2]).to.include.keys('name', 'value', 'description', 'valueType', 'displayName');
                        done();
                    });
            });

            it('should 404 when getting config for non-existing plugin /api/plugins/EE/config', function (done) {
                agent.get(server.getUrl() + '/api/v1/plugins/EE/config')
                    .end(function (err, res) {
                        expect(res.status).equal(404, err);
                        done();
                    });
            });

            it('should 404 when getting configStructure for non-existing plugin /api/plugins/EE/configStructure',
                function (done) {
                    agent.get(server.getUrl() + '/api/v1/plugins/EE/configStructure')
                        .end(function (err, res) {
                            expect(res.status).equal(404, err);
                            done();
                        });
                }
            );

            it('should 404 when for non-existing result /api/plugins/SOME_PLUGIN/results/BOGUS',
                function (done) {
                    agent.get(server.getUrl() + '/api/v1/plugins/SOME_PLUGIN/results/BOGUS')
                        .end(function (err, res) {
                            expect(res.status).equal(404, err);
                            done();
                        });
                }
            );

            it('should execute ExportImport [pluginId, projectId, branchName] /api/plugins/ExportImport/execute',
                function (done) {
                    var requestBody = {
                        pluginId: 'ExportImport',
                        projectId: importResult.project.projectId,
                        branchName: 'master'
                    };
                    this.timeout(4000);
                    agent.post(server.getUrl() + '/api/v1/plugins/ExportImport/execute')
                        .send(requestBody)
                        .end(function (err, res) {
                            var resultId = res.body.resultId;
                            expect(res.status).equal(200, err);
                            expect(typeof resultId).to.equal('string');

                            agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                .end(function (err, res) {
                                    var cnt = 0,
                                        intervalId;
                                    expect(res.status).equal(200, err);
                                    expect(res.body).to.deep.equal({status: 'RUNNING'});

                                    intervalId = setInterval(function () {
                                        agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                            .end(function (err, res) {
                                                expect(res.status).equal(200, err);
                                                if (res.body.status === 'FINISHED') {
                                                    clearInterval(intervalId);
                                                    expect(res.body.result).to.include.keys('commits', 'messages',
                                                        'success'); //etc.
                                                    expect(res.body.result.success).to.equal(true);
                                                    agent.get(server.getUrl() +
                                                        '/api/v1/plugins/ExportImport/results/' + resultId)
                                                        .end(function (err, res) {
                                                            expect(res.status).equal(404, err);
                                                            done();
                                                        });
                                                } else if (res.body.status === 'RUNNING') {
                                                    cnt += 1;
                                                    if (cnt === 30) {
                                                        clearInterval(intervalId);
                                                        done(new Error('Plugin did not finish in time, ' +
                                                            'increase limit'));
                                                    }
                                                } else {
                                                    clearInterval(intervalId);
                                                    done(new Error('Unexpected status', res.body.status));
                                                }
                                            });
                                    }, 200);
                                });
                        });
                }
            );

            it('should execute with ERROR status ExportImport [pluginId] /api/plugins/ExportImport/execute',
                function (done) {
                    var requestBody = {
                        pluginId: 'ExportImport'
                    };
                    agent.post(server.getUrl() + '/api/v1/plugins/ExportImport/execute')
                        .send(requestBody)
                        .end(function (err, res) {
                            var resultId = res.body.resultId;
                            expect(res.status).equal(200, err);
                            expect(typeof resultId).to.equal('string');

                            agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                .end(function (err, res) {
                                    expect(res.status).equal(200, err);
                                    expect(res.body).to.deep.equal({status: 'RUNNING'});
                                    setTimeout(function () {
                                        agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                            .end(function (err, res) {
                                                expect(res.status).equal(200, err);
                                                expect(res.body.status).to.equal('ERROR');
                                                expect(res.body.result).to.include.keys('commits', 'messages',
                                                    'success'); //etc.
                                                expect(res.body.err).to.equal('Invalid argument, data.projectId is ' +
                                                    'not a string.');
                                                expect(res.body.result.success).to.equal(false);
                                                agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                                    .end(function (err, res) {
                                                        expect(res.status).equal(404, err);
                                                        done();
                                                    });
                                            });
                                    }, 1000); // Wait 1 second.
                                });
                        });
                }
            );
        });

        describe('allowServerExecution=true, serverResultTimeout=10000, auth enabled', function () {
            var server,
                agent;

            before(function (done) {
                var gmeConfig = testFixture.getGmeConfig();
                gmeConfig.plugin.allowServerExecution = true;
                gmeConfig.plugin.serverResultTimeout = 10000;
                gmeConfig.authentication.enable = true;

                server = WebGME.standaloneServer(gmeConfig);
                server.start(done);
            });

            after(function (done) {
                server.stop(done);
            });

            beforeEach(function () {
                agent = superagent.agent();
            });

            it('should list all available plugins /api/plugins', function (done) {
                agent.get(server.getUrl() + '/api/v1/plugins/')
                    .end(function (err, res) {
                        expect(res.status).equal(200, err);
                        expect(res.body instanceof Array).to.equal(true);
                        expect(res.body).to.include('ExportImport', 'PluginGenerator');
                        done();
                    });
            });

            it('should get config via /api/plugins/ExportImport/config', function (done) {
                agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/config')
                    .end(function (err, res) {
                        expect(res.status).equal(200, err);
                        expect(res.body).to.deep.equal({
                            type: 'Export',
                            file: '',
                            assets: false
                        });
                        done();
                    });
            });

            it('should get configStructure via /api/plugins/ExportImport/configStructure', function (done) {
                agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/configStructure')
                    .end(function (err, res) {
                        expect(res.status).equal(200, err);
                        expect(res.body instanceof Array).to.equal(true);
                        expect(res.body.length).to.equal(3);
                        expect(res.body[0]).to.include.keys('name', 'value', 'description', 'valueType', 'displayName');
                        expect(res.body[1]).to.include.keys('name', 'value', 'description', 'valueType', 'displayName');
                        expect(res.body[2]).to.include.keys('name', 'value', 'description', 'valueType', 'displayName');
                        done();
                    });
            });

            it('should 404 when getting config for non-existing plugin /api/plugins/EE/config', function (done) {
                agent.get(server.getUrl() + '/api/v1/plugins/EE/config')
                    .end(function (err, res) {
                        expect(res.status).equal(404, err);
                        done();
                    });
            });

            it('should 404 when getting configStructure for non-existing plugin /api/plugins/EE/configStructure',
                function (done) {
                    agent.get(server.getUrl() + '/api/v1/plugins/EE/configStructure')
                        .end(function (err, res) {
                            expect(res.status).equal(404, err);
                            done();
                        });
                }
            );

            it('should 404 when for non-existing result /api/plugins/SOME_PLUGIN/results/BOGUS',
                function (done) {
                    agent.get(server.getUrl() + '/api/v1/plugins/SOME_PLUGIN/results/BOGUS')
                        .end(function (err, res) {
                            expect(res.status).equal(404, err);
                            done();
                        });
                }
            );

            it('should execute ExportImport [pluginId, projectId, branchName] /api/plugins/ExportImport/execute',
                function (done) {
                    var requestBody = {
                        pluginId: 'ExportImport',
                        projectId: importResult.project.projectId,
                        branchName: 'master'
                    };
                    this.timeout(4000);
                    agent.post(server.getUrl() + '/api/v1/plugins/ExportImport/execute')
                        .send(requestBody)
                        .end(function (err, res) {
                            var resultId = res.body.resultId;
                            expect(res.status).equal(200, err);
                            expect(typeof resultId).to.equal('string');

                            agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                .end(function (err, res) {
                                    var cnt = 0,
                                        intervalId;
                                    expect(res.status).equal(200, err);
                                    expect(res.body).to.deep.equal({status: 'RUNNING'});

                                    intervalId = setInterval(function () {
                                        agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                            .end(function (err, res) {
                                                expect(res.status).equal(200, err);
                                                if (res.body.status === 'FINISHED') {
                                                    clearInterval(intervalId);
                                                    expect(res.body.result).to.include.keys('commits', 'messages',
                                                        'success'); //etc.
                                                    expect(res.body.result.success).to.equal(true);
                                                    agent.get(server.getUrl() +
                                                        '/api/v1/plugins/ExportImport/results/' + resultId)
                                                        .end(function (err, res) {
                                                            expect(res.status).equal(404, err);
                                                            done();
                                                        });
                                                } else if (res.body.status === 'RUNNING') {
                                                    cnt += 1;
                                                    if (cnt === 30) {
                                                        clearInterval(intervalId);
                                                        done(new Error('Plugin did not finish in time, ' +
                                                            'increase limit'));
                                                    }
                                                } else {
                                                    clearInterval(intervalId);
                                                    done(new Error('Unexpected status', res.body.status));
                                                }
                                            });
                                    }, 200);
                                });
                        });
                }
            );

            it('should execute with ERROR status ExportImport [pluginId] /api/plugins/ExportImport/execute',
                function (done) {
                    var requestBody = {
                        pluginId: 'ExportImport'
                    };
                    agent.post(server.getUrl() + '/api/v1/plugins/ExportImport/execute')
                        .send(requestBody)
                        .end(function (err, res) {
                            var resultId = res.body.resultId;
                            expect(res.status).equal(200, err);
                            expect(typeof resultId).to.equal('string');

                            agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                .end(function (err, res) {
                                    expect(res.status).equal(200, err);
                                    expect(res.body).to.deep.equal({status: 'RUNNING'});
                                    setTimeout(function () {
                                        agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                            .end(function (err, res) {
                                                expect(res.status).equal(200, err);
                                                expect(res.body.status).to.equal('ERROR');
                                                expect(res.body.result).to.include.keys('commits', 'messages',
                                                    'success'); //etc.
                                                expect(res.body.err).to.equal('Invalid argument, data.projectId is ' +
                                                    'not a string.');
                                                expect(res.body.result.success).to.equal(false);
                                                agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                                    .end(function (err, res) {
                                                        expect(res.status).equal(404, err);
                                                        done();
                                                    });
                                            });
                                    }, 1000); // Wait 1 second.
                                });
                        });
                }
            );
        });

        describe('allowServerExecution=true, serverResultTimeout=200', function () {
            var server,
                agent;

            before(function (done) {
                var gmeConfig = testFixture.getGmeConfig();
                gmeConfig.plugin.allowServerExecution = true;
                gmeConfig.plugin.serverResultTimeout = 200;

                server = WebGME.standaloneServer(gmeConfig);
                server.start(done);
            });

            after(function (done) {
                server.stop(done);
            });

            beforeEach(function () {
                agent = superagent.agent();
            });

            it('should 404 when ExportImport [pluginId, projectId, branchName] /api/plugins/ExportImport/execute ' +
                'and timeout passed /api/v1/plugins/ExportImport/results/%RESULT_ID%',
                function (done) {
                    var requestBody = {
                        pluginId: 'ExportImport',
                        projectId: importResult.project.projectId,
                        pluginConfig: {
                            type: 'Import'
                        }
                    };
                    this.timeout(5000);
                    agent.post(server.getUrl() + '/api/v1/plugins/ExportImport/execute')
                        .send(requestBody)
                        .end(function (err, res) {
                            var resultId = res.body.resultId,
                                cnt = 0,
                                intervalId;

                            expect(res.status).equal(200, err);
                            expect(typeof resultId).to.equal('string');

                            intervalId = setInterval(function () {
                                agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' + resultId)
                                    .end(function (err, res) {
                                        expect(res.status).equal(200, err);

                                        if (res.status === 200) {
                                            if (res.body.status === 'RUNNING') {
                                                cnt += 1;
                                                if (cnt === 30) {
                                                    clearInterval(intervalId);
                                                    done(new Error('Plugin did not finish in time, ' +
                                                        'increase limit'));
                                                }
                                            } else {
                                                clearInterval(intervalId);
                                                setTimeout(function () {
                                                    agent.get(server.getUrl() + '/api/v1/plugins/ExportImport/results/' +
                                                        resultId)
                                                        .end(function (err, res) {
                                                            expect(res.status).equal(404, err);
                                                            done();
                                                        });
                                                }, 1000);
                                            }
                                        } else {
                                            clearInterval(intervalId);
                                            done(new Error('404 before finished'));
                                        }
                                    });
                            }, 100);
                        });
                }
            );
        });
    });
});


text:
package com.github.ltsopensource.core.commons.utils;

import com.github.ltsopensource.core.logger.Logger;
import com.github.ltsopensource.core.logger.LoggerFactory;

/**
 * @author Robert HG (254963746@qq.com) on 11/1/16.
 */
public class DotLogUtils {

    private static final Logger LOGGER = LoggerFactory.getLogger(DotLogUtils.class);

    public static void dot(String msg, Object... args) {
        if (SystemPropertyUtils.isEnableDotLog()) {
            LOGGER.warn("[{}] " + msg, Thread.currentThread().getName(), args);
        }
    }
}


text:
layout: post
date: 2016-09-12
title: "Stella York V Neck Wedding Dress
 Style 5984 Sleeveless Chapel Train Sheath/Column"
category: Stella York
tags: [Stella York,Sheath/Column,V-neck,Chapel Train,Sleeveless]
---
### Stella York V Neck Wedding Dress
 Style 5984
Just **$349.99**
###   Sleeveless Chapel Train Sheath/Column

BRANDS	Stella York

Silhouette	Sheath/Column

Neckline	V-neck

Hemline/Train	Chapel Train

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/stella-york/13473-stella-york-v-neck-wedding-dress-style-5984.html](https://www.readybrides.com/en/stella-york/13473-stella-york-v-neck-wedding-dress-style-5984.html)


text:
package automenta.vivisect.gui;

import java.io.File;
import javax.swing.filechooser.FileFilter;
import processing.core.PApplet;

class FileChooserFilter extends FileFilter {

	private final String[] ftypes;
	private String description = null;

	public FileChooserFilter(String types){
		this(types, null);
	}

	public FileChooserFilter(String types, String desc){
		ftypes = PApplet.split(types.toLowerCase(), ',');
		for(String e : ftypes)
			e = e.trim();
		description = desc;
	}

	@Override
	public boolean accept(File f) {
		String fext = getExtension(f);
		if(fext != null){
			for(String e : ftypes)
				if(fext.equals(e))
					return true;
		}
		return false;
	}

	@Override
	public String getDescription() {
		return description;
	}

	public String getExtension(File f) {
        String ext = null;
        String s = f.getName();
        int i = s.lastIndexOf('.');

        if (i > 0 &&  i < s.length() - 1)
            ext = s.substring(i+1).toLowerCase();
        return ext;
    }
}


text:
class CreateRealEstates < ActiveRecord::Migration
  def self.up
    create_table :real_estates do |t|
      t.integer :realtor_id, :references => :realtor, :null => false
      t.text :ad_title, :null => false
      t.text :ad_description, :null => false
      t.integer :bedrooms
      t.integer :price
      t.boolean :cats, :null => false, :default => false
      t.boolean :dogs, :null => false, :default => false
      t.boolean :active, :null => false, :default => true

      t.timestamps
    end
  end

  def self.down
    drop_table :real_estates
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.yeti-games</groupId>
    <artifactId>td-yeti-server</artifactId>
    <version>0.1</version>

    <properties>
        <spring.version>3.2.5.RELEASE</spring.version>
        <mavenResourcesEncoding>UTF-8</mavenResourcesEncoding>
    </properties>

    <dependencies>

        <!--Netty dependencies-->
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.0.23.Final</version>
        </dependency>

        <dependency>
            <groupId>javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.12.1.GA</version>
        </dependency>

        <!--Spring IoC container dependencies-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <!--Spring Core-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <!--Logger dependencies-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.5</version>
        </dependency>
    </dependencies>

    <build>
        <directory>${project.basedir}/target</directory>
        <outputDirectory>${project.basedir}/target-classes/classes</outputDirectory>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <testOutputDirectory>${project.basedir}/target-classes/test-classes</testOutputDirectory>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>org.yeti.Bootstrap</mainClass>
                            <classpathPrefix>dependency-jars/</classpathPrefix>
                            <classpathLayoutType>repository</classpathLayoutType>
                        </manifest>
                        <manifestEntries>
                            <Class-Path>resources/ resources/config/ resources/file</Class-Path>
                        </manifestEntries>
                    </archive>
                    <excludes>
                        <exclude>**/*.properties</exclude>
                        <exclude>**/*.txt</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.5.1</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.directory}/dependency-jars/
                            </outputDirectory>
                            <useRepositoryLayout>true</useRepositoryLayout>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <encoding>${mavenResourcesEncoding}</encoding>
                </configuration>
                <executions>
                    <execution>
                        <id>copy-resources-settings</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/resources/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <filtering>true</filtering>
                                    <!--<excludes>
                                        <exclude>**/*.xls</exclude>
                                        <exclude>**/*.xlsm</exclude>
                                        <exclude>**/*.xlsx</exclude>
                                    </excludes>-->
                                </resource>
                            </resources>

                        </configuration>
                    </execution>

                    <execution>
                        <id>copy-resources-bin</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/bin/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src/bin</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>

                    <execution>
                        <id>copy-resources-docs</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/docs/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src/docs/</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>


text:
"use strict";
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
bcrypt = require('bcryptjs');

class User{

    constructor() {
        this.collectionName = 'user';
        this.schema = new Schema({
          code:{type:String, require:true},
          login:{type:String, require:true},
          password:{type:String, require:true},
          token:String,
          tokenKey:String,
          email:{type:String, require:true},
          username:{type:String, require:true}
        });

    }

    /**
    @return a mongoose model
    */
    getModel(){
      return mongoose.model(this.collectionName, this.schema);
    }

}

module.exports.user = new User();