Package com.opengamma.master.user

Examples of com.opengamma.master.user.UserSearchResult


  @Test
  public void test_search_noKeys_Exact_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.setExternalIdSearch(new ExternalIdSearch());
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.EXACT);
    UserSearchResult test = _usrMaster.search(request);
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here


  @Test
  public void test_search_noKeys_All_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.setExternalIdSearch(new ExternalIdSearch());
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.ALL);
    UserSearchResult test = _usrMaster.search(request);
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

  @Test
  public void test_search_noKeys_Any_noMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.setExternalIdSearch(new ExternalIdSearch());
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.ANY);
    UserSearchResult test = _usrMaster.search(request);
   
    assertEquals(0, test.getDocuments().size());
  }
View Full Code Here

  @Test
  public void test_search_noKeys_None_allMatch() {
    UserSearchRequest request = new UserSearchRequest();
    request.setExternalIdSearch(new ExternalIdSearch());
    request.getExternalIdSearch().setSearchType(ExternalIdSearchType.NONE);
    UserSearchResult test = _usrMaster.search(request);
   
    assertEquals(_totalUsers, test.getDocuments().size());
  }
View Full Code Here

  //-------------------------------------------------------------------------
  @Test
  public void test_search_oneKey_Any_AB() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalId(ExternalId.of("A", "B"));
    UserSearchResult test = _usrMaster.search(request);
   
    assertEquals(2, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
  }
View Full Code Here

  @Test
  public void test_search_oneKey_Any_CD() {
    UserSearchRequest request = new UserSearchRequest();
    request.addExternalId(ExternalId.of("C", "D"));
    UserSearchResult test = _usrMaster.search(request);
   
    assertEquals(3, test.getDocuments().size());
    assert101(test.getDocuments().get(0));
    assert102(test.getDocuments().get(1));
    assert202(test.getDocuments().get(2));
  }
View Full Code Here

    assertTrue("Docs was " + users + doc6, users.contains(doc6.getUser()));
   
    UserSearchRequest searchRequest = new UserSearchRequest();
    searchRequest.setUserId("user-2");
    searchRequest.setVersionCorrection(VersionCorrection.LATEST);
    UserSearchResult result = _userMaster.search(searchRequest);
    assertEquals(1, result.getDocuments().size());
    assertEquals(result.getFirstUser(), doc2.getUser());
  }
View Full Code Here

    ArgumentChecker.notNull(request.getPagingRequest(), "request.pagingRequest");
    ArgumentChecker.notNull(request.getVersionCorrection(), "request.versionCorrection");
    s_logger.debug("search {}", request);
   
    final VersionCorrection vc = request.getVersionCorrection().withLatestFixed(now());
    final UserSearchResult result = new UserSearchResult(vc);
   
    final ExternalIdSearch externalIdSearch = request.getExternalIdSearch();
    final List<ObjectId> objectIds = request.getObjectIds();
    if ((objectIds != null && objectIds.size() == 0) ||
        (ExternalIdSearch.canMatch(externalIdSearch) == false)) {
      result.setPaging(Paging.of(request.getPagingRequest(), 0));
      return result;
    }
   
    final DbMapSqlParameterSource args = new DbMapSqlParameterSource()
      .addTimestamp("version_as_of_instant", vc.getVersionAsOf())
View Full Code Here

        list.add(doc);
      }
    }
    Collections.sort(list, request.getSortOrder());
   
    UserSearchResult result = new UserSearchResult();
    result.setPaging(Paging.of(request.getPagingRequest(), list));
    result.getDocuments().addAll(request.getPagingRequest().select(list));
    return result;
  }
View Full Code Here

    // Create the doc search cache and register a user master searcher
    _documentSearchCache = new EHCachingSearchCache(name + "User", cacheManager, new EHCachingSearchCache.Searcher() {
      @Override
      public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
        // Fetch search results from underlying master
        UserSearchResult result = ((UserMaster) getUnderlying()).search((UserSearchRequest)
            EHCachingSearchCache.withPagingRequest((UserSearchRequest) request, pagingRequest));

        // Cache the result documents
        EHCachingSearchCache.cacheDocuments(result.getDocuments(), getUidToDocumentCache());

        // Return the list of result UniqueIds
        return new ObjectsPair<>(result.getPaging().getTotalItems(),
                                 EHCachingSearchCache.extractUniqueIds(result.getDocuments()));
      }
    });

    // Create the history search cache and register a security master searcher
    _historySearchCache = new EHCachingSearchCache(name + "UserHistory", cacheManager, new EHCachingSearchCache.Searcher() {
      @Override
      public ObjectsPair<Integer, List<UniqueId>> search(Bean request, PagingRequest pagingRequest) {
        // Fetch search results from underlying master
        UserHistoryResult result = ((UserMaster) getUnderlying()).history((UserHistoryRequest)
            EHCachingSearchCache.withPagingRequest((UserHistoryRequest) request, pagingRequest));

        // Cache the result documents
        EHCachingSearchCache.cacheDocuments(result.getDocuments(), getUidToDocumentCache());

        // Return the list of result UniqueIds
        return new ObjectsPair<>(result.getPaging().getTotalItems(),
                                 EHCachingSearchCache.extractUniqueIds(result.getDocuments()));
      }
    });

    // Prime document search cache
    UserSearchRequest defaultSearch = new UserSearchRequest();
View Full Code Here

TOP

Related Classes of com.opengamma.master.user.UserSearchResult

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.