/*
#=======================================================================================================
#
#                   Copyright (c) 2007 Origin Enterprise Solution LTD.
#
#=======================================================================================================
# File description:  QueryTaskProcessCommand.java
#=======================================================================================================
#	 Date	       time   	   Name	 Action	   Description of Change
#	2011-1-17      上午10:19:35    tyl  	Ini	            初始化文件
#=======================================================================================================
 */
package cust.com.rac.workflow;

import java.util.List;

import cn.com.customization.util.GetAllUserIds;

import com.teamcenter.rac.aif.AbstractAIFCommand;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.kernel.TCException;

public class QueryTaskProcessCommand extends AbstractAIFCommand {

	public AbstractAIFUIApplication	application;

	public QueryTaskProcessCommand(AbstractAIFUIApplication abstractaifapplication) throws TCException {
		application = abstractaifapplication;
		execute();
	}

	private void execute() throws TCException {
		System.out.println(" QueryTaskProcessCommand ");
		GetAllUserIds.setUsers(new GetAllUserIds(application).getAllUsers());
		new Thread() {
			public void run() {
				while (true) {
					try {
						List<String> users = GetAllUserIds.getUsers();
						if ((users == null) || (users.size() == 0)) {
							System.out.println("--------------1000");
							sleep(20000);
						} else {
							new SearchTaskDialog(application, "任务查询", false);
							break;
						}
					}
					catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		}.start();
	}
}
