<%@page contentType="text/html;charset=UTF-8" pageEncoding="ISO-8859-1" session="true"
%><%@page errorPage="Exception.jsp"
%><%@page import="com.fujitsu.iflow.model.workflow.WFSession"
%><%@page import="com.fujitsu.iflow.model.workflow.WFObjectFactory"
%><%@page import="com.fujitsu.iflow.model.workflow.Plan"
%><%@page import="com.fujitsu.iflow.model.workflow.ProcessInstantiator"
%><%@page import="com.fujitsu.iflow.model.workflow.WorkItem"
%><%@page import="com.fujitsu.iflow.model.wfcore.WFAdminSessionImpl"
%><%@page import="com.fujitsu.iflow.model.util.QuickForm"
%><%@page import="java.util.Enumeration"
%><%@page import="java.util.Date"
%><%@page import="java.text.SimpleDateFormat"
%><%@page import="com.fujitsu.iflow.model.util.URLEncoder"
%><%@page import="com.fujitsu.iflow.model.bpm.BPMAdmin"
%><%@page import="com.fujitsu.iflow.model.bpm.BPMSession"
%><%@page import="com.fujitsu.iflow.model.bpmcore.BPMAdminImpl"
%><%
    request.setCharacterEncoding("UTF-8");request.getParameterNames(); //Need dummy call for WL9.1
    BPMSession bps = (BPMSession) session.getAttribute("BPMSession");
    if (bps == null) {
        %><jsp:include page="PasswordPanel.jsp" flush="true"/><%
        return;
    }
    
    BPMAdmin bpas = bps.getAdmin();
    WFAdminSessionImpl wfSession = ((BPMAdminImpl)bpas)._wfas;
    
    boolean performSyncUp = false;
    String syncUpStr = request.getParameter("syncUp");
    
    if (syncUpStr != null) {
        performSyncUp = new Boolean(syncUpStr).booleanValue();
    }

    session.setAttribute("TabIndex","0");

%>
<html>

<SCRIPT TYPE="text/javascript">
</script>

<head><title>Interstage Business Process Manager | Synchronize with Repository</title></head>
<jsp:include page="StyleSheet.jsp" flush="true"/>
<script language="javascript" src="styles/clockscripts.js"></script>

<body class="bodyClass" onLoad="goforit();">
<center>

<jsp:include page="AdminHeader.jsp" flush="true"/>
<br/><br/>


<%
if (performSyncUp == false)
{
%>

    <form name="syncForm" method="get" action="RepositorySync.jsp">
        <TABLE border="0"  bgcolor="#CCCCCC" class="tableClass" width="600" align= "center">
            <center>
                <tr>
                    <td class="headrow" >Synchronize Interstage Business Process Manager with the Repository</td>
                </tr>
                <tr>
                    <td bgcolor="#FFFFFF" align="center"><br/>Pressing the "Synchronize" button will synchronize the Interstage Business Process Manager and
                    the Repository.</td>
                </tr>

                <tr>
                    <td valign="center" align="center" bgcolor="#EEEEEE">
                        <input type="button" onClick="javascript: document.syncForm.syncUp.value='true';document.syncForm.submit();" value="Synchronize" class="core-button">
                        <input type="hidden" name="syncUp">
                    </td>
                </tr>
            </center>
        </table>
    </form>

<%
}
else 
{
%>

    <center>
        <TABLE border="0" class="tableClass" width="600" align= "center">
            <tr>
                <td > Please wait while the Interstage Business Process Manager is being synchronized the repository.... <td>
                
<%
    wfSession.syncUpWithRepository();
%>

                <td><b>done</b><td>
            </tr>
        </TABLE>
    </center>


<%

}
%>
</body>
</html>


<%!
    public WFAdminSessionImpl getiFlowSession(Object modelObject)
    {
            return (WFAdminSessionImpl)(modelObject);
    }



%>
