示例#1
0
        private static IDictionary <String, Object> CreateFilter(String operation, AttributeFilter filter, bool not)
        {
            IDictionary <String, Object> dic = new Dictionary <String, Object>();
            var name  = filter.GetAttribute().Name;
            var value = ConnectorAttributeUtil.GetStringValue(filter.GetAttribute());

            if (StringUtil.IsBlank(value))
            {
                return(null);
            }
            dic.Add(Not, not);
            dic.Add(Operation, operation);
            dic.Add(Left, name);
            dic.Add(Right, value);
            return(dic);
        }
        private String CreateContainsAllValuesExpressionInternal(AttributeFilter filter, Boolean not)
        {
            if (not)
            {
                return(null);
            }

            ConnectorAttribute attr = filter.GetAttribute();

            // if there is only one thing to search on, and it's
            // a uid we need to convert the uid to something we
            // can search on.  NOTE:  only handling the case where
            // we are doing an equality search, and only one item
            // is in the equality search ... It's all that makes
            // sense for uid.
            if (attr is Uid)
            {
                String attrValue = ((Uid)attr).GetUidValue();
                if (LooksLikeGUID(attrValue))
                {
                    String searchGuid = GetUidSearchString(((Uid)attr).GetUidValue());
                    attr = new Uid(searchGuid);
                }
                else
                {
                    attr = new Name(attrValue);
                }
            }


            String[] attrNames = GetLdapNamesForAttribute(attr);
            if (attrNames == null)
            {
                return(null);
            }

            StringBuilder builder = new StringBuilder();

            if (attr.Value == null)
            {
                return(null);
            }
            if (attr.Value.Count == 1)
            {
                BuildEqualityFilter(builder, attrNames,
                                    attr.Value[0]);
            }
            else
            {
                builder.Append("(&");
                foreach (Object value in attr.Value)
                {
                    BuildEqualityFilter(builder, attrNames, value);
                }
                builder.Append(')');
            }

            return(builder.ToString());
        }
示例#3
0
        private String CreateContainsAllValuesExpressionInternal(AttributeFilter filter, Boolean not)
        {
            if (not)
            {
                return(null);
            }

            ConnectorAttribute attr = filter.GetAttribute();

            if (attr is Uid)
            {
                return(((Uid)attr).GetUidValue());
            }
            else if (attr is Name)
            {
                return(((Name)attr).GetNameValue());
            }
            else
            {
                return(null);
            }
        }