General Pages common.inc

This sets the character encoding for the response to send to the client.

<%@page contentType="text/html; charset=UTF-8"%>

The following topics are discussed:

index.jsp

This page sets up the business object and the context for all subsequent pages:

<%@ page 
import="com.matrixone.servlet.*,matrix.db.*,java.util.*"%>
<%@ include file="objSetup.inc"%>
<%=context.getSession().getSessionId()%><br>
<%
String oid = obj.getObjectId();
Framework.setContext(session,context);
String each = "&boid=" + oid + 
"&lock=false&format=generic&fileName=";
String line = "";
Enumeration formatList = obj.getFormats(context).elements();
matrix.db.File mxFile;
Format format;
while (formatList.hasMoreElements())
{
    format = (Format)formatList.nextElement();
    Enumeration fileList = 
obj.getFiles(context,format.getName()).elements();
    while (fileList.hasMoreElements())
    {
        mxFile = (matrix.db.File)fileList.nextElement();
        line += "&lock=false&boid=" + oid + "&format=" + 
mxFile.getFormat() + "&fileName=" + mxFile.getName();
    }
}
%>
<html>
<body>
<table BORDER=0>
<tr>
<td>2 part checkin Checkin (Checkin start/Checkin End)</
td><td>&nbsp;</td>
<td><a href="<%=response.encodeURL("twoPartCheckin.jsp?boid=" + 
oid)%>">Go</a></td>
</tr>
<tr>
<td>1 part checkin Checkin (Pre-checkin/Checkin)</
td><td>&nbsp;</td>
<td><a href="onePartCheckin.jsp">Go</a></td>
</tr>
<tr>
<td>Checkout</td><td>&nbsp;</td>
<td><a href="<%=response.encodeURL("checkout.jsp?" + 
ServletUtil.encodeURL(line))%>">Go</a></td>
</tr>
</table>
</body>
</html>

objSetup.inc

This file is used to set up the testing of a specific business object, policy, attribute, etc.

<%
String rev = "A";
String vault = "eService Sample";
String policy = "test";
String type = "test";
String name = "test";
Context context = new Context("", "localhost");
context.setUser("creator");
context.setPassword("");
context.setVault("");
context.setLanguage("en-us");
context.setTimezone("EST");
context.connect(true);
BusinessObject obj = new BusinessObject(type,
                                        name,
                                        rev,
                                        vault);
if (!obj.exists(context))
{
    obj.create(context,policy);
}
else
{
    obj.open(context);
}
%>