use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.
the class BsWebConfigToRoleBhv method createEntity.
@Override
protected <RESULT extends WebConfigToRole> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
result.setRoleTypeId(DfTypeUtil.toString(source.get("roleTypeId")));
result.setWebConfigId(DfTypeUtil.toString(source.get("webConfigId")));
return updateEntity(source, result);
} catch (InstantiationException | IllegalAccessException e) {
final String msg = "Cannot create a new instance: " + entityType.getName();
throw new IllegalBehaviorStateException(msg, e);
}
}
use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.
the class EsAbstractBehavior method delegateQueryDelete.
@Override
protected int delegateQueryDelete(final ConditionBean cb, final DeleteOption<? extends ConditionBean> option) {
SearchResponse response = null;
int count = 0;
while (true) {
if (response == null) {
final SearchRequestBuilder builder = client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setScroll(scrollForDelete).setSize(sizeForDelete);
final EsAbstractConditionBean esCb = (EsAbstractConditionBean) cb;
if (esCb.getPreference() != null) {
esCb.setPreference(esCb.getPreference());
}
esCb.request().build(builder);
response = esCb.build(builder).execute().actionGet(scrollSearchTimeout);
} else {
final String scrollId = response.getScrollId();
response = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet(scrollSearchTimeout);
}
final SearchHits searchHits = response.getHits();
final SearchHit[] hits = searchHits.getHits();
if (hits.length == 0) {
break;
}
final BulkRequestBuilder bulkRequest = client.prepareBulk();
for (final SearchHit hit : hits) {
bulkRequest.add(client.prepareDelete(asEsIndex(), asEsIndexType(), hit.getId()));
}
count += hits.length;
final BulkResponse bulkResponse = bulkRequest.execute().actionGet(bulkTimeout);
if (bulkResponse.hasFailures()) {
throw new IllegalBehaviorStateException(bulkResponse.buildFailureMessage());
}
}
return count;
}
use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.
the class BsSearchLogBhv method createEntity.
@Override
protected <RESULT extends SearchLog> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
result.setAccessType(DfTypeUtil.toString(source.get("accessType")));
result.setUser(DfTypeUtil.toString(source.get("user")));
result.setRoles(toStringArray(source.get("roles")));
result.setQueryId(DfTypeUtil.toString(source.get("queryId")));
result.setClientIp(DfTypeUtil.toString(source.get("clientIp")));
result.setHitCount(DfTypeUtil.toLong(source.get("hitCount")));
result.setQueryOffset(DfTypeUtil.toInteger(source.get("queryOffset")));
result.setQueryPageSize(DfTypeUtil.toInteger(source.get("queryPageSize")));
result.setReferer(DfTypeUtil.toString(source.get("referer")));
result.setRequestedAt(toLocalDateTime(source.get("requestedAt")));
result.setResponseTime(DfTypeUtil.toLong(source.get("responseTime")));
result.setQueryTime(DfTypeUtil.toLong(source.get("queryTime")));
result.setSearchWord(DfTypeUtil.toString(source.get("searchWord")));
result.setUserAgent(DfTypeUtil.toString(source.get("userAgent")));
result.setUserInfoId(DfTypeUtil.toString(source.get("userInfoId")));
result.setUserSessionId(DfTypeUtil.toString(source.get("userSessionId")));
result.setLanguages(DfTypeUtil.toString(source.get("languages")));
return updateEntity(source, result);
} catch (InstantiationException | IllegalAccessException e) {
final String msg = "Cannot create a new instance: " + entityType.getName();
throw new IllegalBehaviorStateException(msg, e);
}
}
use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.
the class BsClickLogBhv method createEntity.
@Override
protected <RESULT extends ClickLog> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
result.setQueryRequestedAt(toLocalDateTime(source.get("queryRequestedAt")));
result.setRequestedAt(toLocalDateTime(source.get("requestedAt")));
result.setQueryId(DfTypeUtil.toString(source.get("queryId")));
result.setDocId(DfTypeUtil.toString(source.get("docId")));
result.setUserSessionId(DfTypeUtil.toString(source.get("userSessionId")));
result.setUrl(DfTypeUtil.toString(source.get("url")));
result.setOrder(DfTypeUtil.toInteger(source.get("order")));
return updateEntity(source, result);
} catch (InstantiationException | IllegalAccessException e) {
final String msg = "Cannot create a new instance: " + entityType.getName();
throw new IllegalBehaviorStateException(msg, e);
}
}
use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.
the class BsSearchFieldLogBhv method createEntity.
@Override
protected <RESULT extends SearchFieldLog> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
result.setName(DfTypeUtil.toString(source.get("name")));
result.setSearchLogId(DfTypeUtil.toString(source.get("searchLogId")));
result.setValue(DfTypeUtil.toString(source.get("value")));
return updateEntity(source, result);
} catch (InstantiationException | IllegalAccessException e) {
final String msg = "Cannot create a new instance: " + entityType.getName();
throw new IllegalBehaviorStateException(msg, e);
}
}
Aggregations