// The entity has been modified if it is visible and was created previously.
// It is a create if it is visible and was NOT created previously.
// It is a delete if it is NOT visible and was created previously.
// No action if it is NOT visible and was NOT created previously.
if (entityHistory.isVisible() && createdPreviously) {
return new ChangeContainer(entityContainer, ChangeAction.Modify);
} else if (entityHistory.isVisible() && !createdPreviously) {
return new ChangeContainer(entityContainer, ChangeAction.Create);
} else if (!entityHistory.isVisible() && createdPreviously) {
return new ChangeContainer(entityContainer, ChangeAction.Delete);
} else {
// This is an unusual case in that an initial version has been marked as not visible.
// The production database contains many examples of this, presumably due to the original
// TIGER import not being deleted properly.
return new ChangeContainer(entityContainer, ChangeAction.Delete);
}
}