Package com.linkedin.restli.server

Examples of com.linkedin.restli.server.UpdateResponse


  @RestMethod.Delete
  public UpdateResponse delete(Long 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(Long key, PatchRequest<Greeting> patch)
  {
    Greeting 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(Long key, Greeting entity)
  {
    Greeting 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

    for (Object key : mergedKeys)
    {
      final UpdateStatus status = new UpdateStatus();

      final UpdateResponse update = updates.get(key);
      if (update != null)
      {
        status.setStatus(update.getStatus().getCode());
      }

      status.setError(errors.get(key), SetMode.IGNORE_NULL);

      results.put(key, status);
View Full Code Here

  @Override
  public UpdateResponse update(Greeting greeting)
  {
    Long key = this.getContext().getPathKeys().get("subgreetingsId");
    TONES.put(key, greeting.getTone());
    return new UpdateResponse(HttpStatus.S_204_NO_CONTENT);
  }
View Full Code Here

      try
      {
        Greeting patched = new Greeting();
        PatchApplier.applyPatch(patched, patchRequest);
        TONES.put(key, patched.getTone());
        return new UpdateResponse(HttpStatus.S_204_NO_CONTENT);
      }
      catch(DataProcessingException e)
      {
        return new UpdateResponse((HttpStatus.S_400_BAD_REQUEST));
      }
    }
    else
    {
      return new UpdateResponse(HttpStatus.S_404_NOT_FOUND);
    }
  }
View Full Code Here

  @Override
  public UpdateResponse delete()
  {
    Long key = this.getContext().getPathKeys().get("subgreetingsId");
    TONES.remove(key);
    return new UpdateResponse(HttpStatus.S_204_NO_CONTENT);
  }
View Full Code Here

     */
  @Override
  public UpdateResponse delete(CompoundKey id)
  {
    boolean deleted = _app.getMembershipMgr().delete(id);
    return new UpdateResponse(deleted ? S_204_NO_CONTENT : S_404_NOT_FOUND);
  }
View Full Code Here

      membership.setId(URIParamUtils.encodeKeyForBody(id, true, AllProtocolVersions.BASELINE_PROTOCOL_VERSION));
      membership.setGroupID(((Integer)id.getPart(GROUP_ID)));
      membership.setMemberID(((Integer)id.getPart(MEMBER_ID)));
      _app.getMembershipMgr().save(membership);
      results.put(id, new UpdateResponse(S_204_NO_CONTENT));
    }
    return new BatchUpdateResult<CompoundKey, GroupMembership>(results);
  }
View Full Code Here

      GroupMembership groupMembership = _app.getMembershipMgr().get(key);

      if (groupMembership == null)
      {
        results.put(key, new UpdateResponse(HttpStatus.S_404_NOT_FOUND));
      }
      else
      {
        try
        {
          PatchApplier.applyPatch(groupMembership, patch);
          _app.getMembershipMgr().save(groupMembership);
          results.put(key, new UpdateResponse(HttpStatus.S_204_NO_CONTENT));
        }
        catch (DataProcessingException e)
        {
          results.put(key, new UpdateResponse(HttpStatus.S_400_BAD_REQUEST));
        }
      }
    }
    return new BatchUpdateResult<CompoundKey, GroupMembership>(results);
  }
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.