1. John Paulett
  2. xdat_release

Commits

Mohana Ramaratnam  committed 28dd544

Modified with CVS-CNDA_XNAT

  • Participants
  • Parent commits df56136
  • Branches default

Comments (0)

Files changed (4)

File plugin-resources/webapp/xnat-templates/screens/PipelineScreen_add_project_pipeline.vm

View file
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
-
-<style type="text/css">
- .popup {
-  position: absolute;
-  visibility: hidden;
-  background-color: #FDD;
-  layer-background-color: #FDD;
-  width: 200;
-  border-left: 1px solid black;
-  border-top: 1px solid black;
-  border-bottom: 3px solid black;
-  border-right: 3px solid black;
-  padding: 3px;
-  z-index: 10;
- }
-</style>
-
-    <script type="text/javascript"><!--
-
-function getStyleObject(objectId) {
-    // cross-browser function to get an objects style object given its id
-    if(document.getElementById && document.getElementById(objectId)) {
-	// W3C DOM
-	return document.getElementById(objectId).style;
-    } else if (document.all && document.all(objectId)) {
-	// MSIE 4 DOM
-	return document.all(objectId).style;
-    } else if (document.layers && document.layers[objectId]) {
-	// NN 4 DOM.. note: this wont find nested layers
-	return document.layers[objectId];
-    } else {
-	return false;
-    }
-} // getStyleObject
-
-
-function changeObjectVisibility(objectId, newVisibility) {
-    // get a reference to the cross-browser style object and make sure the object exists
-    var styleObject = getStyleObject(objectId);
-    if(styleObject) {
-	styleObject.visibility = newVisibility;
-	return true;
-    } else {
-	// we couldn't find the object, so we can't change its visibility
-	return false;
-    }
-} // changeObjectVisibility
-
-function moveObject(objectId, newXCoordinate, newYCoordinate) {
-    // get a reference to the cross-browser style object and make sure the object exists
-    var styleObject = getStyleObject(objectId);
-    if(styleObject) {
-	styleObject.left = newXCoordinate;
-	styleObject.top = newYCoordinate;
-	return true;
-    } else {
-	// we could not find the object, so we cannot very well move it
-	return false;
-    }
-} // moveObject
-
-
-var xOffset = 5;
-var yOffset = -5;
-
-function showPopup (targetObjectId, eventObj) {
-    if(eventObj) {
-	// hide any currently-visible popups
-	hideCurrentPopup();
-	// stop event from bubbling up any farther
-	eventObj.cancelBubble = true;
-	// move popup div to current cursor position 
-	// (add scrollTop to account for scrolling for IE)
-	var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
-	var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
-	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
-	// and make it visible
-	if( changeObjectVisibility(targetObjectId, 'visible') ) {
-	    // if we successfully showed the popup
-	    // store its Id on a globally-accessible object
-	    window.currentlyVisiblePopup = targetObjectId;
-	    return true;
-	} else {
-	    // we could not show the popup, boo hoo!
-	    return false;
-	}
-    } else {
-	// there was no event object, so we wont be able to position anything, so give up
-	return false;
-    }
-} // showPopup
-
-function hideCurrentPopup() {
-    // note: we have stored the currently-visible popup on the global object window.currentlyVisiblePopup
-    if(window.currentlyVisiblePopup) {
-	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
-	window.currentlyVisiblePopup = false;
-    }
-} // hideCurrentPopup
-
-
-  --></script>
-
-$data.setLayoutTemplate("Popup.vm")
-$page.setTitle("Modify Pipeline")
-$page.setLinkColor($ui.alink)
-$page.setVlinkColor($ui.vlink)
-#if ($data.message)
-<font color="red" size="3">$data.message</font>
-#end
-<p>
-<form ID="form1" name="form1" method="post" action="$link.setAction("ManagePipeline")">
-#if($vr)
-	<font color="red">Invalid parameters:<BR>$vr.toHTML()</font>
-<HR>
-#end
-
-
-#set ($schemaType = $newpipeline.getSchemaElementName())
-#set ($dblQts='"')
-#set ($sizeOfTextBox = 45)
-
-$newpipeline.getDescription() 
-
-<br/>
-<br/>
-
-#set ($checked="")
-#if ($isAutoArchive)
-#set ($checked="checked")
-#end
-
-<TABLE width="100%">
-	<TR>
-		<TD colspan="2" align="left"><b>Pipeline setup</b></TD>
-	</TR>
-	<TR>
-		<TD><b>Is this pipeline to be launched automatically while archiving?</b></TD>
-		<TD> <input type="checkbox"  name="auto_archive" $checked/> </TD>
-	</TR>
-
-<input type="hidden"  id=$dblQts${schemaType}.stepId$dblQts name=$dblQts${schemaType}.stepId$dblQts value="$newpipeline.getName()"/></TD>
-<input type="hidden"   id=$dblQts${schemaType}.displayText$dblQts name=$dblQts${schemaType}.displayText$dblQts value="$newpipeline.getDisplaytext()"/>
-<input type="hidden"  id=$dblQts${schemaType}.name$dblQts name=$dblQts${schemaType}.name$dblQts value="$newpipeline.getName()"/>
-<input type="hidden"  id=$dblQts${schemaType}.location$dblQts name=$dblQts${schemaType}.location$dblQts value="$newpipeline.getLocation()"/>
-<input type="hidden"  id=$dblQts${schemaType}.customwebpage$dblQts name=$dblQts${schemaType}.customwebpage$dblQts value="$!newpipeline.getCustomwebpage()"/>
-<input type="hidden"  id=$dblQts${schemaType}.description$dblQts name=$dblQts${schemaType}.description$dblQts value='$!newpipeline.getDescription()'/>
-
-
-	#set ($parameters =$newpipeline.getParameters_parameter())
-	#if ($parameters.size() > 0)
-	<TR>
-	   <TD><b>Project specific pipeline parameters:</b></TD>
-	   <TD>&nbsp;</td>	
-	</TR>
-	<TR>
-	   <TD colspan="2" align="left">Note: Parameters that take multiple values should be comma-separated</TD>
-	</TR>
-	<TR>
-		<TD colspan="2" align="left"> 
-		    <TABLE>
-			<TR>
-			  <TH>Name</TH> <TH colspan="2" align="center"> Values</TH> 
-			</TR>
-			#set ($c = 0)
-			#foreach ($parameter in $parameters)
-			<TR>
-			  <TD><input type="hidden"  id=$dblQts${schemaType}.parameters.parameter[$c].name$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].name$dblQts value="$parameter.getName()"/><font size="-1">$parameter.getName()</font>
-			<a href="#" style="outline: none;" onclick="return !showPopup('desc$c', event);">(?)</a>
-			</TD> 
-			   <td>	
-			  <input type="text" size="45" id=$dblQts${schemaType}.parameters.parameter[$c].schemaLink$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].schemaLink$dblQts value="$!parameter.getSchemalink()"/>
-			  </td>
-			  <TD><input type="text" size="45" id=$dblQts${schemaType}.parameters.parameter[$c].csvValues$dblQts  name=$dblQts${schemaType}.parameters.parameter[$c].csvValues$dblQts value="$!parameter.getCsvvalues()"/></TD>
-			</tr>
-		<input type="hidden" id=$dblQts${schemaType}.parameters.parameter[$c].description$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].description$dblQts value="$!parameter.getDescription()"/>
-	#set ($c = $c + 1)
-			#end
-		    </TABLE>
-		</TD>
-	</TR>
-	#set ($c = 0)
-	#foreach ($parameter in $parameters)
-
-	<div class=popup onclick="event.cancelBubble = true;" id=desc$c>
-	  <p><b>$parameter.getName(): </b>$!parameter.getDescription() </p>
-
-	  <a href="#" onclick="hideCurrentPopup(); return false;">Close</a>
-	</div>
-	#set ($c = $c + 1)
-			#end
-	#else 
-	<TR>
-		<TD colspan="2" align="left">There are no paramaters to set for this pipeline. Click on Submit button to add this pipeline to your project</TD>
-	</TR>
- 
-	#end
-	<TR>
-		<TD colspan="2" align="center"><input type="button" ONCLICK="javascript:window.close();" value="Close"/>&nbsp;&nbsp;&nbsp;<input type="submit"  name="eventSubmit_doAddprojectpipeline" value="Submit"/></TD>
-	</TR>
-
-
-
-<input type="hidden" name="search_element" value="xnat:projectData"/>
-<input type="hidden" name="search_field" value="xnat:projectData.ID"/>
-<input type="hidden" name="search_value" value="$project"/>
-<input type="hidden" name="project" value="$project"/>
-<input type="hidden" name="pipeline_path" value="$pipeline_path"/>
-<input type="hidden" name="dataType" value="$dataType"/>
-<input type="hidden" name="schemaType" value="$schemaType"/>
-<input type="hidden" name="edit" value="$edit"/>
-<input type="hidden" name="destination" value="JS_Parent_Return.vm"/>
-
-</TABLE>
-</form>
-
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
+
+<style type="text/css">
+ .popup {
+  position: absolute;
+  visibility: hidden;
+  background-color: #FDD;
+  layer-background-color: #FDD;
+  width: 200;
+  border-left: 1px solid black;
+  border-top: 1px solid black;
+  border-bottom: 3px solid black;
+  border-right: 3px solid black;
+  padding: 3px;
+  z-index: 10;
+ }
+</style>
+
+    <script type="text/javascript"><!--
+
+function getStyleObject(objectId) {
+    // cross-browser function to get an objects style object given its id
+    if(document.getElementById && document.getElementById(objectId)) {
+	// W3C DOM
+	return document.getElementById(objectId).style;
+    } else if (document.all && document.all(objectId)) {
+	// MSIE 4 DOM
+	return document.all(objectId).style;
+    } else if (document.layers && document.layers[objectId]) {
+	// NN 4 DOM.. note: this wont find nested layers
+	return document.layers[objectId];
+    } else {
+	return false;
+    }
+} // getStyleObject
+
+
+function changeObjectVisibility(objectId, newVisibility) {
+    // get a reference to the cross-browser style object and make sure the object exists
+    var styleObject = getStyleObject(objectId);
+    if(styleObject) {
+	styleObject.visibility = newVisibility;
+	return true;
+    } else {
+	// we couldn't find the object, so we can't change its visibility
+	return false;
+    }
+} // changeObjectVisibility
+
+function moveObject(objectId, newXCoordinate, newYCoordinate) {
+    // get a reference to the cross-browser style object and make sure the object exists
+    var styleObject = getStyleObject(objectId);
+    if(styleObject) {
+	styleObject.left = newXCoordinate;
+	styleObject.top = newYCoordinate;
+	return true;
+    } else {
+	// we could not find the object, so we cannot very well move it
+	return false;
+    }
+} // moveObject
+
+
+var xOffset = 5;
+var yOffset = -5;
+
+function showPopup (targetObjectId, eventObj) {
+    if(eventObj) {
+	// hide any currently-visible popups
+	hideCurrentPopup();
+	// stop event from bubbling up any farther
+	eventObj.cancelBubble = true;
+	// move popup div to current cursor position 
+	// (add scrollTop to account for scrolling for IE)
+	var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
+	var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
+	moveObject(targetObjectId, newXCoordinate, newYCoordinate);
+	// and make it visible
+	if( changeObjectVisibility(targetObjectId, 'visible') ) {
+	    // if we successfully showed the popup
+	    // store its Id on a globally-accessible object
+	    window.currentlyVisiblePopup = targetObjectId;
+	    return true;
+	} else {
+	    // we could not show the popup, boo hoo!
+	    return false;
+	}
+    } else {
+	// there was no event object, so we wont be able to position anything, so give up
+	return false;
+    }
+} // showPopup
+
+function hideCurrentPopup() {
+    // note: we have stored the currently-visible popup on the global object window.currentlyVisiblePopup
+    if(window.currentlyVisiblePopup) {
+	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
+	window.currentlyVisiblePopup = false;
+    }
+} // hideCurrentPopup
+
+
+  --></script>
+
+$data.setLayoutTemplate("Popup.vm")
+$page.setTitle("Modify Pipeline")
+$page.setLinkColor($ui.alink)
+$page.setVlinkColor($ui.vlink)
+#if ($data.message)
+<font color="red" size="3">$data.message</font>
+#end
+<p>
+<form ID="form1" name="form1" method="post" action="$link.setAction("ManagePipeline")">
+#if($vr)
+	<font color="red">Invalid parameters:<BR>$vr.toHTML()</font>
+<HR>
+#end
+
+
+#set ($schemaType = $newpipeline.getSchemaElementName())
+#set ($dblQts='"')
+#set ($sizeOfTextBox = 45)
+
+$newpipeline.getDescription() 
+
+<br/>
+<br/>
+
+#set ($checked="")
+#if ($isAutoArchive)
+#set ($checked="checked")
+#end
+
+<TABLE width="100%">
+	<TR>
+		<TD colspan="2" align="left"><b>Pipeline setup</b></TD>
+	</TR>
+	<TR>
+		<TD><b>Is this pipeline to be launched automatically while archiving?</b></TD>
+		<TD> <input type="checkbox"  name="auto_archive" $checked/> </TD>
+	</TR>
+
+<input type="hidden"  id=$dblQts${schemaType}.stepId$dblQts name=$dblQts${schemaType}.stepId$dblQts value="$newpipeline.getName()"/></TD>
+<input type="hidden"   id=$dblQts${schemaType}.displayText$dblQts name=$dblQts${schemaType}.displayText$dblQts value="$newpipeline.getDisplaytext()"/>
+<input type="hidden"  id=$dblQts${schemaType}.name$dblQts name=$dblQts${schemaType}.name$dblQts value="$newpipeline.getName()"/>
+<input type="hidden"  id=$dblQts${schemaType}.location$dblQts name=$dblQts${schemaType}.location$dblQts value="$newpipeline.getLocation()"/>
+<input type="hidden"  id=$dblQts${schemaType}.customwebpage$dblQts name=$dblQts${schemaType}.customwebpage$dblQts value="$!newpipeline.getCustomwebpage()"/>
+<input type="hidden"  id=$dblQts${schemaType}.description$dblQts name=$dblQts${schemaType}.description$dblQts value='$!newpipeline.getDescription()'/>
+
+
+	#set ($parameters =$newpipeline.getParameters_parameter())
+	#if ($parameters.size() > 0)
+	<TR>
+	   <TD><b>Project specific pipeline parameters:</b></TD>
+	   <TD>&nbsp;</td>	
+	</TR>
+	<TR>
+	   <TD colspan="2" align="left">Note: Parameters that take multiple values should be comma-separated</TD>
+	</TR>
+	<TR>
+		<TD colspan="2" align="left"> 
+		    <TABLE>
+			<TR>
+			  <TH>Name</TH> <TH colspan="2" align="center"> Values</TH> 
+			</TR>
+			#set ($c = 0)
+			#foreach ($parameter in $parameters)
+			<TR>
+			  <TD><input type="hidden"  id=$dblQts${schemaType}.parameters.parameter[$c].name$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].name$dblQts value="$parameter.getName()"/><font size="-1">$parameter.getName()</font>
+			</TD> 
+			   <td>	
+			  <input type="hidden" size="45" id=$dblQts${schemaType}.parameters.parameter[$c].schemaLink$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].schemaLink$dblQts value="$!parameter.getSchemalink()"/>
+			  </td>
+			  <TD><input type="text" size="45" id=$dblQts${schemaType}.parameters.parameter[$c].csvValues$dblQts  name=$dblQts${schemaType}.parameters.parameter[$c].csvValues$dblQts value="$!parameter.getCsvvalues()"/></TD>
+			</tr>
+		<input type="hidden" id=$dblQts${schemaType}.parameters.parameter[$c].description$dblQts name=$dblQts${schemaType}.parameters.parameter[$c].description$dblQts value="$!parameter.getDescription()"/>
+	#set ($c = $c + 1)
+			#end
+		    </TABLE>
+		</TD>
+	</TR>
+	#set ($c = 0)
+	#foreach ($parameter in $parameters)
+
+	<div class=popup onclick="event.cancelBubble = true;" id=desc$c>
+	  <p><b>$parameter.getName(): </b>$!parameter.getDescription() </p>
+
+	  <a href="#" onclick="hideCurrentPopup(); return false;">Close</a>
+	</div>
+	#set ($c = $c + 1)
+			#end
+	#else 
+	<TR>
+		<TD colspan="2" align="left">There are no paramaters to set for this pipeline. Click on Submit button to add this pipeline to your project</TD>
+	</TR>
+ 
+	#end
+	<TR>
+		<TD colspan="2" align="center"><input type="button" ONCLICK="javascript:window.close();" value="Close"/>&nbsp;&nbsp;&nbsp;<input type="submit"  name="eventSubmit_doAddprojectpipeline" value="Submit"/></TD>
+	</TR>
+
+
+
+<input type="hidden" name="search_element" value="xnat:projectData"/>
+<input type="hidden" name="search_field" value="xnat:projectData.ID"/>
+<input type="hidden" name="search_value" value="$project"/>
+<input type="hidden" name="project" value="$project"/>
+<input type="hidden" name="pipeline_path" value="$pipeline_path"/>
+<input type="hidden" name="dataType" value="$dataType"/>
+<input type="hidden" name="schemaType" value="$schemaType"/>
+<input type="hidden" name="edit" value="$edit"/>
+<input type="hidden" name="destination" value="JS_Parent_Return.vm"/>
+
+</TABLE>
+</form>
+

File plugin-resources/webapp/xnat/java/org/nrg/pipeline/utils/FileUtils.java

View file
-/* 
- *	Copyright Washington University in St Louis 2006
- *	All rights reserved
- * 	
- * 	@author Mohana Ramaratnam (Email: mramarat@wustl.edu)
-
-*/
-
-package org.nrg.pipeline.utils;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.nrg.pipeline.xmlbeans.PipelineDocument;
-import org.nrg.xdat.om.ArcProject;
-import org.nrg.xft.XFT;
-import org.nrg.xnat.turbine.utils.ArcSpecManager;
-
-public class FileUtils {
-	
-	public static PipelineDocument GetDocument(String pathToPipelineXmlFile) throws Exception {
-        if (!pathToPipelineXmlFile.endsWith(".xml")) pathToPipelineXmlFile += ".xml";
-        File xmlFile = new File(pathToPipelineXmlFile); 
-        //Bind the instance to the generated XMLBeans types.
-        ArrayList errors = new ArrayList();
-        XmlOptions xopt = new XmlOptions();
-        xopt.setErrorListener(errors);
-         XmlObject xo = XmlObject.Factory.parse(xmlFile, xopt);
-         if (errors.size() != 0) {
-             throw new XmlException(errors.toArray().toString());
-         }
-         //String err = XMLBeansUtils.validateAndGetErrors(xo);
-         //if (err != null) {
-          //   throw new XmlException("Invalid XML " + xmlFile + "\n" + errors);
-        //}
-        if (!(xo instanceof PipelineDocument)) {
-            throw new Exception("Invalid XML file supplied " + pathToPipelineXmlFile + " ==> Expecting a pipeline document");
-        }
-        PipelineDocument pipelineDoc = (PipelineDocument)xo; 
-        //String error = XMLBeansUtils.validateAndGetErrors(pipelineDoc);
-        //if (error != null) {
-          //  throw new XmlException("Invalid XML " + pathToPipelineXmlFile + "\n" + errors);
-        //}
-        return pipelineDoc;
-}
-
-	
-    public static  String getMaxMatching(String file1, String file2, String scanId1, String scanId2) {
-        String rtn = null;
-        if (file1 == null || file2 == null || scanId1 == null || scanId2 == null) return null;
-        int index = 0; 
-        while (true) {
-            if (file2.charAt(index) != file1.charAt(index)) 
-                break;
-            index++;
-        }
-        rtn = file1.substring(0,index);
-        if (scanId1.charAt(0) == scanId2.charAt(0)) {
-            if (rtn.endsWith("."+scanId1.charAt(0))) {
-                rtn = rtn.substring(0, rtn.length()-2);
-            }
-        }
-        System.out.println("Max Matching is " + rtn);
-        int slash = rtn.lastIndexOf(File.separator);
-        if (slash != -1) {
-            rtn = rtn.substring(slash+1,rtn.length());
-        }
-        
-        if (rtn.endsWith(".")) rtn = rtn.substring(0,rtn.length()-1);
-        
-        System.out.println("Returnning formatted " + rtn);
-        return rtn;
-    }
-    
-    public static String getName(String path) {
-        String rtn = path;
-        int indexOfLastSlash = path.lastIndexOf(File.separator);
-        if (indexOfLastSlash != -1) {
-            rtn = path.substring(indexOfLastSlash + 1);
-        }
-        return rtn;
-    }
-    
-	public static String getBuildDir(String project,  boolean postfixTimestamp) {
-		ArcProject arcProject = ArcSpecManager.GetInstance().getProjectArc(project);
-		String buildPath = XFT.GetPipelinePath()  ;
-		if (arcProject != null) {
-			buildPath = arcProject.getPaths().getBuildpath();
-		}
-		if (postfixTimestamp) {
-			Date date = new Date();
-		    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
-		    String s = formatter.format(date);
-			buildPath += s + "/" ;
-		}
-		return buildPath;
-	}
-	
-
-    
-}
+/* 
+ *	Copyright Washington University in St Louis 2006
+ *	All rights reserved
+ * 	
+ * 	@author Mohana Ramaratnam (Email: mramarat@wustl.edu)
+
+*/
+
+package org.nrg.pipeline.utils;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.nrg.pipeline.xmlbeans.PipelineDocument;
+import org.nrg.xdat.om.ArcProject;
+import org.nrg.xft.XFT;
+import org.nrg.xnat.turbine.utils.ArcSpecManager;
+
+public class FileUtils {
+	
+	public static PipelineDocument GetDocument(String pathToPipelineXmlFile) throws Exception {
+        if (!pathToPipelineXmlFile.endsWith(".xml")) pathToPipelineXmlFile += ".xml";
+        File xmlFile = new File(pathToPipelineXmlFile); 
+        //Bind the instance to the generated XMLBeans types.
+        ArrayList errors = new ArrayList();
+        XmlOptions xopt = new XmlOptions();
+        xopt.setErrorListener(errors);
+         XmlObject xo = XmlObject.Factory.parse(xmlFile, xopt);
+         if (errors.size() != 0) {
+             throw new XmlException(errors.toArray().toString());
+         }
+         //String err = XMLBeansUtils.validateAndGetErrors(xo);
+         //if (err != null) {
+          //   throw new XmlException("Invalid XML " + xmlFile + "\n" + errors);
+        //}
+        if (!(xo instanceof PipelineDocument)) {
+            throw new Exception("Invalid XML file supplied " + pathToPipelineXmlFile + " ==> Expecting a pipeline document");
+        }
+        PipelineDocument pipelineDoc = (PipelineDocument)xo; 
+        //String error = XMLBeansUtils.validateAndGetErrors(pipelineDoc);
+        //if (error != null) {
+          //  throw new XmlException("Invalid XML " + pathToPipelineXmlFile + "\n" + errors);
+        //}
+        return pipelineDoc;
+}
+
+	
+    public static  String getMaxMatching(String file1, String file2, String scanId1, String scanId2) {
+        String rtn = null;
+        if (file1 == null || file2 == null || scanId1 == null || scanId2 == null) return null;
+        int index = 0; 
+        while (true) {
+            if (file2.charAt(index) != file1.charAt(index)) 
+                break;
+            index++;
+        }
+        rtn = file1.substring(0,index);
+        if (scanId1.charAt(0) == scanId2.charAt(0)) {
+            if (rtn.endsWith("."+scanId1.charAt(0))) {
+                rtn = rtn.substring(0, rtn.length()-2);
+            }
+        }
+        System.out.println("Max Matching is " + rtn);
+        int slash = rtn.lastIndexOf(File.separator);
+        if (slash != -1) {
+            rtn = rtn.substring(slash+1,rtn.length());
+        }
+        
+        if (rtn.endsWith(".")) rtn = rtn.substring(0,rtn.length()-1);
+        
+        System.out.println("Returnning formatted " + rtn);
+        return rtn;
+    }
+    
+    public static String getName(String path) {
+        String rtn = path;
+        int indexOfLastSlash = path.lastIndexOf(File.separator);
+        if (indexOfLastSlash != -1) {
+            rtn = path.substring(indexOfLastSlash + 1);
+        }
+        return rtn;
+    }
+    
+	public static String getBuildDir(String project,  boolean postfixTimestamp) {
+		ArcProject arcProject = ArcSpecManager.GetInstance().getProjectArc(project);
+		String buildPath = XFT.GetPipelinePath()  ;
+		if (arcProject != null) {
+			buildPath = arcProject.getPaths().getBuildpath();
+		}
+		if (postfixTimestamp) {
+			Calendar cal = Calendar.getInstance();
+		    SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd_HHmmss");
+		    String s = formatter.format(cal.getTime());
+			buildPath += s + "/" ;
+		}
+		return buildPath;
+	}
+	
+
+    
+}

File plugin-resources/webapp/xnat/java/org/nrg/xnat/turbine/modules/screens/BuildPipelineParameters.java

View file
-/* 
- *	Copyright Washington University in St Louis 2006
- *	All rights reserved
- * 	
- * 	@author Mohana Ramaratnam (Email: mramarat@wustl.edu)
-
-*/
-
-package org.nrg.xnat.turbine.modules.screens;
-
-import java.util.LinkedHashMap;
-
-import org.apache.turbine.util.RunData;
-import org.apache.velocity.context.Context;
-import org.nrg.pipeline.BuildSpecification;
-import org.nrg.xdat.om.XnatMrsessiondata;
-import org.nrg.xdat.turbine.modules.screens.SecureReport;
-import org.nrg.xdat.turbine.utils.TurbineUtils;
-import org.nrg.xft.XFT;
-
-public class BuildPipelineParameters extends SecureReport
-{
-
-    public void preProcessing(RunData data, Context context)
-    {
-        TurbineUtils.InstanciatePassedItemForScreenUse(data,context);
-    }
-    
-    
-    /**
-     * Place all the data object in the context
-     * for use in the template.
-     */
-    public void finalProcessing(RunData data, Context context) 
-    {
-        if (context.get("om")==null) {
-            data.setScreenTemplate("Error.vm");
-            return; 
-        }
-        String pipelineName = data.getParameters().get("pipelineName");
-        if (pipelineName == null) {
-            data.setScreenTemplate("Error.vm");
-            return;
-        }
-        
-        XnatMrsessiondata mr = (XnatMrsessiondata)context.get("om");
-        
-        try {
-            /*LinkedHashMap parametersHash = BuildSpecification.GetInstance().getResolvedParametersForPipeline(pipelineName,mr);
-            context.put("parametersHash",parametersHash);
-            context.put("pipelineName",pipelineName);
-            context.put("search_element",mr.getSchemaElementName());
-            context.put("search_field",mr.getSchemaElementName()+".ID");
-            context.put("search_value",mr.getId());*/
-            return;
-        }catch(Exception e) {
-            String errorString = "<img src=\"/cnda1/images/error.gif\"> Error in the Build Spec file document for the pipeline " + context.get("pipelineName") ;
-            errorString += "<p>Please contact the <a href=\"mailto:"+XFT.GetAdminEmail()+"?subject=Error in Build Spec file for " + mr.getSessionType() + " pipeline " + pipelineName + "\">CNL techdesk</a> to resolve the error.</p>";
-            data.setMessage(errorString);
-            data.getParameters().add("exception",e.getMessage());
-            data.setScreenTemplate("Error.vm");
-        }
-    }
-    
-    
-    
- 
-    
-
-}
+/* 
+ *	Copyright Washington University in St Louis 2006
+ *	All rights reserved
+ * 	
+ * 	@author Mohana Ramaratnam (Email: mramarat@wustl.edu)
+
+*/
+
+package org.nrg.xnat.turbine.modules.screens;
+
+import org.apache.turbine.util.RunData;
+import org.apache.velocity.context.Context;
+import org.nrg.xdat.om.XnatMrsessiondata;
+import org.nrg.xdat.turbine.modules.screens.SecureReport;
+import org.nrg.xdat.turbine.utils.TurbineUtils;
+import org.nrg.xft.XFT;
+
+public class BuildPipelineParameters extends SecureReport
+{
+
+    public void preProcessing(RunData data, Context context)
+    {
+        TurbineUtils.InstanciatePassedItemForScreenUse(data,context);
+    }
+    
+    
+    /**
+     * Place all the data object in the context
+     * for use in the template.
+     */
+    public void finalProcessing(RunData data, Context context) 
+    {
+        if (context.get("om")==null) {
+            data.setScreenTemplate("Error.vm");
+            return; 
+        }
+        String pipelineName = data.getParameters().get("pipelineName");
+        if (pipelineName == null) {
+            data.setScreenTemplate("Error.vm");
+            return;
+        }
+        
+        XnatMrsessiondata mr = (XnatMrsessiondata)context.get("om");
+        
+        try {
+            /*LinkedHashMap parametersHash = BuildSpecification.GetInstance().getResolvedParametersForPipeline(pipelineName,mr);
+            context.put("parametersHash",parametersHash);
+            context.put("pipelineName",pipelineName);
+            context.put("search_element",mr.getSchemaElementName());
+            context.put("search_field",mr.getSchemaElementName()+".ID");
+            context.put("search_value",mr.getId());*/
+            return;
+        }catch(Exception e) {
+            String errorString = "<img src=\"/cnda1/images/error.gif\"> Error in the Build Spec file document for the pipeline " + context.get("pipelineName") ;
+            errorString += "<p>Please contact the <a href=\"mailto:"+XFT.GetAdminEmail()+"?subject=Error in Build Spec file for " + mr.getSessionType() + " pipeline " + pipelineName + "\">CNL techdesk</a> to resolve the error.</p>";
+            data.setMessage(errorString);
+            data.getParameters().add("exception",e.getMessage());
+            data.setScreenTemplate("Error.vm");
+        }
+    }
+    
+    
+    
+ 
+    
+
+}

File plugin-resources/webapp/xnat/java/org/nrg/xnat/turbine/modules/screens/DefaultPipelineScreen.java

View file
-/* 
- *	Copyright Washington University in St Louis 2006
- *	All rights reserved
- * 	
- * 	@author Mohana Ramaratnam (Email: mramarat@wustl.edu)
-
-*/
-
-package org.nrg.xnat.turbine.modules.screens;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.apache.log4j.Logger;
-import org.apache.turbine.util.RunData;
-import org.apache.velocity.context.Context;
-import org.nrg.pipeline.PipelineRepositoryManager;
-import org.nrg.xdat.base.BaseElement;
-import org.nrg.xdat.om.ArcPipelinedataI;
-import org.nrg.xdat.om.ArcPipelineparameterdata;
-import org.nrg.xdat.om.ArcProject;
-import org.nrg.xdat.om.ArcProjectDescendantPipeline;
-import org.nrg.xdat.om.PipePipelinedetails;
-import org.nrg.xdat.om.PipePipelinedetailsParameter;
-import org.nrg.xdat.om.WrkWorkflowdata;
-import org.nrg.xdat.om.XnatAbstractresource;
-import org.nrg.xdat.om.XnatDicomseries;
-import org.nrg.xdat.om.XnatImagescandata;
-import org.nrg.xdat.om.XnatMrsessiondata;
-import org.nrg.xdat.om.XnatProjectdata;
-import org.nrg.xdat.om.XnatResourcecatalog;
-import org.nrg.xdat.om.base.BaseWrkWorkflowdata;
-import org.nrg.xdat.turbine.modules.screens.SecureReport;
-import org.nrg.xdat.turbine.utils.TurbineUtils;
-import org.nrg.xft.ItemI;
-import org.nrg.xft.XFT;
-import org.nrg.xft.XFTItem;
-import org.nrg.xft.search.CriteriaCollection;
-import org.nrg.xnat.exceptions.PipelineNotFoundException;
-import org.nrg.xnat.turbine.utils.ArcSpecManager;
-
-public abstract class DefaultPipelineScreen extends SecureReport{
-
-	static Logger logger = Logger.getLogger(DefaultPipelineScreen.class);
-	String message = null;
-	ArrayList workflows;
-	String project = null;
-	
-	protected Hashtable<String, ArcPipelineparameterdata > projectParameters ;
-	String pipelinePath = null;
-
-	 public DefaultPipelineScreen() {
-	        workflows = new ArrayList<WrkWorkflowdata>();
-	        projectParameters = new Hashtable<String, ArcPipelineparameterdata >();
-	    }
-	
-	  public abstract void finalProcessing(RunData data, Context context);
-
-		protected void setHasDicomFiles(XnatMrsessiondata mr, String mprageScanType, Context context) {
-			boolean rtn = false;
-			String[] types = mprageScanType.split(",");
-			ArrayList<XnatImagescandata> scans = mr.getScansByType(types[0]);
-			if (scans.size() > 0 ) {
-				ArrayList files = scans.get(0).getFile();
-				if (files.size() > 0) {
-					XnatAbstractresource absFile = (XnatAbstractresource) files.get(0);
-					if (absFile instanceof  XnatDicomseries ) {
-						rtn = true;
-					}else if (absFile instanceof  XnatResourcecatalog){
-						XnatResourcecatalog rsccat = (XnatResourcecatalog) absFile;
-						if (rsccat.getFormat().equals("DICOM"))
-							rtn = true;
-					}
-				}
-			}
-			context.put("isDicom", rtn?"1":"0");
-		}
-		
-		protected void setHasFreesurfer(XnatMrsessiondata mr,  Context context) {
-			String project = mr.getProject();
-			int hasFreesurfer = 0;
-			ArcProject arcProject = ArcSpecManager.GetInstance().getProjectArc(project);
-			ArrayList<ArcProjectDescendantPipeline> descPipelines = arcProject.getPipelinesForDescendant(mr.SCHEMA_ELEMENT_NAME);
-			for (int i = 0; i < descPipelines.size(); i++) {
-				ArcProjectDescendantPipeline aPipeline = descPipelines.get(i);
-				if (aPipeline.getLocation().endsWith(File.separator+"StdFreeSurferBuild.xml")); {
-					hasFreesurfer = 1;
-					break;
-				}
-			}
-			context.put("freesurfer", hasFreesurfer);
-			
-		}
-	
-	 
-	  protected void setWorkflows(RunData data, Context context) {
-	        String projectId = (String)context.get("project");
-	        try {
-	        	org.nrg.xft.search.CriteriaCollection cc = new CriteriaCollection("AND");
-	            cc.addClause("wrk:workflowData.ID",item.getProperty("ID"));
-	            if (projectId != null) cc.addClause("wrk:workflowData.ExternalID",projectId);
-	            org.nrg.xft.collections.ItemCollection items = org.nrg.xft.search.ItemSearch.GetItems(cc,TurbineUtils.getUser(data),false);
-	            //Sort by Launch Time
-	            ArrayList workitems = items.getItems("wrk:workflowData.launch_time","DESC");
-	            Iterator iter = workitems.iterator();
-	            while (iter.hasNext())
-	            {
-	                WrkWorkflowdata vrc = new WrkWorkflowdata((XFTItem)iter.next());
-	                workflows.add(vrc);
-	            }
-	            context.put("workflows",workflows);
-	        }catch(Exception e) {
-	        	logger.debug(e);
-	        }
-	    }
-	  
-	   public void preProcessing(RunData data, Context context)   {
-	    }
-	    
-	  
-	  public void doBuildTemplate(RunData data, Context context)	{
-	       // preserveVariables(data,context);
-		    logger.debug("BEGIN SECURE REPORT :" + this.getClass().getName());
-		    preProcessing(data,context);
-	        item = TurbineUtils.getDataItem(data);
-		    if (item== null)		{
-				try {
-					ItemI temp = TurbineUtils.GetItemBySearch(data,preLoad());
-				    item = temp;
-				} catch (IllegalAccessException e1) {
-	                logger.error(e1);
-				    data.setMessage(e1.getMessage());
-					noItemError(data,context);
-					return;
-				} catch (Exception e1) {
-	                logger.error(e1);
-	                data.setMessage(e1.getMessage());
-	                data.setScreenTemplate("Error.vm");
-	                noItemError(data,context);
-	                return;
-				}
-			}
-			if (item == null)		{
-				data.setMessage("Error: No item found.");
-				noItemError(data,context);
-			}else{
-				try {
-					if(XFT.VERBOSE)System.out.println("Creating report: " + getClass());;
-				    context.put("item",item.getItem());
-				    if(XFT.VERBOSE)System.out.println("Loaded item object (org.nrg.xft.ItemI) as context parameter 'item'.");
-				    context.put("user",TurbineUtils.getUser(data));
-				    if(XFT.VERBOSE)System.out.println("Loaded user object (org.nrg.xdat.security.XDATUser) as context parameter 'user'.");
-	            	context.put("element",org.nrg.xdat.schema.SchemaElement.GetElement(item.getXSIType()));
-	            	context.put("search_element",data.getParameters().getString("search_element"));
-	            	context.put("search_field",data.getParameters().getString("search_field"));
-	            	context.put("search_value",data.getParameters().getString("search_value"));
-	            	project = data.getParameters().getString("project");
-	            	pipelinePath = (String)context.get("pipelinePath");
-	        
-	            	context.put("project",project);
-            	    
-	            	om = BaseElement.GetGeneratedItem(item);
-	            	context.put("om",om);
-	            	 setWorkflows(data,context);
-	            	 setParameters(pipelinePath);
-	            	if (message != null) data.setMessage(message);
-					 finalProcessing(data,context);
-				} catch (Exception e) {
-					data.setMessage(e.getMessage());
-					logger.error("",e);
-				}
-			}
-		    logger.debug("END SECURE REPORT :" + this.getClass().getName());
-		}
-
-
-	
-	protected boolean isAnyQueuedOrRunning(ArrayList<WrkWorkflowdata> workflows) {
-        boolean rtn = false;
-        try {
-            for (int i = 0; i <workflows.size(); i++) {
-                WrkWorkflowdata wrkFlow = workflows.get(i);
-                if (wrkFlow.getStatus().toUpperCase().equals(BaseWrkWorkflowdata.QUEUED) ||wrkFlow.getStatus().toUpperCase().equals(BaseWrkWorkflowdata.RUNNING)) {
-                    rtn = true;
-                    break;
-                }
-            }
-        }catch(IndexOutOfBoundsException aoe){logger.debug(aoe);}
-        return rtn;
-    }
-    
-    protected boolean hasBeenCompletedInThePast(String pipelinePath,ArrayList<WrkWorkflowdata> workflows ) {
-    	boolean rtn = false;
-             for (int i = 0; i <workflows.size(); i++) {
-                 WrkWorkflowdata wrkFlow = workflows.get(i);
-                 String matchPipelineName = wrkFlow.getPipelineName();
-                 if (matchPipelineName.equals(pipelinePath) || pipelinePath.contains(matchPipelineName)) {
-                	 if (wrkFlow.getStatus().equalsIgnoreCase(BaseWrkWorkflowdata.COMPLETE)) {
-	                     rtn = true;
-	                     message = "This pipeline has been completed in the past. Relaunching the pipeline may result in loss of data. Are you sure you want to proceed?";
-	                     break;
-                	 }
-                 }
-             }
-         return rtn;
-    	
-    }
-
-    protected ArcPipelineparameterdata  getProjectPipelineSetting(String parameterName) throws Exception {
-    	return projectParameters.get(parameterName);
-    }
-    
-    protected ArcPipelineparameterdata getParameter(ArcProject arcProject, String parameterName) throws PipelineNotFoundException {
-    	ArcPipelineparameterdata rtn = null;
-    	ArcPipelinedataI pipelineData = arcProject.getPipelineByPath(pipelinePath);
-    	ArrayList<ArcPipelineparameterdata> params = pipelineData.getParameters_parameter();
-        for (int i = 0; i < params.size(); i++) {
-        	ArcPipelineparameterdata aParam = params.get(i);
-        	if (aParam.getName().equals(parameterName)) {
-        		rtn = aParam;
-        		break;
-        	}
-        }
-        return rtn;
-    }
-    
-    protected void setParameters(String pipeline) throws PipelineNotFoundException {
-        ArcProject arcProject = ArcSpecManager.GetInstance().getProjectArc(project);
-        ArcPipelinedataI pipelineData = null;
-        if (arcProject == null) { //Project pipeline hasnt been set
-        	PipePipelinedetails pipelineDetails = PipelineRepositoryManager.GetInstance().getPipeline(pipeline);
-        	ArrayList<PipePipelinedetailsParameter> params = pipelineDetails.getParameters_parameter();
-	        for (int i = 0; i < params.size(); i++) {
-	        	ArcPipelineparameterdata aParam = PipelineRepositoryManager.GetInstance().convertToArcPipelineParameter(params.get(i));
-	            projectParameters.put(aParam.getName(),aParam);
-	        } 
-        }else {
-	        if (om.getXSIType().equals(XnatProjectdata.SCHEMA_ELEMENT_NAME)) {
-	        	pipelineData = arcProject.getPipelineByPath(pipeline);
-	        }else {
-	        	 pipelineData = arcProject.getPipelineForDescendantByPath(om.getXSIType(), pipeline);
-	        }
-	    	ArrayList<ArcPipelineparameterdata> params = pipelineData.getParameters_parameter();
-	        for (int i = 0; i < params.size(); i++) {
-	        	ArcPipelineparameterdata aParam = params.get(i);
-	            projectParameters.put(aParam.getName(),aParam);
-	        }
-        }
-    }
-    
-
-	
-}
+/* 
+ *	Copyright Washington University in St Louis 2006
+ *	All rights reserved
+ * 	
+ * 	@author Mohana Ramaratnam (Email: mramarat@wustl.edu)
+
+*/
+
+package org.nrg.xnat.turbine.modules.screens;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.apache.log4j.Logger;
+import org.apache.turbine.util.RunData;
+import org.apache.velocity.context.Context;
+import org.nrg.pipeline.PipelineRepositoryManager;
+import org.nrg.xdat.base.BaseElement;
+import org.nrg.xdat.om.ArcPipelinedataI;
+import org.nrg.xdat.om.ArcPipelineparameterdata;
+import org.nrg.xdat.om.ArcProject;
+import org.nrg.xdat.om.ArcProjectDescendantPipeline;
+import org.nrg.xdat.om.PipePipelinedetails;
+import org.nrg.xdat.om.PipePipelinedetailsParameter;
+import org.nrg.xdat.om.WrkWorkflowdata;
+import org.nrg.xdat.om.XnatAbstractresource;
+import org.nrg.xdat.om.XnatDicomseries;
+import org.nrg.xdat.om.XnatImagescandata;
+import org.nrg.xdat.om.XnatMrsessiondata;
+import org.nrg.xdat.om.XnatProjectdata;
+import org.nrg.xdat.om.XnatResourcecatalog;
+import org.nrg.xdat.om.base.BaseWrkWorkflowdata;
+import org.nrg.xdat.turbine.modules.screens.SecureReport;
+import org.nrg.xdat.turbine.utils.TurbineUtils;
+import org.nrg.xft.ItemI;
+import org.nrg.xft.XFT;
+import org.nrg.xft.XFTItem;
+import org.nrg.xft.search.CriteriaCollection;
+import org.nrg.xnat.exceptions.PipelineNotFoundException;
+import org.nrg.xnat.turbine.utils.ArcSpecManager;
+
+public abstract class DefaultPipelineScreen extends SecureReport{
+
+	static Logger logger = Logger.getLogger(DefaultPipelineScreen.class);
+	String message = null;
+	ArrayList workflows;
+	String project = null;
+	
+	protected Hashtable<String, ArcPipelineparameterdata > projectParameters ;
+	String pipelinePath = null;
+
+	 public DefaultPipelineScreen() {
+	        workflows = new ArrayList<WrkWorkflowdata>();
+	        projectParameters = new Hashtable<String, ArcPipelineparameterdata >();
+	    }
+	
+	  public abstract void finalProcessing(RunData data, Context context);
+
+		protected void setHasDicomFiles(XnatMrsessiondata mr, String mprageScanType, Context context) {
+			boolean rtn = false;
+			String[] types = mprageScanType.split(",");
+			for (int j =0; j <types.length; j++) {
+			ArrayList<XnatImagescandata> scans = mr.getScansByType(types[j].trim());
+			if (scans != null && scans.size() > 0 ) {
+				ArrayList files = scans.get(0).getFile();
+				if (files.size() > 0) {
+					for (int i =0; i < files.size(); i++) {
+						XnatAbstractresource absFile = (XnatAbstractresource) files.get(i);
+						if (absFile instanceof  XnatDicomseries ) {
+							rtn = true;
+						}else if (absFile instanceof  XnatResourcecatalog){
+							XnatResourcecatalog rsccat = (XnatResourcecatalog) absFile;
+							if (rsccat.getContent().endsWith("RAW")) {
+								if (rsccat.getFormat().equals("DICOM"))
+								    rtn = true;
+								break;
+							}
+						}
+						
+					}
+				}
+			}
+		
+			}
+			context.put("isDicom", rtn?"1":"0");
+			
+		}
+		
+		protected void setHasFreesurfer(XnatMrsessiondata mr,  Context context) {
+			String project = mr.getProject();
+			int hasFreesurfer = 0;
+			ArcProject arcProject = ArcSpecManager.GetInstance().getProjectArc(project);
+			ArrayList<ArcProjectDescendantPipeline> descPipelines = arcProject.getPipelinesForDescendant(mr.SCHEMA_ELEMENT_NAME);
+			for (int i = 0; i < descPipelines.size(); i++) {
+				ArcProjectDescendantPipeline aPipeline = descPipelines.get(i);
+				if (aPipeline.getLocation().endsWith(File.separator+"StdFreeSurferBuild.xml")); {
+					hasFreesurfer = 1;
+					break;
+				}
+			}
+			context.put("freesurfer", hasFreesurfer);
+			
+		}
+	
+	 
+	  protected void setWorkflows(RunData data, Context context) {
+	        String projectId = (String)context.get("project");
+	        try {
+	        	org.nrg.xft.search.CriteriaCollection cc = new CriteriaCollection("AND");
+	            cc.addClause("wrk:workflowData.ID",item.getProperty("ID"));
+	            if (projectId != null) cc.addClause("wrk:workflowData.ExternalID",projectId);
+	            org.nrg.xft.collections.ItemCollection items = org.nrg.xft.search.ItemSearch.GetItems(cc,TurbineUtils.getUser(data),false);
+	            //Sort by Launch Time
+	            ArrayList workitems = items.getItems("wrk:workflowData.launch_time","DESC");
+	            Iterator iter = workitems.iterator();
+	            while (iter.hasNext())
+	            {
+	                WrkWorkflowdata vrc = new WrkWorkflowdata((XFTItem)iter.next());
+	                workflows.add(vrc);
+	            }
+	            context.put("workflows",workflows);
+	        }catch(Exception e) {
+	        	logger.debug(e);
+	        }
+	    }
+	  
+	   public void preProcessing(RunData data, Context context)   {
+	    }
+	    
+	  
+	  public void doBuildTemplate(RunData data, Context context)	{
+	       // preserveVariables(data,context);
+		    logger.debug("BEGIN SECURE REPORT :" + this.getClass().getName());
+		    preProcessing(data,context);
+	        item = TurbineUtils.getDataItem(data);
+		    if (item== null)		{
+				try {
+					ItemI temp = TurbineUtils.GetItemBySearch(data,preLoad());
+				    item = temp;
+				} catch (IllegalAccessException e1) {
+	                logger.error(e1);
+				    data.setMessage(e1.getMessage());
+					noItemError(data,context);
+					return;
+				} catch (Exception e1) {
+	                logger.error(e1);
+	                data.setMessage(e1.getMessage());
+	                data.setScreenTemplate("Error.vm");
+	                noItemError(data,context);
+	                return;
+				}
+			}
+			if (item == null)		{
+				data.setMessage("Error: No item found.");
+				noItemError(data,context);
+			}else{
+				try {
+					if(XFT.VERBOSE)System.out.println("Creating report: " + getClass());;
+				    context.put("item",item.getItem());
+				    if(XFT.VERBOSE)System.out.println("Loaded item object (org.nrg.xft.ItemI) as context parameter 'item'.");
+				    context.put("user",TurbineUtils.getUser(data));
+				    if(XFT.VERBOSE)System.out.println("Loaded user object (org.nrg.xdat.security.XDATUser) as context parameter 'user'.");
+	            	context.put("element",org.nrg.xdat.schema.SchemaElement.GetElement(item.getXSIType()));
+	            	context.put("search_element",data.getParameters().getString("search_element"));
+	            	context.put("search_field",data.getParameters().getString("search_field"));
+	            	context.put("search_value",data.getParameters().getString("search_value"));
+	            	project = data.getParameters().getString("project");
+	            	pipelinePath = (String)context.get("pipelinePath");
+	        
+	            	context.put("project",project);
+            	    
+	            	om = BaseElement.GetGeneratedItem(item);
+	            	context.put("om",om);
+	            	 setWorkflows(data,context);
+	            	 setParameters(pipelinePath);
+	            	if (message != null) data.setMessage(message);
+					 finalProcessing(data,context);
+				} catch (Exception e) {
+					data.setMessage(e.getMessage());
+					logger.error("",e);
+				}
+			}
+		    logger.debug("END SECURE REPORT :" + this.getClass().getName());
+		}
+
+
+	
+	protected boolean isAnyQueuedOrRunning(ArrayList<WrkWorkflowdata> workflows) {
+        boolean rtn = false;
+        try {
+            for (int i = 0; i <workflows.size(); i++) {
+                WrkWorkflowdata wrkFlow = workflows.get(i);
+                if (wrkFlow.getStatus().toUpperCase().equals(BaseWrkWorkflowdata.QUEUED) ||wrkFlow.getStatus().toUpperCase().equals(BaseWrkWorkflowdata.RUNNING)) {
+                    rtn = true;
+                    break;
+                }
+            }
+        }catch(IndexOutOfBoundsException aoe){logger.debug(aoe);}
+        return rtn;
+    }
+    
+    protected boolean hasBeenCompletedInThePast(String pipelinePath,ArrayList<WrkWorkflowdata> workflows ) {
+    	boolean rtn = false;
+             for (int i = 0; i <workflows.size(); i++) {
+                 WrkWorkflowdata wrkFlow = workflows.get(i);
+                 String matchPipelineName = wrkFlow.getPipelineName();
+                 if (matchPipelineName.equals(pipelinePath) || pipelinePath.contains(matchPipelineName)) {
+                	 if (wrkFlow.getStatus().equalsIgnoreCase(BaseWrkWorkflowdata.COMPLETE)) {
+	                     rtn = true;
+	                     message = "This pipeline has been completed in the past. Relaunching the pipeline may result in loss of data. Are you sure you want to proceed?";
+	                     break;
+                	 }
+                 }
+             }
+         return rtn;
+    	
+    }
+
+    protected ArcPipelineparameterdata  getProjectPipelineSetting(String parameterName) throws Exception {
+    	return projectParameters.get(parameterName);
+    }
+    
+    protected ArcPipelineparameterdata getParameter(ArcProject arcProject, String parameterName) throws PipelineNotFoundException {
+    	ArcPipelineparameterdata rtn = null;
+    	ArcPipelinedataI pipelineData = arcProject.getPipelineByPath(pipelinePath);
+    	ArrayList<ArcPipelineparameterdata> params = pipelineData.getParameters_parameter();
+        for (int i = 0; i < params.size(); i++) {
+        	ArcPipelineparameterdata aParam = params.get(i);
+        	if (aParam.getName().equals(parameterName)) {
+        		rtn = aParam;
+        		break;
+        	}
+        }
+        return rtn;
+    }
+    
+    protected void setParameters(String pipeline) throws PipelineNotFoundException {
+        ArcProject arcProject = ArcSpecManager.GetInstance().getProjectArc(project);
+        ArcPipelinedataI pipelineData = null;
+        if (arcProject == null) { //Project pipeline hasnt been set
+        	PipePipelinedetails pipelineDetails = PipelineRepositoryManager.GetInstance().getPipeline(pipeline);
+        	ArrayList<PipePipelinedetailsParameter> params = pipelineDetails.getParameters_parameter();
+	        for (int i = 0; i < params.size(); i++) {
+	        	ArcPipelineparameterdata aParam = PipelineRepositoryManager.GetInstance().convertToArcPipelineParameter(params.get(i));
+	            projectParameters.put(aParam.getName(),aParam);
+	        } 
+        }else {
+	        if (om.getXSIType().equals(XnatProjectdata.SCHEMA_ELEMENT_NAME)) {
+	        	pipelineData = arcProject.getPipelineByPath(pipeline);
+	        }else {
+	        	 pipelineData = arcProject.getPipelineForDescendantByPath(om.getXSIType(), pipeline);
+	        }
+	    	ArrayList<ArcPipelineparameterdata> params = pipelineData.getParameters_parameter();
+	        for (int i = 0; i < params.size(); i++) {
+	        	ArcPipelineparameterdata aParam = params.get(i);
+	            projectParameters.put(aParam.getName(),aParam);
+	        }
+        }
+    }
+    
+
+	
+}