code: public int getLastOrderNumber(final NodeData parent) throws RepositoryException
     {
        if (txStarted())
        {
           int txLastOrderNumber = -1;
           for (ItemState change : transactionLog.getAllStates())
           {
              if (change.isNode() && change.isPersisted() && change.isAdded()
                 && change.getData().getParentIdentifier().equals(parent.getIdentifier()))
              {
                 int orderNumber = ((NodeData)change.getData()).getOrderNumber();
                 if (orderNumber > txLastOrderNumber)
                 {
                    txLastOrderNumber = orderNumber;
                 }
              }
           }
  
           int lastOrderNumber = storageDataManager.getLastOrderNumber(parent);
  
           return Math.max(lastOrderNumber, txLastOrderNumber);
        }
        else
        {
           return storageDataManager.getLastOrderNumber(parent);
        }
     }
docs: {@inheritDoc}