You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2009/05/06 03:19:57 UTC
svn commit: r772023 -
/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java
Author: taylor
Date: Wed May 6 01:19:57 2009
New Revision: 772023
URL: http://svn.apache.org/viewvc?rev=772023&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-990
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java?rev=772023&r1=772022&r2=772023&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletregistry/PersistenceBrokerPortletRegistry.java Wed May 6 01:19:57 2009
@@ -27,8 +27,11 @@
import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
import org.apache.jetspeed.components.portletpreferences.PortletPreferencesProvider;
import org.apache.jetspeed.om.common.Support;
+import org.apache.jetspeed.om.portlet.LocalizedField;
import org.apache.jetspeed.om.portlet.PortletApplication;
import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.Preference;
+import org.apache.jetspeed.om.portlet.Preferences;
import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
import org.apache.ojb.broker.query.Criteria;
@@ -346,33 +349,48 @@
copy.setPreferenceValidatorClassname(source.getPreferenceValidatorClassname());
copy.setExpirationCache(source.getExpirationCache());
copy.setCacheScope(source.getCacheScope());
- // TODO: Metadata
-
+ Collection<LocalizedField> fields = source.getMetadata().getFields();
+ for (LocalizedField field : fields)
+ {
+ copy.getMetadata().addField(field);
+ }
copy.setJetspeedSecurityConstraint(source.getJetspeedSecurityConstraint());
copy.getDescriptions().addAll(source.getDescriptions());
copy.getDisplayNames().addAll(source.getDisplayNames());
-
- }
-
- /*
-
- private Collection<LocalizedField> metadataFields = null;
-
-
- private List<InitParam> initParams;
- private List<EventDefinitionReference> supportedProcessingEvents;
- private List<EventDefinitionReference> supportedPublishingEvents;
- private List<SecurityRoleRef> securityRoleRefs;
- private List<Supports> supports;
- private List<String> supportedLocales;
- private List<Language> languages;
- private List<ContainerRuntimeOption> containerRuntimeOptions;
- private List<String> supportedPublicRenderParameters;
- private Preferences descriptorPreferences = new PreferencesImpl();
-
- private transient Map<Locale,InlinePortletResourceBundle> resourceBundles = new HashMap<Locale, InlinePortletResourceBundle>();
-
- protected List portletEntities;
- */
-
+ copy.getInitParams().addAll(source.getInitParams());
+ copy.getSupportedProcessingEvents().addAll(source.getSupportedProcessingEvents());
+ copy.getSupportedPublishingEvents().addAll(source.getSupportedPublishingEvents());
+ copy.getSecurityRoleRefs().addAll(source.getSecurityRoleRefs());
+ copy.getSupports().addAll(source.getSupports());
+ copy.getLanguages().addAll(source.getLanguages());
+ copy.getContainerRuntimeOptions().addAll(source.getContainerRuntimeOptions());
+ copy.getSupportedPublicRenderParameters().addAll(source.getSupportedPublicRenderParameters());
+ //savePortletDefinition(copy);
+ source.getApplication().getPortlets().add(copy);
+ try
+ {
+ updatePortletApplication(source.getApplication());
+ }
+ catch (RegistryException e)
+ {
+ throw new FailedToStorePortletDefinitionException(e);
+ }
+ for (Preference pref : source.getPortletPreferences().getPortletPreferences())
+ {
+ Preference copyPref = copy.getPortletPreferences().addPreference(pref.getName());
+ for (String value : pref.getValues())
+ {
+ copyPref.addValue(value);
+ }
+ }
+ try
+ {
+ preferenceService.storeDefaults(copy);
+ }
+ catch (Throwable e)
+ {
+ source.getApplication().getPortlets().remove(copy);
+ throw new FailedToStorePortletDefinitionException(e);
+ }
+ }
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org