Changeset 5393 for DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/Helpers.java
- Timestamp:
- 06/26/14 18:18:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/Helpers.java
r5266 r5393 23 23 import java.io.InputStream; 24 24 import java.util.Map; 25 import java.util.UUID; 25 26 import javax.xml.parsers.DocumentBuilder; 26 27 import javax.xml.parsers.DocumentBuilderFactory; … … 32 33 import org.w3c.dom.ls.LSSerializer; 33 34 import org.xml.sax.SAXException; 34 35 import java.util.Random; 35 36 /** 36 37 * … … 40 41 41 42 //exception messages 42 final static public String INVALID_BODY_EXCEPTION = "Invalide annotation body: both, text and xml options, are null."; 43 43 //final static public String INVALID_BODY_EXCEPTION = "Invalide annotation body: both, text and xml options, are null."; 44 final static String hexa = "ABCDEabcde"; 45 final static int hexan= hexa.length(); 46 44 47 public static String replace(String text, Map<String, ?> pairs) { 45 48 StringBuilder result = new StringBuilder(text); … … 119 122 return encoder.encodePassword(pswd, salt); 120 123 } 124 125 public static UUID generateUUID(){ 126 UUID result = UUID.randomUUID(); 127 char[] chars = result.toString().toCharArray(); 128 if (chars[0] >= 'a' && chars[0] <='z') { 129 return result; 130 } else { 131 Random r = new Random(); 132 chars[0] = hexa.charAt(r.nextInt(hexan)); 133 result = UUID.fromString(new String(chars)); 134 return result; 135 } 136 } 121 137 }
Note: See TracChangeset
for help on using the changeset viewer.