/** * Sets the revision id for the constructed document. See * {@link EntityDocument#getRevisionId()}. * * @param revisionId * the revision id * @return builder object to continue construction */ public T withRevisionId(long revisionId) { this.revisionId = revisionId; return getThis(); }
/** * Adds an additional label to the constructed document. * * @param text * the text of the label * @param languageCode * the language code of the label * @return builder object to continue construction */ public T withLabel(String text, String languageCode) { withLabel(factory.getMonolingualTextValue(text, languageCode)); return getThis(); }
/** * Starts constructing an EntityDocument from an initial version * of this document. * * @param initialDocument * the initial version of the document to use */ protected EntityDocumentBuilder(O initialDocument) { this.entityIdValue = initialDocument.getEntityId(); this.revisionId = initialDocument.getRevisionId(); for(MonolingualTextValue label : initialDocument.getLabels().values()) { withLabel(label); } for(MonolingualTextValue description : initialDocument.getDescriptions().values()) { withDescription(description); } for(List<MonolingualTextValue> aliases : initialDocument.getAliases().values()) { for(MonolingualTextValue alias : aliases) { withAlias(alias); } } Iterator<Statement> iterator = initialDocument.getAllStatements(); while(iterator.hasNext()) { withStatement(iterator.next()); } }
/** * Adds an additional alias to the constructed document. * * @param text * the text of the alias * @param languageCode * the language code of the alias * @return builder object to continue construction */ public T withAlias(String text, String languageCode) { withAlias(factory.getMonolingualTextValue(text, languageCode)); return getThis(); }
/** * Adds an additional description to the constructed document. * * @param text * the text of the description * @param languageCode * the language code of the description * @return builder object to continue construction */ public T withDescription(String text, String languageCode) { withDescription(factory.getMonolingualTextValue(text, languageCode)); return getThis(); }
/** * Starts constructing an EntityDocument from an initial version * of this document. * * @param initialDocument * the initial version of the document to use */ protected EntityDocumentBuilder(O initialDocument) { this.entityIdValue = initialDocument.getEntityId(); this.revisionId = initialDocument.getRevisionId(); for(MonolingualTextValue label : initialDocument.getLabels().values()) { withLabel(label); } for(MonolingualTextValue description : initialDocument.getDescriptions().values()) { withDescription(description); } for(List<MonolingualTextValue> aliases : initialDocument.getAliases().values()) { for(MonolingualTextValue alias : aliases) { withAlias(alias); } } Iterator<Statement> iterator = initialDocument.getAllStatements(); while(iterator.hasNext()) { withStatement(iterator.next()); } }
/** * Adds an additional alias to the constructed document. * * @param text * the text of the alias * @param languageCode * the language code of the alias * @return builder object to continue construction */ public T withAlias(String text, String languageCode) { withAlias(factory.getMonolingualTextValue(text, languageCode)); return getThis(); }
/** * Adds an additional description to the constructed document. * * @param text * the text of the description * @param languageCode * the language code of the description * @return builder object to continue construction */ public T withDescription(String text, String languageCode) { withDescription(factory.getMonolingualTextValue(text, languageCode)); return getThis(); }
/** * Sets the revision id for the constructed document. See * {@link EntityDocument#getRevisionId()}. * * @param revisionId * the revision id * @return builder object to continue construction */ public T withRevisionId(long revisionId) { this.revisionId = revisionId; return getThis(); }
/** * Adds an additional label to the constructed document. * * @param text * the text of the label * @param languageCode * the language code of the label * @return builder object to continue construction */ public T withLabel(String text, String languageCode) { withLabel(factory.getMonolingualTextValue(text, languageCode)); return getThis(); }
/** * Adds an additional description to the constructed document. * * @param mtv * the additional description * @return builder object to continue construction */ public T withDescription(MonolingualTextValue mtv) { this.descriptions.add(mtv); return getThis(); }
/** * Adds an additional alias to the constructed document. * * @param mtv * the additional alias * @return builder object to continue construction */ public T withAlias(MonolingualTextValue mtv) { this.aliases.add(mtv); return getThis(); }
/** * Adds an additional label to the constructed document. * * @param mtv * the additional label * @return builder object to continue construction */ public T withLabel(MonolingualTextValue mtv) { this.labels.add(mtv); return getThis(); }
/** * Adds an additional description to the constructed document. * * @param mtv * the additional description * @return builder object to continue construction */ public T withDescription(MonolingualTextValue mtv) { this.descriptions.add(mtv); return getThis(); }
/** * Adds an additional label to the constructed document. * * @param mtv * the additional label * @return builder object to continue construction */ public T withLabel(MonolingualTextValue mtv) { this.labels.add(mtv); return getThis(); }
/** * Adds an additional alias to the constructed document. * * @param mtv * the additional alias * @return builder object to continue construction */ public T withAlias(MonolingualTextValue mtv) { this.aliases.add(mtv); return getThis(); }
/** * Adds an additional statement to the constructed document. * * @param statement * the additional statement * @return builder object to continue construction */ public T withStatement(Statement statement) { PropertyIdValue pid = statement.getMainSnak() .getPropertyId(); ArrayList<Statement> pidStatements = this.statements.get(pid); if (pidStatements == null) { pidStatements = new ArrayList<Statement>(); this.statements.put(pid, pidStatements); } pidStatements.add(statement); return getThis(); }
/** * Adds an additional statement to the constructed document. * * @param statement * the additional statement * @return builder object to continue construction */ public T withStatement(Statement statement) { PropertyIdValue pid = statement.getMainSnak() .getPropertyId(); ArrayList<Statement> pidStatements = this.statements.get(pid); if (pidStatements == null) { pidStatements = new ArrayList<Statement>(); this.statements.put(pid, pidStatements); } pidStatements.add(statement); return getThis(); }