| | |
| | | Set<String> values = getDisplayedStringValues(attrName); |
| | | if (!values.contains(value.toString())) |
| | | { |
| | | if (values.size() > 0) |
| | | if (!values.isEmpty()) |
| | | { |
| | | String firstNonEmpty = null; |
| | | for (String v : values) |
| | | { |
| | | v = v.trim(); |
| | | if (v.length() > 0) |
| | | { |
| | | firstNonEmpty = v; |
| | | break; |
| | | } |
| | | } |
| | | String firstNonEmpty = getFirstNonEmpty(values); |
| | | if (firstNonEmpty != null) |
| | | { |
| | | AttributeType attr = rdn.getAttributeType(i); |
| | |
| | | attributeValues.add(value); |
| | | } |
| | | } |
| | | if (attributeTypes.size() == 0) |
| | | if (attributeTypes.isEmpty()) |
| | | { |
| | | // Check the attributes in the order that we display them and use |
| | | // the first one. |
| | |
| | | } |
| | | } |
| | | DN parent = oldDN.parent(); |
| | | if (attributeTypes.size() > 0) |
| | | if (!attributeTypes.isEmpty()) |
| | | { |
| | | DN newDN; |
| | | RDN newRDN = new RDN(attributeTypes, attributeNames, attributeValues); |
| | | |
| | | DN newDN; |
| | | if (parent == null) |
| | | { |
| | | newDN = new DN(new RDN[]{newRDN}); |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private String getFirstNonEmpty(Set<String> values) |
| | | { |
| | | for (String v : values) |
| | | { |
| | | v = v.trim(); |
| | | if (v.length() > 0) |
| | | { |
| | | return v; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private Set<String> getDisplayedStringValues(String attrName) |
| | | { |
| | | Set<String> values = new LinkedHashSet<String>(); |