@Test public void testDeleteAlias() { MonolingualTextValue label = Datamodel.makeMonolingualTextValue("strudel aux pommes", "fr"); MonolingualTextValue alias = Datamodel.makeMonolingualTextValue("Apfelstrudel", "fr"); ItemDocument currentDocument = ItemDocumentBuilder.forItemId(Q1).withLabel(label).withAlias(alias).build(); TermStatementUpdate su = makeUpdate(currentDocument, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.singletonList(alias) ); assertTrue(su.getLabelUpdates().isEmpty()); assertEquals(su.getAliasUpdates().size(), 1); assertEquals(su.getAliasUpdates().get("fr").size(), 0); assertEquals("{\"aliases\":{\"fr\":[]}}", su.getJsonUpdateString()); assertFalse(su.isEmptyEdit()); }
protected void deleteAlias(MonolingualTextValue alias) { String lang = alias.getLanguageCode(); AliasesWithUpdate currentAliases = newAliases.get(lang); if (currentAliases != null) { currentAliases.aliases.remove(alias); currentAliases.deleted.add(alias); currentAliases.write = true; } }
TermStatementUpdate extends StatementUpdate { protected void deleteAlias(MonolingualTextValue alias) { String lang = alias.getLanguageCode(); AliasesWithUpdate currentAliases = newAliases.get(lang); if (currentAliases != null) { currentAliases.aliases.remove(alias); currentAliases.deleted.add(alias); currentAliases.write = true; } } }
TermStatementUpdate extends StatementUpdate { protected void deleteAlias(MonolingualTextValue alias) { String lang = alias.getLanguageCode(); AliasesWithUpdate currentAliases = newAliases.get(lang); if (currentAliases != null) { currentAliases.aliases.remove(alias); currentAliases.deleted.add(alias); currentAliases.write = true; } } TermStatementUpdate(TermedStatementDocument currentDocument,
            List<Statement> addStatements,
            List<Statement> deleteStatements,
            List<MonolingualTextValue> addLabels,
            List<MonolingualTextValue> addDescriptions,
            List<MonolingualTextValue> addAliases,
            List<MonolingualTextValue> deleteAliases); }
TermStatementUpdate extends StatementUpdate { protected void deleteAlias(MonolingualTextValue alias) { String lang = alias.getLanguageCode(); AliasesWithUpdate currentAliases = newAliases.get(lang); if (currentAliases != null) { currentAliases.aliases.remove(alias); currentAliases.deleted.add(alias); currentAliases.write = true; } } TermStatementUpdate(TermedStatementDocument currentDocument,
            List<Statement> addStatements,
            List<Statement> deleteStatements,
            List<MonolingualTextValue> addLabels,
            List<MonolingualTextValue> addDescriptions,
            List<MonolingualTextValue> addAliases,
            List<MonolingualTextValue> deleteAliases); @JsonProperty("labels") @JsonInclude(Include.NON_EMPTY) Map<String, TermImpl> getLabelUpdates(); @JsonProperty("descriptions") @JsonInclude(Include.NON_EMPTY) Map<String, TermImpl> getDescriptionUpdates(); @JsonProperty("aliases") @JsonInclude(Include.NON_EMPTY) Map<String, List<TermImpl>> getAliasUpdates(); @Override @JsonIgnore boolean isEmptyEdit(); List<MonolingualTextValue> getAddedAliases(String language); List<MonolingualTextValue> getRemovedAliases(String language); @Override TermedStatementDocument performEdit(
			WbEditingAction action, boolean editAsBot, String summary, List<String> tags); }
TermStatementUpdate extends StatementUpdate { protected void deleteAlias(MonolingualTextValue alias) { String lang = alias.getLanguageCode(); AliasesWithUpdate currentAliases = newAliases.get(lang); if (currentAliases != null) { currentAliases.aliases.remove(alias); currentAliases.deleted.add(alias); currentAliases.write = true; } } TermStatementUpdate(TermedStatementDocument currentDocument,
            List<Statement> addStatements,
            List<Statement> deleteStatements,
            List<MonolingualTextValue> addLabels,
            List<MonolingualTextValue> addDescriptions,
            List<MonolingualTextValue> addAliases,
            List<MonolingualTextValue> deleteAliases); @JsonProperty("labels") @JsonInclude(Include.NON_EMPTY) Map<String, TermImpl> getLabelUpdates(); @JsonProperty("descriptions") @JsonInclude(Include.NON_EMPTY) Map<String, TermImpl> getDescriptionUpdates(); @JsonProperty("aliases") @JsonInclude(Include.NON_EMPTY) Map<String, List<TermImpl>> getAliasUpdates(); @Override @JsonIgnore boolean isEmptyEdit(); List<MonolingualTextValue> getAddedAliases(String language); List<MonolingualTextValue> getRemovedAliases(String language); @Override TermedStatementDocument performEdit(
			WbEditingAction action, boolean editAsBot, String summary, List<String> tags);  }