Search in sources :

Example 36 with IllegalBehaviorStateException

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

the class BsFileConfigToRoleBhv method createEntity.

@Override
protected <RESULT extends FileConfigToRole> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setFileConfigId(DfTypeUtil.toString(source.get("fileConfigId")));
        result.setRoleTypeId(DfTypeUtil.toString(source.get("roleTypeId")));
        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 37 with IllegalBehaviorStateException

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

the class BsJobLogBhv method createEntity.

@Override
protected <RESULT extends JobLog> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setEndTime(DfTypeUtil.toLong(source.get("endTime")));
        result.setJobName(DfTypeUtil.toString(source.get("jobName")));
        result.setJobStatus(DfTypeUtil.toString(source.get("jobStatus")));
        result.setScriptData(DfTypeUtil.toString(source.get("scriptData")));
        result.setScriptResult(DfTypeUtil.toString(source.get("scriptResult")));
        result.setScriptType(DfTypeUtil.toString(source.get("scriptType")));
        result.setStartTime(DfTypeUtil.toLong(source.get("startTime")));
        result.setTarget(DfTypeUtil.toString(source.get("target")));
        result.setLastUpdated(DfTypeUtil.toLong(source.get("lastUpdated")));
        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 38 with IllegalBehaviorStateException

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

the class BsBadWordBhv method createEntity.

@Override
protected <RESULT extends BadWord> 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.setSuggestWord(DfTypeUtil.toString(source.get("suggestWord")));
        result.setTargetLabel(DfTypeUtil.toString(source.get("targetLabel")));
        result.setTargetRole(DfTypeUtil.toString(source.get("targetRole")));
        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)

Example 39 with IllegalBehaviorStateException

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

the class BsUserInfoBhv method createEntity.

@Override
protected <RESULT extends UserInfo> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setCreatedAt(toLocalDateTime(source.get("createdAt")));
        result.setUpdatedAt(toLocalDateTime(source.get("updatedAt")));
        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 40 with IllegalBehaviorStateException

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

the class BsFavoriteLogBhv method createEntity.

@Override
protected <RESULT extends FavoriteLog> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setCreatedAt(toLocalDateTime(source.get("createdAt")));
        result.setUrl(DfTypeUtil.toString(source.get("url")));
        result.setDocId(DfTypeUtil.toString(source.get("docId")));
        result.setQueryId(DfTypeUtil.toString(source.get("queryId")));
        result.setUserInfoId(DfTypeUtil.toString(source.get("userInfoId")));
        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