@Test public void testEditItem() throws IOException, MediaWikiApiErrorException { WikibaseDataEditor wde = new WikibaseDataEditor(this.con, Datamodel.SITE_WIKIDATA); ItemIdValue id = Datamodel.makeWikidataItemIdValue("Q1234"); ItemDocument itemDocument = ItemDocumentBuilder.forItemId(id) .withRevisionId(1234).build(); ItemDocument expectedResultDocument = ItemDocumentBuilder.forItemId(id) .withRevisionId(1235).build(); String resultData = JsonSerializer .getJsonString(expectedResultDocument); String expectedResult = "{\"entity\":" + resultData + ",\"success\":1}"; Map<String, String> params = new HashMap<>(); params.put("action", "wbeditentity"); params.put("id", "Q1234"); params.put("summary", "My summary"); params.put("tags", "tag1|tag2"); params.put("token", "42307b93c79b0cb558d2dfb4c3c92e0955e06041+\\"); params.put("format", "json"); params.put("baserevid", "1234"); params.put("maxlag", "5"); String data = JsonSerializer.getJsonString(itemDocument); params.put("data", data); con.setWebResource(params, expectedResult); ItemDocument result = wde.editItemDocument(itemDocument, false, "My summary", Arrays.asList("tag1", "tag2")); assertEquals(expectedResultDocument, result); }
public ItemDocument editItemDocument(ItemDocument itemDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException { String data = JsonSerializer.getJsonString(itemDocument); return (ItemDocument) this.wbEditingAction.wbEditEntity(itemDocument .getEntityId().getId(), null, null, null, data, clear, this.editAsBot, itemDocument.getRevisionId(), summary, tags); }
WikibaseDataEditor { public ItemDocument editItemDocument(ItemDocument itemDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException { String data = JsonSerializer.getJsonString(itemDocument); return (ItemDocument) this.wbEditingAction.wbEditEntity(itemDocument .getEntityId().getId(), null, null, null, data, clear, this.editAsBot, itemDocument.getRevisionId(), summary, tags); } }
WikibaseDataEditor { public ItemDocument editItemDocument(ItemDocument itemDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException { String data = JsonSerializer.getJsonString(itemDocument); return (ItemDocument) this.wbEditingAction.wbEditEntity(itemDocument .getEntityId().getId(), null, null, null, data, clear, this.editAsBot, itemDocument.getRevisionId(), summary, tags); } WikibaseDataEditor(ApiConnection connection, String siteUri);  WikibaseDataEditor(ApiConnection connection, String siteUri, GuidGenerator generator); }
WikibaseDataEditor { public ItemDocument editItemDocument(ItemDocument itemDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException { String data = JsonSerializer.getJsonString(itemDocument); return (ItemDocument) this.wbEditingAction.wbEditEntity(itemDocument .getEntityId().getId(), null, null, null, data, clear, this.editAsBot, itemDocument.getRevisionId(), summary, tags); } WikibaseDataEditor(ApiConnection connection, String siteUri);  WikibaseDataEditor(ApiConnection connection, String siteUri, GuidGenerator generator); boolean editAsBot(); void setEditAsBot(boolean editAsBot); int getMaxLag(); void setMaxLag(int maxLag); int getMaxLagMaxRetries(); void setMaxLagMaxRetries(int retries); int getMaxLagFirstWaitTime(); void setMaxLagFirstWaitTime(int time); double getMaxLagBackOffFactor(); void setMaxLagBackOffFactor(double value); int getAverageTimePerEdit(); void setAverageTimePerEdit(int milliseconds); int getRemainingEdits(); void setRemainingEdits(int remainingEdits); void disableEditing(); ItemDocument createItemDocument(ItemDocument itemDocument,
			String summary, List<String> tags); PropertyDocument createPropertyDocument(
			PropertyDocument propertyDocument, String summary, List<String> tags); ItemDocument editItemDocument(ItemDocument itemDocument,
			boolean clear, String summary, List<String> tags); PropertyDocument editPropertyDocument(
			PropertyDocument propertyDocument, boolean clear, String summary,
			List<String> tags); MediaInfoDocument editMediaInfoDocument(
			MediaInfoDocument mediaInfoDocument, boolean clear, String summary,
			List<String> tags); ItemDocument updateStatements(ItemIdValue itemIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); ItemDocument updateTermsStatements(ItemIdValue itemIdValue,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements,
			List<Statement> deleteStatements,
			String summary,
			List<String> tags); PropertyDocument updateStatements(PropertyIdValue propertyIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateStatements(T currentDocument,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateTermsStatements(T currentDocument,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); void nullEdit(ItemIdValue itemId); void nullEdit(PropertyIdValue propertyId); @SuppressWarnings("unchecked") T nullEdit(T currentDocument); }
WikibaseDataEditor { public ItemDocument editItemDocument(ItemDocument itemDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException { String data = JsonSerializer.getJsonString(itemDocument); return (ItemDocument) this.wbEditingAction.wbEditEntity(itemDocument .getEntityId().getId(), null, null, null, data, clear, this.editAsBot, itemDocument.getRevisionId(), summary, tags); } WikibaseDataEditor(ApiConnection connection, String siteUri);  WikibaseDataEditor(ApiConnection connection, String siteUri, GuidGenerator generator); boolean editAsBot(); void setEditAsBot(boolean editAsBot); int getMaxLag(); void setMaxLag(int maxLag); int getMaxLagMaxRetries(); void setMaxLagMaxRetries(int retries); int getMaxLagFirstWaitTime(); void setMaxLagFirstWaitTime(int time); double getMaxLagBackOffFactor(); void setMaxLagBackOffFactor(double value); int getAverageTimePerEdit(); void setAverageTimePerEdit(int milliseconds); int getRemainingEdits(); void setRemainingEdits(int remainingEdits); void disableEditing(); ItemDocument createItemDocument(ItemDocument itemDocument,
			String summary, List<String> tags); PropertyDocument createPropertyDocument(
			PropertyDocument propertyDocument, String summary, List<String> tags); ItemDocument editItemDocument(ItemDocument itemDocument,
			boolean clear, String summary, List<String> tags); PropertyDocument editPropertyDocument(
			PropertyDocument propertyDocument, boolean clear, String summary,
			List<String> tags); MediaInfoDocument editMediaInfoDocument(
			MediaInfoDocument mediaInfoDocument, boolean clear, String summary,
			List<String> tags); ItemDocument updateStatements(ItemIdValue itemIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); ItemDocument updateTermsStatements(ItemIdValue itemIdValue,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements,
			List<Statement> deleteStatements,
			String summary,
			List<String> tags); PropertyDocument updateStatements(PropertyIdValue propertyIdValue,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateStatements(T currentDocument,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); @SuppressWarnings("unchecked") T updateTermsStatements(T currentDocument,
			List<MonolingualTextValue> addLabels,
			List<MonolingualTextValue> addDescriptions,
			List<MonolingualTextValue> addAliases,
			List<MonolingualTextValue> deleteAliases,
			List<Statement> addStatements, List<Statement> deleteStatements,
			String summary, List<String> tags); void nullEdit(ItemIdValue itemId); void nullEdit(PropertyIdValue propertyId); @SuppressWarnings("unchecked") T nullEdit(T currentDocument);  }