try {
PersistentConnectorClient client = new PersistentConnectorClient();
client.executeSql(deleteValuesFromKey,
new PreparedStatementParameter[] {
new PreparedStatementParameter(nodeName,
Types.VARCHAR),
new PreparedStatementParameter(
( isUserNode.booleanValue()? USER_TYPE_NODE : SYSTEM_TYPE_NODE ),
Types.INTEGER)
}
, resourceName);
client.executeSql(deleteValuesFromValue,
new PreparedStatementParameter[] {
new PreparedStatementParameter(nodeName,
Types.VARCHAR)
}
, resourceName);
for (Iterator i = entries.keySet().iterator(); i.hasNext(); ) {
String key = (String) i.next();
String value = (String) entries.get(key);
String timestamp = null;
Timestamp ts = null;
if (key.indexOf(" <<") != -1) {
timestamp = key.substring(key.indexOf(" <<") + 3);
key = key.substring(0, key.indexOf(" <<"));
if (timestamp.indexOf(">>") != -1) {
timestamp = timestamp.substring(0, timestamp.indexOf(">>"));
}
}
if (timestamp != null) {
try {
ts = convertStringToTimestamp(timestamp);
}
catch (Throwable th) {
ts = new Timestamp(System.currentTimeMillis());
}
}
else {
ts = new Timestamp(System.currentTimeMillis());
}
// fix for oracle empty string problem
if (key.length() == 0) {
key = EMPTY_STRING;
}
if (value.length() == 0) {
value = EMPTY_STRING;
}
try {
client.executeSql(insertValuesToKey, new PreparedStatementParameter[] {
new PreparedStatementParameter(nodeName,
Types.VARCHAR),
new PreparedStatementParameter(key,
Types.VARCHAR),
new PreparedStatementParameter(new Integer(2),
Types.INTEGER),
new PreparedStatementParameter(Boolean.TRUE,
Types.BOOLEAN)
}, resourceName);
}
catch (Exception ex) {
// dublicate key possible
}
client.executeSql(insertValuesToValue, new PreparedStatementParameter[] {
new PreparedStatementParameter(nodeName, Types.VARCHAR),
new PreparedStatementParameter(key, Types.VARCHAR),
new PreparedStatementParameter(value, Types.VARCHAR),
new PreparedStatementParameter(ts, Types.TIMESTAMP)
}, resourceName);
}
return loadEntries(isUserNode, nodeName);
}