Projet

Général

Profil

Bug #933 » result.jsp

Nicolas Eysseric, 13/09/2010 10:36

 
<%
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires",-1); //prevents caching at the proxy server
%>

<%@ page import="com.silverpeas.myLinks.*"%>
<%@ page import="com.stratelia.webactiv.kmelia.*"%>
<%@ page import="com.silverpeas.Gallery.*"%>
<%@ page import="com.silverpeas.node.*"%>
<%@ page import="com.stratelia.webactiv.bookmark.*"%>
<%@ page import="com.stratelia.webactiv.forums.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.stratelia.webactiv.webSites.*"%>
<%@ page import="com.silverpeas.question.*"%>
<%@ page import="com.silverpeas.tagcloud.TagCloudBatch"%>
<%@ page import="com.silverpeas.forums.ForumsMessagesBatch"%>
<%@ page import="com.silverpeas.blog.BlogBatch"%>
<%@ page import="com.silverpeas.form.FormXMLBatch"%>

<%
String toLaunch = request.getParameter("batch");
boolean isError = false;
Exception theError = null;
int nb = 0;
%>


<html>
<head>
<title> Silverpeas Batch Result </title>
</head>
<body>
<p>
<%
out.println(toLaunch+" Traitement en cours...<br>");
if (toLaunch.equals("P403MyLinksBatch"))
{
MyLinksBatch mlb = new MyLinksBatch();
try
{
nb = mlb.recup();
}
catch (Exception e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P405GalleryBatch"))
{
GalleryBatch gb = new GalleryBatch();
try
{
gb.recup();
}
catch (Exception e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("MigrateBD_XML"))
{
String ids = request.getParameter("extraParam");
List listIds = new ArrayList();

StringTokenizer st = new StringTokenizer(ids, ",");
while (st.hasMoreTokens())
{
listIds.add(st.nextToken());
}

ModelBatch modelBatch = new ModelBatch();
try
{
modelBatch.migrate(listIds);
}
catch (Exception e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P406FusionBookmarkWebSites"))
{
MergeWebSitesBatch mergeWebSitesBatch = new MergeWebSitesBatch();
try
{
mergeWebSitesBatch.migrate();
}
catch (Exception e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P406ThemeTracker"))
{
NodeBatch nodeBatch = new NodeBatch();
try
{
nodeBatch.updateNodesPath();
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P408Forum"))
{
ForumsBatch forumBatch = new ForumsBatch();
try
{
forumBatch.convertDates();
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P409WebSites"))
{
SitePubliWebSitesBatch webSitesBatch = new SitePubliWebSitesBatch();
try
{
webSitesBatch.migrate();
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P410Questions"))
{
QuestionBatch questionsBatch = new QuestionBatch();
try
{
questionsBatch.updateQuestions();
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P410InfoLink2SeeAlso"))
{
InfoLink2SeeAlso infoLinksBatch = new InfoLink2SeeAlso();
try
{
infoLinksBatch.migrate();
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P410Keywords2TagClouds"))
{
TagCloudBatch tagCloudBatch = new TagCloudBatch();
try
{
tagCloudBatch.launch();
%>
<ul>
<li><%=tagCloudBatch.getRemovedTagsCount()%> tags supprim?s</li>
<li><%=tagCloudBatch.getPublicationsCount()%> publications trait?es</li>
<li><%=tagCloudBatch.getCreatedTagsCount()%> tags recr??s</li>
</ul>
<%
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P410ForumsMessages"))
{
ForumsMessagesBatch forumsMessagesBatch = new ForumsMessagesBatch();
try
{
forumsMessagesBatch.launch();
ArrayList result = forumsMessagesBatch.getResult();
for (int i = 0, n = result.size(); i < n; i++)
{
%>
<%=result.get(i)%><br>
<%
}
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P410BlogBatch"))
{
BlogBatch blogBatch = new BlogBatch();
try
{
blogBatch.createEvent();
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
else if (toLaunch.equals("P410FormXML"))
{
FormXMLBatch formXMLBatch = new FormXMLBatch();
try
{
formXMLBatch.nettoieFieldAndAttachment();
}
catch (RuntimeException e)
{
isError = true;
theError = e;
}
}
if (isError || (theError != null)) { %>
Une erreur s'est produite :
<%
out.print(theError.toString());
theError.printStackTrace();
}
else
{
%>
<br>Action termin?e avec succ?s !
<% } %>
<br/>
</p>
</body>
</html>
(4-4/4)