Search in sources :

Example 31 with IllegalBehaviorStateException

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

the class BsBoostDocumentRuleBhv method createEntity.

@Override
protected <RESULT extends BoostDocumentRule> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setBoostExpr(DfTypeUtil.toString(source.get("boostExpr")));
        result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));
        result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
        result.setSortOrder(DfTypeUtil.toInteger(source.get("sortOrder")));
        result.setUpdatedBy(DfTypeUtil.toString(source.get("updatedBy")));
        result.setUpdatedTime(DfTypeUtil.toLong(source.get("updatedTime")));
        result.setUrlExpr(DfTypeUtil.toString(source.get("urlExpr")));
        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 32 with IllegalBehaviorStateException

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

the class BsCrawlingInfoParamBhv method createEntity.

@Override
protected <RESULT extends CrawlingInfoParam> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setCrawlingInfoId(DfTypeUtil.toString(source.get("crawlingInfoId")));
        result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
        result.setKey(DfTypeUtil.toString(source.get("key")));
        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);
    }
}
Also used : IllegalBehaviorStateException(org.dbflute.exception.IllegalBehaviorStateException)

Example 33 with IllegalBehaviorStateException

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

the class BsDataConfigToLabelBhv method createEntity.

@Override
protected <RESULT extends DataConfigToLabel> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setDataConfigId(DfTypeUtil.toString(source.get("dataConfigId")));
        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 34 with IllegalBehaviorStateException

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

the class BsDataConfigToRoleBhv method createEntity.

@Override
protected <RESULT extends DataConfigToRole> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setDataConfigId(DfTypeUtil.toString(source.get("dataConfigId")));
        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 35 with IllegalBehaviorStateException

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

the class BsFileConfigBhv method createEntity.

@Override
protected <RESULT extends FileConfig> 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.setConfigParameter(DfTypeUtil.toString(source.get("configParameter")));
        result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));
        result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
        result.setDepth(DfTypeUtil.toInteger(source.get("depth")));
        result.setDescription(DfTypeUtil.toString(source.get("description")));
        result.setExcludedDocPaths(DfTypeUtil.toString(source.get("excludedDocPaths")));
        result.setExcludedPaths(DfTypeUtil.toString(source.get("excludedPaths")));
        result.setIncludedDocPaths(DfTypeUtil.toString(source.get("includedDocPaths")));
        result.setIncludedPaths(DfTypeUtil.toString(source.get("includedPaths")));
        result.setIntervalTime(DfTypeUtil.toInteger(source.get("intervalTime")));
        result.setTimeToLive(DfTypeUtil.toInteger(source.get("timeToLive")));
        result.setMaxAccessCount(DfTypeUtil.toLong(source.get("maxAccessCount")));
        result.setName(DfTypeUtil.toString(source.get("name")));
        result.setNumOfThread(DfTypeUtil.toInteger(source.get("numOfThread")));
        result.setPaths(DfTypeUtil.toString(source.get("paths")));
        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