📄 contentmanagerserviceimpl.java
字号:
package org.gridsphere.services.core.content.impl;import org.gridsphere.portlet.service.spi.PortletServiceConfig;import org.gridsphere.portlet.service.spi.PortletServiceProvider;import org.gridsphere.services.core.content.ContentFile;import org.gridsphere.services.core.content.ContentManagerService;import javax.servlet.ServletContext;import java.io.File;import java.util.ArrayList;import java.util.List;/** * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a> * @version $Id$ */public class ContentManagerServiceImpl implements ContentManagerService, PortletServiceProvider { private List<ContentFile> contents = new ArrayList(); public void init(PortletServiceConfig config) { ServletContext ctx = config.getServletContext(); String contentDirPath = ctx.getRealPath("/WEB-INF/CustomPortal/content"); File contentDir = new File(contentDirPath); File[] contentFiles = contentDir.listFiles(); ContentFile content = null; for (int i = 0; i < contentFiles.length; i++) { File contentFile = contentFiles[i]; content = new ContentFileImpl(contentFile); contents.add(content); } } public void destroy() { } public List<ContentFile> getAllContent() { return contents; } public void addContent(ContentFile content) { contents.add(content); } public void removeContent(ContentFile content) { contents.remove(content); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -