final Object groupNameValue = groupNameExpression.getValue(elContext);
if (groupNameValue == null) {
context.setError("Error creating group", "The group name value is null");
return;
}
final Group group = new Group(groupNameValue.toString());
if (parentGroupExpression != null) {
final Object parentGroupValue = parentGroupExpression.getValue(elContext);
if (parentGroupValue instanceof Group) {
group.setParent((Group)parentGroupValue);
} else if (parentGroupValue != null) {
context.setError("Error creating group", "The parent group is not a Group instance");
return;
}
}
if (typeExpression != null) {
final Object typeValue = typeExpression.getValue(elContext);
if (typeValue == null) {
context.setError("Error creating group", "The type value is null");
return;
}
group.setType(typeValue.toString());
}
identitySession.saveGroup(group);
if (targetExpression != null) {
targetExpression.setValue(elContext, group);
}