📄 replicate.jsp
字号:
<%@ page import="java.util.*" %>
<%@ page import="org.ofbiz.base.util.*" %>
<%@ page import="com.sourcetap.sfa.util.Preference" %>
<%@ page import="com.sourcetap.sfa.ui.*" %>
<%@ page import="com.sourcetap.sfa.replication.*" %>
<%@ include file="/includes/header.jsp" %>
<%@ include file="/replication/replicationHeader.jsp" %>
<%
String masterUserPartyId = request.getParameter("masterUserPartyId");
String masterUserRoleId = request.getParameter("masterUserRoleId");
String replUserLoginId = request.getParameter("replUserLoginId");
String masterUserAccountId = request.getParameter("masterUserAccountId");
UserInfo masterUserInfo = new UserInfo(
masterUserPartyId, masterUserRoleId, replUserLoginId, "", masterUserAccountId);
GenericDelegator masterDelegator = GenericDelegator.getGenericDelegator("master");
if (masterDelegator==null) {
%>
<TR>
<TD COLSPAN="3" CLASS="freeFormSectionField">
A problem occurred while trying to connect to the master data base.
</TD>
</TR>
<%
// "Modify the entityengine.xml file on your PC<BR>" +
// "to add a delegator with the name 'master' pointing to the correct IP address.<BR>" +
// "Then restart the web server on your PC and try again.");
return;
}
SFAFullReplicator sfaFullReplicator =
new SFAFullReplicator(
delegator,
masterDelegator,
"*",
masterUserInfo
);
// Do a full replication.
int status = sfaFullReplicator.replicateFull();
if (status == sfaFullReplicator.STATUS_CONTINUE) {
// Data was replicated successfully.
String replNodeId =
sfaFullReplicator.getReplNodeId(delegator);
GenericValue replNodeGV =
sfaFullReplicator.getReplNodeGenericValue(replNodeId);
String replNodeName = replNodeGV.getString("replNodeName");
String ownerId = replNodeGV.getString("ownerId");
boolean isActive = replNodeGV.getString("isActive").equalsIgnoreCase("Y") ? true : false;
String lastUpdatedDate = replNodeGV.getString("lastUpdatedDate") == null ?
"Never" : replNodeGV.getString("lastUpdatedDate");
HashMap contactFindMap = new HashMap();
contactFindMap.put("contactId", ownerId);
String ownerName = ownerId;
GenericValue contactGV = masterDelegator.findByPrimaryKey("Contact", contactFindMap);
String firstName = contactGV.getString("firstName") == null ? "" : contactGV.getString("firstName");
String lastName = contactGV.getString("lastName") == null ? "" : contactGV.getString("lastName");
ownerName = firstName + " " + lastName;
%>
<TR>
<TD COLSPAN="2" CLASS="freeFormSectionField">
Replication was successfully completed.
</TD>
</TR>
<TR>
<TD COLSPAN="2" CLASS="freeFormSectionField">
</TD>
</TR>
<TR>
<TD CLASS="freeFormSectionLabel" WIDTH="100">Node ID:</TD>
<TD CLASS="freeFormSectionField" WIDTH="200">
<%= replNodeId %>
</TD>
</TR>
<TR>
<TD CLASS="freeFormSectionLabel" WIDTH="100">Node Name:</TD>
<TD CLASS="freeFormSectionField" WIDTH="200">
<%= replNodeName %>
</TD>
</TR>
<TR>
<TD CLASS="freeFormSectionLabel">Node Owner:</TD>
<TD CLASS="freeFormSectionField">
<%= ownerName %>
</TD>
</TR>
<TR>
<TD CLASS="freeFormSectionLabel">Last Replicated:</TD>
<TD CLASS="freeFormSectionField">
<%= lastUpdatedDate %>
</TD>
</TR>
<TR>
<TD CLASS="freeFormSectionLabel">Status:</TD>
<TD CLASS="freeFormSectionField">
<%= isActive ? "Active" : "Inactive" %>
</TD>
</TR>
<TR HEIGHT="*">
<TD COLSPAN="2" CLASS="freeFormSectionField">
</TD>
</TR>
<%
} else {
// Replication was not successful.
%>
<TR>
<TD COLSPAN="2" CLASS="freeFormSectionField">
An error occurred during replication.
</TD>
</TR>
<TR HEIGHT="*">
<TD COLSPAN="2" CLASS="freeFormSectionField">
</TD>
</TR>
<%
}
%>
<%@ include file="/replication/replicationFooter.jsp" %>
<%@ include file="/includes/footer.jsp" %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -