/** * 删除模板元数据 * * @param filePath * @return whether the delete is successful */ public boolean deleteTemplateMetadata(String filePath) { File file = new File(filePath); String dirPath = file.getParent(); Map<String, CmsPageMetadata> metadataMap = getTemplateMetadataMap(dirPath); metadataMap.remove(file.getName()); try { saveTemplateMetadata(dirPath, metadataMap); return true; } catch (IOException e) { return false; } }
/** * 更新模板元数据 * * @param filePath * @param metadata * @return whether the update is successful */ public boolean updateTemplateMetadata(String filePath, CmsPageMetadata metadata) { File file = new File(filePath); String dirPath = file.getParent(); Map<String, CmsPageMetadata> metadataMap = getTemplateMetadataMap(dirPath); metadataMap.put(file.getName(), metadata); try { saveTemplateMetadata(dirPath, metadataMap); return true; } catch (IOException e) { return false; } }
/** * 删除模板元数据 * * @param filePath * @return whether the delete is successful */ public boolean deleteTemplateMetadata(String filePath) { File file = new File(filePath); String dirPath = file.getParent(); Map<String, CmsPageMetadata> metadataMap = getTemplateMetadataMap(dirPath); metadataMap.remove(file.getName()); try { saveTemplateMetadata(dirPath, metadataMap); return true; } catch (IOException e) { return false; } }
/** * 更新模板元数据 * * @param filePath * @param metadata * @return whether the update is successful */ public boolean updateTemplateMetadata(String filePath, CmsPageMetadata metadata) { File file = new File(filePath); String dirPath = file.getParent(); Map<String, CmsPageMetadata> metadataMap = getTemplateMetadataMap(dirPath); metadataMap.put(file.getName(), metadata); try { saveTemplateMetadata(dirPath, metadataMap); return true; } catch (IOException e) { return false; } }
/** * 获取模板元数据 * * @param filePath * @return template metadata */ public CmsPageMetadata getTemplateMetadata(String filePath) { File file = new File(filePath); CmsPageMetadata pageMetadata = getTemplateMetadataMap(file.getParent()).get(file.getName()); if (null == pageMetadata) { pageMetadata = new CmsPageMetadata(); pageMetadata.setUseDynamic(true); } return pageMetadata; }
/** * 获取模板元数据 * * @param filePath * @return template metadata */ public CmsPageMetadata getTemplateMetadata(String filePath) { File file = new File(filePath); CmsPageMetadata pageMetadata = getTemplateMetadataMap(file.getParent()).get(file.getName()); if (null == pageMetadata) { pageMetadata = new CmsPageMetadata(); pageMetadata.setUseDynamic(true); } return pageMetadata; }