private static PModePartyInfo CreateMatchedPartyInfo(UserMessage um, PModeMatch match) { if ((match & PModeMatch.ByPartyInfo) == PModeMatch.ByPartyInfo) { return(new PModePartyInfo { FromParty = new PModeParty(um.Sender.Role, um.Sender.PartyIds.Select(id => new PModePartyId(id.Id))), ToParty = new PModeParty(um.Receiver.Role, um.Receiver.PartyIds.Select(id => new PModePartyId(id.Id))) }); } if ((match & PModeMatch.ByUnspecifiedPartyInfo) == PModeMatch.ByUnspecifiedPartyInfo) { return(null); } return(new PModePartyInfo { FromParty = new PModeParty("pmode-Sender-role", $"pmode-frompartyid-{Guid.NewGuid()}"), ToParty = new PModeParty("pmode-Receiver-role", $"pmode-topartyid-{Guid.NewGuid()}") }); }
private static PModeCollaborationInfo CreateMatchedCollaborationInfo(UserMessage um, PModeMatch match) { return(new PModeCollaborationInfo { Action = (match & PModeMatch.ByServiceAction) == PModeMatch.ByServiceAction ? um.CollaborationInfo.Action : $"pmode-action-{Guid.NewGuid()}", Service = (match & PModeMatch.ByServiceAction) == PModeMatch.ByServiceAction ? new PModeService { Type = um.CollaborationInfo.Service.Type.GetOrElse( $"pmode-service-type-{Guid.NewGuid()}"), Value = um.CollaborationInfo.Service.Value } : new PModeService { Type = $"pmode-service-type-{Guid.NewGuid()}", Value = $"pmode-service-value-{Guid.NewGuid()}" }, AgreementReference = (match & PModeMatch.ByAgreementRef) == PModeMatch.ByAgreementRef ? new PModeAgreementRef { Value = um.CollaborationInfo .AgreementReference .Select(a => a.Value) .GetOrElse($"pmode-agreement-value-{Guid.NewGuid()}"), PModeId = um.CollaborationInfo .AgreementReference .SelectMany(a => a.PModeId) .GetOrElse($"pmode-agreement-pmodeid-{Guid.NewGuid()}"), Type = um.CollaborationInfo .AgreementReference .SelectMany(a => a.Type) .GetOrElse($"pmode-agreement-type-{Guid.NewGuid()}") } : new PModeAgreementRef { Value = $"pmode-agreement-value-{Guid.NewGuid()}", Type = $"pmode-agreement-type-{Guid.NewGuid()}", PModeId = $"pmode-agreement-pmodeid-{Guid.NewGuid()}" } }); }
private static ReceivingProcessingMode CreateMatchedReceivingPMode(UserMessage um, PModeMatch match) { return(new ReceivingProcessingMode { Id = um.CollaborationInfo .AgreementReference .Where(_ => (match & PModeMatch.ByPModeId) == PModeMatch.ByPModeId) .SelectMany(a => a.PModeId) .GetOrElse($"pmodeid-{Guid.NewGuid()}"), MessagePackaging = { CollaborationInfo = CreateMatchedCollaborationInfo(um, match), PartyInfo = CreateMatchedPartyInfo(um, match) } }); }