* not been changed.
*/
if (!n.isTransientDescriptionSet())
return;
Description dbDescription = null;
String dbDescriptionValue = null;
dbDescription = getDescriptionDAO().load(news.getId());
if (dbDescription != null)
dbDescriptionValue = dbDescription.getValue();
String newsDescriptionValue = n.getTransientDescription();
/*
* If the description in the news has been set to null and it's already null
* in the database, there is nothing to do.
*/
if (dbDescriptionValue == null && newsDescriptionValue == null)
return;
else if (dbDescriptionValue == null && newsDescriptionValue != null)
db.store(new Description(news, newsDescriptionValue));
else if (dbDescriptionValue != null && newsDescriptionValue == null)
db.delete(dbDescription);
else if (dbDescriptionValue != null && !dbDescriptionValue.equals(newsDescriptionValue)) {
if (dbDescription != null) {
dbDescription.setDescription(newsDescriptionValue);
db.store(dbDescription);
}
}
}