protected String findBestNameForUrlNameMapping(CmsDbContext dbc, String name, CmsUUID structureId)
    throws CmsDataAccessException {

        List<CmsUrlNameMappingEntry> entriesStartingWithName = getVfsDriver(dbc).readUrlNameMappingEntries(
            dbc,
            false,
            CmsUrlNameMappingFilter.ALL.filterNamePattern(name + "%").filterRejectStructureId(structureId));
        Set<String> usedNames = new HashSet<String>();
        for (CmsUrlNameMappingEntry entry : entriesStartingWithName) {
            usedNames.add(entry.getName());
        }
        int counter = 0;
        String numberedName;
        do {
            numberedName = getNumberedName(name, counter);
            counter += 1;
        } while (usedNames.contains(numberedName));
        return numberedName;
    }
protected String findBestNameForUrlNameMapping ( CmsDbContext dbc , String name , CmsUUID structureId ) throws CmsDataAccessException { List < CmsUrlNameMappingEntry > entriesStartingWithName = getVfsDriver ( dbc ) . readUrlNameMappingEntries ( dbc , false , CmsUrlNameMappingFilter . ALL . filterNamePattern ( name + "%" ) . filterRejectStructureId ( structureId ) ) ; Set < String > usedNames = new HashSet < String > ( ) ; for ( CmsUrlNameMappingEntry entry : entriesStartingWithName ) { usedNames . add ( entry . getName ( ) ) ; } int counter = 0 ; String numberedName ; do { numberedName = getNumberedName ( name , counter ) ; counter += 1 ; } while ( usedNames . contains ( numberedName ) ) ; return numberedName ; }
Helper method for finding the 'best' URL name to use for a new URL name mapping.<p>

Since the name given as a parameter may be already used, this method will try to append numeric suffixes
to the name to find a mapping name which is not used.<p>

@param dbc the current database context
@param name the name of the mapping
@param structureId the structure id to which the name is mapped

@return the best name which was found for the new mapping

@throws CmsDataAccessException if something goes wrong