/// <summary>
 /// Call Near Duplicate Computation
 /// </summary>
 private void PerformNearDuplicateComputation()
 {
     //Initialize Near Dupe Adapter
     _nearDuplicationAdapter = new EVPolarisNearDuplicationAdapter();
     _nearDuplicationAdapter.InitializeAdapter(_connectionString, _ingestionId, _licenseServer,
                                               _clusterThreshHold, _familyThreshHold);
     Tracer.Info("Near Duplication Processing Worker: Computation started time {0} for job run id :{1}", DateTime.Now, PipelineId);
     //Index & Group documents
     _nearDuplicationAdapter.PerformNearDuplicateComputation();
     Tracer.Info("Near Duplication Processing Worker: Computation completed time {0} for job run id :{1}", DateTime.Now, PipelineId);
 }
        protected override void BeginWork()
        {
            base.BeginWork();

            _jobParameter =
                (NearDuplicationJobBEO)XmlUtility.DeserializeObject(BootParameters, typeof(NearDuplicationJobBEO));

            #region "Assertion"

            _jobParameter.DatasetId.ShouldBeGreaterThan(0);
            _jobParameter.MatterId.ShouldBeGreaterThan(0);
            _jobParameter.CollectionId.ShouldNotBeEmpty();
            // _jobParameter.JobName.ShouldNotBeEmpty();

            #endregion

            _ingestionId = string.Format("{0}_Dataset-{1}_RunId-{2}", _jobParameter.JobName, _jobParameter.DatasetId, PipelineId);
            var familyThreshHold = ((_jobParameter.FamilyThreshold > 0)
                                        ? (byte)_jobParameter.FamilyThreshold
                                        : Constants.NearDuplicationFamilyThresholdDefaultValue);
            var clusterThreshHold = ((_jobParameter.ClusterThreshold > 0)
                                         ? (byte)_jobParameter.ClusterThreshold
                                         : Constants.NearDuplicationClusterThresholdDefaultValue);

            //Get Vault Database Connection string
            var documentVaultManager = new DocumentVaultManager();
            _connectionString = documentVaultManager.GetConnectionStringForMatter(_jobParameter.MatterId);

            //Get Dataset details
            _dataset = DataSetBO.GetDataSetDetailForDataSetId(_jobParameter.DatasetId);
            _dataset.ShouldNotBe(null);

            //Get Polaris license server IP address
            var licenseServer =
                CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.NearDuplicationPolarisLicenseKeyName);

            try
            {
                //Initialize Near Dupe Adapter
                _nearDuplicationAdapter = new EVPolarisNearDuplicationAdapter();
                _nearDuplicationAdapter.InitializeAdapter(_connectionString, _ingestionId, licenseServer,
                                                          clusterThreshHold,
                                                          familyThreshHold);
            }
            catch (Exception ex)
            {
                Tracer.Error(
                    "Near Duplication Start Up Worker: Failed to initialize Near duplication engine for job run id:{0}, exception:{1}",
                    PipelineId, ex);
                throw;
            }
            // _nearDuplicationAdapter.DeleteAllData();
        }
        protected override void BeginWork()
        {
            base.BeginWork();

            _jobParameter =
                (NearDuplicationJobBEO) XmlUtility.DeserializeObject(BootParameters, typeof (NearDuplicationJobBEO));

            #region "Assertion"

            _jobParameter.DatasetId.ShouldBeGreaterThan(0);
            _jobParameter.MatterId.ShouldBeGreaterThan(0);
            _jobParameter.CollectionId.ShouldNotBeEmpty();
           // _jobParameter.JobName.ShouldNotBeEmpty();

            #endregion
                       
            _ingestionId = string.Format("{0}_Dataset-{1}_RunId-{2}", _jobParameter.JobName, _jobParameter.DatasetId, PipelineId);
            var familyThreshHold = ((_jobParameter.FamilyThreshold > 0)
                                        ? (byte) _jobParameter.FamilyThreshold
                                        : Constants.NearDuplicationFamilyThresholdDefaultValue);
            var clusterThreshHold = ((_jobParameter.ClusterThreshold > 0)
                                         ? (byte) _jobParameter.ClusterThreshold
                                         : Constants.NearDuplicationClusterThresholdDefaultValue);

            //Get Vault Database Connection string
            var documentVaultManager = new DocumentVaultManager();
            _connectionString = documentVaultManager.GetConnectionStringForMatter(_jobParameter.MatterId);

            //Get Dataset details
            _dataset= DataSetBO.GetDataSetDetailForDataSetId(_jobParameter.DatasetId);
            _dataset.ShouldNotBe(null);

            //Get Polaris license server IP address
            var licenseServer =
                CmgServiceConfigBO.GetServiceConfigurationsforConfig(Constants.NearDuplicationPolarisLicenseKeyName);

            try
            {
                //Initialize Near Dupe Adapter
                _nearDuplicationAdapter = new EVPolarisNearDuplicationAdapter();
                _nearDuplicationAdapter.InitializeAdapter(_connectionString, _ingestionId, licenseServer,
                                                          clusterThreshHold,
                                                          familyThreshHold);
            }
            catch (Exception ex)
            {
                Tracer.Error(
                    "Near Duplication Start Up Worker: Failed to initialize Near duplication engine for job run id:{0}, exception:{1}",
                    PipelineId, ex);
                throw;
            }
           // _nearDuplicationAdapter.DeleteAllData();
        }
 /// <summary>
 /// Call Near Duplicate Computation
 /// </summary>
 private void PerformNearDuplicateComputation()
 {
     //Initialize Near Dupe Adapter
     _nearDuplicationAdapter = new EVPolarisNearDuplicationAdapter();
     _nearDuplicationAdapter.InitializeAdapter(_connectionString, _ingestionId, _licenseServer,
                                                 _clusterThreshHold, _familyThreshHold);
     Tracer.Info("Near Duplication Processing Worker: Computation started time {0} for job run id :{1}", DateTime.Now, PipelineId);
     //Index & Group documents
     _nearDuplicationAdapter.PerformNearDuplicateComputation();
     Tracer.Info("Near Duplication Processing Worker: Computation completed time {0} for job run id :{1}", DateTime.Now, PipelineId);
 }