Esempio n. 1
0
 /** ******************************************************************************* */
 private byte[] toByteArray(YDocument doc, String action, String handle) throws IOException {
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   DataOutputStream d = new DataOutputStream(baos);
   d.writeUTF(action);
   d.writeUTF(handle);
   d.writeUTF(doc.getCaseId());
   d.writeLong(doc.getId());
   if (doc.getDocumentSize() > 0) d.write(doc.getDocument());
   return baos.toByteArray();
 }
Esempio n. 2
0
 /**
  * Removes all documents from the Document Store matching a case id
  *
  * @param caseID the case id of the documents to remove
  * @param handle a valid session handle
  * @return a success or error message
  * @throws IOException if the service can't be reached
  */
 public String completeCase(String caseID, String handle) throws IOException {
   YDocument doc = new YDocument();
   doc.setCaseId(caseID);
   return clearCase(doc, handle);
 }
Esempio n. 3
0
 /**
  * Removes a document from the Document Store
  *
  * @param docID the id of the document to remove. The id must match an existing document
  * @param handle a valid session handle
  * @return a success or error message
  * @throws IOException if the service can't be reached
  */
 public String removeDocument(long docID, String handle) throws IOException {
   YDocument doc = new YDocument();
   doc.setId(docID);
   return removeDocument(doc, handle);
 }
Esempio n. 4
0
 /**
  * Updates a stored document with its case id. When a document is uploaded at case start, it
  * occurs before the case has been launched and thus there is not yet a case id allocated. Once
  * the case launch is successful, this method is called to associate the case id with the already
  * uploaded document.
  *
  * @param docID the id of the already uploaded document
  * @param caseID the case id of the case launched with the document as a case param
  * @param handle a valid session handle
  * @return a success or error message
  * @throws IOException if the service can't be reached
  */
 public String addCaseID(long docID, String caseID, String handle) throws IOException {
   YDocument doc = new YDocument();
   doc.setId(docID);
   doc.setCaseId(caseID);
   return executePost(toByteArray(doc, "addcaseid", handle)).toString("UTF-8");
 }
Esempio n. 5
0
 /**
  * Gets a document from the Document Store
  *
  * @param doc the YDocument to get. The YDocument's id must match an existing document
  * @param handle a valid session handle
  * @return the YDocument with the document (i.e. the binary file) inserted, if successful
  * @throws IOException if the service can't be reached
  */
 public YDocument getDocument(YDocument doc, String handle) throws IOException {
   doc.setDocument(executePost(toByteArray(doc, "get", handle)).toByteArray());
   return doc;
 }