Undeletes the selected files

@return the ids of the modified resources

@throws CmsException if something goes wrong
161373
protected List<CmsUUID> undelete() throws CmsException {

        List<CmsUUID> modifiedResources = new ArrayList<CmsUUID>();
        CmsObject cms = m_context.getCms();
        for (CmsResource resource : m_context.getResources()) {
            CmsLockActionRecord actionRecord = null;
            try {
                actionRecord = CmsLockUtil.ensureLock(m_context.getCms(), resource);
                cms.undeleteResource(cms.getSitePath(resource), true);
                modifiedResources.add(resource.getStructureId());
            } finally {
                if ((actionRecord != null) && (actionRecord.getChange() == LockChange.locked)) {

                    try {
                        cms.unlockResource(resource);
                    } catch (CmsLockException e) {
                        LOG.warn(e.getLocalizedMessage(), e);
                    }
                }
            }
        }
        return modifiedResources;
    }
1030605
public List<CmsListItem> getSelectedItems() {

        Iterator<String> it = CmsStringUtil.splitAsList(
            getParamSelItems(),
            CmsHtmlList.ITEM_SEPARATOR,
            true).iterator();
        List<CmsListItem> items = new ArrayList<CmsListItem>();
        while (it.hasNext()) {
            String id = it.next();
            items.add(getList().getItem(id));
        }
        return items;
    }
1249672
public List<String> getDirectActionIds() {

        List<String> ids = new ArrayList<String>();
        Iterator<I_CmsListDirectAction> itDirActions = m_directActions.iterator();
        while (itDirActions.hasNext()) {
            I_CmsListDirectAction action = itDirActions.next();
            ids.add(action.getId());
        }
        return Collections.unmodifiableList(ids);
    }
245713
protected void performSingleDeleteOperation(String resource, CmsResourceDeleteMode deleteOption)
    throws CmsException {

        // lock resource if autolock is enabled
        checkLock(resource);
        // delete the resource
        getCms().deleteResource(resource, deleteOption);
    }
167545
private String getNewContentName() throws CmsException {

        String sitePath = OpenCms.getResourceManager().getNameGenerator().getNewFileName(
            m_cms,
            CmsStringUtil.joinPaths(
                m_cms.getRequestContext().removeSiteRoot(m_configuration.getContentParentFolder().getRootPath()),
                m_configuration.getNamePattern()),
            5);
        return sitePath;
    }
1201075
private LinkedHashMap<CmsUUID, CmsClientSitemapEntry> getDeletedList() {

        CmsObject cms = getCmsObject();
        CmsUser user = cms.getRequestContext().getCurrentUser();
        Object obj = user.getAdditionalInfo(ADDINFO_ADE_DELETED_LIST);
        LinkedHashMap<CmsUUID, CmsClientSitemapEntry> result = new LinkedHashMap<CmsUUID, CmsClientSitemapEntry>();
        if (obj instanceof String) {
            try {
                JSONArray array = new JSONArray((String)obj);
                for (int i = 0; i < array.length(); i++) {
                    try {
                        CmsUUID delId = new CmsUUID(array.getString(i));
                        CmsResource res = cms.readResource(delId, CmsResourceFilter.ALL);
                        if (res.getState().isDeleted()) {
                            // make sure resource is still deleted
                            CmsClientSitemapEntry delEntry = new CmsClientSitemapEntry();
                            delEntry.setSitePath(cms.getSitePath(res));
                            delEntry.setOwnProperties(getClientProperties(cms, res, false));
                            delEntry.setName(res.getName());
                            delEntry.setVfsPath(cms.getSitePath(res));
                            delEntry.setResourceTypeName(
                                OpenCms.getResourceManager().getResourceType(res).getTypeName());
                            delEntry.setEntryType(
                                res.isFolder()
                                ? EntryType.folder
                                : isRedirectType(res.getTypeId()) ? EntryType.redirect : EntryType.leaf);
                            delEntry.setNavModeIcon(
                                CmsIconUtil.getIconClasses(
                                    delEntry.getResourceTypeName(),
                                    delEntry.getVfsPath(),
                                    false));
                            delEntry.setId(delId);
                            result.put(delId, delEntry);
                        }
                    } catch (Throwable e) {
                        // should never happen, catches wrong or no longer existing values
                        LOG.warn(e.getLocalizedMessage());
                    }
                }
            } catch (Throwable e) {
                // should never happen, catches json parsing
                LOG.warn(e.getLocalizedMessage());
            }
        }
        return result;
    }
1353276
private List<CmsResourceInfo> getResourceInfos() {

        List<CmsResourceInfo> infos = new ArrayList<CmsResourceInfo>();
        for (CmsSite site : m_sitesToDelete) {
            infos.add(
                new CmsResourceInfo(site.getTitle(), site.getSiteRoot(), m_manager.getFavIcon(site.getSiteRoot())));
        }
        return infos;
    }
528532
public java.util.List<String> getTagsToDelete() {
        if (tagsToDelete == null) {
            tagsToDelete = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return tagsToDelete;
    }
1196719
private CmsSitemapChange undelete(CmsSitemapChange change) throws CmsException {

        CmsObject cms = getCmsObject();
        CmsResource deleted = cms.readResource(change.getEntryId(), CmsResourceFilter.ALL);
        if (deleted.getState().isDeleted()) {
            ensureLock(deleted);
            cms.undeleteResource(getCmsObject().getSitePath(deleted), true);
            tryUnlock(deleted);
        }
        String parentPath = CmsResource.getParentFolder(cms.getSitePath(deleted));
        CmsJspNavElement navElement = getNavBuilder().getNavigationForResource(
            parentPath,
            CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
        CmsClientSitemapEntry entry = toClientEntry(navElement, navElement.isInNavigation());
        entry.setSubEntries(getChildren(parentPath, 2, null), null);
        change.setUpdatedEntry(entry);
        change.setParentId(cms.readParentFolder(deleted.getStructureId()).getStructureId());
        return change;
    }
1102667
private LinkedHashMap<CmsUUID, CmsClientSitemapEntry> getModifiedList() {

        CmsObject cms = getCmsObject();
        CmsUser user = cms.getRequestContext().getCurrentUser();
        Object obj = user.getAdditionalInfo(ADDINFO_ADE_MODIFIED_LIST);
        LinkedHashMap<CmsUUID, CmsClientSitemapEntry> result = new LinkedHashMap<CmsUUID, CmsClientSitemapEntry>();
        if (obj instanceof String) {
            try {
                JSONArray array = new JSONArray((String)obj);
                for (int i = 0; i < array.length(); i++) {
                    try {
                        CmsUUID modId = new CmsUUID(array.getString(i));
                        CmsResource res = cms.readResource(modId, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
                        String sitePath = cms.getSitePath(res);
                        CmsJspNavElement navEntry = getNavBuilder().getNavigationForResource(
                            sitePath,
                            CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
                        if (navEntry.isInNavigation()) {
                            CmsClientSitemapEntry modEntry = toClientEntry(navEntry, false);
                            result.put(modId, modEntry);
                        }
                    } catch (Throwable e) {
                        // should never happen, catches wrong or no longer existing values
                        LOG.warn(e.getLocalizedMessage());
                    }
                }
            } catch (Throwable e) {
                // should never happen, catches json parsing
                LOG.warn(e.getLocalizedMessage());
            }
        }
        return result;
    }
606183
@SuppressWarnings("unchecked")
    private Set<String> getResourcePaths() {

        Set<String> resources = new HashSet<String>();
        for (Component c : m_resources) {
            if (c instanceof CmsRemovableFormRow<?>) {
                String value = ((CmsRemovableFormRow<CmsPathSelectField>)c).getInput().getValue();
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) {
                    resources.add(value);
                }
            }
        }
        return resources;
    }
709477
public void deleteDescriptorIfNecessary() throws CmsException {

        if (m_removeDescriptorOnCancel && (m_desc != null)) {
            m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(2));
        }

    }
1017313
public List<CmsResource> getMatchedResources() {

        if (m_replace) {
            // re-read the resources to include changes
            List<CmsResource> result = new ArrayList<CmsResource>();
            for (CmsResource resource : m_matchedResources) {
                try {
                    result.add(getCms().readResource(resource.getStructureId()));
                } catch (CmsException e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
            return result;
        } else {
            return new ArrayList<CmsResource>(m_matchedResources);
        }
    }
757216
private void clearLock() throws CmsException {

        if ((m_lockActionRecord != null) && (m_lockActionRecord.getChange() == LockChange.locked)) {
            CmsResource updatedRes = m_cms.readResource(m_resource.getStructureId(), CmsResourceFilter.ALL);
            try {
                m_cms.unlockResource(updatedRes);
            } catch (CmsLockException e) {
                LOG.warn(e.getLocalizedMessage(), e);
            }
            m_lockActionRecord = null;
        }
    }
365256
public void update(Collection<CmsUUID> ids) {

        try {
            CmsResource currentFolderRes = A_CmsUI.getCmsObject().readResource(m_currentFolder, CmsResourceFilter.ALL);
            boolean updateFolder = m_fileTable.getItemCount() < UPDATE_FOLDER_THRESHOLD;
            Set<CmsUUID> removeIds = new HashSet<CmsUUID>();
            for (CmsUUID id : ids) {
                boolean remove = false;
                try {
                    CmsResource resource = A_CmsUI.getCmsObject().readResource(id, CmsResourceFilter.ALL);

                    remove = !CmsResource.getParentFolder(resource.getRootPath()).equals(
                        currentFolderRes.getRootPath());

                } catch (CmsVfsResourceNotFoundException e) {
                    remove = true;
                    LOG.debug("Could not read update resource " + id, e);
                }
                if (remove) {
                    removeIds.add(id);
                }

            }
            for (CmsUUID id : ids) {
                updateTree(id);
            }
            if (updateFolder) {
                updateCurrentFolder(removeIds);
            } else {
                m_fileTable.update(removeIds, true);
                HashSet<CmsUUID> updateIds = new HashSet<CmsUUID>(ids);
                ids.removeAll(removeIds);
                m_fileTable.update(updateIds, false);
            }
            m_fileTable.updateSorting();
            m_fileTable.clearSelection();
        } catch (CmsException e) {
            CmsErrorDialog.showErrorDialog(e);
        }
        if (!CmsStringUtil.isEmptyOrWhitespaceOnly(m_searchField.getValue())) {
            filterTable(m_searchField.getValue());
        }
    }
368323
public void deleteRelationsFromResource(String resourceName, CmsRelationFilter filter) throws CmsException {

        CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL);
        m_securityManager.deleteRelationsForResource(m_context, resource, filter);
    }
464058
@Override
    protected boolean performDialogOperation() throws CmsException {

        // check if the current resource is a folder for single operation
        boolean isFolder = isOperationOnFolder();
        // on folder undelete or multi operation display "please wait" screen, not for simple file undeletion
        if ((isMultiOperation() || isFolder) && !DIALOG_WAIT.equals(getParamAction())) {
            // return false, this will trigger the "please wait" screen
            return false;
        }

        Iterator<String> i = getResourceList().iterator();
        // iterate the resources to undelete
        while (i.hasNext()) {
            String resName = i.next();
            try {
                // lock resource if autolock is enabled
                checkLock(resName);
                // undelete the resource
                getCms().undeleteResource(resName, true);
            } catch (CmsException e) {
                if (isMultiOperation()) {
                    // collect exceptions to create a detailed output
                    addMultiOperationException(e);
                } else {
                    // for single operation, throw the exception immediately
                    throw e;
                }
            }
        }
        // check if exceptions occurred
        checkMultiOperationException(Messages.get(), Messages.ERR_UNDELETE_MULTI_0);
        return true;
    }