@Test public void testLanguageFilterForMediaInfo() { Set<String> languageFilter = new HashSet<>(); languageFilter.add("de"); languageFilter.add("he"); DocumentDataFilter documentDataFilter = new DocumentDataFilter(); documentDataFilter.setLanguageFilter(languageFilter); DatamodelFilter filter = new DatamodelFilter(new DataObjectFactoryImpl(), documentDataFilter); MediaInfoDocument mediaInfoDocument = Datamodel.makeMediaInfoDocument( Datamodel.makeWikimediaCommonsMediaInfoIdValue("M42"), Arrays.asList( Datamodel.makeMonolingualTextValue("Label de", "de"), Datamodel.makeMonolingualTextValue("Label en", "en"), Datamodel.makeMonolingualTextValue("Label he", "he") ), Collections.emptyList() ); MediaInfoDocument mediaInfoDocumentFiltered = Datamodel.makeMediaInfoDocument( Datamodel.makeWikimediaCommonsMediaInfoIdValue("M42"), Arrays.asList( Datamodel.makeMonolingualTextValue("Label de", "de"), Datamodel.makeMonolingualTextValue("Label he", "he") ), Collections.emptyList() ); assertEquals(mediaInfoDocumentFiltered, filter.filter(mediaInfoDocument)); }
public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); }
DatamodelFilter { public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); } }
DatamodelFilter { public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); } DatamodelFilter(DataObjectFactory dataObjectFactory, DocumentDataFilter filter); }
DatamodelFilter { public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); } DatamodelFilter(DataObjectFactory dataObjectFactory, DocumentDataFilter filter); ItemDocument filter(ItemDocument item); PropertyDocument filter(PropertyDocument property); MediaInfoDocument filter(MediaInfoDocument mediaInfo); LexemeDocument filter(LexemeDocument lexeme); FormDocument filter(FormDocument form); SenseDocument filter(SenseDocument sense); }
DatamodelFilter { public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); } DatamodelFilter(DataObjectFactory dataObjectFactory, DocumentDataFilter filter); ItemDocument filter(ItemDocument item); PropertyDocument filter(PropertyDocument property); MediaInfoDocument filter(MediaInfoDocument mediaInfo); LexemeDocument filter(LexemeDocument lexeme); FormDocument filter(FormDocument form); SenseDocument filter(SenseDocument sense);  }