예제 #1
0
 public SearchResult Search(ObjectClass objectClass, Filter filter, ResultsHandler handler, OperationOptions options)
 {
     return ((SearchApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<SearchApiOp>())).Search(
             objectClass, filter, handler, options);
 }
 /// <summary>
 /// Implementation of SearchOp.ExecuteQuery
 /// </summary>
 /// <param name="oclass">Object class</param>
 /// <param name="query">Query to execute</param>
 /// <param name="handler">Result handler</param>
 /// <param name="options">Operation options</param>
 public override void ExecuteQuery(
     ObjectClass oclass,
     string query,
     ResultsHandler handler,
     OperationOptions options)
 {
     // TODO: Implement ExecuteQuery
     base.ExecuteQuery(oclass, query, handler, options);
 }
        public void SearchCallPattern()
        {
            TestCallPattern(new TestOperationPattern()
            {
                MakeCall = facade =>
                {
                    // create an empty results handler..
                    ResultsHandler rh = new ResultsHandler()
                    {
                        Handle = obj => {
                            return true;
                        }

                    };
                    // call the search method..
                    facade.Search(ObjectClass.ACCOUNT, null, rh, null);
                },
                CheckCalls = calls =>
                {
                    Assert.AreEqual("CreateFilterTranslator", GetAndRemoveMethodName(calls));
                    Assert.AreEqual("ExecuteQuery", GetAndRemoveMethodName(calls));
                }
            });
        }
 public void SearchAllCallPattern()
 {
     TestCallPattern(new TestOperationPattern()
     {
         MakeCall = facade =>
         {
             // create an empty results handler..
             ResultsHandler rh = new ResultsHandler()
             {
                 Handle = obj =>
                     {
                         return true;
                     }
             };
             // call the search method..
             facade.Search(ObjectClass.ALL, null, rh, null);
         },
         CheckCalls = calls =>
         {
             Assert.Fail("Should not get here..");
         }
     });
 }
 public MsPowerShellSearchResults(ObjectClass objectClass, ResultsHandler handler)
 {
     _objectClass = objectClass;
     _handler = handler;
 }
예제 #6
0
 public void Search(ObjectClass oclass, Filter filter, ResultsHandler handler, OperationOptions options)
 {
     ((SearchApiOp)this.GetOperationCheckSupported(SafeType<APIOperation>.Get<SearchApiOp>())).Search(
             oclass, filter, handler, options);
 }
예제 #7
0
        internal ConnectorObject GetCurrentObject(UpdateOpContext context, string query)
        {
            ConnectorObject currentObject = null;
            LOGGER.TraceEvent(TraceEventType.Verbose, CAT_DEFAULT, "Fetching object using query {0}", query);

            ResultsHandler handler = new ResultsHandler()
            {
                Handle = cobject =>
                {
                    //LOGGER.TraceEvent(TraceEventType.Verbose, CAT_DEFAULT, "Object-to-be-modified: {0}", CommonUtils.DumpConnectorAttributes(cobject.GetAttributes()));
                    if (currentObject != null)
                    {
                        throw new InvalidOperationException("More than one object complying with " + query + " was found");
                    }
                    currentObject = cobject;
                    return true;
                }
            };

            ((ExchangeConnector) context.Connector).ExecuteQuery(context.ObjectClass, query, handler, null);
            if (currentObject == null)
            {
                throw new ObjectNotFoundException("Object with UID " + context.Uid.GetUidValue() + " was not found");
            }

            return currentObject;
        }