Наследование: ImdaRequest
Пример #1
0
 public void Put(PutRequest request, out PutResponse response, SecurityToken token)
 {
     Put(request, out response, token, null);
 }
Пример #2
0
        /// <summary>
        /// Constructs a put request based on the changes tracked in the transaction.
        /// </summary>
        /// <param name="transaction">The transaction object which tracked the changes made to an object.</param>
        /// <returns></returns>
        public virtual PutRequest CreatePutRequest(RmResourceChanges transaction)
        {
            if (transaction == null)
            {
                throw new ArgumentNullException("transaction");
            }

            RmResource rmObject = transaction.RmObject;
            if (rmObject == null)
            {
                throw new InvalidOperationException("transaction does not have rmObject");
            }
            if (rmObject.ObjectID == null) {
                throw new InvalidOperationException("The rmObject does not have an ObjectID.");
            }
            lock (rmObject)
            {

                PutRequest putRequest = new PutRequest();

                putRequest.ResourceReferenceProperty = new ResourceReferenceProperty(rmObject.ObjectID.ToString());
                if (string.IsNullOrEmpty(rmObject.Locale) == false)
                {
                    putRequest.ResourceLocaleProperty = new ResourceLocaleProperty(new System.Globalization.CultureInfo(rmObject.Locale));
                }

                putRequest.ModifyRequest = new ModifyRequest();

                IList<RmAttributeChange> changes = transaction.GetChanges();

                foreach (RmAttributeChange attributeChange in changes)
                {
                    if (this.ProhibitedAttributes.ContainsKey(attributeChange.Name.Name))
                        continue;

                    DirectoryAccessChange putReqChange = BuildDirectoryAccessChange(attributeChange);

                    if (base.IsMultiValued(attributeChange.Name))
                    {
                        putReqChange.Operation = attributeChange.Operation.ToString();
                    }
                    else
                    {
                        if (attributeChange.Operation == RmAttributeChangeOperation.Add)
                        {
                            putReqChange.Operation = RmAttributeChangeOperation.Replace.ToString();
                        }
                        else if (attributeChange.Operation == RmAttributeChangeOperation.Delete)
                        {
                            putReqChange.Operation = RmAttributeChangeOperation.Replace.ToString();
                            putReqChange.AttributeValue = null;
                        } else {
                            putReqChange.Operation = attributeChange.Operation.ToString();
                        }
                    }
                    putRequest.ModifyRequest.Changes.Add(putReqChange);
                }
                return putRequest;
            }
        }
Пример #3
0
 public void Put(PutRequest request, out PutResponse response)
 {
     Put(request, out response, null);
 }