Search in sources :

Example 26 with IllegalBehaviorStateException

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

the class BsWebConfigBhv method createEntity.

@Override
protected <RESULT extends WebConfig> 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.setExcludedDocUrls(DfTypeUtil.toString(source.get("excludedDocUrls")));
        result.setExcludedUrls(DfTypeUtil.toString(source.get("excludedUrls")));
        result.setIncludedDocUrls(DfTypeUtil.toString(source.get("includedDocUrls")));
        result.setIncludedUrls(DfTypeUtil.toString(source.get("includedUrls")));
        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.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")));
        result.setUrls(DfTypeUtil.toString(source.get("urls")));
        result.setUserAgent(DfTypeUtil.toString(source.get("userAgent")));
        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 27 with IllegalBehaviorStateException

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

the class BsWebConfigToLabelBhv method createEntity.

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

Example 28 with IllegalBehaviorStateException

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

the class BsKeyMatchBhv method createEntity.

@Override
protected <RESULT extends KeyMatch> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setBoost(DfTypeUtil.toFloat(source.get("boost")));
        result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));
        result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
        result.setMaxSize(DfTypeUtil.toInteger(source.get("maxSize")));
        result.setQuery(DfTypeUtil.toString(source.get("query")));
        result.setTerm(DfTypeUtil.toString(source.get("term")));
        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 29 with IllegalBehaviorStateException

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

the class BsLabelToRoleBhv method createEntity.

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

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

the class BsPathMappingBhv method createEntity.

@Override
protected <RESULT extends PathMapping> 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.setProcessType(DfTypeUtil.toString(source.get("processType")));
        result.setRegex(DfTypeUtil.toString(source.get("regex")));
        result.setReplacement(DfTypeUtil.toString(source.get("replacement")));
        result.setSortOrder(DfTypeUtil.toInteger(source.get("sortOrder")));
        result.setUserAgent(DfTypeUtil.toString(source.get("userAgent")));
        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