/** * Returns an instance of ExtendedProperties with key-values pairs which can be used to build e.g. the headline.<p> * * @param linkToFile xml content file which is integrated inside the layout page * @return an instance of ExtendedProperties with key-value pairs which define the elements to use inside * an integrated xml content, e.g. to build the headline */ protected ExtendedProperties getXmlElementsProperties(CmsFile linkToFile) { ExtendedProperties properties = new ExtendedProperties(); try { // get the type name for the integrated file // type name is used as key for m_typeMappings String typeName = OpenCms.getResourceManager().getResourceType(linkToFile.getTypeId()).getTypeName(); if (m_typeMappings.get(typeName) == null) { // get key/value from the .properties file and store it in properties and m_typeMappings properties.load(new ByteArrayInputStream( getCmsObject().readFile( CmsWorkplace.VFS_PATH_MODULES + MODULE_NAME + "/mappings/" + typeName + ".properties").getContents())); m_typeMappings.put(typeName, properties); } else { // if typeName is already used inside m_typeProperties get properties from this map properties = (ExtendedProperties)m_typeMappings.get(typeName); } } catch (Exception e) { // ignore } return properties; }
/** * Checks if the content is locale independent.<p> * * @return true if the content is locale independent */ public boolean isLocaleIndependent() { CmsFile file = getFile(); if (CmsResourceTypeXmlContainerPage.isContainerPage(file) || OpenCms.getResourceManager().matchResourceType( CmsResourceTypeXmlContainerPage.GROUP_CONTAINER_TYPE_NAME, file.getTypeId()) || OpenCms.getResourceManager().matchResourceType( CmsResourceTypeXmlContainerPage.INHERIT_CONTAINER_CONFIG_TYPE_NAME, file.getTypeId())) { return true; } try { I_CmsResourceType resourceType = OpenCms.getResourceManager().getResourceType(file); if ((resourceType instanceof CmsResourceTypeLocaleIndependentXmlContent) || (resourceType instanceof CmsResourceTypeXmlAdeConfiguration)) { return true; } } catch (Exception e) { // ignore } return false; }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#writeFile(org.opencms.file.CmsObject, org.opencms.file.CmsFile) */ @Override public CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException { if (checkTypeId(resource.getTypeId())) { CmsWrappedResource wrap = new CmsWrappedResource(resource); wrap.setRootPath(CmsResourceWrapperUtils.removeFileExtension(cms, resource.getRootPath(), getExtension())); return cms.writeFile(wrap.getFile()); } return null; }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#writeFile(org.opencms.file.CmsObject, org.opencms.file.CmsFile) */ @Override public CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException { if (checkTypeId(resource.getTypeId())) { CmsWrappedResource wrap = new CmsWrappedResource(resource); wrap.setRootPath(CmsResourceWrapperUtils.removeFileExtension(cms, resource.getRootPath(), getExtension())); return cms.writeFile(wrap.getFile()); } return null; }
LOG.warn(e.getLocalizedMessage(), e); String typeName = OpenCms.getResourceManager().getResourceType(file.getTypeId()).getTypeName(); boolean autoUnlock = OpenCms.getWorkplaceManager().shouldAcaciaUnlock(); Map<String, CmsEntity> entities = new HashMap<String, CmsEntity>();
content.getFile().getTypeId()).getTypeName().equals(CmsADEManager.MODULE_CONFIG_TYPE);
/** * Returns the preset path set in the given xml content.<p> * * @param config the xml content with the config where to get the preset path from * * @return the preset path set in the given xml content */ private String getConfigPreset(CmsXmlContent config) { String result = null; if (config != null) { Locale locale = OpenCms.getLocaleManager().getDefaultLocale( getCmsObject(), getCmsObject().getSitePath(m_config.getFile())); if (config.getFile().getTypeId() == RESOURCE_TYPE_ID_CONFIG) { result = config.getStringValue(getCmsObject(), NODE_PRESET, locale); } else { result = config.getStringValue(getCmsObject(), NODE_PRESET_NESTED, locale); } } return result; }
getResourceId(), getRootPath(), getTypeId(), getFlags(), getProjectLastModified(),
/** * Decodes a file's contents and return the content string and the encoding to use for writing the file * back to the VFS.<p> * * @param file the file to decode * @return a pair (content, encoding) * @throws CmsException if something goes wrong */ protected CmsPair<String, String> decode(CmsFile file) throws CmsException { String content = null; String encoding = getConfiguredEncoding(m_cms, file); I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(file.getTypeId()); if (resType instanceof CmsResourceTypeJsp) { content = decode(file.getContents(), encoding); } else { try { CmsXmlEntityResolver resolver = new CmsXmlEntityResolver(m_cms); // parse the XML and serialize it back to a string with the configured encoding Document doc = CmsXmlUtils.unmarshalHelper(file.getContents(), resolver); content = CmsXmlUtils.marshal(doc, encoding); } catch (Exception e) { // invalid xml structure, just use the configured encoding content = decode(file.getContents(), encoding); } } return CmsPair.create(content, encoding); }
getCms().createResource(newFileName, templateFile.getTypeId());
Object[] arguments = new Object[] {vfsName, new Integer(file.getTypeId())}; throw new CmsStaticExportException(Messages.get().container(Messages.ERR_EXPORT_NOT_SUPPORTED_2, arguments));
getResourceId(), getRootPath(), getTypeId(), getFlags(), getProjectLastModified(),
Object[] arguments = new Object[] {vfsName, new Integer(file.getTypeId())}; throw new CmsStaticExportException( Messages.get().container(Messages.ERR_EXPORT_NOT_SUPPORTED_2, arguments));