Beispiel #1
0
 private void SetPostalCode(IEnumerable <Entity> entities, StringBuilder collisionInfo, Boolean overrideData)
 {
     if (entities == null)
     {
         throw new ArgumentNullException("entities");
     }
     ClearRunInfo();
     foreach (var entity in entities.Where(x => !x.IsObsolete && x.codes != null && x.codes.post != null && x.codes.post.value.Any()))
     {
         var item = _helper.GetWikiDataItemForEntity(entity);
         if (item == null)
         {
             _runInfo[WikiDataState.ItemNotFound]++;
             collisionInfo.AppendFormat("{0}: {1} was deleted!", entity.wiki.wikidata, entity.english);
         }
         else
         {
             foreach (var code in entity.codes.post.value)
             {
                 var state = _helper.PostalCodeCorrect(item, entity, code);
                 _runInfo[state]++;
                 if (state == WikiDataState.Incomplete)
                 {
                     var statement = _helper.SetPostalCode(item, entity, code);
                     if (statement != null)
                     {
                         statement.save(_helper.GetClaimSaveEditSummary(statement));
                     }
                 }
             }
         }
     }
 }