public void update(String srcWorkspaceName) throws NoSuchWorkspaceException, AccessDeniedException,
      InvalidItemStateException, LockException, RepositoryException
   {
      checkValid();

      // Check pending changes
      if (session.hasPendingChanges())
      {
         throw new InvalidItemStateException("Session has pending changes ");
      }

      // Check locking
      if (!checkLocking())
      {
         throw new LockException("Node " + getPath() + " is locked ");
      }

      SessionChangesLog changes = new SessionChangesLog(session);

      String srcPath;
      try
      {
         srcPath = getCorrespondingNodePath(srcWorkspaceName);

         ItemDataRemoveVisitor remover =
            new ItemDataRemoveVisitor(session.getTransientNodesManager(), null, session.getWorkspace()
               .getNodeTypesHolder(), session.getAccessManager(), session.getUserState());
         nodeData().accept(remover);

         changes.addAll(remover.getRemovedStates());
      }
      catch (ItemNotFoundException e)
      {
         LOG.debug("No corresponding node in workspace: " + srcWorkspaceName);
         return;
      }

      TransactionableDataManager pmanager = session.getTransientNodesManager().getTransactManager();

      session.getWorkspace().clone(srcWorkspaceName, srcPath, this.getPath(), true, changes);
      pmanager.save(changes);

      NodeData thisParent = (NodeData)session.getTransientNodesManager().getItemData(getParentIdentifier());
      QPathEntry[] qpath = getInternalPath().getEntries();
      NodeData thisNew = (NodeData)pmanager.getItemData(thisParent, qpath[qpath.length - 1], ItemType.NODE);
      // reload node impl with old uuid to a new one data
      session.getTransientNodesManager().getItemsPool().reload(getInternalIdentifier(), thisNew);
   }
public void update ( String srcWorkspaceName ) throws NoSuchWorkspaceException , AccessDeniedException , InvalidItemStateException , LockException , RepositoryException { checkValid ( ) ; if ( session . hasPendingChanges ( ) ) { throw new InvalidItemStateException ( "Session has pending changes " ) ; } if ( ! checkLocking ( ) ) { throw new LockException ( "Node " + getPath ( ) + " is locked " ) ; } SessionChangesLog changes = new SessionChangesLog ( session ) ; String srcPath ; try { srcPath = getCorrespondingNodePath ( srcWorkspaceName ) ; ItemDataRemoveVisitor remover = new ItemDataRemoveVisitor ( session . getTransientNodesManager ( ) , null , session . getWorkspace ( ) . getNodeTypesHolder ( ) , session . getAccessManager ( ) , session . getUserState ( ) ) ; nodeData ( ) . accept ( remover ) ; changes . addAll ( remover . getRemovedStates ( ) ) ; } catch ( ItemNotFoundException e ) { LOG . debug ( "No corresponding node in workspace: " + srcWorkspaceName ) ; return ; } TransactionableDataManager pmanager = session . getTransientNodesManager ( ) . getTransactManager ( ) ; session . getWorkspace ( ) . clone ( srcWorkspaceName , srcPath , this . getPath ( ) , true , changes ) ; pmanager . save ( changes ) ; NodeData thisParent = ( NodeData ) session . getTransientNodesManager ( ) . getItemData ( getParentIdentifier ( ) ) ; QPathEntry [ ] qpath = getInternalPath ( ) . getEntries ( ) ; NodeData thisNew = ( NodeData ) pmanager . getItemData ( thisParent , qpath [ qpath . length - 1 ] , ItemType . NODE ) ; session . getTransientNodesManager ( ) . getItemsPool ( ) . reload ( getInternalIdentifier ( ) , thisNew ) ; }
{@inheritDoc}