-
Notifications
You must be signed in to change notification settings - Fork 19
/
DeleteBuilder.java
47 lines (38 loc) · 1.17 KB
/
DeleteBuilder.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree.
*/
package org.fcrepo.client;
import static org.fcrepo.client.FedoraHeaderConstants.ATOMIC_ID;
import java.net.URI;
import org.apache.http.client.methods.HttpRequestBase;
import org.fcrepo.client.FcrepoResponse.TransactionURI;
/**
* Builds a request to delete a resource
*
* @author bbpennel
*/
public class DeleteBuilder extends RequestBuilder {
/**
* Instantiate builder
*
* @param uri uri request will be issued to
* @param client the client
*/
public DeleteBuilder(final URI uri, final FcrepoClient client) {
super(uri, client);
}
@Override
protected HttpRequestBase createRequest() {
return HttpMethods.DELETE.createRequest(targetUri);
}
@Override
public DeleteBuilder addHeader(final String name, final String value) {
return (DeleteBuilder) super.addHeader(name, value);
}
public DeleteBuilder addTransaction(final TransactionURI transaction) {
request.addHeader(ATOMIC_ID, transaction.asString());
return this;
}
}