All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.ravendb.client.documents.commands.GetConflictsCommand Maven / Gradle / Ivy

There is a newer version: 6.0.1
Show newest version
package net.ravendb.client.documents.commands;

import net.ravendb.client.http.RavenCommand;
import net.ravendb.client.http.ServerNode;
import net.ravendb.client.primitives.Reference;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestBase;

import java.io.IOException;

public class GetConflictsCommand extends RavenCommand {

    private final String _id;

    public GetConflictsCommand(String id) {
        super(GetConflictsResult.class);
        _id = id;
    }

    @Override
    public boolean isReadRequest() {
        return true;
    }

    @Override
    public HttpRequestBase createRequest(ServerNode node, Reference url) {
        url.value = node.getUrl() + "/databases/"
                + node.getDatabase() + "/replication/conflicts?docId="
                + urlEncode(_id);

        return new HttpGet();
    }

    @Override
    public void setResponse(String response, boolean fromCache) throws IOException {
        if (response == null) {
            throwInvalidResponse();
        }

        result = mapper.readValue(response, resultClass);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy