public static Map<String, String> getRequestHeaders(RequestOptions options) { return DocumentClient.getRequestHeaders(options); }
private DocumentServiceRequest getUserRequest(String databaseLink, User user, RequestOptions options, OperationType operationType) { if (StringUtils.isEmpty(databaseLink)) { throw new IllegalArgumentException("databaseLink"); } if (user == null) { throw new IllegalArgumentException("user"); } DocumentClient.validateResource(user); String path = Utils.joinPath(databaseLink, Paths.USERS_PATH_SEGMENT); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(operationType, ResourceType.User, path, user, requestHeaders); return request; }
private DocumentServiceRequest getTriggerRequest(String collectionLink, Trigger trigger, RequestOptions options, OperationType operationType) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } if (trigger == null) { throw new IllegalArgumentException("trigger"); } DocumentClient.validateResource(trigger); String path = Utils.joinPath(collectionLink, Paths.TRIGGERS_PATH_SEGMENT); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(operationType, ResourceType.Trigger, path, trigger, requestHeaders); return request; }
private DocumentServiceRequest getUserDefinedFunctionRequest(String collectionLink, UserDefinedFunction udf, RequestOptions options, OperationType operationType) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } if (udf == null) { throw new IllegalArgumentException("udf"); } DocumentClient.validateResource(udf); String path = Utils.joinPath(collectionLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(operationType, ResourceType.UserDefinedFunction, path, udf, requestHeaders); return request; }
private DocumentServiceRequest getPermissionRequest(String userLink, Permission permission, RequestOptions options, OperationType operationType) { if (StringUtils.isEmpty(userLink)) { throw new IllegalArgumentException("userLink"); } if (permission == null) { throw new IllegalArgumentException("permission"); } DocumentClient.validateResource(permission); String path = Utils.joinPath(userLink, Paths.PERMISSIONS_PATH_SEGMENT); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(operationType, ResourceType.Permission, path, permission, requestHeaders); return request; }
private DocumentServiceRequest getStoredProcedureRequest(String collectionLink, StoredProcedure storedProcedure, RequestOptions options, OperationType operationType) { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } if (storedProcedure == null) { throw new IllegalArgumentException("storedProcedure"); } DocumentClient.validateResource(storedProcedure); String path = Utils.joinPath(collectionLink, Paths.STORED_PROCEDURES_PATH_SEGMENT); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(operationType, ResourceType.StoredProcedure, path, storedProcedure, requestHeaders); return request; }
/** * Reads a trigger by the trigger link. * * @param triggerLink the trigger link. * @param options the request options. * @return the resource response with the read trigger. * @throws DocumentClientException the document client exception. */ public ResourceResponse<Trigger> readTrigger(String triggerLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(triggerLink)) { throw new IllegalArgumentException("triggerLink"); } logger.debug("Reading a Trigger. triggerLink [{}]", triggerLink); String path = Utils.joinPath(triggerLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Read, ResourceType.Trigger, path, requestHeaders); return new ResourceResponse<Trigger>(this.doRead(request), Trigger.class); }
/** * Reads a permission. * * @param permissionLink the permission link. * @param options the request options. * @return the resource response with the read permission. * @throws DocumentClientException the document client exception. */ public ResourceResponse<Permission> readPermission(String permissionLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(permissionLink)) { throw new IllegalArgumentException("permissionLink"); } logger.debug("Reading a Permission. permissionLink [{}]", permissionLink); String path = Utils.joinPath(permissionLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Read, ResourceType.Permission, path, requestHeaders); return new ResourceResponse<Permission>(this.doRead(request), Permission.class); }
/** * Reads a user. * * @param userLink the user link. * @param options the request options. * @return the resource response with the read user. * @throws DocumentClientException the document client exception. */ public ResourceResponse<User> readUser(String userLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(userLink)) { throw new IllegalArgumentException("userLink"); } logger.debug("Reading a User. userLink [{}]", userLink); String path = Utils.joinPath(userLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Read, ResourceType.User, path, requestHeaders); return new ResourceResponse<User>(this.doRead(request), User.class); }
private DocumentServiceRequest getAttachmentRequest(String documentLink, Attachment attachment, RequestOptions options, OperationType operationType) { if (StringUtils.isEmpty(documentLink)) { throw new IllegalArgumentException("documentLink"); } if (attachment == null) { throw new IllegalArgumentException("attachment"); } DocumentClient.validateResource(attachment); String path = Utils.joinPath(documentLink, Paths.ATTACHMENTS_PATH_SEGMENT); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(operationType, ResourceType.Attachment, path, attachment, requestHeaders); this.addPartitionKeyInformation(request, null, options); return request; }
/** * Deletes a user. * * @param userLink the user link. * @param options the request options. * @return the resource response. * @throws DocumentClientException the document client exception. */ public ResourceResponse<User> deleteUser(String userLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(userLink)) { throw new IllegalArgumentException("userLink"); } logger.debug("Deleting a User. userLink [{}]", userLink); String path = Utils.joinPath(userLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Delete, ResourceType.User, path, requestHeaders); return new ResourceResponse<User>(this.doDelete(request), User.class); }
/** * Deletes a permission. * * @param permissionLink the permission link. * @param options the request options. * @return the resource response. * @throws DocumentClientException the document client exception. */ public ResourceResponse<Permission> deletePermission(String permissionLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(permissionLink)) { throw new IllegalArgumentException("permissionLink"); } logger.debug("Deleting a Permission. permissionLink [{}]", permissionLink); String path = Utils.joinPath(permissionLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Delete, ResourceType.Permission, path, requestHeaders); return new ResourceResponse<Permission>(this.doDelete(request), Permission.class); }
/** * Deletes a stored procedure by the stored procedure link. * * @param storedProcedureLink the stored procedure link. * @param options the request options. * @return the resource response. * @throws DocumentClientException the document client exception. */ public ResourceResponse<StoredProcedure> deleteStoredProcedure(String storedProcedureLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(storedProcedureLink)) { throw new IllegalArgumentException("storedProcedureLink"); } logger.debug("Deleting a StoredProcedure. storedProcedureLink [{}]", storedProcedureLink); String path = Utils.joinPath(storedProcedureLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Delete, ResourceType.StoredProcedure, path, requestHeaders); return new ResourceResponse<StoredProcedure>(this.doDelete(request), StoredProcedure.class); }
/** * Read a stored procedure by the stored procedure link. * * @param storedProcedureLink the stored procedure link. * @param options the request options. * @return the resource response with the read stored procedure. * @throws DocumentClientException the document client exception. */ public ResourceResponse<StoredProcedure> readStoredProcedure(String storedProcedureLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(storedProcedureLink)) { throw new IllegalArgumentException("storedProcedureLink"); } logger.debug("Reading a StoredProcedure. storedProcedureLink [{}]", storedProcedureLink); String path = Utils.joinPath(storedProcedureLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Read, ResourceType.StoredProcedure, path, requestHeaders); return new ResourceResponse<StoredProcedure>(this.doRead(request), StoredProcedure.class); }
/** * Deletes a trigger. * * @param triggerLink the trigger link. * @param options the request options. * @return the resource response. * @throws DocumentClientException the document client exception. */ public ResourceResponse<Trigger> deleteTrigger(String triggerLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(triggerLink)) { throw new IllegalArgumentException("triggerLink"); } logger.debug("Deleting a Trigger. triggerLink [{}]", triggerLink); String path = Utils.joinPath(triggerLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Delete, ResourceType.Trigger, path, requestHeaders); return new ResourceResponse<Trigger>(this.doDelete(request), Trigger.class); }
/** * Deletes a document collection by the collection link. * * @param collectionLink the collection link. * @param options the request options. * @return the resource response. * @throws DocumentClientException the document client exception. */ public ResourceResponse<DocumentCollection> deleteCollection(String collectionLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(collectionLink)) { throw new IllegalArgumentException("collectionLink"); } logger.debug("Deleting a Collection. collectionLink: [{}]", collectionLink); String path = Utils.joinPath(collectionLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Delete, ResourceType.DocumentCollection, path, requestHeaders); return new ResourceResponse<DocumentCollection>(this.doDelete(request), DocumentCollection.class); }
/** * Reads a document by the document link. * * @param documentLink the document link. * @param options the request options. * @return the resource response with the read document. * @throws DocumentClientException the document client exception. */ public ResourceResponse<Document> readDocument(String documentLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(documentLink)) { throw new IllegalArgumentException("documentLink"); } logger.debug("Reading a Document. documentLink: [{}]", documentLink); String path = Utils.joinPath(documentLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Read, ResourceType.Document, path, requestHeaders); this.addPartitionKeyInformation(request, null, options); return new ResourceResponse<Document>(this.doRead(request), Document.class); }
/** * Deletes a conflict. * * @param conflictLink the conflict link. * @param options the request options. * @return the resource response. * @throws DocumentClientException the document client exception. */ public ResourceResponse<Conflict> deleteConflict(String conflictLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(conflictLink)) { throw new IllegalArgumentException("conflictLink"); } logger.debug("Deleting a Conflicts. conflictLink [{}]", conflictLink); String path = Utils.joinPath(conflictLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Delete, ResourceType.Conflict, path, requestHeaders); this.addPartitionKeyInformation(request, null, options); return new ResourceResponse<Conflict>(this.doDelete(request), Conflict.class); }
/** * Deletes an attachment. * * @param attachmentLink the attachment link. * @param options the request options. * @return the resource response. * @throws DocumentClientException the document client exception. */ public ResourceResponse<Attachment> deleteAttachment(String attachmentLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(attachmentLink)) { throw new IllegalArgumentException("attachmentLink"); } logger.debug("Deleting a Attachment. attachmentLink [{}]", attachmentLink); String path = Utils.joinPath(attachmentLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Delete, ResourceType.Attachment, path, requestHeaders); this.addPartitionKeyInformation(request, null, options); return new ResourceResponse<Attachment>(this.doDelete(request), Attachment.class); }
/** * Reads an attachment. * * @param attachmentLink the attachment link. * @param options the request options. * @return the resource response with the read attachment. * @throws DocumentClientException the document client exception. */ public ResourceResponse<Attachment> readAttachment(String attachmentLink, RequestOptions options) throws DocumentClientException { if (StringUtils.isEmpty(attachmentLink)) { throw new IllegalArgumentException("attachmentLink"); } logger.debug("Reading a Attachment. attachmentLink [{}]", attachmentLink); String path = Utils.joinPath(attachmentLink, null); Map<String, String> requestHeaders = getRequestHeaders(options); DocumentServiceRequest request = DocumentServiceRequest.create(OperationType.Read, ResourceType.Attachment, path, requestHeaders); this.addPartitionKeyInformation(request, null, options); return new ResourceResponse<Attachment>(this.doRead(request), Attachment.class); }