use of com.publiccms.logic.component.site.FileComponent.FileInfo in project PublicCMS-preview by sanluan.
the class PublishPageDirective method deal.
private Map<String, Boolean> deal(SysSite site, String path) {
path = path.replace("\\", SEPARATOR).replace("//", SEPARATOR);
Map<String, Boolean> map = new LinkedHashMap<>();
Map<String, CmsPageMetadata> metadataMap = metadataComponent.getTemplateMetadataMap(siteComponent.getWebTemplateFilePath(site, path));
List<FileInfo> list = fileComponent.getFileList(siteComponent.getWebTemplateFilePath(site, path));
for (FileInfo fileInfo : list) {
String filePath = path + fileInfo.getFileName();
if (fileInfo.isDirectory()) {
map.putAll(deal(site, filePath + SEPARATOR));
} else {
CmsPageMetadata metadata = metadataMap.get(fileInfo.getFileName());
if (null != metadata && CommonUtils.notEmpty(metadata.getPublishPath())) {
try {
templateComponent.createStaticFile(site, SiteComponent.getFullFileName(site, filePath), metadata.getPublishPath(), null, metadata, null);
map.put(filePath, true);
} catch (IOException | TemplateException e) {
map.put(filePath, false);
}
}
}
}
return map;
}
use of com.publiccms.logic.component.site.FileComponent.FileInfo in project PublicCMS-preview by sanluan.
the class PublishPlaceDirective method deal.
private Map<String, Boolean> deal(SysSite site, String path) {
path = path.replace("\\", SEPARATOR).replace("//", SEPARATOR);
Map<String, Boolean> map = new LinkedHashMap<>();
List<FileInfo> list = fileComponent.getFileList(siteComponent.getWebTemplateFilePath(site, TemplateComponent.INCLUDE_DIRECTORY + SEPARATOR + path));
Map<String, CmsPlaceMetadata> metadataMap = metadataComponent.getPlaceMetadataMap(siteComponent.getWebTemplateFilePath(site, path));
for (FileInfo fileInfo : list) {
String filePath = path + fileInfo.getFileName();
if (fileInfo.isDirectory()) {
map.putAll(deal(site, filePath + SEPARATOR));
} else {
try {
CmsPlaceMetadata metadata = metadataMap.get(fileInfo.getFileName());
if (null == metadata) {
metadata = new CmsPlaceMetadata();
}
templateComponent.staticPlace(site, filePath, metadata);
map.put(filePath, true);
} catch (IOException | TemplateException e) {
map.put(filePath, false);
}
}
}
return map;
}
Aggregations