efficiencyStatement.setDisplayableUserInfo(user.getProperty(UserConstants.FIRSTNAME, null) + " " + user.getProperty(UserConstants.LASTNAME, null) + " (" + identity.getName() + ")");
efficiencyStatement.setLastUpdated(System.currentTimeMillis());
// save efficiency statement as xtream persisted list
final String efficiencyStatementX = XStreamHelper.toXML(efficiencyStatement);
Property efficiencyProperty = null;
if (checkForExistingProperty) {
efficiencyProperty = pm.findUserProperty(identity, PROPERTY_CATEGORY, courseRepoEntryKey);
}
if (assessmentNodes != null) {
if (efficiencyProperty == null) {
// create new
efficiencyProperty = pm.createUserPropertyInstance(identity, PROPERTY_CATEGORY, courseRepoEntryKey, null, null, null, efficiencyStatementX);
pm.saveProperty(efficiencyProperty);
if (logDebug) log.debug("creating new efficiency statement property::" + efficiencyProperty.getKey() + " for id::"
+ identity.getName() + " repoEntry::" + courseRepoEntryKey);
} else {
// update existing
if (logDebug) log.debug("updatting efficiency statement property::" + efficiencyProperty.getKey() + " for id::"
+ identity.getName() + " repoEntry::" + courseRepoEntryKey);
efficiencyProperty.setTextValue(efficiencyStatementX);
pm.updateProperty(efficiencyProperty);
}
} else {
if (efficiencyProperty != null) {
// remove existing since now empty empty efficiency statements
if (logDebug) log.debug("removing efficiency statement property::" + efficiencyProperty.getKey() + " for id::"
+ identity.getName() + " repoEntry::" + courseRepoEntryKey + " since empty");
pm.deleteProperty(efficiencyProperty);
}
// else nothing to create and nothing to delete
}