Beispiel #1
0
        // Token: 0x06000285 RID: 645 RVA: 0x000117FC File Offset: 0x0000F9FC
        private static bool CheckClaimSetsForPartnerUser(AuthorizationContext authorizationContext, OperationContext operationContext)
        {
            HttpContext.Current.Items["AuthType"] = "Partner";
            PerformanceCounters.UpdateRequestsReceivedWithPartnerToken();
            ReadOnlyCollection <ClaimSet> claimSets = authorizationContext.ClaimSets;

            claimSets.TraceClaimSets();
            DelegatedPrincipal delegatedPrincipal      = null;
            OrganizationId     delegatedOrganizationId = null;
            string             text = null;

            if (!PartnerToken.TryGetDelegatedPrincipalAndOrganizationId(claimSets, out delegatedPrincipal, out delegatedOrganizationId, out text))
            {
                ExTraceGlobals.AuthenticationTracer.TraceError <string>(0L, "[AutodiscoverAuthorizationManager.CheckClaimSetsForPartnerUser] unable to create partner identity, error message: {0}", text);
                PerformanceCounters.UpdateUnauthorizedRequestsReceivedWithPartnerToken();
                AutodiscoverAuthorizationManager.Return401UnauthorizedResponse(operationContext, text);
                return(false);
            }
            ExTraceGlobals.AuthenticationTracer.TraceDebug <DelegatedPrincipal>(0L, "[AutodiscoverAuthorizationManager.CheckClaimSetsForPartnerUser] ws-security header contains the partner identity: {0}", delegatedPrincipal);
            string text2 = delegatedPrincipal.ToString();

            if (!string.IsNullOrEmpty(text2))
            {
                AutodiscoverAuthorizationManager.PushUserAndOrgInfoToContext(text2, text2.Split(new char[]
                {
                    '\\'
                })[0]);
            }
            HttpContext.Current.User = new WindowsPrincipal(PartnerIdentity.Create(delegatedPrincipal, delegatedOrganizationId));
            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Save()
        /// </summary>
        public void Save(PartnerIdentity item)
        {
            if (item == null)
            {
                throw new ArgumentException("Null item");
            }
            DateTime now = DateTime.Now;
            string   id  = null;

            if (string.IsNullOrEmpty(item.Id))
            {
                id = IdProvider.Get();
                DoInsert(TABLE_NAME, "Id;Name;Url;ModifiedBy;ModifiedOn;Version",
                         id, item.Name, item.Url, item.ModifiedById,
                         now, item.Version.ToString());
            }
            else
            {
                DoSimpleUpdateOne(TABLE_NAME, "Id", item.Id.ToString(),
                                  "Name;Url;ModifiedBy;ModifiedOn;Version",
                                  item.Name, item.Url, item.ModifiedById,
                                  now, item.Version.ToString());
            }
            if (id != null)
            {
                item.Id = id;
            }
            item.ModifiedOn = now;
        }
Beispiel #3
0
        protected override void LazyInit()
        {
            base.LazyInit();

            _stagingDao = ValidateDBProvider(DATA_PARAM_STAGING_SOURCE, typeof(NamedNullMappingDataReader));

            GetConfigParameter(CONFIG_PARAM_USER_ID, out _userId);
            TryGetConfigParameter(CONFIG_PARAM_AUTHOR, ref _author);
            TryGetConfigParameter(CONFIG_PARAM_ORGANIZATION, ref _organization);
            TryGetConfigParameter(CONFIG_PARAM_CONTACT_INFO, ref _contactInfo);

            string notificationEmails = null;

            if (TryGetConfigParameter(CONFIG_PARAM_NOTIFY_EMAILS, ref notificationEmails))
            {
                _notificationEmails = StringUtils.SplitAndReallyRemoveEmptyEntries(notificationEmails, ';');
            }

            TryGetConfigParameter(CONFIG_PARAM_ICIS_FLOW_NAME, ref _flowName);

            TryGetConfigParameter(CONFIG_PARAM_VALIDATE_XML, ref _validateXml);

            _submissionPartner = TryGetConfigNetworkPartner(CONFIG_PARAM_SUBMISSION_PARTNER_NAME);

            GetServiceImplementation(out _serializationHelper);
            GetServiceImplementation(out _compressionHelper);
            GetServiceImplementation(out _documentManager);
            GetServiceImplementation(out _settingsProvider);
            GetServiceImplementation(out _nodeEndpointClientFactory);
            GetServiceImplementation(out _transactionManager);
            GetServiceImplementation(out _objectsFromDatabase);
        }
Beispiel #4
0
        protected void LazyInit()
        {
            GetServiceImplementation(out _requestManager);
            GetServiceImplementation(out _serializationHelper);
            GetServiceImplementation(out _compressionHelper);
            GetServiceImplementation(out _documentManager);
            GetServiceImplementation(out _headerDocumentHelper);
            GetServiceImplementation(out _settingsProvider);
            GetServiceImplementation(out _partnerManager);
            GetServiceImplementation(out _nodeEndpointClientFactory);
            GetServiceImplementation(out _transactionManager);

            _baseDao = ValidateDBProvider(DataProviderParameterType.SourceProvider.ToString(),
                                          typeof(NamedNullMappingDataReader));

            GetConfigParameter(CONFIG_ADD_HEADER, true, out _addHeader);
            if (_addHeader)
            {
                _author           = ValidateNonEmptyConfigParameter(CONFIG_AUTHOR);
                _organization     = ValidateNonEmptyConfigParameter(CONFIG_ORGANIZATION);
                _contactInfo      = ValidateNonEmptyConfigParameter(CONFIG_CONTACT_INFO);
                _payloadOperation = ValidateNonEmptyConfigParameter(CONFIG_PAYLOAD_OPERATION);
                _title            = ValidateNonEmptyConfigParameter(CONFIG_TITLE);
                TryGetConfigParameter(CONFIG_NOTIFICATIONS, ref _notifications);
                _rcraInfoUserId    = ValidateNonEmptyConfigParameter(CONFIG_RCRA_INFO_USER_ID);
                _rcraInfoStateCode = ValidateNonEmptyConfigParameter(CONFIG_RCRA_INFO_STATE_CODE);
            }

            ParseNaasUserMappingFile();

            string submitPartnerName = null;

            if (TryGetConfigParameter(CONFIG_SUBMISSION_PARTNER_NAME, ref submitPartnerName))
            {
                _submitPartnerNode = _partnerManager.GetByName(submitPartnerName);
                if (_submitPartnerNode == null)
                {
                    throw new ArgumentException(string.Format("A submission partner with the name \"{0}\" specified for this service cannot be found",
                                                              submitPartnerName));
                }
            }
            if (_submitPartnerNode != null)
            {
                if (_naasUsernameToPasswordMap == null)
                {
                    throw new ArgumentException(string.Format("The service specifies a \"{0},\" but does not specify a \"{1}\"",
                                                              CONFIG_SUBMISSION_PARTNER_NAME, CONFIG_NAAS_USER_MAPPING_FILE_PATH));
                }
            }
            else if (_naasUsernameToPasswordMap != null)
            {
                if (_submitPartnerNode == null)
                {
                    throw new ArgumentException(string.Format("The service specifies a \"{0},\" but does not specify a \"{1}\"",
                                                              CONFIG_NAAS_USER_MAPPING_FILE_PATH, CONFIG_SUBMISSION_PARTNER_NAME));
                }
            }
            TryGetConfigParameter(CONFIG_VALIDATE_XML, ref _validateXml);
        }
Beispiel #5
0
        protected override void LazyInit()
        {
            base.LazyInit();

            GetServiceImplementation(out _transactionManager);
            GetServiceImplementation(out _nodeEndpointClientFactory);
            GetServiceImplementation(out _partnerManager);

            GetConfigParameter(EnumUtils.ToDescription(EISConfigParams.AuthorName), out _authorName);
            GetConfigParameter(EnumUtils.ToDescription(EISConfigParams.OrganizationName), out _organizationName);
            GetConfigParameter(EnumUtils.ToDescription(EISConfigParams.SubmissionProgramSystemCode), out _programSystemCode);
            TryGetConfigParameter(EnumUtils.ToDescription(EISConfigParams.SenderContactInfo), ref _senderContactInfo);
            TryGetConfigParameter(EnumUtils.ToDescription(EISConfigParams.SubmissionFlowName), ref _submitFlowName);
            TryGetConfigParameter(EnumUtils.ToDescription(EISConfigParams.SubmissionOperationName), ref _submitFlowOperation);
            string submissionType;

            GetConfigParameter(EnumUtils.ToDescription(EISConfigParams.SubmissionType), out submissionType);
            if (string.Equals(submissionType, PRODUCTION_SUBMISSION_TYPE_NAME, StringComparison.InvariantCultureIgnoreCase))
            {
                _isProductionSubmission = true;
            }
            else if (string.Equals(submissionType, QA_SUBMISSION_TYPE_NAME, StringComparison.InvariantCultureIgnoreCase))
            {
                _isProductionSubmission = false;
            }
            else
            {
                throw new ArgumentException(string.Format("Invalid {0} specified: {1}, must be either \"{2}\" or \"{3}\"",
                                                          EnumUtils.ToDescription(EISConfigParams.SubmissionType),
                                                          submissionType, PRODUCTION_SUBMISSION_TYPE_NAME, QA_SUBMISSION_TYPE_NAME));
            }

            string epaPartnerName = null;

            TryGetConfigParameter(EnumUtils.ToDescription(EISConfigParams.SubmissionPartnerName), ref epaPartnerName);
            if (!string.IsNullOrEmpty(epaPartnerName))
            {
                _epaPartnerNode = _partnerManager.GetByName(epaPartnerName);
                if (_epaPartnerNode == null)
                {
                    throw new ArgumentException(string.Format("The \"{0}\" with the name \"{1}\" specified for this service cannot be found",
                                                              EnumUtils.ToDescription(EISConfigParams.SubmissionPartnerName), epaPartnerName));
                }
                if (string.IsNullOrEmpty(_submitFlowName))
                {
                    throw new ArgumentException(string.Format("The \"{0}\" configuration parameter was not specified",
                                                              EnumUtils.ToDescription(EISConfigParams.SubmissionFlowName)));
                }
            }
            AppendAuditLogEvent("Config params: {0} ({1}), {2} ({3}), {4} ({5}), {6} ({7}), {8} ({9}), {10} ({11}, {12} ({13})",
                                EnumUtils.ToDescription(EISConfigParams.AuthorName), _authorName,
                                EnumUtils.ToDescription(EISConfigParams.OrganizationName), _organizationName,
                                EnumUtils.ToDescription(EISConfigParams.SenderContactInfo), _senderContactInfo ?? string.Empty,
                                EnumUtils.ToDescription(EISConfigParams.SubmissionType), submissionType,
                                EnumUtils.ToDescription(EISConfigParams.SubmissionPartnerName), epaPartnerName ?? string.Empty,
                                EnumUtils.ToDescription(EISConfigParams.SubmissionFlowName), _submitFlowName ?? string.Empty,
                                EnumUtils.ToDescription(EISConfigParams.SubmissionOperationName), _submitFlowOperation ?? string.Empty);
        }
 public void Delete(PartnerIdentity instance, NodeVisit visit)
 {
     ValidateByRole(visit, SystemRoleType.Admin);
     TransactionTemplate.Execute(delegate
     {
         _partnerDao.Delete(instance);
         ActivityManager.LogAudit(NodeMethod.None, null, visit, "{0} deleted partner identity: {1}.",
                                  visit.Account.NaasAccount, instance.ToString());
         return(null);
     });
 }
Beispiel #7
0
        internal static PartnerIdentity MapPartnerIdentity(IDataReader reader)
        {
            PartnerIdentity partnerIdentity = new PartnerIdentity();
            int             index           = 0;

            partnerIdentity.Id           = reader.GetString(index++);
            partnerIdentity.Name         = reader.GetString(index++);
            partnerIdentity.Url          = reader.GetString(index++);
            partnerIdentity.ModifiedById = reader.GetString(index++);
            partnerIdentity.ModifiedOn   = reader.GetDateTime(index++);
            partnerIdentity.Version      = EnumUtils.ParseEnum <EndpointVersionType>(reader.GetString(index++));
            return(partnerIdentity);
        }
Beispiel #8
0
        protected virtual void ProcessWebServiceSolicitSource(ScheduledItem scheduledItem, Activity activity,
                                                              string transactionId)
        {
            PartnerIdentity partner = _partnerManager.GetById(scheduledItem.SourceId);

            if (partner == null)
            {
                throw new ArgumentException(string.Format("Invalid partner id \"{0}.\"  Could not find partner for scheduled item \"{1}\".",
                                                          scheduledItem.TargetId, scheduledItem.Name));
            }

            string filePath = Path.Combine(SettingsProvider.TempFolderPath, GetResultFileName(scheduledItem));

            string networkTransactionId;
            EndpointVersionType endpointVersion;
            string endpointUrl;
            string networkFlowName = null, networkFlowOperation = scheduledItem.SourceRequest;

            using (INodeEndpointClient client = GetNodeClient(partner, activity, scheduledItem.SourceEndpointUser))
            {
                try
                {
                    if (client.Version == EndpointVersionType.EN11)
                    {
                        networkTransactionId = client.Solicit(null, scheduledItem.SourceRequest, scheduledItem.GetTranformedSourceArgs(),
                                                              new string[] { SettingsProvider.Endpoint11Url });
                    }
                    else
                    {
                        networkTransactionId = client.Solicit(scheduledItem.SourceFlow, scheduledItem.SourceRequest,
                                                              scheduledItem.GetTranformedSourceArgs(),
                                                              new string[] { SettingsProvider.Endpoint20Url });
                        networkFlowName = scheduledItem.SourceFlow;
                    }
                }
                catch (Exception e)
                {
                    LogActivityError(activity, "Error returned from node endpoint: \"{0}\"", ExceptionUtils.GetDeepExceptionMessage(e));
                    throw;
                }
                endpointVersion = client.Version;
                endpointUrl     = client.Url;
            }
            LogActivity(activity, "Performed Solicit of partner \"{0}\" at url \"{1}\" with returned transaction id \"{2}\"",
                        partner.Name, partner.Url, networkTransactionId);
            _transactionManager.SetNetworkIdAndEndpointUserId(transactionId, networkTransactionId, endpointVersion, endpointUrl,
                                                              networkFlowName, networkFlowOperation,
                                                              null, scheduledItem.SourceEndpointUser);
            //_transactionManager.SetNetworkId(transactionId, networkTransactionId, endpointVersion, endpointUrl,
            //                                 networkFlowName, networkFlowOperation);
        }
        protected virtual void LazyInit(string transactionId)
        {
            AppendAuditLogEvent("Initializing {0} plugin ...", this.GetType().Name);

            GetServiceImplementation(out _transactionManager);
            GetServiceImplementation(out _settingsProvider);

            _transaction = _transactionManager.GetTransaction(transactionId);
            if (_transaction == null)
            {
                throw new ArgumentException(string.Format("Could not locate local transaction \"{0}\"",
                                                          transactionId));
            }

            _didSubmit = !string.IsNullOrEmpty(_transaction.NetworkEndpointUrl);

            _submitFlowName = _transaction.Flow.FlowName;

            if (_transaction.EndpointVersion == EndpointVersionType.EN11)
            {
                _submitPartner = GetConfigNetworkPartner(EnumUtils.ToDescription(ConfigParams.PartnerName11));
                if (_submitPartner.Version != EndpointVersionType.EN11)
                {
                    throw new ArgumentException(string.Format("The {0} \"{1}\" is not a {2} partner",
                                                              EnumUtils.ToDescription(ConfigParams.PartnerName11),
                                                              _submitPartner.Name,
                                                              EnumUtils.ToDescription(_submitPartner.Version)));
                }
            }
            else
            {
                _submitPartner = GetConfigNetworkPartner(EnumUtils.ToDescription(ConfigParams.PartnerName20));
                if (_submitPartner.Version != EndpointVersionType.EN20)
                {
                    throw new ArgumentException(string.Format("The {0} \"{1}\" is not a {2} partner",
                                                              EnumUtils.ToDescription(ConfigParams.PartnerName20),
                                                              _submitPartner.Name,
                                                              EnumUtils.ToDescription(_submitPartner.Version)));
                }
                _submitOperationName = _transaction.Operation;
                if (string.Equals(_submitPartner.Url, _settingsProvider.Endpoint11Url,
                                  StringComparison.OrdinalIgnoreCase) ||
                    string.Equals(_submitPartner.Url, _settingsProvider.Endpoint20Url,
                                  StringComparison.OrdinalIgnoreCase))
                {
                    throw new ArgumentException(string.Format("The {0} plugin has been configured to submit to itself",
                                                              this.GetType().Name));
                }
            }
        }
 public Exception CheckConnection(PartnerIdentity instance)
 {
     try
     {
         using (INodeEndpointClient client =
                    _nodeEndpointClientFactory.Make(instance.Url, instance.Version))
         {
             client.NodePing();
         }
         return(null);
     }
     catch (Exception e)
     {
         return(e);
     }
 }
        protected override void InitializeModel()
        {
            base.InitializeModel();

            if (_dataItemService == null)
            {
                throw new ArgumentNullException("DataItemService");
            }
            if (!string.IsNullOrEmpty(Request["id"]))
            {
                _dataItem = _dataItemService.GetByName(Request["id"], VisitHelper.GetVisit());
            }
            else
            {
                _dataItem = new PartnerIdentity();
            }
        }
Beispiel #12
0
        protected virtual void ProcessWebServiceQuerySource(ScheduledItem scheduledItem, Activity activity,
                                                            string transactionId)
        {
            PartnerIdentity partner = _partnerManager.GetById(scheduledItem.SourceId);

            if (partner == null)
            {
                throw new ArgumentException(string.Format("Invalid partner id \"{0}.\"  Could not find partner for scheduled item \"{1}\".",
                                                          scheduledItem.TargetId, scheduledItem.Name));
            }

            string filePath = Path.Combine(SettingsProvider.TempFolderPath, GetResultFileName(scheduledItem));

            using (INodeEndpointClient client = GetNodeClient(partner, activity, scheduledItem.SourceEndpointUser))
            {
                CommonContentType type;
                try
                {
                    if (client.Version == EndpointVersionType.EN11)
                    {
                        type = client.Query(null, scheduledItem.SourceRequest, scheduledItem.GetTranformedSourceArgs(),
                                            0, -1, filePath);
                        _transactionManager.SetNetworkIdAndEndpointUserId(transactionId, transactionId, EndpointVersionType.EN11, partner.Url,
                                                                          scheduledItem.SourceRequest, null,
                                                                          null, scheduledItem.SourceEndpointUser);
                    }
                    else
                    {
                        type = client.Query(scheduledItem.SourceFlow, scheduledItem.SourceRequest,
                                            scheduledItem.GetTranformedSourceArgs(), 0, -1, filePath);
                        _transactionManager.SetNetworkIdAndEndpointUserId(transactionId, transactionId, EndpointVersionType.EN20, partner.Url,
                                                                          scheduledItem.SourceFlow, scheduledItem.SourceRequest, null,
                                                                          scheduledItem.SourceEndpointUser);
                    }
                }
                catch (Exception e)
                {
                    LogActivityError(activity, "Error returned from node endpoint: \"{0}\"", ExceptionUtils.GetDeepExceptionMessage(e));
                    throw;
                }
                filePath = FileUtils.ChangeFileExtension(filePath, CommonContentAndFormatProvider.GetFileExtension(type));
                DocumentManager.AddDocument(transactionId, CommonTransactionStatusCode.Processed, null, filePath);
            }
            LogActivity(activity, "Performed Query of partner \"{0}\" at url \"{1}\"", partner.Name, partner.Url);
        }
Beispiel #13
0
        /// <summary>
        /// GetByCode()
        /// </summary>
        public PartnerIdentity GetByName(string name)
        {
            try
            {
                PartnerIdentity partnerIdentity =
                    DoSimpleQueryForObjectDelegate <PartnerIdentity>(
                        TABLE_NAME, "Name", name, MAP_PARTNER_IDENTITY_COLUMNS,
                        delegate(IDataReader reader, int rowNum)
                {
                    return(MapPartnerIdentity(reader));
                });

                return(partnerIdentity);
            }
            catch (Spring.Dao.IncorrectResultSizeDataAccessException)
            {
                return(null); // Not found
            }
        }
 protected void SaveDataItem(object sender, EventArgs e)
 {
     try
     {
         if (divPageError.Visible || !Page.IsValid)
         {
             // Error on page, get out of here
             return;
         }
         _dataItem = _dataItemService.Save(_dataItem, VisitHelper.GetVisit());
         ResponseRedirect("../Secure/ConfigPartner.aspx");
     }
     catch (Exception ex)
     {
         LOG.Error(ex.Message, ex);
         divPageError.Visible   = true;
         divPageError.InnerText = UIUtility.ParseException(ex);
     }
 }
        public PartnerIdentity Save(PartnerIdentity instance, NodeVisit visit)
        {
            ValidateByRole(visit, SystemRoleType.Admin);

            if ((instance == null) || string.IsNullOrEmpty(instance.Url) ||
                string.IsNullOrEmpty(instance.Name))
            {
                throw new ArgumentException("Input values are null.");
            }

            instance.ModifiedById = visit.Account.Id;
            TransactionTemplate.Execute(delegate
            {
                _partnerDao.Save(instance);
                ActivityManager.LogAudit(NodeMethod.None, null, visit, "{0} saved partner identity: {1}.",
                                         visit.Account.NaasAccount, instance.ToString());
                return(null);
            });
            return(instance);
        }
Beispiel #16
0
        protected override void LazyInit()
        {
            base.LazyInit();

            GetServiceImplementation(out _endpointUserManager);
            GetServiceImplementation(out _partnerManager);

            string partnerName;

            GetConfigParameter(CONFIG_PARTNER_NAME_KEY, out partnerName);

            _solicitPartner = GetNetworkPartner(partnerName);

            if (_solicitPartner.Version != EndpointVersionType.EN20)
            {
                throw new ArgumentException(string.Format("The \"{0}\" configuration parameter for this service must reference a {1} node partner, but it is referencing the partner \"{2}\" ({3})",
                                                          CONFIG_PARTNER_NAME_KEY, EnumUtils.ToDescription(EndpointVersionType.EN20),
                                                          _solicitPartner.Name, EnumUtils.ToDescription(_solicitPartner.Version)));
            }

            TryGetConfigParameter(CONFIG_ENDPOINT_USER_NAME_KEY, ref _solicitEndpointUsername);
        }
Beispiel #17
0
        protected virtual INodeEndpointClient GetNodeClient(PartnerIdentity partner, Activity activity, string endpointUserId)
        {
            LogActivity(activity, "Attempting to acquire node endpoint client for partner \"{0}\" with version \"{1}\" at url \"{2}\"...",
                        partner.Name, EnumUtils.ToDescription(partner.Version), partner.Url);

            try
            {
                string naasUsername;
                INodeEndpointClient client =
                    EndpointUserManager.GetNodeEndpointClientForEndpointUserId(partner.Url, partner.Version, endpointUserId, out naasUsername);

                LogActivity(activity, "Acquired node endpoint client for partner \"{0}\" using NAAS user account \"{1}\"",
                            partner.Name, naasUsername);
                return(client);
            }
            catch (Exception ex)
            {
                LogActivity(activity, "Failed to acquire node endpoint client for partner \"{0}\" with exception: {1}",
                            partner.Name, ExceptionUtils.GetDeepExceptionMessage(ex));
                throw;
            }
        }
Beispiel #18
0
        protected override void LazyInit()
        {
            base.LazyInit();

            GetServiceImplementation(out _partnerManager);

            string epaPartnerName = GetConfigParameter(EnumUtils.ToDescription(ConfigArgsEx.SubmissionPartnerName));

            if (!string.IsNullOrEmpty(epaPartnerName))
            {
                _epaPartnerNode = _partnerManager.GetByName(epaPartnerName);
                if (_epaPartnerNode == null)
                {
                    throw new ArgumentException(string.Format("The node partner \"{0}\" with the name \"{1}\" specified for this service cannot be found",
                                                              EnumUtils.ToDescription(ConfigArgsEx.SubmissionPartnerName), epaPartnerName));
                }
            }
            else
            {
                AppendAuditLogEvent("WARNING: A {0} was not specified, so the generated BEACHES xml file will NOT be submitted, but it will be added to the transaction.",
                                    EnumUtils.ToDescription(ConfigArgsEx.SubmissionPartnerName));
            }
        }
        protected override void LazyInit()
        {
            base.LazyInit();

            GetServiceImplementation(out _partnerManager);
            GetServiceImplementation(out _nodeEndpointClientFactory);

            ParseNaasUserMappingFile();

            string submitPartnerName = null;

            if (TryGetConfigParameter(CONFIG_SUBMISSION_PARTNER_NAME, ref submitPartnerName))
            {
                _submitPartnerNode = _partnerManager.GetByName(submitPartnerName);
                if (_submitPartnerNode == null)
                {
                    throw new ArgumentException(string.Format("A submission partner with the name \"{0}\" specified for this service cannot be found",
                                                              submitPartnerName));
                }
            }
            if (_submitPartnerNode != null)
            {
                if (_naasUsernameToPasswordMap == null)
                {
                    throw new ArgumentException(string.Format("The service specifies a \"{0},\" but does not specify a \"{1}\"",
                                                              CONFIG_SUBMISSION_PARTNER_NAME, CONFIG_NAAS_USER_MAPPING_FILE_PATH));
                }
            }
            else if (_naasUsernameToPasswordMap != null)
            {
                if (_submitPartnerNode == null)
                {
                    throw new ArgumentException(string.Format("The service specifies a \"{0},\" but does not specify a \"{1}\"",
                                                              CONFIG_NAAS_USER_MAPPING_FILE_PATH, CONFIG_SUBMISSION_PARTNER_NAME));
                }
            }
        }
Beispiel #20
0
        protected virtual void ProcessPartnerTarget(TransactionStatus transactionStatus,
                                                    ScheduledItem scheduledItem,
                                                    Activity activity)
        {
            PartnerIdentity partner = _partnerManager.GetById(scheduledItem.TargetId);

            if (partner == null)
            {
                throw new ArgumentException(string.Format("Invalid partner id \"{0}.\"  Could not find partner for scheduled item \"{1}\".",
                                                          scheduledItem.TargetId, scheduledItem.Name));
            }

            string filePath = GetZippedTransactionDocumentsAsTempFile(transactionStatus);

            if (filePath != null)
            {
                string transactionId;
                EndpointVersionType endpointVersion;
                string endpointUrl;
                string networkFlowName = null, networkFlowOperation = null;
                using (INodeEndpointClient client = GetNodeClient(partner, activity, scheduledItem.TargetEndpointUser))
                {
                    try
                    {
                        if (client.Version == EndpointVersionType.EN11)
                        {
                            LogActivity(activity, "Attempting to submit target documents as \"{0}\" to partner \"{1}\" for flow \"{2}\"",
                                        Path.GetFileName(filePath), partner.Name, scheduledItem.TargetFlow);
                            transactionId   = client.Submit(scheduledItem.TargetFlow, string.Empty, new string[] { filePath });
                            networkFlowName = scheduledItem.TargetFlow;
                        }
                        else
                        {
                            LogActivity(activity, "Attempting to submit target documents as \"{0}\" to partner \"{1}\" for flow \"{2}\" and operation \"{3}\"",
                                        Path.GetFileName(filePath), partner.Name, scheduledItem.TargetFlow, scheduledItem.TargetRequest);
                            transactionId = client.Submit(scheduledItem.TargetFlow, scheduledItem.TargetRequest,
                                                          string.Empty, new string[] { filePath });
                            networkFlowName      = scheduledItem.TargetFlow;
                            networkFlowOperation = scheduledItem.TargetRequest;
                        }
                    }
                    catch (Exception e)
                    {
                        LogActivityError(activity, "Error returned from node endpoint: \"{0}\"", ExceptionUtils.GetDeepExceptionMessage(e));
                        throw;
                    }
                    endpointVersion = client.Version;
                    endpointUrl     = client.Url;
                }
                LogActivity(activity, "Submitted target documents to partner \"{0}\" at url \"{1}\" for flow \"{2}\" with returned transaction id \"{3}\"",
                            partner.Name, partner.Url, scheduledItem.TargetFlow, transactionId);

                _transactionManager.SetNetworkIdAndEndpointUserId(transactionStatus.Id, transactionId, endpointVersion,
                                                                  endpointUrl, networkFlowName, networkFlowOperation,
                                                                  null, scheduledItem.TargetEndpointUser);
            }
            else
            {
                LogActivity(activity, "No target documents found to submit to partner \"{0}\"", partner.Name);
            }
        }
Beispiel #21
0
 public void Delete(PartnerIdentity item)
 {
     DoSimpleDelete(TABLE_NAME, "Id", new object[] { item.Id });
 }
Beispiel #22
0
 public void Save(PartnerIdentity instance, AdminVisit visit)
 {
     //TODO: Implement
 }
 protected override void LoadModel(object savedModel)
 {
     _dataItem = (PartnerIdentity)savedModel;
 }