Search in sources :

Example 6 with IllegalBehaviorStateException

use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.

the class BsElevateWordToLabelBhv method createEntity.

@Override
protected <RESULT extends ElevateWordToLabel> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setElevateWordId(DfTypeUtil.toString(source.get("elevateWordId")));
        result.setLabelTypeId(DfTypeUtil.toString(source.get("labelTypeId")));
        return updateEntity(source, result);
    } catch (InstantiationException | IllegalAccessException e) {
        final String msg = "Cannot create a new instance: " + entityType.getName();
        throw new IllegalBehaviorStateException(msg, e);
    }
}
Also used : IllegalBehaviorStateException(org.dbflute.exception.IllegalBehaviorStateException)

Example 7 with IllegalBehaviorStateException

use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.

the class BsFailureUrlBhv method createEntity.

@Override
protected <RESULT extends FailureUrl> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setConfigId(DfTypeUtil.toString(source.get("configId")));
        result.setErrorCount(DfTypeUtil.toInteger(source.get("errorCount")));
        result.setErrorLog(DfTypeUtil.toString(source.get("errorLog")));
        result.setErrorName(DfTypeUtil.toString(source.get("errorName")));
        result.setLastAccessTime(DfTypeUtil.toLong(source.get("lastAccessTime")));
        result.setThreadName(DfTypeUtil.toString(source.get("threadName")));
        result.setUrl(DfTypeUtil.toString(source.get("url")));
        return updateEntity(source, result);
    } catch (InstantiationException | IllegalAccessException e) {
        final String msg = "Cannot create a new instance: " + entityType.getName();
        throw new IllegalBehaviorStateException(msg, e);
    }
}
Also used : IllegalBehaviorStateException(org.dbflute.exception.IllegalBehaviorStateException)

Example 8 with IllegalBehaviorStateException

use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.

the class BsFileAuthenticationBhv method createEntity.

@Override
protected <RESULT extends FileAuthentication> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));
        result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
        result.setFileConfigId(DfTypeUtil.toString(source.get("fileConfigId")));
        result.setHostname(DfTypeUtil.toString(source.get("hostname")));
        result.setParameters(DfTypeUtil.toString(source.get("parameters")));
        result.setPassword(DfTypeUtil.toString(source.get("password")));
        result.setPort(DfTypeUtil.toInteger(source.get("port")));
        result.setProtocolScheme(DfTypeUtil.toString(source.get("protocolScheme")));
        result.setUpdatedBy(DfTypeUtil.toString(source.get("updatedBy")));
        result.setUpdatedTime(DfTypeUtil.toLong(source.get("updatedTime")));
        result.setUsername(DfTypeUtil.toString(source.get("username")));
        return updateEntity(source, result);
    } catch (InstantiationException | IllegalAccessException e) {
        final String msg = "Cannot create a new instance: " + entityType.getName();
        throw new IllegalBehaviorStateException(msg, e);
    }
}
Also used : IllegalBehaviorStateException(org.dbflute.exception.IllegalBehaviorStateException)

Example 9 with IllegalBehaviorStateException

use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.

the class BsCrawlingInfoBhv method createEntity.

@Override
protected <RESULT extends CrawlingInfo> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
        result.setExpiredTime(DfTypeUtil.toLong(source.get("expiredTime")));
        result.setName(DfTypeUtil.toString(source.get("name")));
        result.setSessionId(DfTypeUtil.toString(source.get("sessionId")));
        return updateEntity(source, result);
    } catch (InstantiationException | IllegalAccessException e) {
        final String msg = "Cannot create a new instance: " + entityType.getName();
        throw new IllegalBehaviorStateException(msg, e);
    }
}
Also used : IllegalBehaviorStateException(org.dbflute.exception.IllegalBehaviorStateException)

Example 10 with IllegalBehaviorStateException

use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.

the class BsDataConfigBhv method createEntity.

@Override
protected <RESULT extends DataConfig> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setAvailable(DfTypeUtil.toBoolean(source.get("available")));
        result.setBoost(DfTypeUtil.toFloat(source.get("boost")));
        result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));
        result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
        result.setDescription(DfTypeUtil.toString(source.get("description")));
        result.setHandlerName(DfTypeUtil.toString(source.get("handlerName")));
        result.setHandlerParameter(DfTypeUtil.toString(source.get("handlerParameter")));
        result.setHandlerScript(DfTypeUtil.toString(source.get("handlerScript")));
        result.setName(DfTypeUtil.toString(source.get("name")));
        result.setPermissions(toStringArray(source.get("permissions")));
        result.setSortOrder(DfTypeUtil.toInteger(source.get("sortOrder")));
        result.setUpdatedBy(DfTypeUtil.toString(source.get("updatedBy")));
        result.setUpdatedTime(DfTypeUtil.toLong(source.get("updatedTime")));
        return updateEntity(source, result);
    } catch (InstantiationException | IllegalAccessException e) {
        final String msg = "Cannot create a new instance: " + entityType.getName();
        throw new IllegalBehaviorStateException(msg, e);
    }
}
Also used : IllegalBehaviorStateException(org.dbflute.exception.IllegalBehaviorStateException)

Aggregations

IllegalBehaviorStateException (org.dbflute.exception.IllegalBehaviorStateException)44 BulkRequestBuilder (org.elasticsearch.action.bulk.BulkRequestBuilder)4 BulkResponse (org.elasticsearch.action.bulk.BulkResponse)4 SearchResponse (org.elasticsearch.action.search.SearchResponse)4 SearchHit (org.elasticsearch.search.SearchHit)4 SearchHits (org.elasticsearch.search.SearchHits)4 Map (java.util.Map)3 Collectors (java.util.stream.Collectors)3 Pair (org.codelibs.core.misc.Pair)3 DfTypeUtil (org.dbflute.util.DfTypeUtil)3 SearchRequestBuilder (org.elasticsearch.action.search.SearchRequestBuilder)3 BsGroupBhv (org.codelibs.fess.es.user.bsbhv.BsGroupBhv)1 BsRoleBhv (org.codelibs.fess.es.user.bsbhv.BsRoleBhv)1 BsUserBhv (org.codelibs.fess.es.user.bsbhv.BsUserBhv)1 Group (org.codelibs.fess.es.user.exentity.Group)1 Role (org.codelibs.fess.es.user.exentity.Role)1 User (org.codelibs.fess.es.user.exentity.User)1 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)1 MultiSearchResponse (org.elasticsearch.action.search.MultiSearchResponse)1