Index: AntStarTeamCheckOut.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java,v
retrieving revision 1.2
diff -w -d -b -B -r1.2 AntStarTeamCheckOut.java
76,80c76,79
<  * named for the default StarTeam path to the view.  That is, if you
<  * entered /home/cpovirk/work as the target folder, your project was named
<  * "OurProject," the given view was named "TestView," and that view is
<  * stored by default at "C:\projects\Test," your files would be checked
<  * out to /home/cpovirk/work/Test."  I avoided using the project name in
---
>  * named for the the view.  That is, if you entered /home/cpovirk/work
>  * as the target folder, your project was named "OurProject," the given
>  * view was named "TestView," your files would be checked out to
>  * /home/cpovirk/work/TestView."  I avoided using the project name in
82,85c81,84
<  * project on your computer, and I didn't want to use the view name, as
<  * there may be many "Test" or "Version 1.0" views, for example.  This
<  * system's success, of course, depends on what you set the default path
<  * to in StarTeam.
---
>  * project on your computer. The view name does not have to be appended
>  * by setting the <CODE>appendViewName</CODE> attribute to false.  This is
>  * in case you have many "Test" or "Version 1.0" views that you need to
>  * checkout.
251a251,256
> 	/**
> 	 * Set appendViewName to false to check out files without adding
> 	 * a directory for view name between targetFolder and path to
> 	 * file in Starteam. (Under view)
> 	 */
> 	private String appendViewName = "true";
270a276,295
> 	 * The allowed Statuses to check out.
> 	 */
>         private String statusFilter = null;
>         private Vector statusToCheckout = null;
> 
>         private static HashMap statusMap = null;
> 
>         static 
>         {
>                 statusMap = new HashMap(10);
>                 statusMap.put("c", new Integer(0)); //Current
>                 statusMap.put("g", new Integer(1)); //Merge
>                 statusMap.put("i", new Integer(2)); //Missing
>                 statusMap.put("m", new Integer(3)); //Modified
>                 statusMap.put("o", new Integer(4)); //Out-of-Date
>                 statusMap.put("n", new Integer(5)); //Not in view
>                 statusMap.put("u", new Integer(6)); //Unknown
>         }
> 
>         /**
445a471,486
> 
>   		try
> 		{
>   			if(!getAppendViewNameAsBoolean())
> 			{
> 			        f.setAlternatePathFragment( (new java.io.File(getTargetFolder())).getCanonicalPath() );
> 			}
> 			else
> 			{
> 			        f.setAlternatePathFragment( (new java.io.File(getTargetFolder()+delim+viewName)).getCanonicalPath() );
> 			}
> 		}
> 		catch(Exception e)
> 		{
> 		        //pass
> 		}
587c628,638
< 
---
> 		// Change the item to be checked out to a StarTeam File.
> 		com.starbase.starteam.File remote = (com.starbase.starteam.File)item;
> 		int stat = 6;
> 		try
> 		{
> 		        stat = remote.getStatus();
> 		}
> 		catch(Exception e)
> 		{
> 		        //pass
> 		}
616,617c667,668
< 				System.out.print(",\t" + p1.getDisplayName());
< 				if (p2 != null)
---
> 				System.out.print(",  " + p1.getDisplayName());
> 				if (p2 != null && !p2.equals(""))
619c670
< 					System.out.print(",\t" + p2.getDisplayName());
---
> 					System.out.print(",  " + p2.getDisplayName());
631c682
< 			System.out.print(",\t" + formatForDisplay(p1, item.get(p1.getName())));
---
> 			System.out.print(",  " + formatForDisplay(p1, item.get(p1.getName())));
635c686
< 			if (p2 != null)
---
> 			if (p2 != null && !p2.equals(""))
637c688
< 				System.out.print(",\t" + formatForDisplay(p2, item.get(p2.getName())));
---
> 				System.out.print(",  " + formatForDisplay(p2, item.get(p2.getName())));
644c695
< 				System.out.println(",\tLocked by " + locker);
---
> 				System.out.print(",  Locked by " + locker);
648c699,707
< 				System.out.println(",\tNot locked");
---
> 				System.out.print(",  Not locked");
> 			}
>    			try
> 			{
>    				System.out.println(",  " + com.starbase.starteam.Status.name(stat));
> 			}
> 			catch(Exception e)
> 			{
>              	                System.out.println("Failed to get status");
655,656d713
< 		// Change the item to be checked out to a StarTeam File.
< 		com.starbase.starteam.File remote = (com.starbase.starteam.File)item;
658,671d714
< 		// Create a variable dirName that contains the name of the StarTeam folder that is the root folder in this view.
< 		// Get the default path to the current view.
< 		String dirName = v.getDefaultPath();
< 		// Settle on "/" as the default path separator for this purpose only.
< 		dirName = dirName.replace('\\', '/');
<                 // Take the StarTeam folder name furthest down in the hierarchy.
<                 int endDirIndex = dirName.length();
<                 // If it ends with separator then strip it off
<                 if (dirName.endsWith("/"))
<                 {
<                     // This should be the SunOS and Linux case
<                     endDirIndex--;
<                 }
< 		dirName = dirName.substring(dirName.lastIndexOf("/", dirName.length() - 2) + 1, endDirIndex);
673,679c716
< 		// Replace the projectName in the file's absolute path to the viewName.
< 		// This eventually makes the target of a checkout operation equal to:
< 		// targetFolder + dirName + [subfolders] + itemName
< 		StringTokenizer pathTokenizer = new StringTokenizer(item.getParentFolder().getFolderHierarchy(), delim);
< 		String localName = delim;
< 		String currentToken = null;
< 		while (pathTokenizer.hasMoreTokens())
---
> 		try
681,682c718
< 			currentToken = pathTokenizer.nextToken();
< 			if (currentToken.equals(getProjectName()))
---
>       		        if(statusToCheckout == null || statusToCheckout.indexOf(new Integer(stat)) != -1)
684,686c720,722
< 				currentToken = dirName;
< 			}
< 			localName += currentToken + delim;
---
> 			        project.log("Checking file " + remote.getName() + " out to " + remote.getFullName(), project.MSG_VERBOSE);
> 				remote.checkout(Item.LockType.UNCHANGED, false, true, true);
> 				checkedOut++;
688,692d723
< 		// Create a reference to the local target file using the format listed above.
< 		java.io.File local = new java.io.File(getTargetFolder() + localName + item.get(p1.getName()));
< 		try
< 		{
< 			remote.checkoutTo(local, Item.LockType.UNCHANGED, false, true, true);
698d728
< 		checkedOut++;
1288a1319,1359
> 	/**
> 	 * Sets the <CODE>appendViewName</CODE> attribute to the given value.
> 	 *
> 	 * @param appendViewName A string containing "true" or "false" to tell
> 	 *                AntStarTeamCheckOut whether to add the view name to
>   	 * 		  the checkout directory.  By default it is
> 	 * 		  true, so the program adds the extra directory which
> 	 *                is named the same as the View.
> 	 * @see #getAppendViewName()
> 	 * @see #getAppendViewNameAsBoolean()
> 	 */
> 
> 	public void setAppendViewName(String appendViewName)
> 	{
> 		this.appendViewName = appendViewName;
> 	}
> 	/**
> 	 * Gets the <CODE>appendViewName</CODE> attribute.
> 	 *
> 	 * @return A string containing "true" or "false" telling the application
> 	 * 		to add the view name to the checkout path or not.
> 	 * @see #getAppendViewNameAsBoolean()
> 	 * @see #setAppendViewName(String appendViewName)
> 	 */
> 
> 	public String getAppendViewName()
> 	{
> 		return appendViewName;
> 	}
> 	/**
> 	 * Gets the <CODE>appendViewName</CODE> attribute as a boolean value.
> 	 *
> 	 * @return A boolean value telling whether to dispense with extra folder.
> 	 * @see #getAppendViewName()
> 	 * @see #setAppendViewName(String appendViewName)
> 	 */
> 
> 	public boolean getAppendViewNameAsBoolean()
> 	{
> 		return project.toBoolean(appendViewName);
> 	}
1408a1480,1527
> 	}
> 	/**
> 	 * Sets the <CODE>statusFilter</CODE> attribute.
>   	 *
>   	 * Sets the Filter of what statuses are acceptable to checkout.  It is a
> 	 * String which gets parsed.  An example of a Status filter is "MUGI"
> 	 * without spaces and other delimiters.  This example would check out
> 	 * files only if thier status was Modified, Unknown, Merge, or Missing.
> 	 * Any other status and the file would not be checked out.
> 	 *
> 	 * Values can be any combination of the following:
> 	 * <pre>
> 	 * 		'C':  Current
> 	 * 		'G':  Merge
> 	 * 		'I':  Missing
> 	 * 		'M':  Modified
> 	 * 		'O':  Out-of-Date
> 	 * 		'N':  Not-in-View
> 	 * 		'U':  Unknown
> 	 * </pre>
> 	 *
> 	 * These statuses are defined in the Starteam documentation.
> 	 * @param stats A String defining the statuses acceptable to be checked out.
> 	 *
>   	 */
> 	public void setStatusFilter(String stats)
> 	{
> 		this.statusFilter = stats;
>   		statusToCheckout = new Vector();
>   		char letters[] = stats.toCharArray();
> 		for(int i=0; i<letters.length ; i++){
> 		        Object o = statusMap.get(String.valueOf(letters[i]).toLowerCase());
> 			if(o != null)
> 			{
> 			        statusToCheckout.add(o);
> 			}
> 		}
> 		project.log("Status Filter " + statusFilter + " equates " +statusToCheckout, project.MSG_DEBUG);
> 	}
> 	/**
> 	 * Gets the <CODE>statusFilter</CODE> attribute.
> 	 *
> 	 * @return A string containing a list of statuses to check out.
> 	 * @see #setStatusFilter(String stats)
> 	 */
> 
>  	public String getStatusFilter(){
> 	        return statusFilter;

