Search in sources :

Example 21 with SearchRequest

use of io.jans.scim.model.scim2.SearchRequest in project java-retail by googleapis.

the class SearchWithFacetSpec method getSearchResponse.

public static SearchResponse getSearchResponse(String defaultSearchPlacementName) throws IOException {
    // TRY DIFFERENT CONDITIONS HERE:
    String searchQuery = "Tee";
    String facetKeyParam = "colorFamilies";
    int pageSize = 10;
    String visitorId = UUID.randomUUID().toString();
    FacetKey facetKey = FacetKey.newBuilder().setKey(facetKeyParam).build();
    FacetSpec facetSpec = FacetSpec.newBuilder().setFacetKey(facetKey).build();
    SearchRequest searchRequest = SearchRequest.newBuilder().setPlacement(defaultSearchPlacementName).setQuery(searchQuery).setVisitorId(visitorId).addFacetSpecs(facetSpec).setPageSize(pageSize).build();
    System.out.println("Search request: " + searchRequest);
    try (SearchServiceClient client = SearchServiceClient.create()) {
        SearchResponse searchResponse = client.search(searchRequest).getPage().getResponse();
        System.out.println("Search response: " + searchResponse);
        return searchResponse;
    }
}
Also used : SearchServiceClient(com.google.cloud.retail.v2.SearchServiceClient) SearchRequest(com.google.cloud.retail.v2.SearchRequest) FacetSpec(com.google.cloud.retail.v2.SearchRequest.FacetSpec) FacetKey(com.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey) SearchResponse(com.google.cloud.retail.v2.SearchResponse)

Example 22 with SearchRequest

use of io.jans.scim.model.scim2.SearchRequest in project java-retail by googleapis.

the class SearchWithOrdering method getSearchResponse.

public static SearchResponse getSearchResponse(String defaultSearchPlacementName) throws IOException {
    // TRY DIFFERENT ORDER BY EXPRESSION HERE:
    String order = "price desc";
    String queryPhrase = "Hoodie";
    int pageSize = 10;
    String visitorId = UUID.randomUUID().toString();
    SearchRequest searchRequest = SearchRequest.newBuilder().setPlacement(defaultSearchPlacementName).setQuery(queryPhrase).setOrderBy(order).setVisitorId(visitorId).setPageSize(pageSize).build();
    System.out.println("Search request: " + searchRequest);
    try (SearchServiceClient client = SearchServiceClient.create()) {
        SearchResponse searchResponse = client.search(searchRequest).getPage().getResponse();
        System.out.println("Search response: " + searchResponse);
        return searchResponse;
    }
}
Also used : SearchServiceClient(com.google.cloud.retail.v2.SearchServiceClient) SearchRequest(com.google.cloud.retail.v2.SearchRequest) SearchResponse(com.google.cloud.retail.v2.SearchResponse)

Example 23 with SearchRequest

use of io.jans.scim.model.scim2.SearchRequest in project java-retail by googleapis.

the class SearchWithPagination method getSearchResponse.

public static SearchResponse getSearchResponse(String defaultSearchPlacementName) throws IOException {
    // TRY DIFFERENT PAGINATION PARAMETERS HERE:
    int pageSize = 6;
    String queryPhrase = "Hoodie";
    int offset = 0;
    String pageToken = "";
    String visitorId = UUID.randomUUID().toString();
    SearchRequest searchRequest = SearchRequest.newBuilder().setPlacement(defaultSearchPlacementName).setVisitorId(visitorId).setQuery(queryPhrase).setPageSize(pageSize).setOffset(offset).setPageToken(pageToken).build();
    System.out.println("Search request: " + searchRequest);
    try (SearchServiceClient client = SearchServiceClient.create()) {
        SearchResponse searchResponseFirstPage = client.search(searchRequest).getPage().getResponse();
        System.out.println("Search response: " + searchResponseFirstPage);
        return searchResponseFirstPage;
    }
}
Also used : SearchServiceClient(com.google.cloud.retail.v2.SearchServiceClient) SearchRequest(com.google.cloud.retail.v2.SearchRequest) SearchResponse(com.google.cloud.retail.v2.SearchResponse)

Example 24 with SearchRequest

use of io.jans.scim.model.scim2.SearchRequest in project java-retail by googleapis.

the class SearchWithQueryExpansionSpec method getSearchResponse.

public static SearchResponse getSearchResponse(String defaultSearchPlacementName) throws IOException {
    // TRY DIFFERENT QUERY EXPANSION CONDITION HERE:
    Condition condition = Condition.AUTO;
    int pageSize = 10;
    String queryPhrase = "Google Youth Hero Tee Grey";
    String visitorId = UUID.randomUUID().toString();
    QueryExpansionSpec queryExpansionSpec = QueryExpansionSpec.newBuilder().setCondition(condition).build();
    SearchRequest searchRequest = SearchRequest.newBuilder().setPlacement(defaultSearchPlacementName).setQuery(queryPhrase).setVisitorId(visitorId).setQueryExpansionSpec(queryExpansionSpec).setPageSize(pageSize).build();
    System.out.println("Search request: " + searchRequest);
    try (SearchServiceClient client = SearchServiceClient.create()) {
        SearchResponse searchResponse = client.search(searchRequest).getPage().getResponse();
        System.out.println("Search response: " + searchResponse);
        return searchResponse;
    }
}
Also used : Condition(com.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition) SearchServiceClient(com.google.cloud.retail.v2.SearchServiceClient) SearchRequest(com.google.cloud.retail.v2.SearchRequest) QueryExpansionSpec(com.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec) SearchResponse(com.google.cloud.retail.v2.SearchResponse)

Example 25 with SearchRequest

use of io.jans.scim.model.scim2.SearchRequest in project oxTrust by GluuFederation.

the class FidoDeviceWebServiceDecorator method searchDevicesPost.

public Response searchDevicesPost(SearchRequest searchRequest, String userId) {
    SearchRequest searchReq = new SearchRequest();
    Response response = prepareSearchRequest(searchRequest.getSchemas(), searchRequest.getFilter(), searchRequest.getSortBy(), searchRequest.getSortOrder(), searchRequest.getStartIndex(), searchRequest.getCount(), searchRequest.getAttributesStr(), searchRequest.getExcludedAttributesStr(), searchReq);
    if (response == null) {
        response = validateExistenceOfUser(userId);
        if (response == null) {
            response = service.searchDevicesPost(searchReq, userId);
        }
    }
    return response;
}
Also used : Response(javax.ws.rs.core.Response) SearchRequest(org.gluu.oxtrust.model.scim2.SearchRequest)

Aggregations

Response (javax.ws.rs.core.Response)31 SearchRequest (io.jans.scim.model.scim2.SearchRequest)23 ListResponse (io.jans.scim.model.scim2.ListResponse)21 Test (org.testng.annotations.Test)15 UserResource (io.jans.scim.model.scim2.user.UserResource)13 UserBaseTest (io.jans.scim2.client.UserBaseTest)13 SearchRequest (com.google.cloud.retail.v2.SearchRequest)7 SearchResponse (com.google.cloud.retail.v2.SearchResponse)7 SearchServiceClient (com.google.cloud.retail.v2.SearchServiceClient)7 URI (java.net.URI)6 SearchRequest (org.gluu.oxtrust.model.scim2.SearchRequest)6 BaseScimResource (io.jans.scim.model.scim2.BaseScimResource)5 SkipTest (io.jans.scim2.listener.SkipTest)5 SCIMException (io.jans.scim.model.exception.SCIMException)4 URISyntaxException (java.net.URISyntaxException)4 BeforeTest (org.testng.annotations.BeforeTest)4 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)3 DuplicateEntryException (io.jans.orm.exception.operation.DuplicateEntryException)2 GroupResource (io.jans.scim.model.scim2.group.GroupResource)2 Annotation (java.lang.annotation.Annotation)2