if (!isTransient()) {
log.debug(safeGetJCRPath() + " (" + id + "): there's no transient state to persist");
return;
}
PropertyState transientState = (PropertyState) state;
PropertyState persistentState = (PropertyState) transientState.getOverlayedState();
if (persistentState == null) {
// this property is 'new'
persistentState = stateMgr.createNew(transientState);
}
synchronized (persistentState) {
// check staleness of transient state first
if (transientState.isStale()) {
String msg = safeGetJCRPath()
+ ": the property cannot be saved because it has been modified externally.";
log.debug(msg);
throw new InvalidItemStateException(msg);
}
// copy state from transient state
persistentState.setDefinitionId(transientState.getDefinitionId());
persistentState.setType(transientState.getType());
persistentState.setMultiValued(transientState.isMultiValued());
persistentState.setValues(transientState.getValues());
// make state persistent
stateMgr.store(persistentState);
}
// tell state manager to disconnect item state