You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/12/21 14:00:12 UTC

svn commit: r1647137 - in /manifoldcf/branches/CONNECTORS-1119/framework: crawler-ui/src/main/webapp/ ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/

Author: kwright
Date: Sun Dec 21 13:00:12 2014
New Revision: 1647137

URL: http://svn.apache.org/r1647137
Log:
Finish notification connection definition UI

Modified:
    manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/execute.jsp
    manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/navigation.jsp
    manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
    manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
    manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_zh_CN.properties

Modified: manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/execute.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/execute.jsp?rev=1647137&r1=1647136&r2=1647137&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/execute.jsp (original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/execute.jsp Sun Dec 21 13:00:12 2014
@@ -47,6 +47,7 @@
 		IJobManager manager = JobManagerFactory.make(threadContext);
 		IAuthorityGroupManager authGroupManager = AuthorityGroupManagerFactory.make(threadContext);
 		IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(threadContext);
+		INotificationConnectionManager connManager = NotificationConnectionManagerFactory.make(threadContext);
 		IAuthorityConnectionManager authConnManager = AuthorityConnectionManagerFactory.make(threadContext);
 		IMappingConnectionManager mappingConnManager = MappingConnectionManagerFactory.make(threadContext);
 		IOutputConnectionManager outputManager = OutputConnectionManagerFactory.make(threadContext);
@@ -863,6 +864,121 @@
 %>
 				<jsp:forward page="error.jsp"/>
 <%
+			}
+		}
+		else if (type != null && op != null && type.equals("notification"))
+		{
+			// -- Notification connection editing operations --
+			if (op.equals("Save") || op.equals("Continue"))
+			{
+				try
+				{
+					// Set up a connection object that is a merge of an existing connection object plus what was posted.
+					INotificationConnection connection = null;
+					boolean isNew = true;
+					String x = variableContext.getParameter("isnewconnection");
+					if (x != null)
+						isNew = x.equals("true");
+
+					String connectionName = variableContext.getParameter("connname");
+					// If the connectionname is not null, load the connection description and prepopulate everything with what comes from it.
+					if (connectionName != null && connectionName.length() > 0 && !isNew)
+					{
+						connection = notificationManager.load(connectionName);
+					}
+					
+					if (connection == null)
+					{
+						connection = notificationManager.create();
+						if (connectionName != null && connectionName.length() > 0)
+							connection.setName(connectionName);
+					}
+
+					// Gather all the data from the form.
+					connection.setIsNew(isNew);
+					x = variableContext.getParameter("description");
+					if (x != null)
+						connection.setDescription(x);
+					x = variableContext.getParameter("classname");
+					if (x != null)
+						connection.setClassName(x);
+					x = variableContext.getParameter("maxconnections");
+					if (x != null && x.length() > 0)
+						connection.setMaxConnections(Integer.parseInt(x));
+
+					String error = NotificationConnectorFactory.processConfigurationPost(threadContext,connection.getClassName(),variableContext,pageContext.getRequest().getLocale(),connection.getConfigParams());
+					
+					if (error != null)
+					{
+						variableContext.setParameter("text",error);
+						variableContext.setParameter("target","listnotifications.jsp");
+%>
+						<jsp:forward page="error.jsp"/>
+<%
+					}
+					
+					if (op.equals("Continue"))
+					{
+						threadContext.save("ConnectionObject",connection);
+%>
+						<jsp:forward page="editnotification.jsp"/>
+<%
+					}
+					else if (op.equals("Save"))
+					{
+						notificationManager.save(connection);
+						variableContext.setParameter("connname",connectionName);
+%>
+						<jsp:forward page="viewnotification.jsp"/>
+<%
+					}
+				}
+				catch (ManifoldCFException e)
+				{
+					e.printStackTrace();
+					variableContext.setParameter("text",e.getMessage());
+					variableContext.setParameter("target","listnotifications.jsp");
+%>
+					<jsp:forward page="error.jsp"/>
+<%
+				}
+			}
+			else if (op.equals("Delete"))
+			{
+				try
+				{
+					String connectionName = variableContext.getParameter("connname");
+					if (connectionName == null)
+						throw new ManifoldCFException("Missing connection parameter");
+					notificationManager.delete(connectionName);
+%>
+					<jsp:forward page="listnotifications.jsp"/>
+<%
+				}
+				catch (ManifoldCFException e)
+				{
+					e.printStackTrace();
+					variableContext.setParameter("text",e.getMessage());
+					variableContext.setParameter("target","listnotifications.jsp");
+%>
+					<jsp:forward page="error.jsp"/>
+<%
+				}
+			}
+			else if (op.equals("Cancel"))
+			{
+%>
+				<jsp:forward page="listnotifications.jsp"/>
+<%
+			}
+			else
+			{
+				// Error
+				variableContext.setParameter("text","Illegal parameter to notification connection execution page");
+				variableContext.setParameter("target","listnotifications.jsp");
+%>
+				<jsp:forward page="error.jsp"/>
+<%
 			}
 		}
 		else if (type != null && op != null && type.equals("job"))

Modified: manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/navigation.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/navigation.jsp?rev=1647137&r1=1647136&r2=1647137&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/navigation.jsp (original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/crawler-ui/src/main/webapp/navigation.jsp Sun Dec 21 13:00:12 2014
@@ -54,6 +54,9 @@
 	<li class="menuitem">
 		<nobr><a class="menulink" href="listconnections.jsp" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"navigation.Listrepositoryconnections")%>"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.ListRepositoryConnections")%></a></nobr>
 	</li>
+	<li class="menuitem">
+		<nobr><a class="menulink" href="listnotifications.jsp" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"navigation.Listnotificationconnections")%>"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.ListNotificationConnections")%></a></nobr>
+	</li>
 </ul>
 <p class="menumain"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.Jobs")%></nobr></p>
 <ul class="menusecond">

Modified: manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties?rev=1647137&r1=1647136&r2=1647137&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties (original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties Sun Dec 21 13:00:12 2014
@@ -1051,3 +1051,6 @@ viewnotification.EditThisNotificationCon
 viewnotification.Edit=Edit
 viewnotification.DeleteThisNotificationConnection=Delete this notification connection
 viewnotification.Delete=Delete
+
+navigation.Listnotificationconnections=List notification connections
+navigation.ListNotificationConnections=List Notification Connections

Modified: manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties?rev=1647137&r1=1647136&r2=1647137&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties (original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties Sun Dec 21 13:00:12 2014
@@ -1052,3 +1052,6 @@ viewnotification.EditThisNotificationCon
 viewnotification.Edit=Edit
 viewnotification.DeleteThisNotificationConnection=Delete this notification connection
 viewnotification.Delete=Delete
+
+navigation.Listnotificationconnections=List notification connections
+navigation.ListNotificationConnections=List Notification Connections

Modified: manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_zh_CN.properties
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_zh_CN.properties?rev=1647137&r1=1647136&r2=1647137&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_zh_CN.properties (original)
+++ manifoldcf/branches/CONNECTORS-1119/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_zh_CN.properties Sun Dec 21 13:00:12 2014
@@ -1052,3 +1052,6 @@ viewnotification.EditThisNotificationCon
 viewnotification.Edit=Edit
 viewnotification.DeleteThisNotificationConnection=Delete this notification connection
 viewnotification.Delete=Delete
+
+navigation.Listnotificationconnections=List notification connections
+navigation.ListNotificationConnections=List Notification Connections