// TODO Auto-generated catch block
e.printStackTrace();
}
if (values != null && values.length > 0)
{
Attribute a = new AttributeImpl(attrDef);
if (attrDef.isMultiValue())
{
Collection<String> attrValues = new ArrayList<String>();
attrValues.addAll(Arrays.asList(values));
// remove the dummy value for required fields when present.
if (attrDef.isRequired() && attrDef.getRequiredDefaultValue() != null && attrValues.contains(attrDef.getRequiredDefaultValue()))
{
attrValues.remove(attrDef.getRequiredDefaultValue());
}
if (attrValues.size() != 0)
{
a.setValues(attrValues);
attributes.add(a);
}else{
attributes.add(a);
}
}
else
{
if (attrDef.getName().equals(searchConfiguration.getLdapIdAttribute()))
{
entityId = values[0];
}
if (values[0] != null)
{
// check if the value is not the required default value (a dummy value) If it is, ignore the attribute.
if (!(attrDef.isRequired() && attrDef.getRequiredDefaultValue() != null && values[0].equals(attrDef.getRequiredDefaultValue())))
{
a.setValue(values[0]);
attributes.add(a);
}
}
}
}