001    
002    package railo.runtime.functions.other;
003    
004    
005    import railo.runtime.PageContext;
006    import railo.runtime.ext.function.Function;
007    
008    public final class CreateUniqueId implements Function {
009            
010            private static long counter=0;
011            
012            
013            /**
014         * method to invoke the function
015             * @param pc
016             * @return UUID String
017             */
018            public static String call(PageContext pc ) {
019                    return invoke();
020            }
021            public static synchronized String invoke() {
022                    counter++;
023                    if(counter<0) counter=1;
024                    return Long.toString(counter, Character.MAX_RADIX);
025            }
026    }