/** * Compute the real name based on the Dn, assuming that depending on the underlying * OS, some characters are not allowed. * * We don't allow filename which length is > 255 chars. */ private String getFileName( Dn dn ) throws LdapException { StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Rdn rdn : dn.getRdns() ) { // First, get the AT name, or OID String normAT = rdn.getNormType(); AttributeType at = schemaManager.lookupAttributeTypeRegistry( normAT ); String atName = at.getName(); // Now, get the normalized value String normValue = rdn.getAva().getValue().getValue(); if ( isFirst ) { isFirst = false; } else { sb.append( "," ); } sb.append( atName ).append( "=" ).append( normValue ); } return getOSFileName( sb.toString() ); }
private static String convertToDomainExtension(Dn dn) { String fqdn = ""; List<Rdn> rdns = dn.getRdns(); for(Rdn rdn: rdns) { if(!rdn.getAva().getType().equalsIgnoreCase("dc")) { return null; } if(fqdn.length() > 0) { fqdn = rdn.getNormValue().getString() + "." + fqdn; } else { fqdn = rdn.getNormValue().getString(); } } return fqdn; }
/** * Exctract the schema name from the Dn. It is supposed to be the * second Rdn in the dn : * <pre> * ou=schema, cn=MySchema, ... * </pre> * Here, the schemaName is MySchema * * @param dn The Dn we want to get the schema name from * @return The schema name * @throws LdapException If we got an error */ protected String getSchemaName( Dn dn ) throws LdapException { int size = dn.size(); if ( size < 2 ) { throw new LdapInvalidDnException( I18n.err( I18n.ERR_276 ) ); } Rdn rdn = dn.getRdn( size - 2 ); return Strings.trim( rdn.getAva().getValue().getNormalized() ); }
if ( !atav.equals( oldRdn.getAva() ) && ( entry.contains( atav.getNormType(), atav.getValue().getValue() ) ) )
if ( !atav.equals( oldRdn.getAva() ) && ( entry.contains( atav.getNormType(), atav.getValue().getValue() ) ) )
if ( !atav.equals( oldRdn.getAva() ) && ( entry.contains( atav.getNormType(), atav.getValue().getValue() ) ) )