/** * Creates a select option with the resource to select, the resource's name as the display text and no help text * that is potentially the default selection (argument isDefault).<p> * * @param resource the resource of this selection * @param isDefault true, if this option is the default option (preselected) * */ public CmsResourceSelectWidgetOption(CmsResource resource, boolean isDefault) { this(resource, isDefault, resource.getName()); }
/** * Returns <code>true</code> if the given resource path points to a temporary file name.<p> * * A resource name is considered a temporary file name if the name of the file * (without parent folders) starts with the prefix char <code>'~'</code> (tilde). * Existing parent folder elements are removed from the path before the file name is checked.<p> * * @param path the resource path to check * * @return <code>true</code> if the given resource name is a temporary file name * * @see #isTemporaryFile() */ public static boolean isTemporaryFileName(String path) { return (path != null) && getName(path).startsWith(TEMP_FILE_PREFIX); }
/** * Returns <code>true</code> if the given resource name is a temporary file name.<p> * * A resource name is considered a temporary file name if the name of the file * (without parent folders) starts with the prefix char <code>'~'</code> (tilde).<p> * * @param resourceName the resource name to check * * @return <code>true</code> if the given resource name is a temporary file name * * @see #getTemporaryFileName(String) * @see #isTemporaryFile(CmsResource) */ public static boolean isTemporaryFileName(String resourceName) { return (resourceName != null) && (CmsResource.getName(resourceName).startsWith(TEMP_FILE_PREFIX)); }
/** * Returns the file name of this resource without parent folders, for example <code>index.html</code>.<p> * * @return the file name of this resource without parent folders */ public String getName() { String name = getName(m_rootPath); if (name.charAt(name.length() - 1) == '/') { return name.substring(0, name.length() - 1); } else { return name; } }
/** * Returns the name of this resource without parent folders, for example <code>index.html</code>.<p> * * @return the name of this resource without parent folders */ public String getName() { String name = getName(m_rootPath); if (name.charAt(name.length() - 1) == '/') { return name.substring(0, name.length() - 1); } else { return name; } }
/** * Returns the file name without path information of the current resource.<p> * * @return the name of the current resource */ protected String getFileName() { return CmsResource.getName(getParamResource()); }
/** * Returns the file name without path information of the current resource.<p> * * @return the name of the current resource */ protected String getFileName() { return CmsResource.getName(getParamResource()); }
/** * Gets the name to display for the given resource.<p> * * @param cms the CMS context * @param resource a resource * @param parentId the id of the parent of the resource * * @return the name for the given resoure */ protected String getName(CmsObject cms, CmsResource resource, CmsUUID parentId) { return parentId == null ? resource.getRootPath() : resource.getName(); } }
/** * Adds the name of a child resource to this file's path.<p> * * @param child the child resource * * @return the path of the child */ protected String getFullChildPath(CmsResource child) { String childName = child.getName(); String sep = getFullName().endsWith("\\") ? "" : "\\"; return getFullName() + sep + childName; }
/** * 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; }
/** * Constructor, creates a new CmsDecorationMap.<p> * * @param cms the CmsObject * @param res the resource to extrace the decorations from * @param decDef the CmsDecorationDefintion to be used in this decoration map * @throws CmsException if something goes wrong */ public CmsDecorationMap(CmsObject cms, CmsResource res, CmsDecorationDefintion decDef) throws CmsException { m_decoratorDefinition = decDef; m_name = res.getName(); m_locale = extractLocale(); m_decorationMap = fillMap(cms, res); }
/** * Constructor, creates a new CmsDecorationMap.<p> * * @param cms the CmsObject * @param res the resource to extrace the decorations from * @param decDef the CmsDecorationDefintion to be used in this decoration map * @throws CmsException if something goes wrong */ public CmsDecorationMap(CmsObject cms, CmsResource res, CmsDecorationDefintion decDef) throws CmsException { m_decoratorDefinition = decDef; m_name = res.getName(); m_locale = extractLocale(); m_decorationMap = fillMap(cms, res); }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#moveResource(org.opencms.file.CmsObject, java.lang.String, java.lang.String) */ @Override public boolean moveResource(CmsObject cms, String source, String destination) throws CmsException, CmsIllegalArgumentException { String name = CmsResource.getName(destination); if (m_disabledNames.contains(name)) { throw new CmsPermissionViolationException( Messages.get().container(Messages.ERR_PERM_DENIED_2, destination, "+c")); } else { return false; } }
/** * Returns the VFS path for the given filename and folder.<p> * * @param cms the cms object * @param fileName the filename to combine with the folder * @param folder the folder to combine with the filename * * @return the VFS path for the given filename and folder */ public static String getNewResourceName(CmsObject cms, String fileName, String folder) { String newResname = CmsResource.getName(fileName.replace('\\', '/')); newResname = cms.getRequestContext().getFileTranslator().translateResource(newResname); newResname = folder + newResname; return newResname; }
/** * Returns <code>true</code> if this resource is a temporary file.<p> * * A resource is considered a temporary file it is a file where the * {@link CmsResource#FLAG_TEMPFILE} flag has been set, or if the file name (without parent folders) * starts with the prefix char <code>'~'</code> (tilde).<p> * * @return <code>true</code> if the given resource name is a temporary file * * @see #isTemporaryFileName(String) */ public boolean isTemporaryFile() { return isFile() && (((getFlags() & CmsResource.FLAG_TEMPFILE) > 0) || isTemporaryFileName(getName())); }
/** * Returns the name of the website area specified in the common configuration file.<p> * * If the name is not found, the title of the start folder is shown.<p> * * @return the name of the website area */ public String getAreaName() { String name = getConfigurationValue("area.name", null); if (name == null) { String startFolder = getStartFolder(); name = property(CmsPropertyDefinition.PROPERTY_TITLE, startFolder, CmsResource.getName(startFolder)); } return name; }
/** * Returns the path to the associated detail content.<p> * * @param detailContainersPage the detail containers page path * * @return the path to the associated detail content */ public static String getDetailContentPath(String detailContainersPage) { String detailName = CmsResource.getName(detailContainersPage); String parentFolder = CmsResource.getParentFolder(CmsResource.getParentFolder(detailContainersPage)); if (parentFolder.endsWith("/" + DETAIL_CONTAINERS_FOLDER_NAME + "/")) { // this will be the case for locale dependent detail only pages, move one level up parentFolder = CmsResource.getParentFolder(parentFolder); } detailName = CmsStringUtil.joinPaths(parentFolder, detailName); return detailName; }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#deleteResource(org.opencms.file.CmsObject, java.lang.String, org.opencms.file.CmsResource.CmsResourceDeleteMode) */ @Override public boolean deleteResource(CmsObject cms, String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException { if (matchParentPath(EXPORT_PATH, resourcename)) { String fileName = CmsResource.getName(resourcename); boolean result = OpenCms.getModuleManager().getImportExportRepository().deleteModule(fileName); return result; } else { return false; } }
/** * 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 } }