public String getParentKey() { return getContext().getPathKeys().get("parentKey"); } }
/** * Deletes the greeting. */ @Override public UpdateResponse delete() { Long key = this.getContext().getPathKeys().get("subgreetingsId"); TONES.remove(key); return new UpdateResponse(HttpStatus.S_204_NO_CONTENT); }
/** * Updates the greeting. */ @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); }
/** * Gets the greeting. */ @Override public Greeting get() { Long key = this.getContext().getPathKeys().get("subgreetingsId"); return TONES.containsKey(key) ? new Greeting().setId(key * 10) .setMessage("Subsubgreeting") .setTone(TONES.get(key)) : null; }
@RestMethod.Get public TwoPartKey get(String key) { PathKeys pathKeys = getContext().getPathKeys(); ComplexResourceKey<TwoPartKey, TwoPartKey> keys = pathKeys.get("keys"); return convert(keys); }
@Override public Greeting get(CustomLong lo) { CustomLong customTypes2Id = (CustomLong)getContext().getPathKeys().get("customTypes2Id"); return new Greeting().setId(customTypes2Id.toLong() * lo.toLong()); }
/** * Updates the greeting. */ @Override public UpdateResponse update(PatchRequest<Greeting> patchRequest) { Long key = this.getContext().getPathKeys().get("subgreetingsId"); if (TONES.containsKey(key)) { 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); } }
/** * @see com.linkedin.restli.server.resources.AssociationResourceTemplate#update(com.linkedin.restli.common.CompoundKey, com.linkedin.data.template.RecordTemplate) */ @Override public UpdateResponse update(CompoundKey key, GroupMembership membership) { validate(membership); // we set groupID, memberID based on the URI membership.setId(URIParamUtils.encodeKeyForBody(key, 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); }
public Message get(String key) { PathKeys pathKeys = getContext().getPathKeys(); String srcKey = pathKeys.getAsString("src"); String destKey = pathKeys.getAsString("dest"); Message message = new Message(); message.setId(srcKey); message.setTone(Tone.FRIENDLY); message.setMessage(destKey); return message; }
Long key = resource.getContext().getPathKeys().get(_resourceName + "Id"); Greeting g = _db.get(key); if (g == null)
/** * @see AssociationResource#update */ @Override public UpdateResponse update(CompoundKey id, PatchRequest<GroupMembership> patch) { GroupMembership membership = _app.getMembershipMgr().get(id); try { 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); }