use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.
the class BsWebAuthenticationBhv method createEntity.
@Override
protected <RESULT extends WebAuthentication> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
result.setAuthRealm(DfTypeUtil.toString(source.get("authRealm")));
result.setCreatedBy(DfTypeUtil.toString(source.get("createdBy")));
result.setCreatedTime(DfTypeUtil.toLong(source.get("createdTime")));
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")));
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);
}
}
use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.
the class BsGroupBhv method createEntity.
@Override
protected <RESULT extends Group> RESULT createEntity(Map<String, Object> source, Class<? extends RESULT> entityType) {
try {
final RESULT result = entityType.newInstance();
result.setGidNumber(DfTypeUtil.toLong(source.get("gidNumber")));
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);
}
}
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.setDocId(DfTypeUtil.toString(source.get("docId")));
result.setQueryId(DfTypeUtil.toString(source.get("queryId")));
result.setUrl(DfTypeUtil.toString(source.get("url")));
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);
}
}
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);
}
}
use of org.dbflute.exception.IllegalBehaviorStateException in project fess by codelibs.
the class UserBhv method createEntity.
@Override
protected <RESULT extends User> RESULT createEntity(final Map<String, Object> source, final 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.setGroups(toStringArray(source.get(GROUPS)));
result.setRoles(toStringArray(source.get(ROLES)));
result.setAttributes(source.entrySet().stream().filter(e -> isAttribute(e.getKey())).map(e -> new Pair<>(e.getKey(), (String) e.getValue())).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond)));
return result;
} catch (InstantiationException | IllegalAccessException e) {
final String msg = "Cannot create a new instance: " + entityType.getName();
throw new IllegalBehaviorStateException(msg, e);
}
}
Aggregations