Package com.linkedin.restli.server

Examples of com.linkedin.restli.server.UpdateResponse


    {
      PatchApplier.applyPatch(membership, patch);
    }
    catch (DataProcessingException e)
    {
      return new UpdateResponse(S_400_BAD_REQUEST);
    }

    validate(membership);

    // we set groupID, memberID based on the URI
    membership.setId(URIParamUtils.encodeKeyForBody(id, true, AllProtocolVersions.BASELINE_PROTOCOL_VERSION));
    membership.setGroupID(getContext().getPathKeys().getAsInt(GROUP_ID));
    membership.setMemberID(getContext().getPathKeys().getAsInt(MEMBER_ID));

    _app.getMembershipMgr().save(membership);

    return new UpdateResponse(S_204_NO_CONTENT);
  }
View Full Code Here


    membership.setGroupID(getContext().getPathKeys().getAsInt(GROUP_ID));
    membership.setMemberID(getContext().getPathKeys().getAsInt(MEMBER_ID));

    _app.getMembershipMgr().save(membership);

    return new UpdateResponse(S_204_NO_CONTENT);
  }
View Full Code Here

    {
      PatchApplier.applyPatch(group, patch);
    }
    catch (DataProcessingException e)
    {
      return new UpdateResponse(HttpStatus.S_400_BAD_REQUEST);
    }
    boolean wasUpdated = getGroupMgr().update(id, group);
    return new UpdateResponse(wasUpdated ? HttpStatus.S_204_NO_CONTENT : HttpStatus.S_404_NOT_FOUND);
  }
View Full Code Here

  @Override
  public UpdateResponse delete(Integer id)
  {
    boolean deleted = getGroupMgr().delete(id);
    return new UpdateResponse(deleted ? HttpStatus.S_204_NO_CONTENT : HttpStatus.S_404_NOT_FOUND);
  }
View Full Code Here

  public BatchUpdateResult<CustomLong, Greeting> batchDelete(BatchDeleteRequest<CustomLong, Greeting> ids)
  {
    Map<CustomLong, UpdateResponse> results = new HashMap<CustomLong, UpdateResponse>();
    for (CustomLong id: ids.getKeys())
    {
      results.put(id, new UpdateResponse(HttpStatus.S_204_NO_CONTENT));
    }
    return new BatchUpdateResult<CustomLong, Greeting>(results);
  }
View Full Code Here

  public BatchUpdateResult<CustomLong, Greeting> batchUpdate(BatchPatchRequest<CustomLong, Greeting> entityUpdates)
  {
    Map<CustomLong, UpdateResponse> results = new HashMap<CustomLong, UpdateResponse>();
    for (CustomLong id: entityUpdates.getData().keySet())
    {
      results.put(id, new UpdateResponse(HttpStatus.S_204_NO_CONTENT));
    }
    return new BatchUpdateResult<CustomLong, Greeting>(results);
  }
View Full Code Here

  public BatchUpdateResult<CustomLong, Greeting> batchUpdate(BatchUpdateRequest<CustomLong, Greeting> entities)
  {
    Map<CustomLong, UpdateResponse> results = new HashMap<CustomLong, UpdateResponse>();
    for (CustomLong id: entities.getData().keySet())
    {
      results.put(id, new UpdateResponse(HttpStatus.S_204_NO_CONTENT));
    }
    return new BatchUpdateResult<CustomLong, Greeting>(results);
  }
View Full Code Here

  @RestMethod.Delete
  public UpdateResponse delete(String key)
  {
    boolean removed = _db.remove(key) != null;

    return new UpdateResponse(removed ? HttpStatus.S_204_NO_CONTENT : HttpStatus.S_404_NOT_FOUND);
  }
View Full Code Here

  public UpdateResponse update(String key, PatchRequest<Message> patch)
  {
    Message g = _db.get(key);
    if (g == null)
    {
      return new UpdateResponse(HttpStatus.S_404_NOT_FOUND);
    }

    try
    {
      PatchApplier.applyPatch(g, patch);
    }
    catch (DataProcessingException e)
    {
      return new UpdateResponse(HttpStatus.S_400_BAD_REQUEST);
    }

    _db.put(key, g);

    return new UpdateResponse(HttpStatus.S_204_NO_CONTENT);
  }
View Full Code Here

  public UpdateResponse update(String key, Message entity)
  {
    Message g = _db.get(key);
    if (g == null)
    {
      return new UpdateResponse(HttpStatus.S_404_NOT_FOUND);
    }

    _db.put(key, entity);

    return new UpdateResponse(HttpStatus.S_204_NO_CONTENT);
  }
View Full Code Here

TOP

Related Classes of com.linkedin.restli.server.UpdateResponse

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.