Package er.rest

Examples of er.rest.ERXRestRequestNode$Key


    validateQuery(query);
    validateSplitSize(numSplits);

    List<Query> splits = new ArrayList<Query>(numSplits);
    List<Key> scatterKeys = getScatterKeys(numSplits, query, datastore);
    Key lastKey = null;
    for (Key nextKey : getSplitKey(scatterKeys, numSplits)) {
      splits.add(createSplit(lastKey, nextKey, query));
      lastKey = nextKey;
    }
    splits.add(createSplit(lastKey, null, query));
View Full Code Here


   * @param filter
   *            the filter to apply to the objects
   * @return a WOResponse in the given format
   */
  public WOActionResults response(ERXRestFormat format, EOClassDescription entity, NSArray<?> values, ERXKeyFilter filter) {
    ERXRestRequestNode responseNode;
    try {
      responseNode = ERXRestRequestNode.requestNodeWithObjectAndFilter(entity, values, filter, restContext());
    }
    catch (ObjectNotAvailableException e) {
      return errorResponse(e, WOMessage.HTTP_STATUS_NOT_FOUND);
View Full Code Here

   * @param filter
   *            the filter to apply
   * @return a WOResponse in the given format
   */
  public WOActionResults response(ERXRestFormat format, Object value, ERXKeyFilter filter) {
    ERXRestRequestNode responseNode;
    try {
      responseNode = ERXRestRequestNode.requestNodeWithObjectAndFilter(value, filter, restContext());
    }
    catch (ObjectNotAvailableException e) {
      return errorResponse(e, WOMessage.HTTP_STATUS_NOT_FOUND);
View Full Code Here

    String arrayJSON = ERXRestFormat.json().toString(list);
    System.out.println("Client.main: array as JSON " + arrayJSON);

    ClientCompany newCompany = new ClientCompany();
    newCompany.setName("Peters Pickles");
    ERXRestRequestNode node = client.createObjectWithPath(newCompany, ERXKeyFilter.filterWithAllRecursive(), "Company.json", ERXRestFormat.json());
    System.out.println("Client.main: The newly created company is: " + node.toString(ERXRestFormat.json(), new ERXRestContext()));
  }
View Full Code Here

  }

  /* Extract the requestNode from the given method using the given format.
   */
  protected ERXRestRequestNode requestNodeWithMethod(HttpMethodBase method, ERXRestFormat format) throws IOException {
    ERXRestRequestNode responseNode = format.parser().parseRestRequest(new ERXStringRestRequest(method.getResponseBodyAsString()), format.delegate(), _context);
    return responseNode;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public <T> T objectWithPath(String path, String entityName) throws HttpException, IOException {
    HttpClient client = httpClient();
    GetMethod fetchObjectMethod = new GetMethod(new ERXMutableURL(_baseURL).appendPath(path).toExternalForm());
    client.executeMethod(fetchObjectMethod);
    ERXRestRequestNode node = requestNodeWithMethod(fetchObjectMethod);
    return (T) _objectWithRequestNode(node, entityName);
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public <T> T objectWithPath(String path) throws HttpException, IOException {
    HttpClient client = httpClient();
    GetMethod fetchObjectMethod = new GetMethod(new ERXMutableURL(_baseURL).appendPath(path).toExternalForm());
    client.executeMethod(fetchObjectMethod);
    ERXRestRequestNode node = requestNodeWithMethod(fetchObjectMethod);
    String type = node.type();
    return (T) _objectWithRequestNode(node, type);
  }
View Full Code Here

  public ERXRestRequestNode update(Object obj, ERXKeyFilter filter, String entityName, String id, String action, ERXRestFormat format) throws HttpException, IOException {
    return updateObjectWithPath(obj, filter, path(entityName, id, action, format), format);
  }

  public ERXRestRequestNode updateObjectWithPath(Object obj, ERXKeyFilter filter, String path, ERXRestFormat format) throws HttpException, IOException {
    ERXRestRequestNode node = ERXRestRequestNode.requestNodeWithObjectAndFilter(obj, filter, _context);
    ERXStringBufferRestResponse response = new ERXStringBufferRestResponse();
    format.writer().appendToResponse(node, response, format.delegate(), _context);

    HttpClient client = httpClient();
    PutMethod updateObjectMethod = new PutMethod(new ERXMutableURL(_baseURL).appendPath(path).toExternalForm());
View Full Code Here

  public ERXRestRequestNode create(Object obj, ERXKeyFilter filter, String entityName, String id, String action, ERXRestFormat format) throws HttpException, IOException {
    return createObjectWithPath(obj, filter, path(entityName, id, action, format), format);
  }

  public ERXRestRequestNode createObjectWithPath(Object obj, ERXKeyFilter filter, String path, ERXRestFormat format) throws HttpException, IOException {
    ERXRestRequestNode node = ERXRestRequestNode.requestNodeWithObjectAndFilter(obj, filter, _context);
    ERXStringBufferRestResponse response = new ERXStringBufferRestResponse();
    format.writer().appendToResponse(node, response, format.delegate(), _context);

    HttpClient client = httpClient();
    PostMethod updateObjectMethod = new PostMethod(new ERXMutableURL(_baseURL).appendPath(path).toExternalForm());
View Full Code Here

  public ERXRestRequestNode delete(Object obj, String entityName, String id, String action, ERXRestFormat format) throws HttpException, IOException {
    return deleteObjectWithPath(obj, path(entityName, id, action, format), format);
  }

  public ERXRestRequestNode deleteObjectWithPath(Object obj, String path, ERXRestFormat format) throws HttpException, IOException {
    ERXRestRequestNode node = ERXRestRequestNode.requestNodeWithObjectAndFilter(obj, ERXKeyFilter.filterWithNone(), _context);

    HttpClient client = httpClient();
    DeleteMethod deleteObjectMethod = new DeleteMethod(new ERXMutableURL(_baseURL).appendPath(path).toExternalForm());
    client.executeMethod(deleteObjectMethod);
    return requestNodeWithMethod(deleteObjectMethod);
View Full Code Here

TOP

Related Classes of er.rest.ERXRestRequestNode$Key

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.