/** * @see org.opencms.repository.I_CmsRepositoryItem#isCollection() */ public boolean isCollection() { return m_resource.isFolder(); }
/** * @see org.opencms.repository.I_CmsRepositoryItem#isCollection() */ public boolean isCollection() { return m_resource.isFolder(); }
/** * Adds folders to perform the search in. * @param folders Folders to search in. */ private void addFoldersToSearchIn(final List<String> folders) { if (null == folders) { return; } for (String folder : folders) { if (!CmsResource.isFolder(folder)) { folder += "/"; } m_foldersToSearchIn.add(folder); } }
/** * Extends the given path query with another term for the given search root element.<p> * * @param terms the path filter to extend * @param searchRoot the search root to add to the path query */ protected void extendPathFilter(List<Term> terms, String searchRoot) { if (!CmsResource.isFolder(searchRoot)) { searchRoot += "/"; } terms.add(new Term(CmsSearchField.FIELD_PARENT_FOLDERS, searchRoot)); }
/** * @see org.opencms.search.CmsSearchIndex#excludeFromIndex(CmsObject, CmsResource) */ @Override protected boolean excludeFromIndex(CmsObject cms, CmsResource resource) { if (resource.isFolder() || resource.isTemporaryFile()) { // don't index folders or temporary files for galleries, but pretty much everything else return true; } return false; }
/** * Extends the given path query with another term for the given search root element.<p> * * @param pathFilter the path filter to extend * @param searchRoot the search root to add to the path query */ protected void extendPathFilter(TermsFilter pathFilter, String searchRoot) { if (!CmsResource.isFolder(searchRoot)) { searchRoot += "/"; } pathFilter.addTerm(new Term(CmsSearchField.FIELD_PARENT_FOLDERS, searchRoot)); }
/** * Checks whether the resources list contains any folders.<p> * * @return <code>true</code> if the resources list contains any folders */ private boolean hasFolders() { for (CmsResource resource : m_context.getResources()) { if (resource.isFolder()) { return true; } } return false; }
/** * Creates an HTML input form for the current access control entry.<p> * * @param entry the current access control entry * @param editable boolean to determine if the form is editable * @param extendedView boolean to determine if the view is selectable with DHTML * @param inheritRes the resource name from which the ace is inherited * @return StringBuffer with HTML code of the form */ private CmsPermissionView buildPermissionEntryForm( CmsAccessControlEntry entry, boolean editable, boolean extendedView, String inheritRes) { return new CmsPermissionView(entry, editable, m_resource.isFolder(), inheritRes, this); }
/** * Returns the mere category name without it's complete path and without the trailing folder - slash.<p> * * @return the mere category name without it's complete path and without the trailing folder - slash */ public String getName() { if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_path)) { return ""; } String result = CmsResource.getName(m_path); // remove trailing slash as categories are not displayed like folders if (CmsResource.isFolder(result)) { result = result.substring(0, result.length() - 1); } return result; }
/** * Returns the mere category name without it's complete path and without the trailing folder - slash.<p> * * @return the mere category name without it's complete path and without the trailing folder - slash */ public String getName() { if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_path)) { return ""; } String result = CmsResource.getName(m_path); // remove trailing slash as categories are not displayed like folders if (CmsResource.isFolder(result)) { result = result.substring(0, result.length() - 1); } return result; }
/** * @see org.opencms.ui.contextmenu.I_CmsHasMenuItemVisibility#getVisibility(org.opencms.file.CmsObject, java.util.List) */ public CmsMenuItemVisibilityMode getVisibility(CmsObject cms, List<CmsResource> resources) { if (resources.size() == 1) { CmsResource res = resources.get(0); if (res.isFolder()) { String type = OpenCms.getResourceManager().getResourceType(res).getTypeName(); if (Arrays.asList(GALLERY_TYPES).contains(type)) { return VISIBILITY.getVisibility(cms, resources); } } } return CmsMenuItemVisibilityMode.VISIBILITY_INVISIBLE; } }
/** * Creates a new virtual resource.<p> * * @param res the resource this virtual resource is based on */ public CmsWrappedResource(CmsResource res) { m_base = res; m_rootPath = res.getRootPath(); m_typeId = res.getTypeId(); m_isFolder = res.isFolder(); m_length = res.getLength(); }
/** * returns if the resource to be changed is a folder.<p> * * @return true if the resource is a folder * * @throws CmsException if the reading of the resource fails */ public boolean resourceIsFolder() throws CmsException { return getCms().readResource(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION).isFolder(); }
/** * returns if the resource to be changed is a folder.<p> * * @return true if the resource is a folder * * @throws CmsException if the reading of the resource fails */ public boolean resourceIsFolder() throws CmsException { return getCms().readResource(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION).isFolder(); }
/** * Creates a new virtual resource.<p> * * @param res the resource this virtual resource is based on */ public CmsWrappedResource(CmsResource res) { m_base = res; m_rootPath = res.getRootPath(); m_typeId = res.getTypeId(); m_isFolder = res.isFolder(); m_length = res.getLength(); }
/** * Converts a resource to a folder (if possible).<p> * * @param resource the resource to convert * @return the converted resource * * @throws CmsVfsResourceNotFoundException if the resource is not a folder */ protected CmsFolder convertResourceToFolder(CmsResource resource) throws CmsVfsResourceNotFoundException { if (resource.isFolder()) { return new CmsFolder(resource); } throw new CmsVfsResourceNotFoundException( Messages.get().container(Messages.ERR_ACCESS_FILE_AS_FOLDER_1, resource.getRootPath())); }
/** * Converts a resource to a folder (if possible).<p> * * @param resource the resource to convert * @return the converted resource * * @throws CmsVfsResourceNotFoundException if the resource is not a folder */ protected CmsFolder convertResourceToFolder(CmsResource resource) throws CmsVfsResourceNotFoundException { if (resource.isFolder()) { return new CmsFolder(resource); } throw new CmsVfsResourceNotFoundException(Messages.get().container( Messages.ERR_ACCESS_FILE_AS_FOLDER_1, resource.getRootPath())); }
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }
/** * Copies state information from the internal CmsResource object to this object.<p> */ protected void updateFromResource() { setCreationDate(m_resource.getDateCreated()); int length = m_resource.getLength(); if (m_resource.isFolder()) { length = 1; } setFileSize(length); setModifyDate(m_resource.getDateLastModified()); setAttributes(m_resource.isFile() ? FileAttribute.Normal : FileAttribute.Directory); }
/** * Preselects the target folder.<p> * * @param resource the target resource */ public void setTargetForlder(CmsResource resource) { if (resource.isFolder()) { m_targetPath.setValue(getCms().getSitePath(resource)); updateDefaultActions(resource.getRootPath()); } else { throw new CmsIllegalArgumentException( org.opencms.workplace.commons.Messages.get().container( org.opencms.workplace.commons.Messages.ERR_COPY_MULTI_TARGET_NOFOLDER_1, A_CmsUI.getCmsObject().getSitePath(resource))); } }