Ejemplo n.º 1
0
        /// ****************************************************************
        ///   public FindBuilder [constructor]
        /// ----------------------------------------------------------------
        ///   <summary>
        ///   </summary>
        /// ----------------------------------------------------------------
        ///   <param name="entityType">
        ///     The type of entity to search for.
        ///   </param>
        ///
        ///   <param name="findQualifiers">
        ///   </param>
        /// ****************************************************************
        ///
        public FindBuilder(EntityType entityType, FindQualifierCollection findQualifiers)
        {
            this.entityType = entityType;
            this.entityName = Conversions.EntityNameFromID(entityType);

            //
            // Parse the find qualifiers.
            //
            if (null != findQualifiers)
            {
                foreach (FindQualifier findQualifier in findQualifiers)
                {
                    //
                    // Need to trim whitespace
                    //
                    switch (findQualifier.Value.Trim())
                    {
                    case "exactNameMatch":
                        if (EntityType.BusinessEntity == entityType ||
                            EntityType.BusinessService == entityType ||
                            EntityType.TModel == entityType)
                        {
                            ExactNameMatch = true;
                        }
                        break;

                    case "caseSensitiveMatch":
                        if (EntityType.BusinessEntity == entityType ||
                            EntityType.BusinessService == entityType ||
                            EntityType.TModel == entityType)
                        {
                            CaseSensitiveMatch = true;
                        }
                        break;

                    case "sortByNameAsc":
                        if (EntityType.BusinessEntity == entityType ||
                            EntityType.BusinessService == entityType ||
                            EntityType.TModel == entityType)
                        {
                            //
                            // sortByNameAsc and sortByNameDesc are mutually exclusive.
                            //
                            Debug.Verify(!SortByNameDesc, "UDDI_ERROR_UNSUPPORTED_NAMEASCANDDESC", ErrorType.E_unsupported);
                            SortByNameAsc = true;
                        }
                        break;

                    case "sortByNameDesc":
                        if (EntityType.BusinessEntity == entityType ||
                            EntityType.BusinessService == entityType ||
                            EntityType.TModel == entityType)
                        {
                            //
                            // sortByNameAsc and sortByNameDesc are mutually exclusive.
                            //
                            Debug.Verify(!SortByNameAsc, "UDDI_ERROR_UNSUPPORTED_NAMEASCANDDESC", ErrorType.E_unsupported);

                            SortByNameDesc = true;
                        }
                        break;

                    case "sortByDateAsc":
                        if (EntityType.BindingTemplate == entityType ||
                            EntityType.BusinessEntity == entityType ||
                            EntityType.BusinessService == entityType ||
                            EntityType.TModel == entityType)
                        {
                            //
                            // sortByDateAsc and sortByDateDesc are mutually exclusive.
                            //
                            Debug.Verify(!SortByDateDesc, "UDDI_ERROR_UNSUPPORTED_DATEASCANDDESC", ErrorType.E_unsupported);
                            SortByDateAsc = true;
                        }
                        break;

                    case "sortByDateDesc":
                        if (EntityType.BindingTemplate == entityType ||
                            EntityType.BusinessEntity == entityType ||
                            EntityType.BusinessService == entityType ||
                            EntityType.TModel == entityType)
                        {
                            //
                            // sortByDateAsc and sortByDateDesc are mutually exclusive.
                            //
                            Debug.Verify(!SortByDateAsc, "UDDI_ERROR_UNSUPPORTED_DATEASCANDDESC", ErrorType.E_unsupported);
                            SortByDateDesc = true;
                        }
                        break;

                    case "orLikeKeys":
                        if (EntityType.BusinessEntity == entityType ||
                            EntityType.BusinessService == entityType ||
                            EntityType.TModel == entityType)
                        {
                            //
                            // orLikeKeys, orAllKeys, and andAllKeys are mutually exclusive.
                            //
                            Debug.Verify(!OrAllKeys && !AndAllKeys, "UDDI_ERROR_UNSUPPORTED_KEYSORAND", ErrorType.E_unsupported);
                            OrLikeKeys = true;
                        }
                        break;

                    case "orAllKeys":
                        if (EntityType.BusinessEntity == entityType ||
                            EntityType.BindingTemplate == entityType ||
                            EntityType.BusinessService == entityType ||
                            EntityType.TModel == entityType)
                        {
                            //
                            // orLikeKeys, orAllKeys, and andAllKeys are mutually exclusive.
                            //
                            Debug.Verify(!OrLikeKeys && !AndAllKeys, "UDDI_ERROR_UNSUPPORTED_KEYSORAND", ErrorType.E_unsupported);

                            OrAllKeys = true;
                        }
                        break;

                    case "combineCategoryBags":
                        if (EntityType.BusinessEntity == entityType)
                        {
                            CombineCategoryBags = true;
                        }
                        break;

                    case "serviceSubset":
                        if (EntityType.BusinessEntity == entityType)
                        {
                            ServiceSubset = true;
                        }
                        break;

                    case "andAllKeys":
                        if (EntityType.BusinessEntity == entityType ||
                            EntityType.TModel == entityType)
                        {
                            //
                            // orLikeKeys, orAllKeys, and andAllKeys are mutually exclusive.
                            //
                            Debug.Verify(!OrLikeKeys && !OrAllKeys, "UDDI_ERROR_UNSUPPORTED_KEYSORAND", ErrorType.E_unsupported);

                            AndAllKeys = true;
                        }
                        break;

                    default:
                        throw new UDDIException(
                                  ErrorType.E_unsupported,
                                  "UDDI_ERROR_UNSUPPORTED_FINDQUALIFIER",
                                  findQualifier.Value);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// ****************************************************************
 ///   public FindBuilder [constructor]
 /// ----------------------------------------------------------------
 ///   <summary>
 ///   </summary>
 /// ----------------------------------------------------------------
 ///   <param name="entityType">
 ///     The type of entity to search for.
 ///   </param>
 ///
 ///   <param name="findQualifiers">
 ///   </param>
 ///
 ///   <param name="parentKey">
 ///   </param>
 /// ****************************************************************
 ///
 public FindBuilder(EntityType entityType, FindQualifierCollection findQualifiers, string parentKey)
     : this(entityType, findQualifiers)
 {
     this.parentKey = parentKey;
 }