All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rapture.common.client.HttpSearchApi Maven / Gradle / Ivy

/**
 * The MIT License (MIT)
 *
 * Copyright (C) 2011-2016 Incapture Technologies LLC
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/**
 * This file is autogenerated and any changes will be overwritten.
 */

package rapture.common.client;

import java.util.List;
import java.util.Map;
import rapture.common.api.SearchApi;
import rapture.common.api.ScriptSearchApi;
import rapture.common.CallingContext;
import rapture.common.model.GeneralResponse;
import rapture.common.model.BasePayload;
import rapture.common.exception.RaptureException;
import rapture.common.impl.jackson.JacksonUtil;

import com.fasterxml.jackson.core.type.TypeReference;

import org.apache.log4j.Logger;

import rapture.common.model.SearchRepoConfig;
import rapture.common.SearchResponse;

import rapture.common.shared.search.SearchPayload;

import rapture.common.shared.search.SearchWithCursorPayload;

import rapture.common.shared.search.QualifiedSearchPayload;

import rapture.common.shared.search.QualifiedSearchWithCursorPayload;

import rapture.common.shared.search.ValidateSearchRepoPayload;

import rapture.common.shared.search.CreateSearchRepoPayload;

import rapture.common.shared.search.SearchRepoExistsPayload;

import rapture.common.shared.search.GetSearchRepoConfigPayload;

import rapture.common.shared.search.GetSearchRepoConfigsPayload;

import rapture.common.shared.search.DeleteSearchRepoPayload;

import rapture.common.shared.search.RebuildRepoIndexPayload;

import rapture.common.shared.search.DropRepoIndexPayload;

import rapture.common.shared.search.StartSearchReposPayload;


@SuppressWarnings("all")
public class HttpSearchApi extends BaseHttpApi implements SearchApi, ScriptSearchApi {
        private static final Logger log = Logger.getLogger(HttpSearchApi.class);

	public HttpSearchApi(HttpLoginApi login) {
		super(login, "search");
	}
		
	    private static final class SearchTypeReference extends TypeReference {
	    }    
	    @Override
	    public SearchResponse search(CallingContext context, String query) {
	        SearchPayload requestObj = new SearchPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setQuery(query);
	        return doRequest(requestObj, "SEARCH", new SearchTypeReference());    }

	    private static final class SearchWithCursorTypeReference extends TypeReference {
	    }    
	    @Override
	    public SearchResponse searchWithCursor(CallingContext context, String cursorId, int size, String query) {
	        SearchWithCursorPayload requestObj = new SearchWithCursorPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setCursorId(cursorId);
	        requestObj.setSize(size);
	        requestObj.setQuery(query);
	        return doRequest(requestObj, "SEARCHWITHCURSOR", new SearchWithCursorTypeReference());    }

	    private static final class QualifiedSearchTypeReference extends TypeReference {
	    }    
	    @Override
	    public SearchResponse qualifiedSearch(CallingContext context, String searchRepo, List types, String query) {
	        QualifiedSearchPayload requestObj = new QualifiedSearchPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setSearchRepo(searchRepo);
	        requestObj.setTypes(types);
	        requestObj.setQuery(query);
	        return doRequest(requestObj, "QUALIFIEDSEARCH", new QualifiedSearchTypeReference());    }

	    private static final class QualifiedSearchWithCursorTypeReference extends TypeReference {
	    }    
	    @Override
	    public SearchResponse qualifiedSearchWithCursor(CallingContext context, String searchRepo, List types, String cursorId, int size, String query) {
	        QualifiedSearchWithCursorPayload requestObj = new QualifiedSearchWithCursorPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setSearchRepo(searchRepo);
	        requestObj.setTypes(types);
	        requestObj.setCursorId(cursorId);
	        requestObj.setSize(size);
	        requestObj.setQuery(query);
	        return doRequest(requestObj, "QUALIFIEDSEARCHWITHCURSOR", new QualifiedSearchWithCursorTypeReference());    }

	    private static final class ValidateSearchRepoTypeReference extends TypeReference {
	    }    
	    @Override
	    public Boolean validateSearchRepo(CallingContext context, String searchRepoUri) {
	        ValidateSearchRepoPayload requestObj = new ValidateSearchRepoPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setSearchRepoUri(searchRepoUri);
	        return doRequest(requestObj, "VALIDATESEARCHREPO", new ValidateSearchRepoTypeReference());    }

	    
	    @Override
	    public void createSearchRepo(CallingContext context, String searchRepoUri, String config) {
	        CreateSearchRepoPayload requestObj = new CreateSearchRepoPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setSearchRepoUri(searchRepoUri);
	        requestObj.setConfig(config);
	        doRequest(requestObj, "CREATESEARCHREPO", null);    }

	    private static final class SearchRepoExistsTypeReference extends TypeReference {
	    }    
	    @Override
	    public Boolean searchRepoExists(CallingContext context, String searchRepoUri) {
	        SearchRepoExistsPayload requestObj = new SearchRepoExistsPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setSearchRepoUri(searchRepoUri);
	        return doRequest(requestObj, "SEARCHREPOEXISTS", new SearchRepoExistsTypeReference());    }

	    private static final class GetSearchRepoConfigTypeReference extends TypeReference {
	    }    
	    @Override
	    public SearchRepoConfig getSearchRepoConfig(CallingContext context, String searchRepoUri) {
	        GetSearchRepoConfigPayload requestObj = new GetSearchRepoConfigPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setSearchRepoUri(searchRepoUri);
	        return doRequest(requestObj, "GETSEARCHREPOCONFIG", new GetSearchRepoConfigTypeReference());    }

	    private static final class GetSearchRepoConfigsTypeReference extends TypeReference> {
	    }    
	    @Override
	    public List getSearchRepoConfigs(CallingContext context) {
	        GetSearchRepoConfigsPayload requestObj = new GetSearchRepoConfigsPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        return doRequest(requestObj, "GETSEARCHREPOCONFIGS", new GetSearchRepoConfigsTypeReference());    }

	    
	    @Override
	    public void deleteSearchRepo(CallingContext context, String searchRepoUri) {
	        DeleteSearchRepoPayload requestObj = new DeleteSearchRepoPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setSearchRepoUri(searchRepoUri);
	        doRequest(requestObj, "DELETESEARCHREPO", null);    }

	    
	    @Override
	    public void rebuildRepoIndex(CallingContext context, String repoUri) {
	        RebuildRepoIndexPayload requestObj = new RebuildRepoIndexPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setRepoUri(repoUri);
	        doRequest(requestObj, "REBUILDREPOINDEX", null);    }

	    
	    @Override
	    public void dropRepoIndex(CallingContext context, String repoUri) {
	        DropRepoIndexPayload requestObj = new DropRepoIndexPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setRepoUri(repoUri);
	        doRequest(requestObj, "DROPREPOINDEX", null);    }

	    
	    @Override
	    public void startSearchRepos(CallingContext context) {
	        StartSearchReposPayload requestObj = new StartSearchReposPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        doRequest(requestObj, "STARTSEARCHREPOS", null);    }

	
	    @Override
	    public SearchResponse search(String query) {
	        return search(null,query);    }

	    @Override
	    public SearchResponse searchWithCursor(String cursorId, int size, String query) {
	        return searchWithCursor(null,cursorId,size,query);    }

	    @Override
	    public SearchResponse qualifiedSearch(String searchRepo, List types, String query) {
	        return qualifiedSearch(null,searchRepo,types,query);    }

	    @Override
	    public SearchResponse qualifiedSearchWithCursor(String searchRepo, List types, String cursorId, int size, String query) {
	        return qualifiedSearchWithCursor(null,searchRepo,types,cursorId,size,query);    }

	    @Override
	    public Boolean validateSearchRepo(String searchRepoUri) {
	        return validateSearchRepo(null,searchRepoUri);    }

	    @Override
	    public void createSearchRepo(String searchRepoUri, String config) {
	        createSearchRepo(null,searchRepoUri,config);    }

	    @Override
	    public Boolean searchRepoExists(String searchRepoUri) {
	        return searchRepoExists(null,searchRepoUri);    }

	    @Override
	    public SearchRepoConfig getSearchRepoConfig(String searchRepoUri) {
	        return getSearchRepoConfig(null,searchRepoUri);    }

	    @Override
	    public List getSearchRepoConfigs() {
	        return getSearchRepoConfigs(null);    }

	    @Override
	    public void deleteSearchRepo(String searchRepoUri) {
	        deleteSearchRepo(null,searchRepoUri);    }

	    @Override
	    public void rebuildRepoIndex(String repoUri) {
	        rebuildRepoIndex(null,repoUri);    }

	    @Override
	    public void dropRepoIndex(String repoUri) {
	        dropRepoIndex(null,repoUri);    }

	    @Override
	    public void startSearchRepos() {
	        startSearchRepos(null);    }

}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy