Merge branch '10.3.x'
This commit is contained in:
commit
50fc9851ba
46 changed files with 160 additions and 95 deletions
|
@ -83,7 +83,7 @@ public class AccessTokenService {
|
|||
|
||||
public OptionalEntity<AccessToken> getAccessTokenByToken(final String token) {
|
||||
return accessTokenBhv.selectEntity(cb -> {
|
||||
cb.query().setToken_CommonTerms(token);
|
||||
cb.query().setToken_Term(token);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
|
||||
final String rootURL = getRootURL(paramMap);
|
||||
final String authToken = getAuthToken(paramMap);
|
||||
final List<String> sourceLabels = getSourceLabelList(rootURL, authToken);
|
||||
final long readInterval = getReadInterval(paramMap);
|
||||
|
||||
if (rootURL.isEmpty() || authToken.isEmpty()) {
|
||||
|
@ -91,8 +92,9 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
};
|
||||
for (final Map<String, Object> repository : repositoryList) {
|
||||
try {
|
||||
final String name = (String) repository.get("name");
|
||||
final String owner = (String) repository.get("owner");
|
||||
final String name = (String) repository.get("name");
|
||||
final String refStr = getGitRef(rootURL, authToken, owner, name, "master");
|
||||
final List<String> roleList = createRoleList(owner, repository);
|
||||
|
||||
collectFileNames(
|
||||
|
@ -100,12 +102,13 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
authToken,
|
||||
owner,
|
||||
name,
|
||||
refStr,
|
||||
StringUtil.EMPTY,
|
||||
0,
|
||||
readInterval,
|
||||
path -> {
|
||||
storeFileContent(rootURL, authToken, owner, name, roleList, path, crawlingConfig, callback, paramMap,
|
||||
scriptMap, defaultDataMap);
|
||||
storeFileContent(rootURL, authToken, sourceLabels, owner, name, refStr, roleList, path, crawlingConfig,
|
||||
callback, paramMap, scriptMap, defaultDataMap);
|
||||
if (readInterval > 0) {
|
||||
sleep(readInterval);
|
||||
}
|
||||
|
@ -135,6 +138,20 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
return StringUtil.EMPTY;
|
||||
}
|
||||
|
||||
protected List<String> getSourceLabelList(final String rootURL, final String authToken) {
|
||||
final String url = rootURL + "api/v3/fess/label";
|
||||
try (CurlResponse curlResponse = Curl.get(url).header("Authorization", "token " + authToken).execute()) {
|
||||
final Map<String, Object> map = curlResponse.getContentAsMap();
|
||||
assert (map.containsKey("source_label"));
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<String> sourceLabels = (List<String>) map.get("source_label");
|
||||
return sourceLabels;
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to access to " + rootURL, e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Map<String, Object>> getRepositoryList(final String rootURL, final String authToken) {
|
||||
final String url = rootURL + "api/v3/fess/repos";
|
||||
try (CurlResponse curlResponse = Curl.get(url).header("Authorization", "token " + authToken).execute()) {
|
||||
|
@ -149,6 +166,21 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
}
|
||||
}
|
||||
|
||||
protected String getGitRef(final String rootURL, final String authToken, final String owner, final String name, final String branch) {
|
||||
final String url = rootURL + "api/v3/repos/" + owner + "/" + name + "/git/refs/heads/" + branch;
|
||||
try (CurlResponse curlResponse = Curl.get(url).header("Authorization", "token " + authToken).execute()) {
|
||||
final Map<String, Object> map = curlResponse.getContentAsMap();
|
||||
assert (map.containsKey("object"));
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, String> objmap = (Map<String, String>) map.get("object");
|
||||
assert (objmap.containsKey("sha"));
|
||||
return objmap.get("sha");
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to access to " + rootURL, e);
|
||||
return branch;
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> createRoleList(final String owner, final Map<String, Object> repository) {
|
||||
Boolean isPrivate = true;
|
||||
if (repository.containsKey(PRIVATE_REPOSITORY_PARAM)) {
|
||||
|
@ -174,11 +206,12 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
}
|
||||
}
|
||||
|
||||
private void storeFileContent(final String rootURL, final String authToken, final String owner, final String name,
|
||||
final List<String> roleList, final String path, final CrawlingConfig crawlingConfig, final IndexUpdateCallback callback,
|
||||
final Map<String, String> paramMap, final Map<String, String> scriptMap, final Map<String, Object> defaultDataMap) {
|
||||
private void storeFileContent(final String rootURL, final String authToken, final List<String> sourceLabels, final String owner,
|
||||
final String name, final String refStr, final List<String> roleList, final String path, final CrawlingConfig crawlingConfig,
|
||||
final IndexUpdateCallback callback, final Map<String, String> paramMap, final Map<String, String> scriptMap,
|
||||
final Map<String, Object> defaultDataMap) {
|
||||
final String apiUrl = rootURL + "api/v3/repos/" + owner + "/" + name + "/contents/" + path;
|
||||
final String viewUrl = rootURL + owner + "/" + name + "/blob/master/" + path;
|
||||
final String viewUrl = rootURL + owner + "/" + name + "/blob/" + refStr + "/" + path;
|
||||
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Get a content from " + apiUrl);
|
||||
|
@ -186,10 +219,11 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
final Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.putAll(defaultDataMap);
|
||||
dataMap.putAll(ComponentUtil.getDocumentHelper().processRequest(crawlingConfig, paramMap.get("crawlingInfoId"),
|
||||
apiUrl + "?large_file=true"));
|
||||
apiUrl + "?ref=" + refStr + "&large_file=true"));
|
||||
|
||||
dataMap.put("url", viewUrl);
|
||||
dataMap.put("role", roleList);
|
||||
dataMap.put("label", sourceLabels);
|
||||
|
||||
// TODO scriptMap
|
||||
|
||||
|
@ -198,14 +232,14 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
return;
|
||||
}
|
||||
|
||||
protected void collectFileNames(final String rootURL, final String authToken, final String owner, final String name, final String path,
|
||||
final int depth, final long readInterval, final Consumer<String> consumer) {
|
||||
protected void collectFileNames(final String rootURL, final String authToken, final String owner, final String name,
|
||||
final String refStr, final String path, final int depth, final long readInterval, final Consumer<String> consumer) {
|
||||
|
||||
if (MAX_DEPTH <= depth) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String url = rootURL + "api/v3/repos/" + owner + "/" + name + "/contents/" + path;
|
||||
final String url = rootURL + "api/v3/repos/" + owner + "/" + name + "/contents/" + path + "?ref=" + refStr;
|
||||
|
||||
try (CurlResponse curlResponse = Curl.get(url).header("Authorization", "token " + authToken).execute()) {
|
||||
final InputStream iStream = curlResponse.getContentAsStream();
|
||||
|
@ -223,7 +257,7 @@ public class GitBucketDataStoreImpl extends AbstractDataStoreImpl {
|
|||
if (readInterval > 0) {
|
||||
sleep(readInterval);
|
||||
}
|
||||
collectFileNames(rootURL, authToken, owner, name, newPath, depth + 1, readInterval, consumer);
|
||||
collectFileNames(rootURL, authToken, owner, name, refStr, newPath, depth + 1, readInterval, consumer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
|
|||
esCb.request().build(builder);
|
||||
final SearchResponse response = esCb.build(builder).execute().actionGet(searchTimeout);
|
||||
|
||||
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>();
|
||||
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>(builder);
|
||||
final SearchHits searchHits = response.getHits();
|
||||
searchHits.forEach(hit -> {
|
||||
final Map<String, Object> source = hit.getSource();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package org.codelibs.fess.es.config.allcommon;
|
||||
|
||||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
|
||||
/**
|
||||
* @param <ENTITY> The type of entity.
|
||||
|
@ -29,6 +30,15 @@ public class EsPagingResultBean<ENTITY> extends PagingResultBean<ENTITY> {
|
|||
private int totalShards;
|
||||
private int successfulShards;
|
||||
private int failedShards;
|
||||
private SearchRequestBuilder builder;
|
||||
|
||||
public EsPagingResultBean(final SearchRequestBuilder builder) {
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
public String getQueryDsl() {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public long getTook() {
|
||||
return took;
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsAccessTokenCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsAccessTokenCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsAccessTokenCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -897,7 +897,7 @@ public abstract class BsAccessTokenCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public void setParameterName_Wildcard(String parameterName, ConditionOptionCall<WildcardQueryBuilder> opLambda) {
|
||||
WildcardQueryBuilder builder = regWildcardQ("parameterName", parameterName);
|
||||
WildcardQueryBuilder builder = regWildcardQ("parameter_name", parameterName);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
|
@ -908,7 +908,7 @@ public abstract class BsAccessTokenCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public void setParameterName_Regexp(String parameterName, ConditionOptionCall<RegexpQueryBuilder> opLambda) {
|
||||
RegexpQueryBuilder builder = regRegexpQ("parameterName", parameterName);
|
||||
RegexpQueryBuilder builder = regRegexpQ("parameter_name", parameterName);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ public abstract class BsAccessTokenCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public void setParameterName_Exists(ConditionOptionCall<ExistsQueryBuilder> opLambda) {
|
||||
ExistsQueryBuilder builder = regExistsQ("parameterName");
|
||||
ExistsQueryBuilder builder = regExistsQ("parameter_name");
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
|
@ -974,7 +974,7 @@ public abstract class BsAccessTokenCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public void setParameterName_CommonTerms(String parameterName, ConditionOptionCall<CommonTermsQueryBuilder> opLambda) {
|
||||
CommonTermsQueryBuilder builder = regCommonTermsQ("parameterName", parameterName);
|
||||
CommonTermsQueryBuilder builder = regCommonTermsQ("parameter_name", parameterName);
|
||||
if (opLambda != null) {
|
||||
opLambda.callback(builder);
|
||||
}
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsBadWordCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsBadWordCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsBadWordCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,12 +154,12 @@ public abstract class BsBoostDocumentRuleCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsBoostDocumentRuleCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsBoostDocumentRuleCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsCrawlingInfoCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsCrawlingInfoCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsCrawlingInfoCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,12 +154,12 @@ public abstract class BsCrawlingInfoParamCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsCrawlingInfoParamCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsCrawlingInfoParamCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsDataConfigCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsDataConfigCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsDataConfigCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,12 +154,12 @@ public abstract class BsDataConfigToLabelCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsDataConfigToLabelCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsDataConfigToLabelCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsDataConfigToRoleCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsDataConfigToRoleCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsDataConfigToRoleCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsDuplicateHostCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsDuplicateHostCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsDuplicateHostCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsElevateWordCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsElevateWordCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsElevateWordCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,12 +154,12 @@ public abstract class BsElevateWordToLabelCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsElevateWordToLabelCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsElevateWordToLabelCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsFailureUrlCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsFailureUrlCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsFailureUrlCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,12 +154,12 @@ public abstract class BsFileAuthenticationCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsFileAuthenticationCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsFileAuthenticationCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsFileConfigCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsFileConfigCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsFileConfigCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,12 +154,12 @@ public abstract class BsFileConfigToLabelCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsFileConfigToLabelCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsFileConfigToLabelCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsFileConfigToRoleCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsFileConfigToRoleCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsFileConfigToRoleCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsJobLogCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsJobLogCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsJobLogCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsKeyMatchCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsKeyMatchCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsKeyMatchCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsLabelToRoleCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsLabelToRoleCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsLabelToRoleCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsLabelTypeCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsLabelTypeCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsLabelTypeCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsPathMappingCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsPathMappingCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsPathMappingCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsRequestHeaderCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsRequestHeaderCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsRequestHeaderCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsRoleTypeCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsRoleTypeCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsRoleTypeCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsScheduledJobCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsScheduledJobCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsScheduledJobCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsThumbnailQueueCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsThumbnailQueueCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsThumbnailQueueCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -154,12 +154,12 @@ public abstract class BsWebAuthenticationCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsWebAuthenticationCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsWebAuthenticationCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsWebConfigCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsWebConfigCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsWebConfigCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsWebConfigToLabelCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsWebConfigToLabelCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsWebConfigToLabelCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsWebConfigToRoleCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsWebConfigToRoleCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsWebConfigToRoleCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
|
|||
esCb.request().build(builder);
|
||||
final SearchResponse response = esCb.build(builder).execute().actionGet(searchTimeout);
|
||||
|
||||
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>();
|
||||
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>(builder);
|
||||
final SearchHits searchHits = response.getHits();
|
||||
searchHits.forEach(hit -> {
|
||||
final Map<String, Object> source = hit.getSource();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package org.codelibs.fess.es.log.allcommon;
|
||||
|
||||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
|
||||
/**
|
||||
* @param <ENTITY> The type of entity.
|
||||
|
@ -29,6 +30,15 @@ public class EsPagingResultBean<ENTITY> extends PagingResultBean<ENTITY> {
|
|||
private int totalShards;
|
||||
private int successfulShards;
|
||||
private int failedShards;
|
||||
private SearchRequestBuilder builder;
|
||||
|
||||
public EsPagingResultBean(final SearchRequestBuilder builder) {
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
public String getQueryDsl() {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public long getTook() {
|
||||
return took;
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsClickLogCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsClickLogCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsClickLogCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsFavoriteLogCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsFavoriteLogCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsFavoriteLogCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsSearchFieldLogCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsSearchFieldLogCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsSearchFieldLogCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsSearchLogCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsSearchLogCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsSearchLogCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,12 +150,12 @@ public abstract class BsUserInfoCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsUserInfoCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsUserInfoCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
|
|||
esCb.request().build(builder);
|
||||
final SearchResponse response = esCb.build(builder).execute().actionGet(searchTimeout);
|
||||
|
||||
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>();
|
||||
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>(builder);
|
||||
final SearchHits searchHits = response.getHits();
|
||||
searchHits.forEach(hit -> {
|
||||
final Map<String, Object> source = hit.getSource();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package org.codelibs.fess.es.user.allcommon;
|
||||
|
||||
import org.dbflute.cbean.result.PagingResultBean;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
|
||||
/**
|
||||
* @param <ENTITY> The type of entity.
|
||||
|
@ -29,6 +30,15 @@ public class EsPagingResultBean<ENTITY> extends PagingResultBean<ENTITY> {
|
|||
private int totalShards;
|
||||
private int successfulShards;
|
||||
private int failedShards;
|
||||
private SearchRequestBuilder builder;
|
||||
|
||||
public EsPagingResultBean(final SearchRequestBuilder builder) {
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
public String getQueryDsl() {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public long getTook() {
|
||||
return took;
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsGroupCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsGroupCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsGroupCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsRoleCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsRoleCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsRoleCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,12 +153,12 @@ public abstract class BsUserCQ extends EsAbstractConditionQuery {
|
|||
}
|
||||
|
||||
public BsUserCQ addOrderBy_Id_Asc() {
|
||||
regOBA("_id");
|
||||
regOBA("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
public BsUserCQ addOrderBy_Id_Desc() {
|
||||
regOBD("_id");
|
||||
regOBD("_uid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.openqa.selenium.phantomjs.PhantomJSDriver;
|
|||
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
|
||||
import org.openqa.selenium.phantomjs.PhantomJSDriverService.Builder;
|
||||
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||
import org.openqa.selenium.remote.SessionNotFoundException;
|
||||
import org.openqa.selenium.remote.UnreachableBrowserException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -143,7 +144,7 @@ public class WebDriverGenerator extends BaseThumbnailGenerator {
|
|||
final File thumbnail = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.FILE);
|
||||
convert(thumbnail, outputFile);
|
||||
return true;
|
||||
} catch (final UnreachableBrowserException e) {
|
||||
} catch (final UnreachableBrowserException | SessionNotFoundException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("WebDriver is not available.", e);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue