// add modified state to the list
dirty.add(transientState);
break;
case ItemState.STATUS_STALE_MODIFIED:
throw new InvalidItemStateException(
"Item cannot be saved because it has been "
+ "modified externally: " + this);
case ItemState.STATUS_STALE_DESTROYED:
throw new InvalidItemStateException(
"Item cannot be saved because it has been "
+ "deleted externally: " + this);
case ItemState.STATUS_UNDEFINED:
throw new InvalidItemStateException(
"Item cannot be saved; it seems to have been "
+ "removed externally: " + this);
default:
log.warn("Unexpected item state status: "
+ transientState.getStatus() + " of " + this);
// ignore
break;
}
}
}
// fail-fast test: check status of this item's state
if (isTransient()) {
final ItemState state = getItemState();
switch (state.getStatus()) {
case ItemState.STATUS_EXISTING_MODIFIED:
// add this item's state to the list
dirty.add(state);
break;
case ItemState.STATUS_NEW:
throw new RepositoryException(
"Cannot save a new item: " + this);
case ItemState.STATUS_STALE_MODIFIED:
throw new InvalidItemStateException(
"Item cannot be saved because it has been"
+ " modified externally: " + this);
case ItemState.STATUS_STALE_DESTROYED:
throw new InvalidItemStateException(
"Item cannot be saved because it has been"
+ " deleted externally:" + this);
case ItemState.STATUS_UNDEFINED:
throw new InvalidItemStateException(
"Item cannot be saved; it seems to have been"
+ " removed externally: " + this);
default:
log.warn("Unexpected item state status:"