public class DocumentConversion extends WatsonService
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_LIMIT
The default limit for get requests.
|
static String |
JOB_ID
The Constant JOB_ID.
|
static String |
LIMIT
The Constant LIMIT.
|
static String |
MEDIA_TYPE
The Constant MEDIA_TYPE.
|
static String |
NAME
The Constant NAME.
|
static String |
SINCE
The Constant SINCE.
|
static String |
STATUS
The Constant STATUS.
|
static String |
TOKEN
The Constant TOKEN.
|
FORWARD_SLASH| Constructor and Description |
|---|
DocumentConversion()
Sets the endpoint url for the service.
|
| Modifier and Type | Method and Description |
|---|---|
BatchDocumentResponse |
addDocumentToBatch(String batchId,
String documentId)
Adds a document to the batch whose ids are specified
PUT /v1/batches/{batch_id}/documents/{document_id}.
|
InputStream |
convertDocument(File document,
ConversionTarget conversionTarget)
Synchronously converts a new document without persistence
POST /v1/convert_document.
|
InputStream |
convertDocument(File document,
String mediaType,
ConversionTarget conversionTarget)
Synchronously converts a new document without persistence
POST /v1/convert_document.
|
InputStream |
convertDocument(String documentId,
ConversionTarget conversionTarget)
Synchronously converts a single previously uploaded document
POST /v1/convert_document.
|
Answers |
convertDocumentToAnswer(File document)
Synchronously converts a new document without persistence into an Answers object
POST /v1/convert_document.
|
Answers |
convertDocumentToAnswer(String documentId)
Synchronously converts a single previously uploaded document into an Answers object
POST /v1/convert_document.
|
Batch |
createBatch(String name,
List<Property> properties)
Creates a new batch with name and properties
POST /v1/batches.
|
JobResponse |
createJob(String name,
String batchId,
ConversionTarget conversionTarget)
Creates a new job by submitting a batch for processing
POST /v1/jobs.
|
JobResponse |
createJob(String name,
String batchId,
ConversionTarget conversionTarget,
com.google.gson.JsonObject config)
Creates a new job by submitting a batch for processing
POST /v1/jobs.
|
org.apache.http.HttpResponse |
execute(org.apache.http.client.methods.HttpRequestBase request)
Execute the Http request.
|
Batch |
getBatch(String batchId)
Gets an existing batch
GET /v1/batches/{batch_id}.
|
BatchCollection |
getBatchCollection()
Gets a collection of all existing batches in the service
GET /v1/batches.
|
BatchCollection |
getBatchCollection(Map<String,Object> batchListParams)
Gets a collection of all existing batches with optional query parameters for filtering results.
|
BatchDocumentResponse |
getBatchDocument(String batchId,
String documentId)
Retrieves the documents from the batch whose ids are specified
GET /v1/batches/{batch_id}/documents/{document_id}.
|
BatchDocumentCollection |
getBatchDocumentCollection(String batchId)
Gets a collection of existing documents in the batch
GET /v1/batches/{batch_id}/documents.
|
BatchDocumentCollection |
getBatchDocumentCollection(String batchId,
Map<String,Object> batchDocListParams)
Gets a list of existing documents in the batch with optional query parameters for filtering results.
|
InputStream |
getDocument(String documentId)
Retrieves a document from the service with the given id
GET /v1/documents/{document_id}.
|
DocumentCollection |
getDocumentCollection()
Gets a collection of uploaded documents
GET /v1/documents.
|
DocumentCollection |
getDocumentCollection(Map<String,Object> docListParams)
Gets a collection of all existing documents with optional query parameters for filtering results.
|
Job |
getJob(String jobId)
Gets information about a job
GET /v1/jobs/{job_id}.
|
JobCollection |
getJobCollection()
Gets a collection of all jobs in the service
GET /v1/jobs.
|
JobCollection |
getJobCollection(Map<String,Object> jobListParams)
Gets a list of all jobs with optional query parameters for filtering results.
|
InputStream |
getJobLog(String jobId)
Gets the job processing log
GET /v1/jobs/{job_id}/log.
|
InputStream |
getOutput(String outputId)
Gets the content of the output of the document conversion process.
|
OutputCollection |
getOutputCollection()
Gets a collection of all generated outputs
GET /v1/output.
|
OutputCollection |
getOutputCollection(Map<String,Object> outputListParams)
Gets a collection of all generated outputs with optional query parameters for filtering results.
|
Batch |
updateBatch(String batchId,
String name,
List<Property> properties)
Updates an existing batch with the provided name and properties
PUT /v1/batches/{batch_id}.
|
Document |
uploadDocument(File document)
Uploads the document to the service with the given media type
POST /v1/documents.
|
Document |
uploadDocument(File document,
String mediaType)
Uploads the document to the service with the given media type
POST /v1/documents.
|
executeRequest, executeWithoutResponse, getApiKey, getDefaultContentType, getDefaultRequestParams, getEndPoint, getHttpClient, getThreadSafeClient, setApiKey, setAuthentication, setEndPoint, setUsernameAndPassword, toStringpublic static final int DEFAULT_LIMIT
public static final String JOB_ID
public static final String LIMIT
public static final String MEDIA_TYPE
public static final String NAME
public static final String SINCE
public static final String STATUS
public static final String TOKEN
public DocumentConversion()
public BatchDocumentResponse addDocumentToBatch(String batchId, String documentId)
batchId - id of the batch to be retrieveddocumentId - id of the document to be retrievedpublic InputStream convertDocument(File document, ConversionTarget conversionTarget)
document - The file to convertconversionTarget - The conversion target to usepublic InputStream convertDocument(File document, String mediaType, ConversionTarget conversionTarget)
document - The file to convertmediaType - Internet media type of the fileconversionTarget - The conversion target to usepublic InputStream convertDocument(String documentId, ConversionTarget conversionTarget)
documentId - The id of the document to convertconversionTarget - The conversion target to usepublic Answers convertDocumentToAnswer(File document)
document - The file to convertpublic Answers convertDocumentToAnswer(String documentId)
documentId - The id of the document to convertpublic Batch createBatch(String name, List<Property> properties)
name - the name of the created batchproperties - the properties for the created batchpublic JobResponse createJob(String name, String batchId, ConversionTarget conversionTarget)
name - The name of the jobbatchId - The id of the batch to processconversionTarget - The conversion target to usepublic JobResponse createJob(String name, String batchId, ConversionTarget conversionTarget, com.google.gson.JsonObject config)
name - The name of the jobbatchId - The id of the batch to processconversionTarget - The conversion target to useconfig - The configuration to use for the job (optional), pass null to use default configpublic org.apache.http.HttpResponse execute(org.apache.http.client.methods.HttpRequestBase request)
WatsonServiceexecute in class WatsonServicerequest - the http requestpublic Batch getBatch(String batchId)
batchId - id for the batch to be updatedpublic BatchCollection getBatchCollection()
public BatchCollection getBatchCollection(Map<String,Object> batchListParams)
batchListParams - The parameters to be used in the batch list service call.
The parameters - token, limit, name and since are optional
public BatchDocumentResponse getBatchDocument(String batchId, String documentId)
batchId - id of the batch to be retrieveddocumentId - id of the document to be retrievedpublic BatchDocumentCollection getBatchDocumentCollection(String batchId)
batchId - The id for the batch whose documents are returnedpublic BatchDocumentCollection getBatchDocumentCollection(String batchId, Map<String,Object> batchDocListParams)
batchId - The id for the batch whose documents are returnedbatchDocListParams - The parameters to be used in the batch documents list service call.
The parameters - token, limit, since, job_id and media_type are optional
public InputStream getDocument(String documentId)
documentId - id of the document to be retrievedpublic DocumentCollection getDocumentCollection()
public DocumentCollection getDocumentCollection(Map<String,Object> docListParams)
docListParams - The parameters to be used in the documents list service call.
The parameters - token, limit, name, since and media_type are optional
public Job getJob(String jobId)
jobId - The id of the jobpublic JobCollection getJobCollection()
public JobCollection getJobCollection(Map<String,Object> jobListParams)
jobListParams - The parameters to be used in the job list service call.
The parameters - token, limit, since, name, since and status are optional
public InputStream getJobLog(String jobId)
jobId - The id of the jobpublic InputStream getOutput(String outputId)
outputId - The id of the output to getpublic OutputCollection getOutputCollection()
public OutputCollection getOutputCollection(Map<String,Object> outputListParams)
outputListParams - The parameters to be used in the output list service call.
The parameters - token, limit, since, job_id and media_type are optional
public Batch updateBatch(String batchId, String name, List<Property> properties)
batchId - id for the batch to be updatedname - name of the batch to be updatedproperties - properties of the batch to be updatedpublic Document uploadDocument(File document)
document - the document to be uploadedCopyright © 2015. All rights reserved.