public void ListRandom500() { System.Diagnostics.Debugger.Launch(); var service = new Part.Part() { ApplicationHeaderValue = new ApplicationHeader() { ApplicationToken = "07059250-E448-4040-B695-9C03F9E59E38", UserToken = "" } }; var uuids = new List <string>(Properties.Resources.All_UUIDs.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries)); Random r = new Random(); while (uuids.Count > 500) { int index = r.Next(0, uuids.Count); uuids.RemoveAt(index); } var input = new ListInputType() { UUID = uuids.ToArray() }; var start = DateTime.Now; var output = service.List(input); var end = DateTime.Now; int success = output.LaesResultat.Where(p => p.Item != null).Count(); int fail = output.LaesResultat.Where(p => p.Item == null).Count(); Console.WriteLine(string.Format("List <{0}> persons - Time: <{1}>, Success = <{2}>, Failed = <{3}>", input.UUID.Length, end - start, success, fail)); }
public ListFacadeMethodInfo(ListInputType inp, SourceUsageOrder sourceUsage, string appToken, string userToken) : base(appToken, userToken) { input = inp; this.InitializationMethod = new Action(InitializationMethod); this.AggregationFailOption = AggregationFailOption.FailOnAll; this.sourceUsageOrder = sourceUsage; }
public static ListOutputType1 List(string userToken, string appToken, ListInputType input, SourceUsageOrder localAction, out QualityLevel?qualityLevel) { ListOutputType1 ret = null; ret = GetMethodOutput <ListOutputType1, LaesResultatType[]>( new ListFacadeMethodInfo(input, localAction, appToken, userToken) ); //TODO: remove quality level because it applies to individual elements rather than the whole result qualityLevel = QualityLevel.LocalCache; return(ret); }
public FiltreretOejebliksbilledeType[] GetLatestRegistrations(string[] uuids) { ListInputType listInput = new ListInputType(); listInput.UUIDIdentifikator = uuids; listRequest request = new listRequest(); request.ListRequest1 = new ListRequestType(); request.ListRequest1.ListInput = listInput; request.ListRequest1.AuthorityContext = new AuthorityContextType(); request.ListRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetMunicipality(); OrganisationFunktionPortType channel = StubUtil.CreateChannel <OrganisationFunktionPortType>(OrganisationFunktionStubHelper.SERVICE, "List", helper.CreatePort()); try { listResponse response = channel.list(request); int statusCode = Int32.Parse(response.ListResponse1.ListOutput.StandardRetur.StatusKode); if (statusCode != 20) { // note that statusCode 44 means that the objects does not exists, so that is a valid response if (statusCode != 44) { log.Warn("Lookup on OrgFunction with uuids '" + string.Join(",", uuids) + "' failed with statuscode " + statusCode); } else { log.Debug("Lookup on OrgFunction with uuids '" + string.Join(",", uuids) + "' failed with statuscode " + statusCode); } return(null); } if (response.ListResponse1.ListOutput.FiltreretOejebliksbillede == null || response.ListResponse1.ListOutput.FiltreretOejebliksbillede.Length == 0) { log.Debug("Lookup on OrgFunction with uuids '" + string.Join(",", uuids) + "' returned an empty resultset"); return(null); } return(response.ListResponse1.ListOutput.FiltreretOejebliksbillede); } catch (Exception ex) when(ex is CommunicationException || ex is IOException || ex is TimeoutException || ex is WebException) { throw new ServiceNotFoundException("Failed to establish connection to the Laes service on OrganisationFunktion", ex); } }
public void ListDPR() { var service = new Part.Part() { ApplicationHeaderValue = new ApplicationHeader() { ApplicationToken = "07059250-E448-4040-B695-9C03F9E59E38", UserToken = "" } }; var input = new ListInputType() { UUID = Properties.Resources.Successful_DPR_UUIDs.Split(Environment.NewLine.ToArray(), StringSplitOptions.RemoveEmptyEntries).Take(100).ToArray() }; //input.UUID = new string[] { "{f37779c4-358a-4c89-87e4-03a235a87f5f}" }; // "0101531538" var start = DateTime.Now; var output = service.List(input); var end = DateTime.Now; int success = output.LaesResultat.Where(p => p.Item != null).Count(); int fail = output.LaesResultat.Where(p => p.Item == null).Count(); Console.WriteLine(string.Format("List <{0}> persons - Time: <{1}>, Success = <{2}>, Failed = <{3}>", input.UUID.Length, end - start, success, fail)); }
public Dictionary <string, RegistreringType1> GetLatestRegistrations(List <string> uuids) { var result = new Dictionary <string, RegistreringType1>(); ListInputType listInput = new ListInputType(); listInput.UUIDIdentifikator = uuids.ToArray(); listRequest request = new listRequest(); request.ListRequest1 = new ListRequestType(); request.ListRequest1.ListInput = listInput; request.ListRequest1.AuthorityContext = new AuthorityContextType(); request.ListRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); PersonPortType channel = StubUtil.CreateChannel <PersonPortType>(PersonStubHelper.SERVICE, "List", helper.CreatePort()); try { listResponse response = channel.list(request); int statusCode = Int32.Parse(response.ListResponse1.ListOutput.StandardRetur.StatusKode); if (statusCode != 20) { // note that statusCode 44 means that the object does not exists, so that is a valid response log.Debug("List on Person failed with statuscode " + statusCode); return(result); } if (response.ListResponse1.ListOutput.FiltreretOejebliksbillede == null || response.ListResponse1.ListOutput.FiltreretOejebliksbillede.Length == 0) { log.Debug("List on Person has 0 hits"); return(result); } foreach (var person in response.ListResponse1.ListOutput.FiltreretOejebliksbillede) { RegistreringType1[] resultSet = person.Registrering; if (resultSet.Length == 0) { log.Warn("Person with uuid '" + person.ObjektType.UUIDIdentifikator + "' exists, but has no registration"); continue; } RegistreringType1 reg = null; if (resultSet.Length > 1) { log.Warn("Person with uuid " + person.ObjektType.UUIDIdentifikator + " has more than one registration when reading latest registration, this should never happen"); DateTime winner = DateTime.MinValue; foreach (RegistreringType1 res in resultSet) { // first time through will always result in a True evaluation here if (DateTime.Compare(winner, res.Tidspunkt) < 0) { reg = res; winner = res.Tidspunkt; } } } else { reg = resultSet[0]; } // we cannot perform any kind of updates on Slettet/Passiveret, så it makes sense to filter them out on lookup, // so the rest of the code will default to Import op top of this if (reg.LivscyklusKode.Equals(LivscyklusKodeType.Slettet) || reg.LivscyklusKode.Equals(LivscyklusKodeType.Passiveret)) { continue; } result.Add(person.ObjektType.UUIDIdentifikator, reg); } return(result); } catch (Exception ex) when(ex is CommunicationException || ex is IOException || ex is TimeoutException || ex is WebException) { throw new ServiceNotFoundException("Failed to establish connection to the List service on Person", ex); } }
public ListOutputType1 List(ListInputType input) { var localAction = SourceUsageOrderHeader.GetLocalDataProviderUsageOption(this.sourceUsageOrderHeader); return(PartManager.List(applicationHeader.UserToken, applicationHeader.ApplicationToken, input, localAction, out qualityHeader.QualityLevel)); }