本文整理汇总了Java中javax.portlet.PortletConfig类的典型用法代码示例。如果您正苦于以下问题:Java PortletConfig类的具体用法?Java PortletConfig怎么用?Java PortletConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PortletConfig类属于javax.portlet包,在下文中一共展示了PortletConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processAction
import javax.portlet.PortletConfig; //导入依赖的package包/类
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
String columns = ParamUtil.getString(actionRequest, "columns");
String[] exportFileNames = actionRequest.getParameterValues("exportFileName");
String[] exportNames = actionRequest.getParameterValues("exportName");
String[] exportScripts = actionRequest.getParameterValues("exportScript");
setPreference(actionRequest, "columns", columns.split(","));
setPreference(actionRequest, "exportFileName", exportFileNames);
setPreference(actionRequest, "exportName", exportNames);
setPreference(actionRequest, "exportScript", exportScripts);
super.processAction(portletConfig, actionRequest, actionResponse);
}
示例2: processAction
import javax.portlet.PortletConfig; //导入依赖的package包/类
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse arg2) throws Exception {
if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD)))
return;
PortletPreferences prefs;
String portletResource = ParamUtil.getString(actionRequest, "portletResource");
if (Validator.isNotNull(portletResource)){
prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);
} else {
prefs = actionRequest.getPreferences();
}
prefs.setValue("numerateModules", actionRequest.getParameter("numerateModules"));
prefs.store();
SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure");
}
示例3: getSaveAndContinueRedirect
import javax.portlet.PortletConfig; //导入依赖的package包/类
protected String getSaveAndContinueRedirect(
ActionRequest actionRequest, TaskRecord taskRecord, Layout layout, String redirect)
throws Exception {
PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcRenderCommandName", "editTaskRecord");
portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
portletURL.setParameter("redirect", redirect, false);
portletURL.setParameter(
"groupId", String.valueOf(taskRecord.getGroupId()), false);
portletURL.setParameter(
"taskRecordId", String.valueOf(taskRecord.getTaskRecordId()), false);
portletURL.setWindowState(actionRequest.getWindowState());
return portletURL.toString();
}
示例4: init
import javax.portlet.PortletConfig; //导入依赖的package包/类
@Override
public void init(PortletConfig config) throws PortletException {
super.init(config);
this.templatesPath = config.getInitParameter(INIT_PARAM_TEMPLATES_PATH);
if(this.templatesPath == null) {
throw new PortletException("Templates path not specified in init parameters.");
}
if(!this.templatesPath.endsWith(StringPool.SLASH)) {
this.templatesPath = this.templatesPath.concat(StringPool.SLASH);
}
this.portal = this.getPortal();
this.templateManager = this.getTemplateManager();
try {
this.templateResourceLoader = TemplateResourceLoaderUtil.getTemplateResourceLoader(this.templateManager.getName());
} catch(TemplateException e) {
throw new PortletException(e);
}
}
示例5: getSaveAndContinueRedirect
import javax.portlet.PortletConfig; //导入依赖的package包/类
protected String getSaveAndContinueRedirect(
ActionRequest actionRequest, Contact contact, Layout layout, String redirect)
throws Exception {
_log.info("getSaveAndContinueRedirect()");
PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcRenderCommandName", "editContact");
portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
portletURL.setParameter("redirect", redirect, false);
portletURL.setParameter(
"groupId", String.valueOf(contact.getGroupId()), false);
portletURL.setParameter(
"contactId", String.valueOf(contact.getContactId()), false);
portletURL.setWindowState(actionRequest.getWindowState());
return portletURL.toString();
}
示例6: getRegistrationStates
import javax.portlet.PortletConfig; //导入依赖的package包/类
private List<JSONObject> getRegistrationStates(ThemeDisplay themeDisplay) {
JSONObject regObject = JSONFactoryUtil.createJSONObject();
List<JSONObject> registrationState = new ArrayList<>();
PortletConfig portletConfig = PortletConfigFactoryUtil.get(
themeDisplay.getPortletDisplay().getId());
ResourceBundle resourceBundle =
portletConfig.getResourceBundle(themeDisplay.getLocale());
for (int i=0; i<4; i++) {
regObject = JSONFactoryUtil.createJSONObject();
regObject.put("value", i);
regObject.put("text", LanguageUtil.get(resourceBundle, "registration-state"+i));
registrationState.add(regObject);
}
return registrationState;
}
示例7: processAction
import javax.portlet.PortletConfig; //导入依赖的package包/类
@Override
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
String linkList = ParamUtil.getString(actionRequest, DummyFactoryConfiguration.CONF_LINKLIST);
String urlList = ParamUtil.getString(actionRequest, DummyFactoryConfiguration.CONF_URLLIST);
if (_log.isDebugEnabled()) {
_log.debug("Link List :" + linkList);
_log.debug("URL List :" + urlList);
}
List<String> errors = Lists.newArrayList();
if (validate(linkList, errors)) {
setPreference(actionRequest, DummyFactoryConfiguration.CONF_LINKLIST, linkList);
setPreference(actionRequest, DummyFactoryConfiguration.CONF_URLLIST, urlList);
SessionMessages.add(actionRequest, "prefs-success");
}
super.processAction(portletConfig, actionRequest, actionResponse);
}
示例8: getSaveAndContinueRedirect
import javax.portlet.PortletConfig; //导入依赖的package包/类
protected String getSaveAndContinueRedirect(
ActionRequest actionRequest, Measurement measurement, Layout layout, String redirect)
throws Exception {
PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcRenderCommandName", "editMeasurement");
portletURL.setParameter(Constants.CMD, Constants.UPDATE, false);
portletURL.setParameter("redirect", redirect, false);
portletURL.setParameter(
"groupId", String.valueOf(measurement.getGroupId()), false);
portletURL.setParameter(
"measurementId", String.valueOf(measurement.getMeasurementId()), false);
portletURL.setWindowState(actionRequest.getWindowState());
return portletURL.toString();
}
示例9: generateCSVOutput
import javax.portlet.PortletConfig; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static List<String> generateCSVOutput(
PortletConfig portletConfig, RenderRequest renderRequest) {
String title = (String) renderRequest.getAttribute("title");
EnumSet<ExecutionMode> executionMode =
(EnumSet<ExecutionMode>)renderRequest.getAttribute("executionMode");
Map<Company, Long> companyProcessTime =
(Map<Company, Long>)renderRequest.getAttribute(
"companyProcessTime");
Map<Company, Map<Long, List<Comparison>>> companyResultDataMap =
(Map<Company, Map<Long, List<Comparison>>>)
renderRequest.getAttribute("companyResultDataMap");
Map<Company, String> companyError =
(Map<Company, String>) renderRequest.getAttribute("companyError");
if ((executionMode == null)||(companyProcessTime == null)||
(companyResultDataMap == null)) {
return null;
}
return generateCSVOutput(
portletConfig, title, renderRequest.getLocale(), true,
companyProcessTime, companyResultDataMap, companyError);
}
示例10: getUpdateMessage
import javax.portlet.PortletConfig; //导入依赖的package包/类
public String getUpdateMessage(PortletConfig portletConfig) {
PluginPackage pluginPackage = getPluginPackage(portletConfig);
if (pluginPackage == null) {
return getUpdateMessageOffline(portletConfig);
}
@SuppressWarnings("unchecked")
Collection<String> lastAvalibleVersion =
(Collection<String>)RemoteConfigurationUtil.getConfigurationEntry(
"lastAvalibleVersion");
if ((lastAvalibleVersion == null) || lastAvalibleVersion.isEmpty()) {
return getUpdateMessageOffline(portletConfig);
}
String portletVersion = pluginPackage.getVersion();
if (lastAvalibleVersion.contains(portletVersion)) {
return null;
}
return (String)RemoteConfigurationUtil.getConfigurationEntry(
"updateMessage");
}
示例11: getUpdateMessageOffline
import javax.portlet.PortletConfig; //导入依赖的package包/类
public String getUpdateMessageOffline(PortletConfig portletConfig) {
LiferayPortletContext context =
(LiferayPortletContext)portletConfig.getPortletContext();
long installationTimestamp = context.getPortlet().getTimestamp();
if (installationTimestamp == 0L) {
return null;
}
long offlineUpdateTimeoutMilis =
(Long)ConfigurationUtil.getConfigurationEntry(
"offlineUpdateTimeoutMilis");
long offlineUpdateTimestamp =
(installationTimestamp + offlineUpdateTimeoutMilis);
long currentTimeMillis = System.currentTimeMillis();
if (offlineUpdateTimestamp > currentTimeMillis) {
return null;
}
return (String)ConfigurationUtil.getConfigurationEntry(
"offlineUpdateMessage");
}
示例12: afterPropertiesSet
import javax.portlet.PortletConfig; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
if (this.portletClass == null) {
throw new IllegalArgumentException("portletClass is required");
}
if (!Portlet.class.isAssignableFrom(this.portletClass)) {
throw new IllegalArgumentException("portletClass [" + this.portletClass.getName() +
"] needs to implement interface [javax.portlet.Portlet]");
}
if (this.portletName == null) {
this.portletName = this.beanName;
}
PortletConfig config = this.portletConfig;
if (config == null || !this.useSharedPortletConfig) {
config = new DelegatingPortletConfig();
}
this.portletInstance = (Portlet) this.portletClass.newInstance();
this.portletInstance.init(config);
}
示例13: postProcessAfterInitialization
import javax.portlet.PortletConfig; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof Portlet) {
PortletConfig config = this.portletConfig;
if (config == null || !this.useSharedPortletConfig) {
config = new DelegatingPortletConfig(beanName, this.portletContext, this.portletConfig);
}
try {
((Portlet) bean).init(config);
}
catch (PortletException ex) {
throw new BeanInitializationException("Portlet.init threw exception", ex);
}
}
return bean;
}
示例14: PortletConfigPropertyValues
import javax.portlet.PortletConfig; //导入依赖的package包/类
/**
* Create new PortletConfigPropertyValues.
* @param config PortletConfig we'll use to take PropertyValues from
* @param requiredProperties set of property names we need, where
* we can't accept default values
* @throws PortletException if any required properties are missing
*/
private PortletConfigPropertyValues(PortletConfig config, Set<String> requiredProperties)
throws PortletException {
Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
new HashSet<String>(requiredProperties) : null;
Enumeration<String> en = config.getInitParameterNames();
while (en.hasMoreElements()) {
String property = en.nextElement();
Object value = config.getInitParameter(property);
addPropertyValue(new PropertyValue(property, value));
if (missingProps != null) {
missingProps.remove(property);
}
}
// fail if we are still missing properties
if (missingProps != null && missingProps.size() > 0) {
throw new PortletException(
"Initialization from PortletConfig for portlet '" + config.getPortletName() +
"' failed; the following required properties were missing: " +
StringUtils.collectionToDelimitedString(missingProps, ", "));
}
}
示例15: include
import javax.portlet.PortletConfig; //导入依赖的package包/类
@Override
public void include(
PortletConfig portletConfig, HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse)
throws Exception {
if (_log.isDebugEnabled()) {
_log.debug("Blade Message Portlet configuration include");
}
httpServletRequest.setAttribute(
MessageDisplayConfiguration.class.getName(),
_messageDisplayConfiguration);
super.include(portletConfig, httpServletRequest, httpServletResponse);
}