MongoPersonRepository extends MongoRepositoryBase<Person2> implements PersonRepository { @Override public ImmutableSet<String> getFcmTokens(String id) { final DBObject query = new BasicDBObject(ImmutableMap.of("_id", id, "firebaseCloudMessagingTokens", new BasicDBObject("$exists", true))); final BasicDBObject fields = new BasicDBObject("firebaseCloudMessagingTokens", true); final List<DBObject> dbObjects = findSecondaryAsDBObjects(query, fields, null, 0, 0, "getFcmTokens", id); final ImmutableSet.Builder<String> bSet = ImmutableSet.builder(); if (!dbObjects.isEmpty()) { dbObjects.forEach(new Consumer<DBObject>() { @Override public void accept(DBObject objDoc) { final BasicDBList objTokens = (BasicDBList) objDoc.get("firebaseCloudMessagingTokens"); objTokens.forEach(new Consumer<Object>() { @Override public void accept(Object token) { bSet.add(String.valueOf(token)); } }); } }); } final ImmutableSet<String> result = bSet.build(); log.debug("Got fcm tokens for person '{}': {}", id, result); return result; } MongoPersonRepository(String tenantId, @Nullable CacheManager cacheMgr, String mongoUri,
			boolean migrationEnabled, boolean autoExplainSlow); @Override @Nullable Person2 findOneBySlug(StatusMask statusMask, String upSlug); @Override Existence<String> existsBySlug(StatusMask statusMask, String upSlug); @Override Existence<String> existsBySlugCacheable(StatusMask statusMask, String upSlug); @Override Person2 findOneByFacebook(@Nullable Long facebookId, @Nullable String facebookUsername); @Override @Nullable Person2 findOneByEmail(StatusMask statusMask, @Nullable String email); @Override @Nullable Person2 findOneByEmail(AccountStatus status, String email); @Override boolean isExistsByEmail(StatusMask statusMask, String email); @Override Optional<String> getIdByEmail(StatusMask statusMask, String email); @Override @Nullable Person2 findOneById(StatusMask statusMask, @Nullable String id); @Override @Nullable Person2 findOneByMobileOrPhoneNumber(StatusMask statusMask, @Nullable String phoneNumber); @Override boolean isMobilePhoneNumberAlreadyRegistered(StatusMask statusMask, String phoneNumber); @Override Optional<String> getIdByMobileOrPhoneNumber(StatusMask statusMask, String phoneNumber); @Override @Nullable Person2 findOneByTwitter(@Nullable Long twitterId, @Nullable String twitterScreenName); @Override @Nullable Person2 findOneByClientAccessToken(@Nullable String clientAccessToken); @Override Page<Person2> findBySearchText(StatusMask statusMask, @Nullable String searchText, Pageable pageable); @Override long countBySearchText(StatusMask statusMask, String searchText); @Override Page<Person2> findAll(StatusMask statusMask, Pageable pageable); @Override Page<Person2> findAll(StatusMask statusMask, Projection projection, Pageable pageable); @Override long count(StatusMask statusMask); @Override Person2 findOneActive(String personId); @Override S lookupOne(StatusMask statusMask, LookupKey lookupKey, K key); @Override Map<K, Try<S>> lookupAll(StatusMask statusMask,
			LookupKey lookupKey, Collection<K> keys); @Override Map<K, Existence<K>> checkExistsAll(StatusMask statusMask, LookupKey lookupKey,
			Collection<K> keys); @Override Existence<K> checkExists(StatusMask statusMask, LookupKey lookupKey, K key); @Override TrashResult trash(Person2 entity); @Override TrashResult trashById(String id); @Override Map<String, Try<TrashResult>> trashAll(Collection<Person2> entities); @Override Map<String, Try<TrashResult>> trashAllByIds(Collection<String> ids); @Override UntrashResult untrash(Person2 entity); @Override UntrashResult untrashById(String id); @Override Map<String, Try<UntrashResult>> untrashAll(Collection<Person2> entities); @Override Map<String, Try<UntrashResult>> untrashAllByIds(Collection<String> ids); @Override List<Person2> findAll(StatusMask statusMask, Collection<String> ids); @Override Page<Person2> findAll(StatusMask statusMask, Collection<String> ids, Pageable pageable); @Override List<Person2> findAllBySecRoleIds(StatusMask statusMask, Collection<String> secRoleIds); @Override boolean hasMatchWithSecRoleIds(String personId, Collection<String> secRoleIds); @Override List<Person2> findAllByCustomerRoleIds(StatusMask statusMask, Collection<String> customerRoleIds); @Override Page<Person2> findAllByCustomerRoleIds(StatusMask statusMask, Collection<String> customerRoleIds,
			Pageable pageable); @Override long countAllByCustomerRolesIds(StatusMask statusMask, Collection<String> customerRoleIds); @Override Page<Person2> findAllByKeywordAndStatus(String keyword, Collection<AccountStatus> accountStatuses,
			Pageable pageable); @Override Page<Person2> findAllByKeywordAndRoles(String keyword, Collection<AccountStatus> accountStatuses,
			CustomerRole2 customerRole, Collection<String> securityRoleIds, Pageable pageable); @Override long countAllByKeywordAndRoles(String keyword, Collection<AccountStatus> accountStatuses,
			CustomerRole2 customerRole, Collection<String> securityRoleIds); @Override Page<Person2> findAll(Collection<AccountStatus> accountStatuses, Pageable pageable); @Override long countBySearchText(Collection<AccountStatus> accountStatuses, String searchText); @Override long countByStatuses(Collection<AccountStatus> accountStatuses); @Override long countByFacebook(); @Override boolean existByCustomerRoleIds(StatusMask statusMask, Collection<String> customerRoleIds); @Override void setNullCustomerRole(Collection<String> customerRoleIds); @Override String getCustomerRoleByPersonId(String personId); @Override ImmutableSet<String> findAllSlugsByStatus(StatusMask statusMask); @Override ImmutableSet<String> findAllSlugsByStatus(StatusMask statusMask, Pageable pageable); @Override @Nullable Person2 getZendeskUserId(String email); @Override Long getZendeskUserIdByPersonId(String personId); @Override Page<Person2> findAllByEmailExists(StatusMask statusMask, Pageable pageable); @Override Page<Person2> findAllByEmailExists(DateTime starTime, DateTime endTime, StatusMask statusMask,
			Pageable pageable); @Override List<String> findAllIdsByCustomerRoleId(StatusMask statusMask, String customerRoleId); @Override Optional<String> getCustomerRole(@Nonnull String personId); @Override boolean existsByEmail(String email); @Override boolean existsByEmailAndStatus(String email, AccountStatus status); @Override ImmutableList<AccountStatus> getStatusesByEmail(String email); String findJneAreaCode(String district, String city, String province, String country); @Override double getPerformanceValue(String id); @Override boolean updatePerformanceValues(Map<String, Double> upPerformanceMap); @Override Page<Person2> findAllWhereCustomerRoleValidThruNotNull(StatusMask statusMask, Pageable pageable); @SuppressWarnings("deprecation") @Override void removeFcmToken(String userId, String oldFirebaseCloudMessagingToken); @Override boolean addPrimaryEmail(String id, String primaryEmail); @Override boolean addPrimaryMobileNumber(String id, String mobileNumber); @Override @Nullable PersonInfo2 findOneAsInfo(String id); @Override ImmutableList<PostalAddress2> getAddresses(String id); @Override void setJneAreaCode(String id, UUID addressId, String areaCode); @Override void addAddress(String id, PostalAddress2 address); @Override PostalAddress2 getBillingAddress(String id); @Override void modifyAddress(String personId, PostalAddress2 postalAddress); @Override ImmutableSet<String> getFcmTokens(String id); @Override PostalAddress2 getShippingAddress(String id); @Override ImmutableMap<String, String> findCustomerRoleIdMap(Collection<String> personIds); @Override void setAddressToResellerStartUp(String personId, UUID addressId, String startUpId, Date regDate); @Override Map<String, Double> getPerformanceValue(Collection<String> ids); @Override List<Performance> getPerformance(Collection<String> ids); @Override Performance getPerformance(String id);  }
@Test public void getFcmTokens() { final ImmutableSet<String> fcmTokens = personRepo.getFcmTokens("ingga_bia_putri"); }