protected static String generateSessionKey(
        String prefix,
        String fileName,
        boolean subFolder,
        CmsUser user,
        List<CmsGroup> groups) {

        StringBuffer result = new StringBuffer(256);
        result.append(prefix);
        result.append(CmsResource.getFolderPath(fileName).hashCode()).append("_");
        result.append(subFolder);
        if (user != null) {
            // add user to session key
            result.append("_").append(user.getName().hashCode());
        }
        if ((groups != null) && !groups.isEmpty()) {
            // add group(s) to session key
            StringBuffer groupNames = new StringBuffer(128);
            for (Iterator<CmsGroup> i = groups.iterator(); i.hasNext();) {
                groupNames.append(i.next().getName());
            }
            result.append("_").append(groupNames.toString().hashCode());
        }
        return result.toString();
    }
protected static String generateSessionKey ( String prefix , String fileName , boolean subFolder , CmsUser user , List < CmsGroup > groups ) { StringBuffer result = new StringBuffer ( 256 ) ; result . append ( prefix ) ; result . append ( CmsResource . getFolderPath ( fileName ) . hashCode ( ) ) . append ( "_" ) ; result . append ( subFolder ) ; if ( user != null ) { result . append ( "_" ) . append ( user . getName ( ) . hashCode ( ) ) ; } if ( ( groups != null ) && ! groups . isEmpty ( ) ) { StringBuffer groupNames = new StringBuffer ( 128 ) ; for ( Iterator < CmsGroup > i = groups . iterator ( ) ; i . hasNext ( ) ; ) { groupNames . append ( i . next ( ) . getName ( ) ) ; } result . append ( "_" ) . append ( groupNames . toString ( ) . hashCode ( ) ) ; } return result . toString ( ) ; }
Returns a unique session key depending on the values of the given parameters.<p>

@param prefix the key prefix to use
@param fileName the file name to track
@param subFolder flag indicating if sub folders should be included
@param user the user that should be used
@param groups the groups that should be used

@return a unique session key