if (dataManager.hasPendingChanges(getInternalPath()))
throw new InvalidItemStateException("Node has pending unsaved changes " + getPath());
Lock newLock = session.getLockManager().addLock(this, isDeep, isSessionScoped, -1);
PlainChangesLog changesLog =
new PlainChangesLogImpl(new ArrayList<ItemState>(), session.getId(), ExtendedEvent.LOCK);
PropertyData propData =
TransientPropertyData.createPropertyData(nodeData(), Constants.JCR_LOCKOWNER, PropertyType.STRING, false,
new TransientValueData(session.getUserID()));
changesLog.add(ItemState.createAddedState(propData));
propData =
TransientPropertyData.createPropertyData(nodeData(), Constants.JCR_LOCKISDEEP, PropertyType.BOOLEAN, false,
new TransientValueData(isDeep));
changesLog.add(ItemState.createAddedState(propData));
dataManager.getTransactManager().save(changesLog);
session.getActionHandler().postLock(this);
return newLock;