return defaultValue;
}
public void setPageProperty(String pageName, String property, int newValue) {
String toStore = pageName + "=" + newValue;
User user = getUser();
if (user != null) {
String values = user.getProperties().get(property);
if (values != null) {
if (values.contains(toStore)) {
// The new value for the page was already stored so do nothing
return;
}
else {
if (values.contains(pageName)) {
// Replace an old value for the page with the new value
int oldValue = getPageProperty(pageName, property, -1);
String toRemove = pageName + "=" + oldValue;
user.getProperties().put(property, values.replace(toRemove, toStore));
}
else {
// Append the new page-value
user.getProperties().put(property, values + "," + toStore);
}
}
}
else {
// Store the new page-value as a new user property
user.getProperties().put(property, toStore);
}
}
}