Adds the information for an new entry in the revision index.

@param revisionID
ID of the revision
@param revisionPrimaryKey
PK of the revison
@param fullRevisionPrimaryKey
PK of the related full revison
481205
public void add(final int revisionID, final long revisionPrimaryKey,
			final long fullRevisionPrimaryKey)
	{

		boolean sql = !insertStatement.isEmpty();
		if (sql&&buffer.length() != insertStatement.length()) {
			this.buffer.append(",");
		}

		this.buffer.append((sql?"(":"") + revisionID + "," + revisionPrimaryKey + ","
				+ fullRevisionPrimaryKey + (sql?")":""));

		if(!sql){
			buffer.append("\n");
		}

		if (buffer.length() + 100 >= MAX_ALLOWED_PACKET) {
			storeBuffer();
		}
	}
316249
def insert(self, revision, index):
        
        if not isinstance(revision, Revision):
            raise InvalidArgType()

        for rev in self.revisions:
            if rev == revision:
                return self

        self.revisions.insert(index, revision)

        return self
103382
public void setRevisions(java.util.Collection<ConfigurationRevision> revisions) {
        if (revisions == null) {
            this.revisions = null;
            return;
        }

        this.revisions = new java.util.ArrayList<ConfigurationRevision>(revisions);
    }
1016824
def add_new_revision
            root = @revisions.last.trailer[:Root] unless @revisions.empty?

            @revisions << Revision.new(self)
            @revisions.last.trailer = Trailer.new
            @revisions.last.trailer.Root = root

            self
        end
962670
func (s *CreateSimulationApplicationVersionOutput) SetRevisionId(v string) *CreateSimulationApplicationVersionOutput {
	s.RevisionId = &v
	return s
}
300380
func (s *AddLayerVersionPermissionInput) SetRevisionId(v string) *AddLayerVersionPermissionInput {
	s.RevisionId = &v
	return s
}
694631
@Override
	public void setPrimaryKey(
		com.liferay.commerce.account.service.persistence.CommerceAccountUserRelPK primaryKey) {
		_commerceAccountUserRel.setPrimaryKey(primaryKey);
	}
1335916
@Override
	public Revision next()
	{
		try {

			int revCount, articleID;

			revCount = result.getInt(3);
			articleID = result.getInt(5);

			if (articleID != this.currentArticleID) {
				this.currentRevCounter = 0;
				this.currentArticleID = articleID;
			}

			if (revCount - 1 != this.currentRevCounter) {

				logger.error("Invalid RevCounter -" + " [ArticleId "
						+ articleID + ", RevisionId " + result.getInt(4)
						+ ", RevisionCounter " +revCount + "] - Expected: "
						+ (this.currentRevCounter + 1));

				this.currentRevCounter = revCount;
				this.previousRevision = null;

				return null;
			}

			this.currentRevCounter = revCount;
			this.primaryKey = result.getInt(1);

			Revision revision = new Revision(revCount);
			revision.setPrimaryKey(this.primaryKey);
			if (!shouldLoadRevisionText) {
				String currentRevision;

				Diff diff;
				RevisionDecoder decoder = new RevisionDecoder(
						config.getCharacterSet());

				if (binaryData) {
					decoder.setInput(result.getBinaryStream(2), true);
				}
				else {
					decoder.setInput(result.getString(2));
				}
				diff = decoder.decode();

				try {
					currentRevision = diff.buildRevision(previousRevision);
				}
				catch (Exception e) {
					this.previousRevision = null;
					logger.error("Reconstruction failed -"
							+ " [ArticleId " + result.getInt(5)
							+ ", RevisionId " + result.getInt(4)
							+ ", RevisionCounter " + result.getInt(3) + "]");
					return null;
				}

				previousRevision = currentRevision;
				revision.setRevisionText(currentRevision);
			} else {
				if(revApi==null){
					revApi = new RevisionApi(config);
				}
				revision.setRevisionApi(revApi);
			}

			revision.setRevisionID(result.getInt(4));
			revision.setArticleID(articleID);
			revision.setTimeStamp(new Timestamp(result.getLong(6)));
			revision.setFullRevisionID(result.getInt(7));
			revision.setContributorName(result.getString(8));
			revision.setContributorId(result.getInt(9));
			revision.setComment(result.getString(10));
			revision.setMinor(result.getBoolean(11));
			revision.setContributorIsRegistered(result.getBoolean(12));

			return revision;

		}
		catch (DecodingException | SQLException | IOException | WikiApiException e) {
			throw new RuntimeException(e);
		}
	}
1079753
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CommercePriceEntry addCommercePriceEntry(
		CommercePriceEntry commercePriceEntry) {
		commercePriceEntry.setNew(true);

		return commercePriceEntryPersistence.update(commercePriceEntry);
	}
1177039
func (s *UpdateRobotApplicationOutput) SetRevisionId(v string) *UpdateRobotApplicationOutput {
	s.RevisionId = &v
	return s
}
120872
@InterfaceAudience.Private
    private boolean uploadMultipartRevision(final RevisionInternal revision) {
        Map<String, Object> body = revision.getProperties();
        Map<String, Object> attachments = (Map<String, Object>) body.get("_attachments");

        boolean attachmentsFollow = false;
        for (String attachmentKey : attachments.keySet()) {
            Map<String, Object> attachment = (Map<String, Object>) attachments.get(attachmentKey);
            if (attachment.containsKey("follows")) attachmentsFollow = true;
        }
        if (!attachmentsFollow) return false;

        Log.d(TAG, "Uploading multipart request.  Revision: %s", revision);
        addToChangesCount(1);
        final String path = String.format(Locale.ENGLISH, "%s?new_edits=false", encodeDocumentId(revision.getDocID()));
        CustomFuture future = sendAsyncMultipartRequest("PUT", path, body, attachments,
                new RemoteRequestCompletion() {
                    @Override
                    public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
                        try {
                            if (e != null) {
                                if (e instanceof RemoteRequestResponseException) {
                                    // Server doesn't like multipart, eh? Fall back to JSON.
                                    if (((RemoteRequestResponseException) e).getCode() == 415) {
                                        //status 415 = "bad_content_type"
                                        dontSendMultipart = true;
                                        uploadJsonRevision(revision);
                                    }
                                } else {
                                    Log.e(TAG, "Exception uploading multipart request", e);
                                    setError(e);
                                }
                            } else {
                                Log.v(TAG, "Uploaded multipart request.  Revision: %s", revision);
                                removePending(revision);
                            }
                        } finally {
                            addToCompletedChangesCount(1);
                        }
                    }
                });
        future.setQueue(pendingFutures);
        pendingFutures.add(future);
        return true;
    }
1240824
public void setRevisionTextAndParts(Revision revision)
    {

        try {

            PreparedStatement statement = null;
            ResultSet result = null;

            int fullRevPK = -1;
            int limit = 1;
            try {
                statement = this.connection.prepareStatement("SELECT FullRevisionPK, RevisionPK "
                        + "FROM index_revisionID " + "WHERE revisionID=? LIMIT 1");
                statement.setInt(1, revision.getRevisionID());
                result = statement.executeQuery();

                if (result.next()) {
                    fullRevPK = result.getInt(1);
                    limit = (result.getInt(2) - fullRevPK) + 1;

                }
                else {
                    throw new WikiPageNotFoundException("The revision with the ID "
                            + revision.getRevisionID() + " was not found.");
                }
            }
            finally {
                if (statement != null) {
                    statement.close();
                }
                if (result != null) {
                    result.close();
                }
            }

            try {
                statement = this.connection
                        .prepareStatement("SELECT Revision, PrimaryKey, RevisionCounter, RevisionID, ArticleID, Timestamp, Comment, Minor, ContributorName, ContributorId, ContributorIsRegistered "
                                + "FROM revisions " + "WHERE PrimaryKey >= ? LIMIT " + limit);
                statement.setInt(1, fullRevPK);
                result = statement.executeQuery();

                String previousRevision = null, currentRevision = null;

                Diff diff = null;
                RevisionDecoder decoder;

                boolean binaryData = result.getMetaData().getColumnType(1) == Types.LONGVARBINARY;

                while (result.next()) {

                    decoder = new RevisionDecoder(config.getCharacterSet());

                    if (binaryData) {
                        decoder.setInput(result.getBinaryStream(1), true);
                    }
                    else {
                        decoder.setInput(result.getString(1));
                    }

                    diff = decoder.decode();
                    currentRevision = diff.buildRevision(previousRevision);

                    previousRevision = currentRevision;
                }

                Collection<DiffPart> parts = new LinkedList<DiffPart>();
                Iterator<DiffPart> it = diff.iterator();
                while (it.hasNext()) {
                    parts.add(it.next());
                }

                revision.setParts(parts);
                revision.setRevisionText(currentRevision);

            }
            finally {
                if (statement != null) {
                    statement.close();
                }
                if (result != null) {
                    result.close();
                }
            }
        }
        catch (WikiPageNotFoundException | DecodingException | SQLException | IOException e) {
            throw new RuntimeException(e);
        }
        catch (RuntimeException e) {
            throw e;
        }

    }
614044
public static ModuleIdentifier createRevisionId(ModuleId scriptModuleId, long revisionNumber) {
        Objects.requireNonNull(scriptModuleId, "scriptModuleId");
        return ModuleIdentifier.create(scriptModuleId.toString(), Long.toString(revisionNumber));
    }
788135
public List<OpenRevision> getDocWithOpenRevisions(String id, Collection<String> revisions,
                                                      Collection<String> attsSince,
                                                      boolean pullAttachmentsInline) {
        Misc.checkNotNullOrEmpty(id, "id");
        Misc.checkArgument(revisions.size() > 0, "Need at least one open revision");

        Map<String, Object> options = new HashMap<String, Object>();
        options.put("revs", true);
        // by adding latest we should never receive a "missing" response from the server. A descendant
        // of the revision requested will be returned even if it has been deleted.
        options.put("latest", true);
        // only pull attachments inline if we're configured to
        if (pullAttachmentsInline) {
            options.put("attachments", true);
            if (attsSince != null) {
                options.put("atts_since", JSONUtils.toJson(attsSince));
            }
        } else {
            options.put("attachments", false);
            options.put("att_encoding_info", true);
        }
        options.put("open_revs", JSONUtils.toJson(revisions));
        return this.getDocument(id, options, JSONUtils.OPEN_REVS_LIST_TYPE_DEF);
    }
352694
func (s *FunctionConfiguration) SetRevisionId(v string) *FunctionConfiguration {
	s.RevisionId = &v
	return s
}
911221
@InterfaceAudience.Private
    protected void revisionAdded(DocumentChange change, boolean notify) {
        if (change.getRevisionId() != null) {
            String revID = change.getWinningRevisionID();
            if (revID == null)
                return;  // current revision didn't change

            if (currentRevision != null && !revID.equals(currentRevision.getId())) {
                RevisionInternal rev = change.getWinningRevisionIfKnown();
                if (rev == null)
                    forgetCurrentRevision();
                else if (rev.isDeleted())
                    currentRevision = null;
                else
                    currentRevision = new SavedRevision(this, rev);
            }
        } else {
            // Document was purged!
            currentRevision = null;
        }

        if (notify) {
            for (ChangeListener listener : changeListeners)
                listener.changed(new ChangeEvent(this, change));
        }
    }

    @InterfaceAudience.Private
    protected void forgetCurrentRevision() {
        currentRevision = null;
    }
}
1009647
func (s *RemoveLayerVersionPermissionInput) SetRevisionId(v string) *RemoveLayerVersionPermissionInput {
	s.RevisionId = &v
	return s
}