// Now, insert the new cookies
int i = 0;
while (i < cookies.getCookieCount())
{
Cookie c = cookies.getCookie(i);
Cookie2 c2;
if (c instanceof Cookie2)
c2 = (Cookie2)c;
else
c2 = null;
HashMap map = new HashMap();
map.put(keyField,sessionKey);
map.put(ordinalField,new Long(i));
String domain = c.getDomain();
if (domain != null && domain.length() > 0)
map.put(domainField,domain);
map.put(domainSpecifiedField,booleanToString(c.isDomainAttributeSpecified()));
String name = c.getName();
if (name != null && name.length() > 0)
map.put(nameField,name);
String value = c.getValue();
if (value != null && value.length() > 0)
map.put(valueField,value);
String path = c.getPath();
if (path != null && path.length() > 0)
map.put(pathField,path);
map.put(pathSpecifiedField,booleanToString(c.isPathAttributeSpecified()));
map.put(versionField,new Long(c.getVersion()));
if (c2 != null)
map.put(versionSpecifiedField,booleanToString(c2.isVersionAttributeSpecified()));
else
// Make something up. It may not be correct, but there's really no choice.
map.put(versionSpecifiedField,booleanToString(true));
String comment = c.getComment();
if (comment != null && comment.length() > 0)
map.put(commentField,comment);
map.put(secureField,booleanToString(c.getSecure()));
Date expirationDate = c.getExpiryDate();
if (expirationDate != null)
map.put(expirationDateField,new Long(expirationDate.getTime()));
if (c2 != null)
map.put(discardField,booleanToString(!c2.isPersistent()));
else
// Once again, make something up.
map.put(discardField,booleanToString(true));
if (c2 != null)
{
String commentURL = c2.getCommentURL();
if (commentURL != null && commentURL.length() > 0)
map.put(commentURLField,commentURL);
}
if (c2 != null)
{
int[] ports = c2.getPorts();
if (ports != null && ports.length > 0)
map.put(portField,portsToString(ports));
}
if (c2 != null)
map.put(portBlankField,booleanToString(c2.isPortAttributeBlank()));
else
map.put(portBlankField,booleanToString(true));
if (c2 != null)
map.put(portSpecifiedField,booleanToString(c2.isPortAttributeSpecified()));
else
map.put(portSpecifiedField,booleanToString(false));
performInsert(map,null);
i++;
}