Search in sources :

Example 41 with IllegalBehaviorStateException

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

the class BsRoleBhv method createEntity.

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

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

the class BsUserBhv method createEntity.

@Override
protected <RESULT extends User> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
    try {
        final RESULT result = entityType.newInstance();
        result.setName(DfTypeUtil.toString(source.get("name")));
        result.setPassword(DfTypeUtil.toString(source.get("password")));
        result.setSurname(DfTypeUtil.toString(source.get("surname")));
        result.setGivenName(DfTypeUtil.toString(source.get("givenName")));
        result.setEmployeeNumber(DfTypeUtil.toString(source.get("employeeNumber")));
        result.setMail(DfTypeUtil.toString(source.get("mail")));
        result.setTelephoneNumber(DfTypeUtil.toString(source.get("telephoneNumber")));
        result.setHomePhone(DfTypeUtil.toString(source.get("homePhone")));
        result.setHomePostalAddress(DfTypeUtil.toString(source.get("homePostalAddress")));
        result.setLabeledURI(DfTypeUtil.toString(source.get("labeledURI")));
        result.setRoomNumber(DfTypeUtil.toString(source.get("roomNumber")));
        result.setDescription(DfTypeUtil.toString(source.get("description")));
        result.setTitle(DfTypeUtil.toString(source.get("title")));
        result.setPager(DfTypeUtil.toString(source.get("pager")));
        result.setStreet(DfTypeUtil.toString(source.get("street")));
        result.setPostalCode(DfTypeUtil.toString(source.get("postalCode")));
        result.setPhysicalDeliveryOfficeName(DfTypeUtil.toString(source.get("physicalDeliveryOfficeName")));
        result.setDestinationIndicator(DfTypeUtil.toString(source.get("destinationIndicator")));
        result.setInternationaliSDNNumber(DfTypeUtil.toString(source.get("internationaliSDNNumber")));
        result.setState(DfTypeUtil.toString(source.get("state")));
        result.setEmployeeType(DfTypeUtil.toString(source.get("employeeType")));
        result.setFacsimileTelephoneNumber(DfTypeUtil.toString(source.get("facsimileTelephoneNumber")));
        result.setPostOfficeBox(DfTypeUtil.toString(source.get("postOfficeBox")));
        result.setInitials(DfTypeUtil.toString(source.get("initials")));
        result.setCarLicense(DfTypeUtil.toString(source.get("carLicense")));
        result.setMobile(DfTypeUtil.toString(source.get("mobile")));
        result.setPostalAddress(DfTypeUtil.toString(source.get("postalAddress")));
        result.setCity(DfTypeUtil.toString(source.get("city")));
        result.setTeletexTerminalIdentifier(DfTypeUtil.toString(source.get("teletexTerminalIdentifier")));
        result.setX121Address(DfTypeUtil.toString(source.get("x121Address")));
        result.setBusinessCategory(DfTypeUtil.toString(source.get("businessCategory")));
        result.setRegisteredAddress(DfTypeUtil.toString(source.get("registeredAddress")));
        result.setDisplayName(DfTypeUtil.toString(source.get("displayName")));
        result.setPreferredLanguage(DfTypeUtil.toString(source.get("preferredLanguage")));
        result.setDepartmentNumber(DfTypeUtil.toString(source.get("departmentNumber")));
        result.setUidNumber(DfTypeUtil.toLong(source.get("uidNumber")));
        result.setGidNumber(DfTypeUtil.toLong(source.get("gidNumber")));
        result.setHomeDirectory(DfTypeUtil.toString(source.get("homeDirectory")));
        result.setGroups(toStringArray(source.get("groups")));
        result.setRoles(toStringArray(source.get("roles")));
        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 43 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 44 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