protected void resetResourcesInProject(
        CmsDbContext dbc,
        CmsUUID projectId,
        List<CmsResource> modifiedFiles,
        List<CmsResource> modifiedFolders)
    throws CmsException, CmsSecurityException, CmsDataAccessException {

        // all resources inside the project have to be be reset to their online state.
        // 1. step: delete all new files
        for (int i = 0; i < modifiedFiles.size(); i++) {
            CmsResource currentFile = modifiedFiles.get(i);
            if (currentFile.getState().isNew()) {
                CmsLock lock = getLock(dbc, currentFile);
                if (lock.isNullLock()) {
                    // lock the resource
                    lockResource(dbc, currentFile, CmsLockType.EXCLUSIVE);
                } else if (!lock.isOwnedBy(dbc.currentUser()) || !lock.isInProject(dbc.currentProject())) {
                    changeLock(dbc, currentFile, CmsLockType.EXCLUSIVE);
                }
                // delete the properties
                getVfsDriver(dbc).deletePropertyObjects(
                    dbc,
                    projectId,
                    currentFile,
                    CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES);
                // delete the file
                getVfsDriver(dbc).removeFile(dbc, dbc.currentProject().getUuid(), currentFile);
                // remove the access control entries
                getUserDriver(dbc).removeAccessControlEntries(dbc, dbc.currentProject(), currentFile.getResourceId());
                // fire the corresponding event
                OpenCms.fireCmsEvent(
                    new CmsEvent(
                        I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
                        Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFile)));
            }
        }

        // 2. step: delete all new folders
        for (int i = 0; i < modifiedFolders.size(); i++) {
            CmsResource currentFolder = modifiedFolders.get(i);
            if (currentFolder.getState().isNew()) {
                // delete the properties
                getVfsDriver(dbc).deletePropertyObjects(
                    dbc,
                    projectId,
                    currentFolder,
                    CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES);
                // delete the folder
                getVfsDriver(dbc).removeFolder(dbc, dbc.currentProject(), currentFolder);
                // remove the access control entries
                getUserDriver(dbc).removeAccessControlEntries(dbc, dbc.currentProject(), currentFolder.getResourceId());
                // fire the corresponding event
                OpenCms.fireCmsEvent(
                    new CmsEvent(
                        I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
                        Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFolder)));
            }
        }

        // 3. step: undo changes on all changed or deleted folders
        for (int i = 0; i < modifiedFolders.size(); i++) {
            CmsResource currentFolder = modifiedFolders.get(i);
            if ((currentFolder.getState().isChanged()) || (currentFolder.getState().isDeleted())) {
                CmsLock lock = getLock(dbc, currentFolder);
                if (lock.isNullLock()) {
                    // lock the resource
                    lockResource(dbc, currentFolder, CmsLockType.EXCLUSIVE);
                } else if (!lock.isOwnedBy(dbc.currentUser()) || !lock.isInProject(dbc.currentProject())) {
                    changeLock(dbc, currentFolder, CmsLockType.EXCLUSIVE);
                }
                // undo all changes in the folder
                undoChanges(dbc, currentFolder, CmsResource.UNDO_CONTENT);
                // fire the corresponding event
                OpenCms.fireCmsEvent(
                    new CmsEvent(
                        I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
                        Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFolder)));
            }
        }

        // 4. step: undo changes on all changed or deleted files
        for (int i = 0; i < modifiedFiles.size(); i++) {
            CmsResource currentFile = modifiedFiles.get(i);
            if (currentFile.getState().isChanged() || currentFile.getState().isDeleted()) {
                CmsLock lock = getLock(dbc, currentFile);
                if (lock.isNullLock()) {
                    // lock the resource
                    lockResource(dbc, currentFile, CmsLockType.EXCLUSIVE);
                } else if (!lock.isOwnedInProjectBy(dbc.currentUser(), dbc.currentProject())) {
                    if (lock.isLockableBy(dbc.currentUser())) {
                        changeLock(dbc, currentFile, CmsLockType.EXCLUSIVE);
                    }
                }
                // undo all changes in the file
                undoChanges(dbc, currentFile, CmsResource.UNDO_CONTENT);
                // fire the corresponding event
                OpenCms.fireCmsEvent(
                    new CmsEvent(
                        I_CmsEventListener.EVENT_RESOURCE_AND_PROPERTIES_MODIFIED,
                        Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, currentFile)));
            }
        }
    }
protected void resetResourcesInProject ( CmsDbContext dbc , CmsUUID projectId , List < CmsResource > modifiedFiles , List < CmsResource > modifiedFolders ) throws CmsException , CmsSecurityException , CmsDataAccessException { for ( int i = 0 ; i < modifiedFiles . size ( ) ; i ++ ) { CmsResource currentFile = modifiedFiles . get ( i ) ; if ( currentFile . getState ( ) . isNew ( ) ) { CmsLock lock = getLock ( dbc , currentFile ) ; if ( lock . isNullLock ( ) ) { lockResource ( dbc , currentFile , CmsLockType . EXCLUSIVE ) ; } else if ( ! lock . isOwnedBy ( dbc . currentUser ( ) ) || ! lock . isInProject ( dbc . currentProject ( ) ) ) { changeLock ( dbc , currentFile , CmsLockType . EXCLUSIVE ) ; } getVfsDriver ( dbc ) . deletePropertyObjects ( dbc , projectId , currentFile , CmsProperty . DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES ) ; getVfsDriver ( dbc ) . removeFile ( dbc , dbc . currentProject ( ) . getUuid ( ) , currentFile ) ; getUserDriver ( dbc ) . removeAccessControlEntries ( dbc , dbc . currentProject ( ) , currentFile . getResourceId ( ) ) ; OpenCms . fireCmsEvent ( new CmsEvent ( I_CmsEventListener . EVENT_RESOURCE_AND_PROPERTIES_MODIFIED , Collections . < String , Object > singletonMap ( I_CmsEventListener . KEY_RESOURCE , currentFile ) ) ) ; } } for ( int i = 0 ; i < modifiedFolders . size ( ) ; i ++ ) { CmsResource currentFolder = modifiedFolders . get ( i ) ; if ( currentFolder . getState ( ) . isNew ( ) ) { getVfsDriver ( dbc ) . deletePropertyObjects ( dbc , projectId , currentFolder , CmsProperty . DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES ) ; getVfsDriver ( dbc ) . removeFolder ( dbc , dbc . currentProject ( ) , currentFolder ) ; getUserDriver ( dbc ) . removeAccessControlEntries ( dbc , dbc . currentProject ( ) , currentFolder . getResourceId ( ) ) ; OpenCms . fireCmsEvent ( new CmsEvent ( I_CmsEventListener . EVENT_RESOURCE_AND_PROPERTIES_MODIFIED , Collections . < String , Object > singletonMap ( I_CmsEventListener . KEY_RESOURCE , currentFolder ) ) ) ; } } for ( int i = 0 ; i < modifiedFolders . size ( ) ; i ++ ) { CmsResource currentFolder = modifiedFolders . get ( i ) ; if ( ( currentFolder . getState ( ) . isChanged ( ) ) || ( currentFolder . getState ( ) . isDeleted ( ) ) ) { CmsLock lock = getLock ( dbc , currentFolder ) ; if ( lock . isNullLock ( ) ) { lockResource ( dbc , currentFolder , CmsLockType . EXCLUSIVE ) ; } else if ( ! lock . isOwnedBy ( dbc . currentUser ( ) ) || ! lock . isInProject ( dbc . currentProject ( ) ) ) { changeLock ( dbc , currentFolder , CmsLockType . EXCLUSIVE ) ; } undoChanges ( dbc , currentFolder , CmsResource . UNDO_CONTENT ) ; OpenCms . fireCmsEvent ( new CmsEvent ( I_CmsEventListener . EVENT_RESOURCE_AND_PROPERTIES_MODIFIED , Collections . < String , Object > singletonMap ( I_CmsEventListener . KEY_RESOURCE , currentFolder ) ) ) ; } } for ( int i = 0 ; i < modifiedFiles . size ( ) ; i ++ ) { CmsResource currentFile = modifiedFiles . get ( i ) ; if ( currentFile . getState ( ) . isChanged ( ) || currentFile . getState ( ) . isDeleted ( ) ) { CmsLock lock = getLock ( dbc , currentFile ) ; if ( lock . isNullLock ( ) ) { lockResource ( dbc , currentFile , CmsLockType . EXCLUSIVE ) ; } else if ( ! lock . isOwnedInProjectBy ( dbc . currentUser ( ) , dbc . currentProject ( ) ) ) { if ( lock . isLockableBy ( dbc . currentUser ( ) ) ) { changeLock ( dbc , currentFile , CmsLockType . EXCLUSIVE ) ; } } undoChanges ( dbc , currentFile , CmsResource . UNDO_CONTENT ) ; OpenCms . fireCmsEvent ( new CmsEvent ( I_CmsEventListener . EVENT_RESOURCE_AND_PROPERTIES_MODIFIED , Collections . < String , Object > singletonMap ( I_CmsEventListener . KEY_RESOURCE , currentFile ) ) ) ; } } }
Resets the resources in a project to their online state.<p>

@param dbc the database context
@param projectId the project id
@param modifiedFiles the modified files
@param modifiedFolders the modified folders
@throws CmsException if something goes wrong
@throws CmsSecurityException if we don't have the permissions
@throws CmsDataAccessException if something goes wrong with the database