Skip to content

Commit

Permalink
Add batchGet for BaseAspectV2Resource (#419)
Browse files Browse the repository at this point in the history

---------

Co-authored-by: Derek Pham <[email protected]>
  • Loading branch information
derekpham and Derek Pham authored Sep 10, 2024
1 parent e658496 commit b6b2c88
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import com.linkedin.restli.server.annotations.ReturnEntity;
import com.linkedin.restli.server.resources.CollectionResourceTaskTemplate;
import java.time.Clock;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nonnull;
Expand Down Expand Up @@ -85,6 +88,12 @@ public Task<ASPECT> get(@Nonnull URN urn) {
.orElseThrow(RestliUtils::resourceNotFoundException));
}

@RestMethod.BatchGet
@Nonnull
public Task<Map<URN, java.util.Optional<ASPECT>>> batchGet(@Nonnull Collection<URN> urns) {
return RestliUtils.toTask(() -> getLocalDAO().get(_aspectClass, new HashSet<>(urns)));
}

@RestMethod.GetAll
@Nonnull
public Task<CollectionResult<ASPECT, ListResultMetadata>> getAllWithMetadata(@Nonnull URN urn,
Expand Down

0 comments on commit b6b2c88

Please sign in to comment.