Ejemplo n.º 1
0
        // Process staging data in the staging table with the specified batch tag.
        private static void ProcessStagingData(string modelName, string entityName, string versionName, string batchTag, MemberType memberType)
        {
            try
            {
                // Set model, entity, and version objects.
                MDSTestService.Identifier modelId = new MDSTestService.Identifier {
                    Name = modelName
                };
                MDSTestService.Identifier entityId = new MDSTestService.Identifier {
                    Name = entityName
                };
                MDSTestService.Identifier versionId = new MDSTestService.Identifier {
                    Name = versionName
                };

                // Get entity MUID.
                MetadataGetRequest getRequest = new MetadataGetRequest();
                getRequest.SearchCriteria        = new MetadataSearchCriteria();
                getRequest.SearchCriteria.Models = new System.Collections.ObjectModel.Collection <Identifier> {
                };
                getRequest.SearchCriteria.Models.Add(modelId);
                getRequest.SearchCriteria.Entities = new System.Collections.ObjectModel.Collection <Identifier> {
                };
                getRequest.SearchCriteria.Entities.Add(entityId);
                getRequest.SearchCriteria.Versions = new System.Collections.ObjectModel.Collection <Identifier> {
                };
                getRequest.SearchCriteria.Versions.Add(versionId);
                getRequest.SearchCriteria.SearchOption = SearchOption.BothUserDefinedAndSystemObjects;

                getRequest.ResultOptions          = new MetadataResultOptions();
                getRequest.ResultOptions.Entities = ResultType.Identifiers;
                getRequest.ResultOptions.Versions = ResultType.Identifiers;

                MetadataGetResponse getResponse = clientProxy.MetadataGet(getRequest);
                HandleOperationErrors(getResponse.OperationResult);

                // Set entity MUID since it cannot be specified only by name.
                entityId.Id = getResponse.Metadata.Entities[0].Identifier.Id;

                // Set entity MUID since it cannot be specified only by name.
                versionId.Id = getResponse.Metadata.Versions[0].Identifier.Id;
                // Create the request object.
                MDSTestService.EntityStagingProcessRequest processRequest = new EntityStagingProcessRequest();
                processRequest.BatchTag   = batchTag;
                processRequest.EntityId   = entityId;
                processRequest.VersionId  = versionId;
                processRequest.MemberType = MemberType.Leaf;

                // Process staging data.
                MDSTestService.EntityStagingProcessResponse processResponse = clientProxy.EntityStagingProcess(processRequest);

                HandleOperationErrors(processResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
Ejemplo n.º 2
0
        // Get the staging information such as batch status and the error information.
        // In this example returns the batch id for the specified batch tag.
        private static int GetStagingInformation(string modelName, string batchTag)
        {
            int batchId = -1;

            try
            {
                // Set model object.
                MDSTestService.Identifier modelId = new MDSTestService.Identifier {
                    Name = modelName
                };

                // Create the request object.
                // Get batch information for the specified model.
                MDSTestService.EntityStagingGetRequest getInfoRequest = new EntityStagingGetRequest();
                EntityStagingGetCriteria getCriteria = new EntityStagingGetCriteria();
                getCriteria.ModelId = modelId;
                getCriteria.IncludeClearedBatches = false;
                getInfoRequest.GetCriteria        = getCriteria;

                MDSTestService.EntityStagingGetResponse getInfoResponse = clientProxy.EntityStagingGet(getInfoRequest);

                HandleOperationErrors(getInfoResponse.OperationResult);

                // Find the batch id (the last one) for the specified batch tag.
                foreach (EntityStagingBatch aBatch in getInfoResponse.Batches)
                {
                    if (string.Equals(aBatch.BatchTag, batchTag, StringComparison.OrdinalIgnoreCase))
                    {
                        batchId = aBatch.BatchId.Value;
                        // You can also access the error information or the batch status.
                        // aBatch.ErrorView
                        // aBatch.Status
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }

            return(batchId);
        }
Ejemplo n.º 3
0
        // Clear the batch staging data for the specified batch id.
        private static void ClearStagingData(string modelName, int batchId)
        {
            try
            {
                // Set model and batch objects.
                MDSTestService.Identifier modelId = new MDSTestService.Identifier { Name = modelName };

                // Create the request object.
                MDSTestService.EntityStagingClearRequest clearRequest = new EntityStagingClearRequest();
                clearRequest.ModelId = modelId;
                clearRequest.BatchId = batchId;

                // Clear the batch staging data.
                MDSTestService.EntityStagingClearResponse processResponse = clientProxy.EntityStagingClear(clearRequest);

                HandleOperationErrors(processResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
Ejemplo n.º 4
0
        // Clear the batch staging data for the specified batch id.
        private static void ClearStagingData(string modelName, int batchId)
        {
            try
            {
                // Set model and batch objects.
                MDSTestService.Identifier modelId = new MDSTestService.Identifier {
                    Name = modelName
                };

                // Create the request object.
                MDSTestService.EntityStagingClearRequest clearRequest = new EntityStagingClearRequest();
                clearRequest.ModelId = modelId;
                clearRequest.BatchId = batchId;

                // Clear the batch staging data.
                MDSTestService.EntityStagingClearResponse processResponse = clientProxy.EntityStagingClear(clearRequest);

                HandleOperationErrors(processResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
Ejemplo n.º 5
0
        // Process staging data in the staging table with the specified batch tag.
        private static void ProcessStagingData(string modelName, string entityName, string versionName, string batchTag, MemberType memberType)
        {
            try
            {
                // Set model, entity, and version objects.
                MDSTestService.Identifier modelId = new MDSTestService.Identifier { Name = modelName };
                MDSTestService.Identifier entityId = new MDSTestService.Identifier { Name = entityName };
                MDSTestService.Identifier versionId = new MDSTestService.Identifier { Name = versionName };

                // Get entity MUID.
                MetadataGetRequest getRequest = new MetadataGetRequest();
                getRequest.SearchCriteria = new MetadataSearchCriteria();
                getRequest.SearchCriteria.Models = new System.Collections.ObjectModel.Collection<Identifier> { };
                getRequest.SearchCriteria.Models.Add(modelId);
                getRequest.SearchCriteria.Entities = new System.Collections.ObjectModel.Collection<Identifier> { };
                getRequest.SearchCriteria.Entities.Add(entityId);
                getRequest.SearchCriteria.Versions = new System.Collections.ObjectModel.Collection<Identifier> { };
                getRequest.SearchCriteria.Versions.Add(versionId);
                getRequest.SearchCriteria.SearchOption = SearchOption.BothUserDefinedAndSystemObjects;

                getRequest.ResultOptions = new MetadataResultOptions();
                getRequest.ResultOptions.Entities = ResultType.Identifiers;
                getRequest.ResultOptions.Versions = ResultType.Identifiers;

                MetadataGetResponse getResponse = clientProxy.MetadataGet(getRequest);
                HandleOperationErrors(getResponse.OperationResult);

                // Set entity MUID since it cannot be specified only by name.
                entityId.Id = getResponse.Metadata.Entities[0].Identifier.Id;

                // Set entity MUID since it cannot be specified only by name.
                versionId.Id = getResponse.Metadata.Versions[0].Identifier.Id;
                // Create the request object.
                MDSTestService.EntityStagingProcessRequest processRequest = new EntityStagingProcessRequest();
                processRequest.BatchTag = batchTag;
                processRequest.EntityId = entityId;
                processRequest.VersionId = versionId;
                processRequest.MemberType = MemberType.Leaf;

                // Process staging data.
                MDSTestService.EntityStagingProcessResponse processResponse = clientProxy.EntityStagingProcess(processRequest);

                HandleOperationErrors(processResponse.OperationResult);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }
        }
Ejemplo n.º 6
0
        // Get the staging information such as batch status and the error information.
        // In this example returns the batch id for the specified batch tag.
        private static int GetStagingInformation(string modelName, string batchTag)
        {
            int batchId = -1;

            try
            {
                // Set model object.
                MDSTestService.Identifier modelId = new MDSTestService.Identifier { Name = modelName };

                // Create the request object.
                // Get batch information for the specified model.
                MDSTestService.EntityStagingGetRequest getInfoRequest = new EntityStagingGetRequest();
                EntityStagingGetCriteria getCriteria = new EntityStagingGetCriteria();
                getCriteria.ModelId = modelId;
                getCriteria.IncludeClearedBatches = false;
                getInfoRequest.GetCriteria = getCriteria;

                MDSTestService.EntityStagingGetResponse getInfoResponse = clientProxy.EntityStagingGet(getInfoRequest);

                HandleOperationErrors(getInfoResponse.OperationResult);

                // Find the batch id (the last one) for the specified batch tag.
                foreach (EntityStagingBatch aBatch in getInfoResponse.Batches)
                {
                    if (string.Equals(aBatch.BatchTag, batchTag, StringComparison.OrdinalIgnoreCase))
                    {
                        batchId = aBatch.BatchId.Value;
                        // You can also access the error information or the batch status.
                        // aBatch.ErrorView
                        // aBatch.Status
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }

            return batchId;
        }