@RestMethod.GetAll public CollectionResult<Greeting, Empty> getAllCollectionResult(@PagingContextParam PagingContext ctx) { return null; }
@Override public List<Message> getAll(@PagingContextParam PagingContext pagingContext) { return _dataProvider.getAll(); }
@RestMethod.GetAll public List<Greeting> getAll(@PagingContextParam PagingContext ctx) { // Deterministic behaviour of getAll to make it easier to test as part of the integration test suite // Just return those greetings that have "GetAll" present in their message List<Greeting> greetings = new ArrayList<Greeting>(); for (Greeting greeting: _db.values()) { if (greeting.getMessage().contains("GetAll")) { greetings.add(greeting); } } return greetings; }
@Finder("finderTaskNullList") public Task<List<Greeting>> finderTaskNullList(@PagingContextParam final PagingContext a, @QueryParam("tone") final Tone b) { return new BaseTask<List<Greeting>>() { protected Promise<List<Greeting>> run(final com.linkedin.parseq.Context context) throws Exception { //Depending on the tone, we return a null list or a list with a null element return Promises.value(searchReturnNullList(a, b)); } }; } }
@Finder("searchWithDefault") public List<Greeting> searchWithDefault(@PagingContextParam PagingContext ctx, @QueryParam("tone") @Optional("FRIENDLY") Tone tone) { return search(ctx, tone); }
/** * This resource method performs automatic projection for the root object entities and also the custom metadata. */ @Finder("rootAutomaticMetadataAutomatic") public CollectionResult<Greeting, Greeting> rootAutomaticMetadataAutomatic( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) { return new CollectionResult<Greeting, Greeting>(LIST, 2, CUSTOM_METADATA_GREETING); }
@Override public List<GroupMembership> getAll(@PagingContextParam PagingContext pagingContext) { return _app.getMembershipMgr() .search(new GroupMembershipSearchQuery(GroupMembershipSearchQuery.WILDCARD, pagingContext.getStart(), pagingContext.getCount())); } }
/** * This resource method performs automatic projection for the custom metadata and complete automatic projection * for paging. This means that it will provide a total in its construction of CollectionResult. */ @Finder("metadataAutomaticPagingFullyAutomatic") public CollectionResult<Greeting, Greeting> metadataAutomaticPagingFullyAutomatic( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) { return new CollectionResult<Greeting, Greeting>(LIST, 2, CUSTOM_METADATA_GREETING); }
/** * This resource method performs automatic projection for the root object entities and automatic on the metadata * as well. The caveat here is that the metadata returned by the resource method is null. We want to make sure * restli doesn't fall over when it sees the null later on. */ @Finder("rootAutomaticMetadataAutomaticNull") public CollectionResult<Greeting, Greeting> rootAutomaticMetadataAutomaticNull( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) { return new CollectionResult<Greeting, Greeting>(LIST, 2, null); }
@Finder("emailDomain") public List<Group> findByEmailDomain(@PagingContextParam PagingContext pagingContext, @QueryParam("emailDomain") String emailDomain) { return getGroupMgr().findByEmailDomain(emailDomain, pagingContext.getStart(), pagingContext.getCount()); }
@Finder("search") public List<Greeting> search(@PagingContextParam PagingContext ctx, @QueryParam("tone") @Optional Tone tone, @QueryParam("complexQueryParam") @Optional Greeting complexQueryParam) { return _impl.search(ctx, tone); }
@Finder("member") public List<GroupMembership> getMemberships(@PagingContextParam PagingContext pagingContext, @AssocKeyParam("memberID") int memberID) { return _app.getMembershipMgr().getByMember(memberID, MembershipLevel.MEMBER, pagingContext.getStart(), pagingContext.getCount()); }
@Finder("manager") public List<Group> findByManager(@PagingContextParam PagingContext pagingContext, @QueryParam("managerMemberID") int memberID) { return getGroupMgr().findByManager(memberID, pagingContext.getStart(), pagingContext.getCount()); }
/** * This resource method performs automatic projection for the custom metadata and automatic projection * for paging. This particular resource method also varies on what it sets total to. */ @Finder("metadataAutomaticPagingAutomaticPartialNull") public CollectionResult<Greeting, Greeting> metadataAutomaticPagingAutomaticPartialNull( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) { return new CollectionResult<Greeting, Greeting>(LIST, calculateTotal(pagingProjection), CUSTOM_METADATA_GREETING); }
/** * This resource method performs automatic projection for the root object entities and manual projection for the * custom metadata. */ @Finder("rootAutomaticMetadataManual") public CollectionResult<Greeting, Greeting> rootAutomaticMetadataManual( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) throws CloneNotSupportedException { super.getContext().setMetadataProjectionMode(ProjectionMode.MANUAL); return new CollectionResult<Greeting, Greeting>(LIST, 2, applyMetadataProjection(metadataProjection)); }
/** * This resource method performs manual projection for the root object entities and automatic projection for the * custom metadata. */ @Finder("rootManualMetadataAutomatic") public CollectionResult<Greeting, Greeting> rootManualMetadataAutomatic( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) throws CloneNotSupportedException { super.getContext().setProjectionMode(ProjectionMode.MANUAL); return new CollectionResult<Greeting, Greeting>(applyRootObjectProjection(rootObjectProjection), 2, CUSTOM_METADATA_GREETING); }
/** * This resource method is a variant of the rootAutomaticMetadataManual finder above, except it uses GET_ALL. * This test is to make sure that GET_ALL observes the same code path in restli as FINDER does for projection. * Redundant comments excluded for the sake of brevity. */ @RestMethod.GetAll public CollectionResult<Greeting, Greeting> getAllRootAutomaticMetadataManual( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) throws CloneNotSupportedException { super.getContext().setMetadataProjectionMode(ProjectionMode.MANUAL); return new CollectionResult<Greeting, Greeting>(LIST, 2, applyMetadataProjection(metadataProjection)); }
/** * This resource method performs manual projection for the custom metadata and automatic projection * for Paging. */ @Finder("metadataManualPagingFullyAutomatic") public CollectionResult<Greeting, Greeting> metadataManualPagingFullyAutomatic( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) throws CloneNotSupportedException { super.getContext().setMetadataProjectionMode(ProjectionMode.MANUAL); return new CollectionResult<Greeting, Greeting>(LIST, 2, applyMetadataProjection(metadataProjection)); }
@Finder("search") public List<Group> search(@PagingContextParam PagingContext pagingContext, @QueryParam("keywords") @Optional String keywords, @QueryParam("nameKeywords") @Optional String nameKeywords, @QueryParam("groupID") @Optional Integer groupID) { return getGroupMgr().search(keywords, nameKeywords, groupID, pagingContext.getStart(), pagingContext.getCount()); }
/** * This resource method performs manual projection for the root object entities and manual projection for the * custom metadata. Comments excluded since its combining behavior from the previous tests. */ @Finder("rootManualMetadataManual") public CollectionResult<Greeting, Greeting> rootManualMetadataManual( final @PagingContextParam PagingContext ctx, final @ProjectionParam MaskTree rootObjectProjection, final @MetadataProjectionParam MaskTree metadataProjection, final @PagingProjectionParam MaskTree pagingProjection) throws CloneNotSupportedException { super.getContext().setMetadataProjectionMode(ProjectionMode.MANUAL); super.getContext().setProjectionMode(ProjectionMode.MANUAL); return new CollectionResult<Greeting, Greeting>(applyRootObjectProjection(rootObjectProjection), 2, applyMetadataProjection(metadataProjection)); }