@ Override public void recreateEntry ( final SessionProvider sessionProvider , final String groupPath , final RegistryEntry entry ) throws RepositoryException { final String entryRelPath = EXO_REGISTRY + "/" + groupPath + "/" + entry . getName ( ) ; final String parentFullPath = "/" + EXO_REGISTRY + "/" + groupPath ; try { Session session = session ( sessionProvider , repositoryService . getCurrentRepository ( ) ) ; // Don't care about concurrency, Session should be dedicated to the Thread, see JCR-765 // synchronized (session) { Node node = session . getRootNode ( ) . getNode ( entryRelPath ) ; // delete existing entry... node . remove ( ) ; // create same entry, // [PN] no check we need here, as we have deleted this node before // checkGroup(sessionProvider, fullParentPath); session . importXML ( parentFullPath , entry . getAsInputStream ( ) , IMPORT_UUID_CREATE_NEW ) ; // save recreated changes session . save ( ) ; // } } catch ( IOException ioe ) { throw new RepositoryException ( "Item " + parentFullPath + "can't be created " + ioe ) ; } catch ( TransformerException te ) { throw new RepositoryException ( "Can't get XML representation from stream " + te ) ; } }
Re - creates an entry in the group .