/** * Returns if the given return code is valid.<p> * * @param returnCode the return code to check * * @return <code>true</code> if the return code is valid */ private boolean isValidReturnCode(String returnCode) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(returnCode)) { return false; } int pos = returnCode.indexOf(":"); if (pos > 0) { return CmsUUID.isValidUUID(returnCode.substring(0, pos)) && CmsUUID.isValidUUID(returnCode.substring(pos + 1)); } else { return CmsUUID.isValidUUID(returnCode); } }
/** * Returns the resource id form the given state.<p> * * @param state the state * * @return the resource id */ private CmsUUID getResourceIdFromState(String state) { CmsUUID result = null; int index = state.indexOf(RESOURCE_ID_PREFIX); if (index >= 0) { String id = state.substring( index + RESOURCE_ID_PREFIX.length(), index + RESOURCE_ID_PREFIX.length() + UUID_LENGTH); if (CmsUUID.isValidUUID(id)) { result = new CmsUUID(id); } } return result; }
/** * Replaces formatter id in element settings.<p> * * @param individualSettings the settings in which to replace the formatter id * * @return the map with the possible replaced ids */ private Map<String, String> maybeReplaceFormatterInSettings(Map<String, String> individualSettings) { if (individualSettings == null) { return null; } else if (m_customReplacements == null) { return individualSettings; } else { LinkedHashMap<String, String> result = new LinkedHashMap<String, String>(); for (Map.Entry<String, String> entry : individualSettings.entrySet()) { String value = entry.getValue(); if (CmsUUID.isValidUUID(value)) { CmsUUID valueId = new CmsUUID(value); if (m_customReplacements.containsKey(valueId)) { value = "" + m_customReplacements.get(valueId); } } result.put(entry.getKey(), value); } return result; } }
/** * Gets the correct helper object for a given object id to perform operations on the corresponding object.<p> * * @param objectId the object id * * @return the helper object to use for the given object id */ I_CmsCmisObjectHelper getHelper(String objectId) { if (CmsUUID.isValidUUID(objectId)) { return getResourceHelper(); } else if (CmsCmisRelationHelper.RELATION_PATTERN.matcher(objectId).matches()) { return getRelationHelper(); } else { return null; } }
/** * Returns the project id parameter from the given state.<p> * * @param state the state * * @return the project id */ private CmsUUID getIdFromState(String state) { CmsUUID result = null; String temp = A_CmsWorkplaceApp.getParamFromState(state, "projectId"); if (CmsUUID.isValidUUID(temp)) { result = new CmsUUID(temp); } return result; } }
/** * This method retrieves the structure id which is mapped to a given URL name.<p> * * If there is no structure id mapped to the given name, null will be returned.<p> * * However if the parameter is a string which represents a valid uuid, it will be directly returned as a {@link CmsUUID} instance.<p> * * @param name the url name * @return the id which is mapped to the URL name * * @throws CmsException if something goes wrong */ public CmsUUID readIdForUrlName(String name) throws CmsException { if (CmsUUID.isValidUUID(name)) { return new CmsUUID(name); } return m_securityManager.readIdForUrlName(m_context, name); }
/** * Returns the project id from the current state.<p> * * @return the project id */ private CmsUUID getProjectIdFromState() { String projectIdStr = StateBean.parse(m_currentState).getProjectId(); if (CmsUUID.isValidUUID(projectIdStr)) { return new CmsUUID(projectIdStr); } return null; }
/** * @see org.opencms.ade.publish.I_CmsVirtualProject#getResources(org.opencms.file.CmsObject, java.util.Map, java.lang.String) */ public List<CmsResource> getResources(CmsObject cms, Map<String, String> params, String workflowId) { String containerpageId = params.get(CmsPublishOptions.PARAM_CONTAINERPAGE); String elementId = params.get(CmsPublishOptions.PARAM_CONTENT); String detailId = params.get(CmsPublishOptions.PARAM_DETAIL); Set<CmsResource> resources = new HashSet<CmsResource>(); for (String id : new String[] {containerpageId, elementId, detailId}) { if (CmsUUID.isValidUUID(id)) { try { CmsResource resource = cms.readResource(new CmsUUID(id), CmsResourceFilter.ALL); resources.add(resource); CmsResource parent = cms.readParentFolder(resource.getStructureId()); if (!parent.getState().isUnchanged()) { resources.add(parent); } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } } } return Lists.newArrayList(resources); }
|| !formatterEntry.getValue().equals(previousFormatterEntry.getValue()))) { String idString = formatterEntry.getValue(); if (CmsUUID.isValidUUID(idString)) { // TODO: Make this work for schema formatters
if (CmsUUID.isValidUUID(removeKey)) { m_updateSet.put(new CmsUUID(removeKey), Boolean.FALSE); } else if (removeKey.startsWith(PREFIX_TYPE)) { if (CmsUUID.isValidUUID(addKey)) { m_updateSet.put(new CmsUUID(addKey), Boolean.TRUE); } else if (addKey.startsWith(PREFIX_TYPE)) {
/** * @see org.opencms.workplace.tools.CmsToolDialog#computeUpLevelLink() */ @Override protected String computeUpLevelLink() { // if adminProject is set, go back to the project file list in the administration String adminProject = getJsp().getRequest().getParameter(CmsToolDialog.PARAM_ADMIN_PROJECT); if ((adminProject != null) && CmsUUID.isValidUUID(adminProject)) { String upLevelLink = OpenCms.getLinkManager().substituteLink( getCms(), "/system/workplace/views/admin/admin-main.jsp") + "?path=%2Fprojects%2Ffiles&action=initial&projectid=" + adminProject; return upLevelLink; } else { return super.computeUpLevelLink(); } }
&& CmsUUID.isValidUUID(property.getValue())) { formatter = OpenCms.getADEManager().getCachedFormatters( cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters().get(
if (CmsUUID.isValidUUID(resourceNameOrID)) { resource = readResource(new CmsUUID(resourceNameOrID), filter); } else {
if (settings != null) { String formatterConfigId = settings.get(CmsFormatterConfig.getSettingsKeyForContainer(containerName)); if (CmsUUID.isValidUUID(formatterConfigId)) { formatter = OpenCms.getADEManager().getCachedFormatters(false).getFormatters().get( new CmsUUID(formatterConfigId));
if (CmsUUID.isValidUUID(principalName)) {
CmsResource res = cms.readResource(CmsStringUtil.joinPaths(parentPath, name)); if (!CmsUUID.isValidUUID(id) || res.getStructureId().toString().equals(id)) {
/** * Given a string which might be a id or a (sitemap or VFS) URI, this method will return * a bean containing the right (sitemap or vfs) root path and (sitemap entry or structure) id.<p> * * @param cms the current CMS context * @param idOrUri a string containing an id or an URI * * @return a bean containing a root path and an id * * @throws CmsException if something goes wrong */ protected static CmsVfsFileValueBean getFileValueForIdOrUri(CmsObject cms, String idOrUri) throws CmsException { CmsVfsFileValueBean result; if (CmsUUID.isValidUUID(idOrUri)) { CmsUUID id = new CmsUUID(idOrUri); String uri = getUriForId(cms, id); result = new CmsVfsFileValueBean(cms.getRequestContext().addSiteRoot(uri), id); } else { String uri = idOrUri; CmsUUID id = getIdForUri(cms, idOrUri); result = new CmsVfsFileValueBean(cms.getRequestContext().addSiteRoot(uri), id); } return result; }
String[] resIds = resources.split(";"); for (int i = 0; i < resIds.length; i++) { if (CmsUUID.isValidUUID(resIds[i])) { resourceList.add( getCmsObject().readResource(
/** * Removes an access control entry of a given principal from a given resource.<p> * * @param resourceName name of the resource * @param principalType the type of the principal (currently group or user) * @param principalName the name of the principal * * @throws CmsException if something goes wrong */ public void rmacc(String resourceName, String principalType, String principalName) throws CmsException { CmsResource res = readResource(resourceName, CmsResourceFilter.ALL); if (CmsUUID.isValidUUID(principalName)) { // principal name is in fact a UUID, probably the user was already deleted m_securityManager.removeAccessControlEntry(m_context, res, new CmsUUID(principalName)); } else { try { // principal name not a UUID, assume this is a normal group or user name I_CmsPrincipal principal = CmsPrincipal.readPrincipal(this, principalType, principalName); m_securityManager.removeAccessControlEntry(m_context, res, principal.getId()); } catch (CmsDbEntryNotFoundException e) { // role case CmsRole role = CmsRole.valueOfRoleName(principalName); if (role == null) { throw e; } m_securityManager.removeAccessControlEntry(m_context, res, role.getId()); } } }
boolean isOnline = cms.getRequestContext().getCurrentProject().isOnlineProject(); CmsResource res = null; if (CmsUUID.isValidUUID(m_value)) { CmsUUID structureId = new CmsUUID(m_value); res = isOnline