/*
 * (C) 2010-2012 ICM UW. All rights reserved.
 */
package pl.edu.icm.coansys.disambiguation.author.pig;

import java.io.IOException;

import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;

import java.util.Date;

/**
 * @author pdendek
 * @author mwos
 */

public class GenUUID extends EvalFunc< String > {

    /**
     * @param Tuple input with one String - contributor name, 
     * for whom we want find unique id
     * @returns String UUID
     */		
	//TODO: na wejsciu DateBag nie pojedyncza Tupla, na wykscoi DateBag z String
	@Override
	public String exec( Tuple input ) throws IOException {	
		return "" + input.get(0) + (new Date()).getTime();
	}
}
@@ -193,37 +193,351 @@
 ata.
-Tuple;%0A%0Aimport java.util.Date
+DataBag;%0Aimport org.apache.pig.data.Tuple;%0A%0Aimport pl.edu.icm.coansys.disambiguation.idgenerators.IdGenerator;%0Aimport pl.edu.icm.coansys.disambiguation.idgenerators.UuIdGenerator;%0Aimport pl.edu.icm.synat.application.commons.id.UUIDGenerator;%0A%0Aimport java.util.Date;%0Aimport java.util.Iterator;%0Aimport java.util.LinkedList;%0Aimport java.util.List
 ;%0A%0A/
@@ -630,16 +630,66 @@
 ng %3E %7B%0A%0A
+%09IdGenerator idgenerator = new UuIdGenerator();%0A%09%0A
     /**%0A
@@ -976,60 +976,228 @@
 on %7B
-%09
 %0A%09%09
-return %22%22 + input.get(0) + (new Date()).getTime(
+DataBag db = (DataBag) input.get(0);%0A%09%09List%3CString%3E l = new LinkedList%3CString%3E();%0A%09%09Iterator%3CTuple%3E it = db.iterator();%0A%09%09while(it.hasNext())%7B%0A%09%09%09l.add((String) it.next().get(0));%0A%09%09%7D%0A%09%09return idgenerator.genetareId(l
 );%0A%09

correct generation of UUID