public LaesResultatType[] SearchList(SoegInputType1 searchCriteria) { var name = searchCriteria.SoegObjekt.SoegAttributListe.SoegEgenskab.First().NavnStruktur; var cpr = searchCriteria.SoegObjekt.SoegAttributListe.SoegRegisterOplysning.First().Item as CprBorgerType; cpr.PersonCivilRegistrationIdentifier = CprBroker.Tests.PartInterface.Utilities.RandomCprNumber(); return(new LaesResultatType[] { new LaesResultatType() { Item = new FiltreretOejebliksbilledeType() { AttributListe = new AttributListeType() { Egenskab = new EgenskabType[] { new EgenskabType() { NavnStruktur = name, } }, RegisterOplysning = new RegisterOplysningType[] { new RegisterOplysningType() { Item = cpr } } } } } }); }
private bool search(PartManager partManager, SoegInputType1 soegObject, BatchLine batchLine, SourceUsageOrder SourceUsageOrder) { var searchResult = partManager.SearchList( BrokerContext.Current.UserToken, BrokerContext.Current.ApplicationToken, soegObject, SourceUsageOrder); if (StandardReturType.IsSucceeded(searchResult.StandardRetur)) { if (batchLine.FillFrom(searchResult)) { return(true); } else { batchLine.Error = "Person not found"; return(false); } } else { batchLine.Error = string.Format("{0}-{1}", searchResult.StandardRetur.StatusKode, searchResult.StandardRetur.FejlbeskedTekst); return(false); } }
public void Soeg() { SoegInputType1 input = new SoegInputType1(); //input.SoegVirkning = new SoegVirkningType(); input.AttributListe = new AttributListeType(); input.RelationListe = new RelationListeType(); input.TilstandListe = new TilstandListeType(); soegRequest request = new soegRequest(); request.SoegRequest1 = new SoegRequestType(); request.SoegRequest1.SoegInput = input; request.SoegRequest1.AuthorityContext = new AuthorityContextType(); request.SoegRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); OrganisationPortType channel = StubUtil.CreateChannel <OrganisationPortType>(OrganisationStubHelper.SERVICE, "Soeg", helper.CreatePort()); try { channel.soeg(request); } 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 Organisation", ex); } }
public SearchSubMethodInfo(SoegInputType1 input) { searchCriteria = input; LocalDataProviderOption = SourceUsageOrder.LocalThenExternal; FailIfNoDataProvider = true; FailOnDefaultOutput = true; }
public static SoegOutputType Search(string userToken, string appToken, SoegInputType1 searchCriteria, out QualityLevel?qualityLevel) { SearchFacadeMethodInfo facadeMethod = new SearchFacadeMethodInfo(searchCriteria, appToken, userToken); var ret = GetMethodOutput <SoegOutputType, string[]>(facadeMethod); //TODO: Move into Search method of data provider qualityLevel = QualityLevel.LocalCache; return(ret); }
public void Search_MunicipalityCodeAndSize_5([Values("851")] string municipalityCode) { var searchCriteria = new SoegInputType1() { SoegObjekt = new SoegObjektType() { SoegAttributListe = new SoegAttributListeType() { SoegRegisterOplysning = new RegisterOplysningType[] { new RegisterOplysningType() { Item = new CprBorgerType() { FolkeregisterAdresse = new AdresseType() { Item = new DanskAdresseType() { AddressComplete = new AddressCompleteType() { AddressAccess = new AddressAccessType() { MunicipalityCode = municipalityCode } } } } } } } } }, MaksimalAntalKvantitet = "5", FoersteResultatReference = "0" }; var prov = new DatabaseDataProvider(); var ret = prov.Search(searchCriteria); Assert.AreEqual(5, ret.Length); }
public soegResponse Search(SoegInputType1 soegInput) { // construct request soegRequest request = new soegRequest(); request.SoegRequest1 = new SoegRequestType(); request.SoegRequest1.SoegInput = soegInput; request.SoegRequest1.AuthorityContext = new AuthorityContextType(); request.SoegRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); // send request OrganisationFunktionPortType channel = StubUtil.CreateChannel <OrganisationFunktionPortType>(OrganisationFunktionStubHelper.SERVICE, "Soeg", helper.CreatePort()); try { return(channel.soeg(request)); } 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 Soeg service on OrganisationFunktion", ex); } }
public List <string> Soeg(string antal = null, string offset = null) { OrganisationEnhedPortType channel = StubUtil.CreateChannel <OrganisationEnhedPortType>(OrganisationEnhedStubHelper.SERVICE, "Soeg", helper.CreatePort()); SoegInputType1 soegInput = new SoegInputType1(); soegInput.AttributListe = new AttributListeType(); soegInput.RelationListe = new RelationListeType(); soegInput.TilstandListe = new TilstandListeType(); if (antal != null) { soegInput.MaksimalAntalKvantitet = antal; } if (offset != null) { soegInput.FoersteResultatReference = offset; } // only search for Active units soegInput.TilstandListe.Gyldighed = new GyldighedType[1]; soegInput.TilstandListe.Gyldighed[0] = new GyldighedType(); soegInput.TilstandListe.Gyldighed[0].GyldighedStatusKode = GyldighedStatusKodeType.Aktiv; // TODO: these three lines should be removeable once KMD fixes their end soegInput.TilstandListe.Gyldighed[0].Virkning = new VirkningType(); soegInput.TilstandListe.Gyldighed[0].Virkning.FraTidspunkt = new TidspunktType(); soegInput.TilstandListe.Gyldighed[0].Virkning.FraTidspunkt.Item = DateTime.Now; // only return objects that have a Tilhører relationship top-level Organisation UnikIdType orgReference = StubUtil.GetReference <UnikIdType>(registry.MunicipalityOrganisationUUID[OrganisationRegistryProperties.GetCurrentMunicipality()], ItemChoiceType.UUIDIdentifikator); OrganisationRelationType organisationRelationType = new OrganisationRelationType(); organisationRelationType.ReferenceID = orgReference; soegInput.RelationListe.Tilhoerer = organisationRelationType; // search soegRequest request = new soegRequest(); request.SoegRequest1 = new SoegRequestType(); request.SoegRequest1.SoegInput = soegInput; request.SoegRequest1.AuthorityContext = new AuthorityContextType(); request.SoegRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetCurrentMunicipality(); try { soegResponse response = channel.soeg(request); int statusCode = Int32.Parse(response.SoegResponse1.SoegOutput.StandardRetur.StatusKode); if (statusCode != 20 && statusCode != 44) // 44 is empty search result { string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Soeg", OrganisationEnhedStubHelper.SERVICE, response.SoegResponse1.SoegOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } List <string> functions = new List <string>(); if (statusCode == 20) { foreach (string id in response.SoegResponse1.SoegOutput.IdListe) { functions.Add(id); } } return(functions); } 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 Soeg service on OrganisationEnhed", ex); } }
public SearchFacadeMethodInfo(SoegInputType1 input, string appToken, string userToken) : base(appToken, userToken) { Input = input; }
public SoegOutputType Search(SoegInputType1 searchCriteria) { return(PartManager.Search(applicationHeader.UserToken, applicationHeader.ApplicationToken, searchCriteria, out qualityHeader.QualityLevel)); }
private List <string> Soeg(string functionsTypeUuid, string userUuid, string unitUuid, string itSystemUuid) { OrganisationFunktionPortType channel = StubUtil.CreateChannel <OrganisationFunktionPortType>(OrganisationFunktionStubHelper.SERVICE, "Soeg", helper.CreatePort()); SoegInputType1 soegInput = new SoegInputType1(); soegInput.AttributListe = new AttributListeType(); soegInput.RelationListe = new RelationListeType(); soegInput.TilstandListe = new TilstandListeType(); // only return objects that have a Tilhører relationship top-level Organisation UnikIdType orgReference = StubUtil.GetReference <UnikIdType>(registry.MunicipalityOrganisationUUID[OrganisationRegistryProperties.GetMunicipality()], ItemChoiceType.UUIDIdentifikator); soegInput.RelationListe.TilknyttedeOrganisationer = new OrganisationFlerRelationType[1]; soegInput.RelationListe.TilknyttedeOrganisationer[0] = new OrganisationFlerRelationType(); soegInput.RelationListe.TilknyttedeOrganisationer[0].ReferenceID = orgReference; if (!String.IsNullOrEmpty(functionsTypeUuid)) { UnikIdType reference = new UnikIdType(); reference.Item = functionsTypeUuid; reference.ItemElementName = ItemChoiceType.UUIDIdentifikator; KlasseRelationType funktionsType = new KlasseRelationType(); funktionsType.ReferenceID = reference; soegInput.RelationListe.Funktionstype = funktionsType; } if (!String.IsNullOrEmpty(userUuid)) { UnikIdType reference = new UnikIdType(); reference.Item = userUuid; reference.ItemElementName = ItemChoiceType.UUIDIdentifikator; soegInput.RelationListe.TilknyttedeBrugere = new BrugerFlerRelationType[1]; soegInput.RelationListe.TilknyttedeBrugere[0] = new BrugerFlerRelationType(); soegInput.RelationListe.TilknyttedeBrugere[0].ReferenceID = reference; } if (!String.IsNullOrEmpty(unitUuid)) { UnikIdType reference = new UnikIdType(); reference.Item = unitUuid; reference.ItemElementName = ItemChoiceType.UUIDIdentifikator; soegInput.RelationListe.TilknyttedeEnheder = new OrganisationEnhedFlerRelationType[1]; soegInput.RelationListe.TilknyttedeEnheder[0] = new OrganisationEnhedFlerRelationType(); soegInput.RelationListe.TilknyttedeEnheder[0].ReferenceID = reference; } if (!String.IsNullOrEmpty(itSystemUuid)) { UnikIdType reference = new UnikIdType(); reference.Item = itSystemUuid; reference.ItemElementName = ItemChoiceType.UUIDIdentifikator; soegInput.RelationListe.TilknyttedeItSystemer = new ItSystemFlerRelationType[1]; soegInput.RelationListe.TilknyttedeItSystemer[0] = new ItSystemFlerRelationType(); soegInput.RelationListe.TilknyttedeItSystemer[0].ReferenceID = reference; } // search soegRequest request = new soegRequest(); request.SoegRequest1 = new SoegRequestType(); request.SoegRequest1.SoegInput = soegInput; request.SoegRequest1.AuthorityContext = new AuthorityContextType(); request.SoegRequest1.AuthorityContext.MunicipalityCVR = OrganisationRegistryProperties.GetMunicipality(); try { soegResponse response = channel.soeg(request); int statusCode = Int32.Parse(response.SoegResponse1.SoegOutput.StandardRetur.StatusKode); if (statusCode != 20 && statusCode != 44) // 44 is empty search result { string message = StubUtil.ConstructSoapErrorMessage(statusCode, "Soeg", OrganisationFunktionStubHelper.SERVICE, response.SoegResponse1.SoegOutput.StandardRetur.FejlbeskedTekst); log.Error(message); throw new SoapServiceException(message); } List <string> functions = new List <string>(); if (statusCode == 20) { foreach (string id in response.SoegResponse1.SoegOutput.IdListe) { functions.Add(id); } } return(functions); } 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 Soeg service on OrganisationFunktion", ex); } }
public IActionResult Search([FromHeader] string cvr, [FromHeader] string apiKey, [FromBody] SoegInputType1 input) { if ((cvr = AuthorizeAndFetchCvr(cvr, apiKey)) == null) { return(Unauthorized()); } soegResponse result = rawOrganisationFunctionStub.Search(input); return(Ok(result)); }