/// <summary>
        /// Converts the search filter into a string.
        /// </summary>
        public static string GenericConditionToString(GenericSearchCondition condition)
        {
            var result = new StringBuilder();

            var and   = condition as GenericSearchAnd;
            var attr  = condition as GenericSearchAttributeCondition;
            var field = condition as GenericSearchFieldCondition;

            if (and != null)
            {
                var first = true;
                foreach (var subCondition in and.Conditions)
                {
                    if (!first)
                    {
                        result.Append("+");
                    }
                    result.Append(GenericConditionToString(subCondition));
                    first = false;
                }
            }
            else if (attr != null)
            {
                result.Append(attr.Attribute).Append(InverseOperations[attr.Operation]);
                result.Append("[").Append(attr.Value).Append("]");
            }
            else if (field != null)
            {
                result.Append(field.FieldName).Append(InverseOperations[field.Operation]);
                result.Append("[").Append(field.Value).Append("]");
            }
            return(result.ToString());
        }
        /// <summary>
        /// Deletes the measurements including the measurement values for part <paramref name="partPath"/>. The <paramref name="filter"/> can be used
        /// to restrict the measurements. If the filter is empty, all measurements for the specified part will be deleted. If the partPath is empty,
        /// all measurements from the whole database will be deleted.
        /// </summary>
        /// <param name="partPath">The part path to delete the measurements from.</param>
        /// <param name="filter">A filter to restruct the delete operation.</param>
        /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
        public Task DeleteMeasurements(PathInformation partPath = null, GenericSearchCondition filter = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (filter != null)
            {
                return(Delete(string.Format("measurements?partPath={0}&searchCondition={1}", PathHelper.PathInformation2String(partPath), SearchConditionParser.GenericConditionToString(filter)), cancellationToken));
            }

            return(Delete(string.Format("measurements?partPath={0}", PathHelper.PathInformation2String(partPath)), cancellationToken));
        }
 /// <summary>
 /// Tries to parse the <code>searchFilter</code> and returns the filter as a <see cref="GenericSearchCondition"/> if successful.
 /// </summary>
 public static bool TryParse(string searchFilter, out GenericSearchCondition condition)
 {
     try
     {
         condition = Parse(searchFilter);
         return(true);
     }
     catch
     {
         condition = null;
         return(false);
     }
 }
        /// <summary>
        /// Converts the search filter into a string.
        /// </summary>
        public static string GenericConditionToString( GenericSearchCondition condition )
        {
            var result = new StringBuilder();

            var and = condition as GenericSearchAnd;
            var attr = condition as GenericSearchAttributeCondition;
            if( and != null )
            {
                var first = true;
                foreach( var subCondition in and.Conditions )
                {
                    if( !first ) result.Append( "+" );
                    result.Append( GenericConditionToString( subCondition ) );
                    first = false;
                }
            }
            else if( attr != null )
            {
                result.Append( attr.Attribute ).Append( InverseOperations[ attr.Operation ] );
                result.Append( "[" ).Append( attr.Value ).Append( "]" );
            }
            return result.ToString();
        }
		/// <summary>
		/// Deletes the measurements including the measurement values for part <paramref name="partPath"/>. The <paramref name="filter"/> can be used 
		/// to restrict the measurements. If the filter is empty, all measurements for the specified part will be deleted. If the partPath is empty,
		/// all measurements from the whole database will be deleted.
		/// </summary>
		/// <param name="partPath">The part path to delete the measurements from.</param>
		/// <param name="filter">A filter to restruct the delete operation.</param>
		/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
		public Task DeleteMeasurements( PathInformation partPath = null, GenericSearchCondition filter = null, CancellationToken cancellationToken = default(CancellationToken) )
		{
			if( filter != null )
				return Delete( string.Format( "measurements?partPath={0}&searchCondition={1}", PathHelper.PathInformation2String( partPath ), SearchConditionParser.GenericConditionToString( filter ) ), cancellationToken );

			return Delete( string.Format( "measurements?partPath={0}", PathHelper.PathInformation2String( partPath ) ), cancellationToken );
		}
 /// <summary>
 /// Tries to parse the <code>searchFilter</code> and returns the filter as a <see cref="GenericSearchCondition"/> if successful.
 /// </summary>
 public static bool TryParse( string searchFilter, out GenericSearchCondition condition )
 {
     try
     {
         condition = Parse( searchFilter );
         return true;
     }
     catch
     {
         condition = null;
         return false;
     }
 }
 /// <summary>
 /// Konstruktor
 /// </summary>
 public GenericSearchAnd( GenericSearchCondition[] filter )
 {
     Conditions = filter;
 }