public FailedToStorePortletDefinitionException( PortletDefinition portlet, String reason ) { this("Unable to store portlet definition "+portlet.getPortletName()+". Resaon: "+reason); }
public FailedToStorePortletDefinitionException( PortletDefinition portlet, Throwable nested ) { this("Unable to store portlet definition "+portlet.getPortletName()+". Reason: "+nested.toString(), nested); }
public PortletDefinition getClone(String cloneName) { for (PortletDefinition clone : getClones()) { if (clone.getPortletName().equals(cloneName)) { return clone; } } return null; }
public PortletDefinition getPortlet(String portletName) { for (PortletDefinition pd : getPortlets()) { if (pd.getPortletName().equals(portletName)) { return pd; } } return null; }
/** * <p> * setPortletDefinition * </p> * * @param composite * */ public void setPortletDefinition(PortletDefinition pd) { if (pd != null) { portletDefinition = pd; this.appName = portletDefinition.getApplication().getName(); this.portletName = portletDefinition.getPortletName(); } else { throw new IllegalArgumentException("Cannot pass a null PortletDefinition to a PortletEntity."); } }
public void portletUpdated(PortletDefinition pd) { synchronized (cacheMutex) { if (pd != null) { String paName = pd.getApplication().getName(); String pdName = pd.getPortletName(); // clear PreferenceValidator cache Map<String, PreferencesValidator> pvCache = validatorCache.get(paName); if (pvCache != null) { pvCache.remove(pdName); } // clear Portlet ResourceBundle cache Map<String, Map<Locale, ResourceBundle>> portletResourceBundleCache = portletsResourceBundleCache.get(paName); if (portletResourceBundleCache != null) { portletResourceBundleCache.remove(pdName); } // update PortletInstance PortletConfig instance (maybe should kill/destroy PortletInstance ?) updatePortletConfig(pd); } } }
public void storePortletPreference(org.apache.jetspeed.om.portlet.PortletDefinition portletdefinition, String windowId, String userName, Map<String, PortletPreference> map) { String appName = portletdefinition.getApplication().getName(); String portletName = portletdefinition.getPortletName(); storePortletPreference(appName, portletName, windowId, userName, map); }
public FilterManager getFilterManager(PortletWindow window, String lifeCycle) { PortletDefinition def = ((org.apache.jetspeed.container.PortletWindow) window).getPortletDefinition(); return new JetspeedFilterManager(this.portletFactory, def.getApplication(), def.getPortletName(), lifeCycle); }
public void updatePortletConfig(PortletDefinition pd) { synchronized (cacheMutex) { if (pd != null) { Map<String, PortletInstance> instanceCache = portletCache.get(pd.getApplication().getName()); PortletInstance instance = instanceCache != null ? instanceCache.get(pd.getPortletName()) : null; if (instance != null) { JetspeedPortletConfigImpl config = (JetspeedPortletConfigImpl) instance.getConfig(); config.setPortletDefinition(pd); } } } }
/** * Get the portal-wide list of available layouts. * * @return A list of layout portlets of type <code>PortletDefinitionComposite</code> */ public List<LayoutInfo> getLayouts( RequestContext request ) { List list = new LinkedList(); Iterator portlets = registry.getAllDefinitions().iterator(); while ( portlets.hasNext() ) { PortletDefinition portlet = (PortletDefinition)portlets.next(); PortletApplication app = (PortletApplication)portlet.getApplication(); String appName = app.getName(); if ( appName == null ) continue; if ( ! appName.equals( "jetspeed-layouts" ) ) continue; String uniqueName = appName + "::" + portlet.getPortletName(); list.add( new LayoutInfoImpl( uniqueName, portlet.getDisplayNameText( request.getLocale() ), portlet.getDescriptionText( request.getLocale() ) ) ); } return list; }
protected String autoGenerateID(PortletDefinition pd) { String appName = pd.getApplication().getName(); String portletName = pd.getPortletName(); return appName+"::"+portletName+"::"+new UID().toString(); }
private JSPortlet exportPD(PortletDefinition pd, Map<String,Object> settings, Logger log) throws SerializerException { JSPortlet jsPortlet = null; try { Set<String> windowIds = prefsProvider.getPortletWindowIds(pd); if ((windowIds == null) || (windowIds.size() == 0)) return null; JSEntities entities = new JSEntities(); for (String windowId : windowIds) { JSEntity jsEntity = exportEntityPref(pd, windowId, settings, log); if (jsEntity != null) entities.add(jsEntity); } if (!entities.isEmpty()) { jsPortlet = new JSPortlet(); jsPortlet.setName(pd.getPortletName()); jsPortlet.setEntities(entities); log.debug("-----exporting for PD=" + pd.getPortletName()); // jsPortlet.setEntities(entities); } } catch (Exception e) { throw new SerializerException(SerializerException.CREATE_SERIALIZED_OBJECT_FAILED.create(new String[] { "Entity", e.getMessage() }), e); } return jsPortlet; }
public Set<String> getPortletWindowIds(org.apache.jetspeed.om.portlet.PortletDefinition portletdefinition) { Set<String> windowsId = new TreeSet<String>(); String appName = portletdefinition.getApplication().getName(); String portletName = portletdefinition.getPortletName(); Criteria c = new Criteria(); c.addEqualTo(DTYPE, DISCRIMINATOR_USER); c.addEqualTo(APPLICATION_NAME, appName); c.addEqualTo(PORTLET_NAME, portletName); c.addNotEqualTo(ENTITY_ID, EMPTY_VALUE); ReportQueryByCriteria query = QueryFactory.newReportQuery(DatabasePreference.class, c); query.setAttributes(new String[] {ENTITY_ID, "id" }); Iterator<Object[]> ObjectwindowsId = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query); while (ObjectwindowsId.hasNext()) { windowsId.add((String) ObjectwindowsId.next()[0]); } return windowsId; }
public Set<String> getUserNames(org.apache.jetspeed.om.portlet.PortletDefinition portletdefinition, String windowId) { Set<String> userNames = new TreeSet<String>(); String appName = portletdefinition.getApplication().getName(); String portletName = portletdefinition.getPortletName(); Criteria c = new Criteria(); c.addEqualTo(DTYPE, DISCRIMINATOR_USER); c.addEqualTo(APPLICATION_NAME, appName); c.addEqualTo(PORTLET_NAME, portletName); c.addEqualTo(ENTITY_ID, windowId); c.addNotEqualTo(USER_NAME, EMPTY_VALUE); ReportQueryByCriteria query = QueryFactory.newReportQuery(DatabasePreference.class, c); query.setAttributes(new String[] {USER_NAME, "id" }); query.setDistinct(true); Iterator<Object[]> userObjects = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(query); while (userObjects.hasNext()) { userNames.add((String) userObjects.next()[0]); } return userNames; }
/** * Jetspeed: PortletPreferencesProvider */ public void removeDefaults(org.apache.jetspeed.om.portlet.PortletDefinition pd) { Criteria c = new Criteria(); c.addEqualTo(DTYPE, DISCRIMINATOR_PORTLET); c.addEqualTo(APPLICATION_NAME, pd.getApplication().getName()); c.addEqualTo(PORTLET_NAME, pd.getPortletName()); QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c); getPersistenceBrokerTemplate().deleteByQuery(query); String defaultsCacheKey = getPortletPreferenceKey(pd.getApplication().getName(), pd.getPortletName()); preferenceCache.remove(defaultsCacheKey); }
/** * Jetspeed: PortletPreferencesProvider */ public void storeEntityPreferences(Map<String, PortletPreference> map, PortletWindow window) throws PreferencesException { for (Entry<String, PortletPreference> entry : map.entrySet()) { org.apache.jetspeed.om.portlet.PortletDefinition pd = window.getPortletDefinition(); String entityId = window.getPortletEntityId(); String appName = pd.getApplication().getName(); String portletName = pd.getPortletName(); String entityCacheKey = this.getEntityPreferenceKey(appName, portletName, entityId); preferenceCache.remove(entityCacheKey); } try { ContentFragment fragment = window.getFragment(); fragment.updatePreferences(map); } catch (Exception e) { throw new PreferencesException(e); } }
public static void fillInPortletWindow(RequestDiagnostics rd, PortletWindow pw, Throwable e) { if (pw != null) { rd.setPortletWindowId(pw.getWindowId()); PortletDefinition pd = pw.getPortletDefinition(); rd.setPortletApplicationName(pd.getApplication().getName()); rd.setPortletName(pd.getPortletName()); } if (e != null) { fillInException(rd, e); } }
/** * * <p> * getPortletEntities * </p> * * @param portletDefinition * @return */ public Collection getPortletEntities( PortletDefinition portletDefinition ) { Criteria c = new Criteria(); String appName = portletDefinition.getApplication().getName(); String portletName = portletDefinition.getPortletName(); c.addEqualTo("appName", appName); c.addEqualTo("portletName", portletName); return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(PortletEntityImpl.class, c)); }
public void removeDefaults(org.apache.jetspeed.om.portlet.PortletDefinition pd, String preferenceName) { Criteria c = new Criteria(); c.addEqualTo(DTYPE, DISCRIMINATOR_PORTLET); c.addEqualTo(APPLICATION_NAME, pd.getApplication().getName()); c.addEqualTo(PORTLET_NAME, pd.getPortletName()); c.addEqualTo("name", preferenceName); QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c); getPersistenceBrokerTemplate().deleteByQuery(query); String defaultsCacheKey = getPortletPreferenceKey(pd.getApplication().getName(), pd.getPortletName()); JetspeedPreferencesMap map = (JetspeedPreferencesMap) preferenceCache.get(defaultsCacheKey).getContent(); map.remove(preferenceName); preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map)); }
protected PortletContent createPortletContent(RequestContext request, PortletWindow portletWindow, int expirationCache) { ContentCacheKey cacheKey = portletContentCache.createCacheKey(request, portletWindow.getFragment().getId()); String title = portletWindow.getFragment().getTitle(); if (title == null) { title = request.getPreferedLanguage(portletWindow.getPortletDefinition()).getTitle(); } if (title == null) { title = portletWindow.getPortletDefinition().getPortletName(); } return new PortletContentImpl(cacheKey, expirationCache, title, portletWindow.getPortletMode(), portletWindow.getWindowState()); }