use of org.gluu.model.attribute.AttributeDataType in project oxTrust by GluuFederation.
the class GluuAttributeValidator method validate.
@Override
public void validate(FacesContext context, UIComponent comp, Object value) {
String attributeValue;
if (value instanceof AttributeDataType) {
attributeValue = ((AttributeDataType) value).getValue();
} else {
attributeValue = (String) value;
}
if (StringHelper.isEmpty(attributeValue)) {
FacesMessage message = new FacesMessage("Value is required");
message.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(message);
}
}
use of org.gluu.model.attribute.AttributeDataType in project oxTrust by GluuFederation.
the class ImportPersonConfiguration method createAttributeFromConfig.
private GluuAttribute createAttributeFromConfig(String prefix) {
String attributeName = importConfiguration.getString(prefix + ATTRIBUTE_LDAP_NAME_SUFFIX, null);
String displayName = importConfiguration.getString(prefix + ATTRIBUTE_DISPLAY_NAME_SUFFIX, null);
String dataType = importConfiguration.getString(prefix + ATTRIBUTE_DATA_TYPE_SUFFIX, null);
boolean required = importConfiguration.getBoolean(prefix + ATTRIBUTE_DATA_REQUIRED_SUFFIX, false);
if (StringHelper.isNotEmpty(attributeName) && StringHelper.isNotEmpty(displayName) && StringHelper.isNotEmpty(dataType)) {
AttributeDataType attributeDataType = AttributeDataType.getByValue(dataType);
if (attributeDataType != null) {
GluuAttribute attr = new GluuAttribute();
attr.setName(attributeName);
attr.setDisplayName(displayName);
attr.setDataType(attributeDataType);
attr.setRequred(required);
return attr;
}
}
return null;
}
use of org.gluu.model.attribute.AttributeDataType in project oxTrust by GluuFederation.
the class ImportPersonConfiguration method createAttributeFromConfig.
private GluuAttribute createAttributeFromConfig(ImportPerson importPerson) {
String attributeName = importPerson.getLdapName();
String displayName = importPerson.getDisplayName();
String dataType = importPerson.getDataType();
boolean required = importPerson.getRequired();
if (StringHelper.isNotEmpty(attributeName) && StringHelper.isNotEmpty(displayName) && StringHelper.isNotEmpty(dataType)) {
AttributeDataType attributeDataType = AttributeDataType.getByValue(dataType);
if (attributeDataType != null) {
GluuAttribute attr = new GluuAttribute();
attr.setName(attributeName);
attr.setDisplayName(displayName);
attr.setDataType(attributeDataType);
attr.setRequred(required);
return attr;
}
}
return null;
}
Aggregations