/**
 * Copyright Notice
 * 
 * This is a work of the U.S. Government and is not subject to copyright
 * protection in the United States. Foreign copyrights may apply.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * UuidGenerator
 * 
 * @author <a href="mailto:joel.kniaz@gmail.com">Joel Kniaz</a>
 */
package gov.va.isaac.util;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;

import org.ihtsdo.otf.tcc.api.uuid.UuidT5Generator;

/**
 * UuidGenerator
 * 
 * @author <a href="mailto:joel.kniaz@gmail.com">Joel Kniaz</a>
 *
 */
public class UuidGenerator {

	/**
	 * 
	 */
	private UuidGenerator() {
	}

	public static UUID get(UUID domainSeed, String seed) throws NoSuchAlgorithmException, UnsupportedEncodingException {
		return UuidT5Generator.get(domainSeed, seed);
	}
	public static UUID get(String seed) throws NoSuchAlgorithmException, UnsupportedEncodingException {
		return get(UuidT5Generator.PATH_ID_FROM_FS_DESC, seed);
	}

	public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException
	{
		UUID domainSeed = UuidT5Generator.PATH_ID_FROM_FS_DESC;
		String seed = null;
		if (args.length == 1) {
			seed = args[0];
		} else if (args.length > 1) {
			domainSeed = UUID.fromString(args[0]);
			seed = args[1];
		}
		UUID uuid = get(domainSeed, seed);
		System.err.println("UUID for \"" + domainSeed + "\" --> \"" + seed + "\" is \"" + uuid + "\"");
		System.out.println(uuid);
	}
}

@@ -865,24 +865,120 @@
 ac.util;%0D%0A%0D%0A
+import java.io.BufferedReader;%0D%0Aimport java.io.IOException;%0D%0Aimport java.io.InputStreamReader;%0D%0A
 import java.
@@ -1083,18 +1083,16 @@
 .UUID;%0D%0A
-%0D%0A
 import o
@@ -1736,35 +1736,18 @@
 eption, 
-UnsupportedEncoding
+IO
 Exceptio
@@ -1855,16 +1855,309 @@
 ength ==
+ 0)%0D%0A%09%09%7B%0D%0A%09%09%09System.out.println(%22Enter text:%22);%0D%0A%09%09%09if (System.console() != null)%0D%0A%09%09%09%7B%0D%0A%09%09%09%09seed = System.console().readLine();%0D%0A%09%09%09%7D%0D%0A%09%09%09else%0D%0A%09%09%09%7B%0D%0A%09%09%09%09BufferedReader br = new BufferedReader(new InputStreamReader(System.in));%0D%0A%09%09%09%09seed = br.readLine();%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09else if (args.length ==
  1) %7B%0D%0A%09
@@ -2200,17 +2200,18 @@
 .length 
-%3E
+==
  1) %7B%0D%0A%09
@@ -2277,16 +2277,105 @@
 ;%0D%0A%09%09%7D%0D%0A
+%09%09else%0D%0A%09%09%7B%0D%0A%09%09%09throw new RuntimeException(%22Unsupported number of arguments%22);%0D%0A%09%09%7D%0D%0A%09%09%0D%0A
 %09%09UUID u
@@ -2400,24 +2400,28 @@
 ed, seed);%0D%0A
+%09%09%0D%0A
 %09%09System.err
@@ -2421,11 +2421,11 @@
 tem.
-err
+out
 .pri
@@ -2435,18 +2435,79 @@
 n(%22U
-UID for %5C%22
+sing the text '%22 + seed + %22'%22);%0D%0A%09%09System.out.println(%22and the domain '
 %22 + 
@@ -2520,85 +2520,162 @@
 Seed
- 
 + %22
-%5C%22 --%3E %5C%22%22 + seed + %22%5C%22 is %5C%22%22 + uuid + %22%5C%22%22);%0D%0A%09%09System.out.println(uuid
+'%22 + (domainSeed == UuidT5Generator.PATH_ID_FROM_FS_DESC ? %22 (path ID from FSN description)%22 : %22%22));%0D%0A%09%09System.out.println(%22the UUID is '%22 + uuid + %22'%22
 );%0D%0A

rework to make easy-to-use