/// <summary>
        /// Deletes the attribute definitions from the database configuration for the specified <paramref name="entity"/>. If the key
        /// list is empty, all definitions for the entity are deleted.
        /// </summary>
        /// <param name="entity">The entity the attribute definitions should be deleted from.</param>
        /// <param name="keys">The keys that specify the definitions.</param>
        /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
        public Task DeleteAttributeDefinitions(Entity entity, ushort[] keys = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (keys != null && keys.Length > 0)
            {
                return(Delete(string.Format("configuration/{0}/{1}", entity, RestClientHelper.ConvertUInt16ListToString(keys)), cancellationToken));
            }

            return(Delete(string.Format("configuration/{0}", entity), cancellationToken));
        }
 /// <summary>
 /// Removes the catalog entries with the specified <paramref name="keys"/> from the catalog <paramref name="catalogUuid"/>. If the list of keys
 /// is empty, all catalog entries will be removed.
 /// </summary>
 /// <param name="catalogUuid">The uuid of the catalog to remove the entries from.</param>
 /// <param name="keys">The keys of the catalog entries to delete.</param>
 /// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
 public Task DeleteCatalogEntries(Guid catalogUuid, ushort[] keys = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Delete(string.Format("catalogs/{0}/{1}", catalogUuid, RestClientHelper.ConvertUInt16ListToString(keys)), cancellationToken));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a <see cref="ParameterDefinition"/> list that represents this filter.
        /// </summary>
        public ParameterDefinition[] ToParameterDefinition()
        {
            var result = new List <ParameterDefinition>();

            if (Deep)
            {
                result.Add(ParameterDefinition.Create(DeepParamName, Deep.ToString()));
            }

            if (LimitResult >= 0)
            {
                result.Add(ParameterDefinition.Create(LimitResultParamName, LimitResult.ToString()));
            }

            if (MeasurementUuids != null && MeasurementUuids.Length > 0)
            {
                result.Add(ParameterDefinition.Create(MeasurementUuidsParamName, RestClientHelper.ConvertGuidListToString(MeasurementUuids)));
            }

            if (CharacteristicsUuidList != null && CharacteristicsUuidList.Length > 0)
            {
                result.Add(ParameterDefinition.Create(CharacteristicsUuidListParamName, RestClientHelper.ConvertGuidListToString(CharacteristicsUuidList)));
            }

            if (RequestedValueAttributes != null && RequestedValueAttributes.AllAttributes != AllAttributeSelection.True && RequestedValueAttributes.Attributes != null)
            {
                result.Add(ParameterDefinition.Create(RequestedValueAttributesParamName, RestClientHelper.ConvertUInt16ListToString(RequestedValueAttributes.Attributes)));
            }

            if (RequestedMeasurementAttributes != null && RequestedMeasurementAttributes.AllAttributes != AllAttributeSelection.True && RequestedMeasurementAttributes.Attributes != null)
            {
                result.Add(ParameterDefinition.Create(RequestedMeasurementAttributesParamName, RestClientHelper.ConvertUInt16ListToString(RequestedMeasurementAttributes.Attributes)));
            }

            if (OrderBy != null && OrderBy.Length > 0)
            {
                result.Add(ParameterDefinition.Create(OrderByParamName, MeasurementFilterAttributes.OrderByToString(OrderBy)));
            }

            if (SearchCondition != null)
            {
                result.Add(ParameterDefinition.Create(SearchConditionParamName, SearchConditionParser.GenericConditionToString(SearchCondition)));
            }

            if (AggregationMeasurements != AggregationMeasurementSelection.Default)
            {
                result.Add(ParameterDefinition.Create(AggregationParamName, AggregationMeasurements.ToString()));
            }

            if (FromModificationDate.HasValue)
            {
                result.Add(ParameterDefinition.Create(FromModificationDateParamName, XmlConvert.ToString(FromModificationDate.Value, XmlDateTimeSerializationMode.RoundtripKind)));
            }

            if (ToModificationDate.HasValue)
            {
                result.Add(ParameterDefinition.Create(ToModificationDateParamName, XmlConvert.ToString(ToModificationDate.Value, XmlDateTimeSerializationMode.RoundtripKind)));
            }

            return(result.ToArray());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a <see cref="ParameterDefinition"/> list that represents this filter.
        /// </summary>
        public IEnumerable <ParameterDefinition> ToParameterDefinition()
        {
            var result = new List <ParameterDefinition>();

            if (Depth.HasValue)
            {
                result.Add(ParameterDefinition.Create(DepthParamName, Depth.ToString()));
            }

            if (WithHistory)
            {
                result.Add(ParameterDefinition.Create(WithHistoryParamName, WithHistory.ToString()));
            }

            if (PartUuids != null && PartUuids.Length > 0)
            {
                result.Add(ParameterDefinition.Create(PartUuidsParamName, RestClientHelper.ConvertGuidListToString(PartUuids)));
            }

            if (RequestedPartAttributes != null && RequestedPartAttributes.AllAttributes != AllAttributeSelection.True && RequestedPartAttributes.Attributes != null)
            {
                result.Add(ParameterDefinition.Create(RequestedPartAttributesParamName, RestClientHelper.ConvertUInt16ListToString(RequestedPartAttributes.Attributes)));
            }

            if (RequestedCharacteristicAttributes != null && RequestedCharacteristicAttributes.AllAttributes != AllAttributeSelection.True && RequestedCharacteristicAttributes.Attributes != null)
            {
                result.Add(ParameterDefinition.Create(RequestedCharacteristicsAttributesParamName, RestClientHelper.ConvertUInt16ListToString(RequestedCharacteristicAttributes.Attributes)));
            }

            return(result);
        }