public Map<String,PortletPreference> getDefaultPreferences( PortletWindow portletWindow,
PortletRequest request )
throws PortletContainerException {
Map<String,PortletPreference> preferences = null;
PortletDefinition portlet = portletWindow.getPortletDefinition();
Preferences prefs = portlet.getPortletPreferences();
if (prefs != null && prefs.getPortletPreferences() != null) {
preferences = new HashMap<String,PortletPreference>(prefs.getPortletPreferences().size());
for (Preference pref : prefs.getPortletPreferences()) {
String[] values = null;
if (pref.getValues() != null && pref.getValues().size() > 0) {
values = pref.getValues().toArray(new String[pref.getValues().size()]);
}
preferences.put(pref.getName(), new PortletPreferenceImpl(pref.getName(), values, pref.isReadOnly()));