Author: kwright
Date: Mon Jun 16 19:58:18 2014
New Revision: 1602983

URL: http://svn.apache.org/r1602983
Log:
Bring listjobs and viewjob up to date

Modified:
    
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/listjobs.jsp
    
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/viewjob.jsp

Modified: 
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/listjobs.jsp
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/listjobs.jsp?rev=1602983&r1=1602982&r2=1602983&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/listjobs.jsp
 (original)
+++ 
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/listjobs.jsp
 Mon Jun 16 19:58:18 2014
@@ -84,11 +84,22 @@
                                <td 
class="columnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listjobs.ScheduleType")%></nobr></td>
                        </tr>
 <%
-       int i = 0;
-       while (i < jobs.length)
+       for (int i = 0; i < jobs.length; i++)
        {
-               IJobDescription jd = jobs[i++];
+               IJobDescription jd = jobs[i];
 
+               StringBuilder sb = new StringBuilder();
+               for (int j = 0; j < jd.countPipelineStages(); j++)
+               {
+                       if (jd.getPipelineStageIsOutputConnection(j))
+                       {
+                               if (sb.length() > 0)
+                                       sb.append(",");
+                               sb.append(jd.getPipelineStageConnectionName(j));
+                       }
+               }
+               String outputConnectionNames = sb.toString();
+               
                String jobType = "";
                switch (jd.getType())
                {
@@ -112,7 +123,7 @@
                        </nobr>
                    </td>
                    <td 
class="columncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(jd.getDescription())%></td>
-                   <td 
class="columncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(jd.getOutputConnectionName())%></td>
+                   <td 
class="columncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(outputConnectionNames)%></td>
                    <td 
class="columncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(jd.getConnectionName())%></td>
                    <td class="columncell"><%=jobType%></td>
                </tr>

Modified: 
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/viewjob.jsp
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/viewjob.jsp?rev=1602983&r1=1602982&r2=1602983&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/viewjob.jsp
 (original)
+++ 
manifoldcf/branches/CONNECTORS-962/framework/crawler-ui/src/main/webapp/viewjob.jsp
 Mon Jun 16 19:58:18 2014
@@ -143,22 +143,8 @@
                int priority = job.getPriority();
 
                String connectionName = job.getConnectionName();
-               String outputName = job.getOutputConnectionName();
-               String[] transformationNames = new 
String[job.countPipelineStages()];
-               String[] transformationDescriptions = new 
String[job.countPipelineStages()];
-               for (int j = 0; j < job.countPipelineStages(); j++)
-               {
-                       transformationNames[j] = 
job.getPipelineStageConnectionName(j);
-                       String transformationDescription = 
job.getPipelineStageDescription(j);
-                       if (transformationDescription == null)
-                               transformationDescription = "";
-                       transformationDescriptions[j] = 
transformationDescription;
-               }
-
                IRepositoryConnection connection = 
connManager.load(connectionName);
-               IOutputConnection outputConnection = 
outputManager.load(outputName);
-               ITransformationConnection[] transformationConnections = 
transformationManager.loadMultiple(transformationNames);
-
+               
                int model = 
RepositoryConnectorFactory.getConnectorModel(threadContext,connection.getClassName());
                String[] relationshipTypes = 
RepositoryConnectorFactory.getRelationshipTypes(threadContext,connection.getClassName());
                Map hopCountFilters = job.getHopCountFilters();
@@ -169,7 +155,7 @@
                //threadContext.save("OutputConnection",outputConnection);
                
//threadContext.save("DocumentSpecification",job.getSpecification());
                //threadContext.save("RepositoryConnection",connection);
-               int displaySequence = 0;
+               int rowCounter = 0;
 
 %>
                <table class="displaytable">
@@ -189,31 +175,32 @@
                                        <table class="formtable">
                                                <tr class="formheaderrow">
                                                        <td 
class="formcolumnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.StageNumber")%></nobr></td>
+                                                       <td 
class="formcolumnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.StageType")%></nobr></td>
+                                                       <td 
class="formcolumnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.StagePrecedent")%></nobr></td>
                                                        <td 
class="formcolumnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.StageDescription")%></nobr></td>
                                                        <td 
class="formcolumnheader"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.StageConnectionName")%></nobr></td>
                                                </tr>
-                                               <tr class="<%=((displaySequence 
% 2)==0)?"evenformrow":"oddformrow"%>">
-                                                       <td 
class="formcolumncell"><%=(++displaySequence)%>.</td>
+                                               <tr class="<%=((rowCounter++ % 
2)==0)?"evenformrow":"oddformrow"%>">
+                                                       <td 
class="formcolumncell">1.</td>
+                                                       <td 
class="formcolumncell"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.Repository")%></td>
+                                                       <td 
class="formcolumncell"></td>
                                                        <td 
class="formcolumncell"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.RepositoryStage")%></td>
                                                        <td 
class="formcolumncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(connectionName)%></td>
                                                </tr>
 <%
-               for (int j = 0; j < transformationNames.length; j++)
+               for (int j = 0; j < job.countPipelineStages(); j++)
                {
 %>
-                                               <tr class="<%=((displaySequence 
% 2)==0)?"evenformrow":"oddformrow"%>">
-                                                       <td 
class="formcolumncell"><%=(++displaySequence)%>.</td>
-                                                       <td 
class="formcolumncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(transformationDescriptions[j])%></td>
-                                                       <td 
class="formcolumncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(transformationNames[j])%></td>
+                                               <tr class="<%=((rowCounter++ % 
2)==0)?"evenformrow":"oddformrow"%>">
+                                                       <td 
class="formcolumncell"><%=(j+2)%>.</td>
+                                                       <td 
class="formcolumncell"><%=job.getPipelineStageIsOutputConnection(j)?Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.Output"):Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.Transformation")%></td>
+                                                       <td 
class="formcolumncell"><%=(job.getPipelineStagePrerequisite(j)+2)%>.</td>
+                                                       <td 
class="formcolumncell"><%=(job.getPipelineStageDescription(j)!=null)?org.apache.manifoldcf.ui.util.Encoder.bodyEscape(job.getPipelineStageDescription(j)):""%></td>
+                                                       <td 
class="formcolumncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(job.getPipelineStageConnectionName(j))%></td>
                                                </tr>
 <%
                }
 %>
-                                               <tr class="<%=((displaySequence 
% 2)==0)?"evenformrow":"oddformrow"%>">
-                                                       <td 
class="formcolumncell"><%=(++displaySequence)%>.</td>
-                                                       <td 
class="formcolumncell"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.OutputStage")%></td>
-                                                       <td 
class="formcolumncell"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(outputName)%></td>
-                                               </tr>
                                        </table>
                                </td>
                        </tr>
@@ -692,25 +679,24 @@
 
                }
 %>
-
                        <tr>
-                               <td class="separator" colspan="4"><hr/></td>
+                               <td class="separator" colspan="4">1.<hr/></td>
                        </tr>
                        <tr>
                                <td colspan="4">
 <%
-               if (outputConnection != null)
+               if (connection != null)
                {
-                       IOutputConnector outputConnector = 
outputConnectorPool.grab(outputConnection);
-                       if (outputConnector != null)
+                       IRepositoryConnector repositoryConnector = 
repositoryConnectorPool.grab(connection);
+                       if (repositoryConnector != null)
                        {
                                try
                                {
-                                       outputConnector.viewSpecification(new 
org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),job.getOutputSpecification(),1+transformationConnections.length);
+                                       
repositoryConnector.viewSpecification(new 
org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),job.getSpecification(),0);
                                }
                                finally
                                {
-                                       
outputConnectorPool.release(outputConnection,outputConnector);
+                                       
repositoryConnectorPool.release(connection,repositoryConnector);
                                }
                        }
                }
@@ -718,19 +704,36 @@
                                </td>
                        </tr>
 <%
-               if (transformationConnections.length > 0)
+               for (int j = 0; j < job.countPipelineStages(); j++)
                {
 %>
                        <tr>
-                               <td class="separator" colspan="4"><hr/></td>
+                               <td class="separator" 
colspan="4"><%=(j+2)%>.<hr/></td>
                        </tr>
                        <tr>
                                <td colspan="4">
 <%
-                       for (int j = 0; j < transformationConnections.length; 
j++)
+                       OutputSpecification os = 
job.getPipelineStageSpecification(j);
+                       if (job.getPipelineStageIsOutputConnection(j))
                        {
-                               OutputSpecification os = 
job.getPipelineStageSpecification(j);
-                               ITransformationConnector 
transformationConnector = 
transformationConnectorPool.grab(transformationConnections[j]);
+                               IOutputConnection thisConnection = 
outputManager.load(job.getPipelineStageConnectionName(j));
+                               IOutputConnector outputConnector = 
outputConnectorPool.grab(thisConnection);
+                               if (outputConnector != null)
+                               {
+                                       try
+                                       {
+                                               
outputConnector.viewSpecification(new 
org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),os,1+j);
+                                       }
+                                       finally
+                                       {
+                                               
outputConnectorPool.release(thisConnection,outputConnector);
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               ITransformationConnection thisConnection = 
transformationManager.load(job.getPipelineStageConnectionName(j));
+                               ITransformationConnector 
transformationConnector = transformationConnectorPool.grab(thisConnection);
                                if (transformationConnector != null)
                                {
                                        try
@@ -739,7 +742,7 @@
                                        }
                                        finally
                                        {
-                                               
transformationConnectorPool.release(transformationConnections[j],transformationConnector);
+                                               
transformationConnectorPool.release(thisConnection,transformationConnector);
                                        }
                                }
                        }
@@ -753,30 +756,6 @@
                                <td class="separator" colspan="4"><hr/></td>
                        </tr>
                        <tr>
-                               <td colspan="4">
-<%
-               if (connection != null)
-               {
-                       IRepositoryConnector repositoryConnector = 
repositoryConnectorPool.grab(connection);
-                       if (repositoryConnector != null)
-                       {
-                               try
-                               {
-                                       
repositoryConnector.viewSpecification(new 
org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),job.getSpecification(),0);
-                               }
-                               finally
-                               {
-                                       
repositoryConnectorPool.release(connection,repositoryConnector);
-                               }
-                       }
-               }
-%>
-                               </td>
-                       </tr>
-                       <tr>
-                               <td class="separator" colspan="4"><hr/></td>
-                       </tr>
-                       <tr>
                                <td class="message" colspan="4">
                                        <nobr>
                                                <a 
href='<%="editjob.jsp?jobid="+jobID%>' 
alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"viewjob.EditThisJob")%>"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewjob.Edit")%></a>


Reply via email to