KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openuss > utility > UniqueKeyGenerator


1 /**
2  * Title: OpenUSS - Open Source University Support System
3  * Description: Utility for OpenUSS
4  * Copyright: Copyright (c) B. Lofi Dewanto
5  * Company: University of Muenster
6  * @author B. Lofi Dewanto
7  * @version 1.0
8  */

9 package org.openuss.utility;
10
11 import java.util.*;
12
13
14 /**
15  * Unique key generator.
16  * This is used to calculate primary keys in all
17  * the EJBs.
18  *
19  * @author B. Lofi Dewanto
20  * @version 1.0
21  */

22 public class UniqueKeyGenerator {
23     // Calculate the id
24
private static long uniqueId = System.currentTimeMillis();
25
26     /**
27      * Get the id.
28      */

29     public static synchronized String JavaDoc getUniqueId() {
30         return String.valueOf(uniqueId++);
31     }
32 }
Popular Tags