gatein SVN: r3295 - epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-06-10 23:18:34 -0400 (Thu, 10 Jun 2010)
New Revision: 3295
Modified:
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Installation.xml
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Site_Publisher_Release_Notes.ent
Log:
Edits to Installation section
Modified: epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Installation.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Installation.xml 2010-06-10 16:21:34 UTC (rev 3294)
+++ epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Installation.xml 2010-06-11 03:18:34 UTC (rev 3295)
@@ -6,14 +6,14 @@
<chapter id="chap-Site_Publisher_Release_Notes-Installation">
<title>Installation</title>
<note>
- <title>JASON NOTE</title>
+ <title>DOC NOTE</title>
<para>
- Taken from the eXo Release Notes - I am concerned that the instructions are not quite correct. I do not see the steps where the customer would add the EAR files into the Jboss-AS deploy directory. We should check this and make sure these are correct.
+ The instructions below are based on the eXo Release Notes. More information is required to ensure they are correct.
</para>
</note>
<procedure>
-
+ <title>eXo Install procedure (Doc Note: will be removed)</title>
<step>
<para>
Install Java...
@@ -21,12 +21,6 @@
<para>
Based on JavaEE, Site Publisher runs with version 1.6 so if you are using newer version, please download and install this version to run Site Publisher. Support for newer versions of Java will be added in future releases.
</para>
- <note>
- <title>Scott Note</title>
- <para>
- Is this necessary, as anyone using SP will already, by definition, be running EPP, which needs java to run...
- </para>
- </note>
</step>
<step>
<para>
@@ -60,5 +54,59 @@
</itemizedlist>
</step>
</procedure>
+ <procedure>
+ <title>EPP Install Procedure</title>
+ <step>
+ <para>
+ If you have not already done so, install &PRODUCT; &VERSION;.
+ </para>
+ <para>
+ Installation instructions can be found in the &PRODUCT; Installation Guide at <ulink type="http" url="http://www.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/">http://www.redhat.com/docs/en-US/JBoss_Enterprise_Portal_Platform/</ulink>
+ </para>
+ </step>
+ <step>
+ <para>
+ Unzip the Site Publisher package to an appropriate location. In Windows environments, ensure the path to this location does not contain any spaces.
+ </para>
+ </step>
+ <step>
+ <para>
+ Copy the <filename>X</filename>, <filename>Y</filename> and <filename>Z</filename> EAR files from the <filename>directory/name</filename> directory in to the <filename>jboss-as/somewhere/</filename> directory.
+ </para>
+ </step>
+ <step>
+ <para>
+ Start &PRODUCT; using your established method, the procedures outlined in the &PRODUCT; &VERSION; Installation Guide or by following the steps below.
+ </para>
+ </step>
+ <step>
+ <procedure>
+ <step>
+ <para>
+ Open a command-line terminal session and navigate to the <filename>bin/</filename> directory in the &PRODUCT; location.
+ </para>
+ </step>
+ <step>
+ <para>
+ Run the command that corresponds to your operating environment.
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ In Windows:
+ </para>
+<programlisting>run.bat</programlisting>
+ </listitem>
+ <listitem>
+ <para>
+ In Unix/Linux/cygwin:
+ </para>
+<programlisting>./run.sh</programlisting>
+ </listitem>
+ </itemizedlist>
+ </step>
+ </procedure>
+ </step>
+ </procedure>
</chapter>
Modified: epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Site_Publisher_Release_Notes.ent
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Site_Publisher_Release_Notes.ent 2010-06-10 16:21:34 UTC (rev 3294)
+++ epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Site_Publisher_Release_Notes.ent 2010-06-11 03:18:34 UTC (rev 3295)
@@ -1,6 +1,6 @@
<!ENTITY PRODUCT "JBoss Enterprise Portal Platform">
<!ENTITY JBEPP "JBoss Enterprise Portal Platform">
-<!ENTITY VERSION "5.0.1">
+<!ENTITY VERSION "5.0">
<!ENTITY BOOKID "Site Publisher Release Notes">
<!ENTITY YEAR "2010">
<!ENTITY HOLDER "Red Hat, Inc">
14 years, 6 months
gatein SVN: r3294 - in components/wsrp/trunk: consumer/src/main/java/org/gatein/wsrp/services/v1 and 1 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-10 12:21:34 -0400 (Thu, 10 Jun 2010)
New Revision: 3294
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1PortletManagementService.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/PortletManagementEndpoint.java
Log:
- Started implementing PortletManagement support.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-10 08:41:09 UTC (rev 3293)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-10 16:21:34 UTC (rev 3294)
@@ -25,7 +25,6 @@
import com.google.common.base.Function;
import com.google.common.collect.Lists;
-import org.gatein.common.NotYetImplemented;
import org.gatein.pc.api.OpaqueStateString;
import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
@@ -54,7 +53,6 @@
import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1ResourceValue;
import org.oasis.wsrp.v1.V1RuntimeContext;
-import org.oasis.wsrp.v1.V1ServiceDescription;
import org.oasis.wsrp.v1.V1StateChange;
import org.oasis.wsrp.v1.V1Telecom;
import org.oasis.wsrp.v1.V1TelephoneNum;
@@ -86,7 +84,6 @@
import org.oasis.wsrp.v2.ResourceList;
import org.oasis.wsrp.v2.ResourceValue;
import org.oasis.wsrp.v2.RuntimeContext;
-import org.oasis.wsrp.v2.ServiceDescription;
import org.oasis.wsrp.v2.SessionParams;
import org.oasis.wsrp.v2.StateChange;
import org.oasis.wsrp.v2.Telecom;
@@ -494,11 +491,6 @@
}
}
- public static ServiceDescription toV2ServiceDescription(V1ServiceDescription v1ServiceDescription)
- {
- throw new NotYetImplemented();
- }
-
public static <E extends Exception> E toV2Exception(Class<E> v2ExceptionClass, Exception v1Exception)
{
if (!"org.oasis.wsrp.v2".equals(v2ExceptionClass.getPackage().getName()))
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-10 08:41:09 UTC (rev 3293)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-10 16:21:34 UTC (rev 3294)
@@ -9,7 +9,7 @@
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -25,7 +25,6 @@
import com.google.common.base.Function;
import com.google.common.collect.Lists;
-import org.gatein.common.NotYetImplemented;
import org.gatein.wsrp.WSRPUtils;
import org.oasis.wsrp.v1.V1CacheControl;
import org.oasis.wsrp.v1.V1ClientData;
@@ -47,8 +46,10 @@
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
import org.oasis.wsrp.v1.V1Postal;
+import org.oasis.wsrp.v1.V1Property;
import org.oasis.wsrp.v1.V1PropertyDescription;
import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1ResetProperty;
import org.oasis.wsrp.v1.V1Resource;
import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1ResourceValue;
@@ -82,8 +83,10 @@
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
import org.oasis.wsrp.v2.Postal;
+import org.oasis.wsrp.v2.Property;
import org.oasis.wsrp.v2.PropertyDescription;
import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResetProperty;
import org.oasis.wsrp.v2.Resource;
import org.oasis.wsrp.v2.ResourceList;
import org.oasis.wsrp.v2.ResourceValue;
@@ -117,13 +120,10 @@
public static final V2ToV1ResourceValue RESOURCEVALUE = new V2ToV1ResourceValue();
public static final V2ToV1NamedString NAMEDSTRING = new V2ToV1NamedString();
public static final V2ToV1UploadContext UPLOADCONTEXT = new V2ToV1UploadContext();
+ public static final V2ToV1Property PROPERTY = new V2ToV1Property();
+ public static final V2ToV1ResetProperty RESETPROPERTY = new V2ToV1ResetProperty();
- public static V1PortletDescription toV1PortletDescription(PortletDescription portletDescription)
- {
- throw new NotYetImplemented();
- }
-
public static V1PortletContext toV1PortletContext(PortletContext portletContext)
{
if (portletContext != null)
@@ -723,6 +723,11 @@
}
}
+ public static V1PortletDescription toV1PortletDescription(PortletDescription description)
+ {
+ return PORTLETDESCRIPTION.apply(description);
+ }
+
private static class V2ToV1Extension implements Function<Extension, V1Extension>
{
public V1Extension apply(Extension from)
@@ -978,4 +983,59 @@
}
}
+ private static class V2ToV1Property implements Function<Property, V1Property>
+ {
+ public V1Property apply(Property from)
+ {
+ if (from != null)
+ {
+ V1Property result = WSRP1TypeFactory.createProperty(from.getName().toString(), from.getLang(), from.getStringValue());
+ List<Object> any = from.getAny();
+ if (any != null)
+ {
+ result.getAny().addAll(any);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ private static class V2ToV1ResetProperty implements Function<ResetProperty, V1ResetProperty>
+ {
+ public V1Property apply(Property from)
+ {
+ if (from != null)
+ {
+ V1Property result = WSRP1TypeFactory.createProperty(from.getName().toString(), from.getLang(), from.getStringValue());
+ List<Object> any = from.getAny();
+ if (any != null)
+ {
+ result.getAny().addAll(any);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public V1ResetProperty apply(ResetProperty from)
+ {
+ if (from != null)
+ {
+ return WSRP1TypeFactory.createResetProperty(from.getName().toString());
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1PortletManagementService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1PortletManagementService.java 2010-06-10 08:41:09 UTC (rev 3293)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1PortletManagementService.java 2010-06-10 16:21:34 UTC (rev 3294)
@@ -1,29 +1,43 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.wsrp.services.v1;
import org.gatein.common.NotYetImplemented;
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.services.PortletManagementService;
+import org.gatein.wsrp.spec.v1.V2ToV1Converter;
+import org.oasis.wsrp.v1.V1AccessDenied;
+import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InconsistentParameters;
+import org.oasis.wsrp.v1.V1InvalidHandle;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1InvalidUserCategory;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.CopiedPortlet;
@@ -74,7 +88,45 @@
@Override
public void getPortletDescription(RegistrationContext registrationContext, PortletContext portletContext, UserContext userContext, List<String> desiredLocales, Holder<PortletDescription> portletDescription, Holder<ResourceList> resourceList, Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ try
+ {
+ service.getPortletDescription(
+ V2ToV1Converter.toV1RegistrationContext(registrationContext),
+ V2ToV1Converter.toV1PortletContext(portletContext),
+ V2ToV1Converter.toV1UserContext(userContext),
+ desiredLocales,
+ new Holder<V1PortletDescription>(V2ToV1Converter.toV1PortletDescription(portletDescription.value)),
+ new Holder<V1ResourceList>(V2ToV1Converter.toV1ResourceList(resourceList.value)),
+ new Holder<List<V1Extension>>(WSRPUtils.transform(extensions.value, V2ToV1Converter.EXTENSION)));
+ }
+ catch (V1AccessDenied v1AccessDenied)
+ {
+ WSRPExceptionFactory.throwWSException(AccessDenied.class, v1AccessDenied.getMessage(), v1AccessDenied);
+ }
+ catch (V1InconsistentParameters v1InconsistentParameters)
+ {
+ WSRPExceptionFactory.throwWSException(InconsistentParameters.class, v1InconsistentParameters.getMessage(), v1InconsistentParameters);
+ }
+ catch (V1InvalidHandle v1InvalidHandle)
+ {
+ WSRPExceptionFactory.throwWSException(InvalidHandle.class, v1InvalidHandle.getMessage(), v1InvalidHandle);
+ }
+ catch (V1InvalidRegistration v1InvalidRegistration)
+ {
+ WSRPExceptionFactory.throwWSException(InvalidRegistration.class, v1InvalidRegistration.getMessage(), v1InvalidRegistration);
+ }
+ catch (V1InvalidUserCategory v1InvalidUserCategory)
+ {
+ WSRPExceptionFactory.throwWSException(InvalidUserCategory.class, v1InvalidUserCategory.getMessage(), v1InvalidUserCategory);
+ }
+ catch (V1MissingParameters v1MissingParameters)
+ {
+ WSRPExceptionFactory.throwWSException(MissingParameters.class, v1MissingParameters.getMessage(), v1MissingParameters);
+ }
+ catch (V1OperationFailed v1OperationFailed)
+ {
+ WSRPExceptionFactory.throwWSException(OperationFailed.class, v1OperationFailed.getMessage(), v1OperationFailed);
+ }
}
@Override
@@ -92,43 +144,43 @@
@Override
public void getPortletsLifetime(RegistrationContext registrationContext, List<PortletContext> portletContext, UserContext userContext, Holder<List<PortletLifetime>> portletLifetime, Holder<List<FailedPortlets>> failedPortlets, Holder<ResourceList> resourceList, Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ WSRPExceptionFactory.throwWSException(OperationNotSupported.class, "getPortletsLifetime not supported in WSRP 1", null);
}
@Override
public void setPortletsLifetime(RegistrationContext registrationContext, List<PortletContext> portletContext, UserContext userContext, Lifetime lifetime, Holder<List<PortletLifetime>> updatedPortlet, Holder<List<FailedPortlets>> failedPortlets, Holder<ResourceList> resourceList, Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ WSRPExceptionFactory.throwWSException(OperationNotSupported.class, "setPortletsLifetime not supported in WSRP 1", null);
}
@Override
public void copyPortlets(RegistrationContext toRegistrationContext, UserContext toUserContext, RegistrationContext fromRegistrationContext, UserContext fromUserContext, List<PortletContext> fromPortletContexts, Lifetime lifetime, Holder<List<CopiedPortlet>> copiedPortlets, Holder<List<FailedPortlets>> failedPortlets, Holder<ResourceList> resourceList, Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ WSRPExceptionFactory.throwWSException(OperationNotSupported.class, "copyPortlets not supported in WSRP 1", null);
}
@Override
public void exportPortlets(RegistrationContext registrationContext, List<PortletContext> portletContext, UserContext userContext, Holder<Lifetime> lifetime, Boolean exportByValueRequired, Holder<byte[]> exportContext, Holder<List<ExportedPortlet>> exportedPortlet, Holder<List<FailedPortlets>> failedPortlets, Holder<ResourceList> resourceList, Holder<List<Extension>> extensions) throws AccessDenied, ExportByValueNotSupported, InconsistentParameters, InvalidHandle, InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ WSRPExceptionFactory.throwWSException(OperationNotSupported.class, "exportPortlets not supported in WSRP 1", null);
}
@Override
public void importPortlets(RegistrationContext registrationContext, byte[] importContext, List<ImportPortlet> importPortlet, UserContext userContext, Lifetime lifetime, Holder<List<ImportedPortlet>> importedPortlets, Holder<List<ImportPortletsFailed>> importFailed, Holder<ResourceList> resourceList, Holder<List<Extension>> extensions) throws AccessDenied, ExportNoLongerValid, InconsistentParameters, InvalidRegistration, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ WSRPExceptionFactory.throwWSException(OperationNotSupported.class, "importPortlets not supported in WSRP 1", null);
}
@Override
public List<Extension> releaseExport(RegistrationContext registrationContext, byte[] exportContext, UserContext userContext)
{
- throw new NotYetImplemented();
+ throw new NotYetImplemented(); // WFT? this operation cannot fail? :)
}
@Override
public Lifetime setExportLifetime(SetExportLifetime setExportLifetime) throws AccessDenied, InvalidHandle, InvalidRegistration, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ throw WSRPExceptionFactory.throwWSException(OperationNotSupported.class, "setExportLifetime not supported in WSRP 1", null);
}
@Override
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/PortletManagementEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/PortletManagementEndpoint.java 2010-06-10 08:41:09 UTC (rev 3293)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/PortletManagementEndpoint.java 2010-06-10 16:21:34 UTC (rev 3294)
@@ -24,16 +24,14 @@
package org.gatein.wsrp.endpoints.v1;
import org.gatein.common.NotYetImplemented;
+import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.endpoints.WSRPBaseEndpoint;
+import org.gatein.wsrp.spec.v1.V1ToV2Converter;
+import org.gatein.wsrp.spec.v1.V2ToV1Converter;
+import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
import org.oasis.wsrp.v1.V1AccessDenied;
-import org.oasis.wsrp.v1.V1ClonePortlet;
import org.oasis.wsrp.v1.V1DestroyFailed;
-import org.oasis.wsrp.v1.V1DestroyPortlets;
-import org.oasis.wsrp.v1.V1DestroyPortletsResponse;
import org.oasis.wsrp.v1.V1Extension;
-import org.oasis.wsrp.v1.V1GetPortletDescription;
-import org.oasis.wsrp.v1.V1GetPortletProperties;
-import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
import org.oasis.wsrp.v1.V1InconsistentParameters;
import org.oasis.wsrp.v1.V1InvalidHandle;
import org.oasis.wsrp.v1.V1InvalidRegistration;
@@ -43,16 +41,24 @@
import org.oasis.wsrp.v1.V1OperationFailed;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
-import org.oasis.wsrp.v1.V1PortletDescriptionResponse;
-import org.oasis.wsrp.v1.V1PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v1.V1Property;
import org.oasis.wsrp.v1.V1PropertyList;
import org.oasis.wsrp.v1.V1RegistrationContext;
import org.oasis.wsrp.v1.V1ResetProperty;
import org.oasis.wsrp.v1.V1ResourceList;
-import org.oasis.wsrp.v1.V1SetPortletProperties;
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v1.WSRPV1PortletManagementPortType;
+import org.oasis.wsrp.v2.AccessDenied;
+import org.oasis.wsrp.v2.GetPortletDescription;
+import org.oasis.wsrp.v2.GetPortletProperties;
+import org.oasis.wsrp.v2.InconsistentParameters;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidUserCategory;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletDescriptionResponse;
+import org.oasis.wsrp.v2.PropertyList;
import javax.jws.HandlerChain;
import javax.jws.WebParam;
@@ -158,19 +164,48 @@
@WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>> extensions
) throws V1MissingParameters, V1InconsistentParameters, V1InvalidHandle, V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
{
- /*GetPortletDescription getPortletDescription = new GetPortletDescription();
- getPortletDescription.setRegistrationContext(registrationContext);
- getPortletDescription.setPortletContext(portletContext);
- getPortletDescription.setUserContext(userContext);
+ GetPortletDescription getPortletDescription = new GetPortletDescription();
+ getPortletDescription.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
+ getPortletDescription.setPortletContext(V1ToV2Converter.toV2PortletContext(portletContext));
+ getPortletDescription.setUserContext(V1ToV2Converter.toV2UserContext(userContext));
getPortletDescription.getDesiredLocales().addAll(desiredLocales);
- PortletDescriptionResponse description = producer.getPortletDescription(getPortletDescription);
+ try
+ {
+ PortletDescriptionResponse description = producer.getPortletDescription(getPortletDescription);
- portletDescription.value = description.getPortletDescription();
- resourceList.value = description.getResourceList();
- extensions.value = description.getExtensions();*/
-
- throw new NotYetImplemented();
+ portletDescription.value = V2ToV1Converter.toV1PortletDescription(description.getPortletDescription());
+ resourceList.value = V2ToV1Converter.toV1ResourceList(description.getResourceList());
+ extensions.value = WSRPUtils.transform(description.getExtensions(), V2ToV1Converter.EXTENSION);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ WSRP1ExceptionFactory.throwWSException(accessDenied.getClass(), accessDenied.getMessage(), accessDenied);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ WSRP1ExceptionFactory.throwWSException(invalidHandle.getClass(), invalidHandle.getMessage(), invalidHandle);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ WSRP1ExceptionFactory.throwWSException(invalidUserCategory.getClass(), invalidUserCategory.getMessage(), invalidUserCategory);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ WSRP1ExceptionFactory.throwWSException(inconsistentParameters.getClass(), inconsistentParameters.getMessage(), inconsistentParameters);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ WSRP1ExceptionFactory.throwWSException(missingParameters.getClass(), missingParameters.getMessage(), missingParameters);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ WSRP1ExceptionFactory.throwWSException(invalidRegistration.getClass(), invalidRegistration.getMessage(), invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ WSRP1ExceptionFactory.throwWSException(operationFailed.getClass(), operationFailed.getMessage(), operationFailed);
+ }
}
public void getPortletProperties(
@@ -183,19 +218,49 @@
@WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>> extensions
) throws V1MissingParameters, V1InconsistentParameters, V1InvalidHandle, V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
{
- /*GetPortletProperties getPortletProperties = new GetPortletProperties();
- getPortletProperties.setRegistrationContext(registrationContext);
- getPortletProperties.setPortletContext(portletContext);
- getPortletProperties.setUserContext(userContext);
+ GetPortletProperties getPortletProperties = new GetPortletProperties();
+ getPortletProperties.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
+ getPortletProperties.setPortletContext(V1ToV2Converter.toV2PortletContext(portletContext));
+ getPortletProperties.setUserContext(V1ToV2Converter.toV2UserContext(userContext));
getPortletProperties.getNames().addAll(names);
- PropertyList result = producer.getPortletProperties(getPortletProperties);
+ try
+ {
+ PropertyList result = producer.getPortletProperties(getPortletProperties);
- properties.value = result.getProperties();
- resetProperties.value = result.getResetProperties();
- extensions.value = result.getExtensions();*/
+ properties.value = WSRPUtils.transform(result.getProperties(), V2ToV1Converter.PROPERTY);
+ resetProperties.value = WSRPUtils.transform(result.getResetProperties(), V2ToV1Converter.RESETPROPERTY);
+ extensions.value = WSRPUtils.transform(result.getExtensions(), V2ToV1Converter.EXTENSION);
- throw new NotYetImplemented();
+ }
+ catch (AccessDenied accessDenied)
+ {
+ WSRP1ExceptionFactory.throwWSException(accessDenied.getClass(), accessDenied.getMessage(), accessDenied);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ WSRP1ExceptionFactory.throwWSException(invalidHandle.getClass(), invalidHandle.getMessage(), invalidHandle);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ WSRP1ExceptionFactory.throwWSException(invalidUserCategory.getClass(), invalidUserCategory.getMessage(), invalidUserCategory);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ WSRP1ExceptionFactory.throwWSException(inconsistentParameters.getClass(), inconsistentParameters.getMessage(), inconsistentParameters);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ WSRP1ExceptionFactory.throwWSException(missingParameters.getClass(), missingParameters.getMessage(), missingParameters);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ WSRP1ExceptionFactory.throwWSException(invalidRegistration.getClass(), invalidRegistration.getMessage(), invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ WSRP1ExceptionFactory.throwWSException(operationFailed.getClass(), operationFailed.getMessage(), operationFailed);
+ }
}
public void destroyPortlets(
14 years, 6 months
gatein SVN: r3293 - in components/wsrp/trunk: common/src/main/java/org/gatein/wsrp/spec/v1 and 3 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-10 04:41:09 -0400 (Thu, 10 Jun 2010)
New Revision: 3293
Added:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java
Removed:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java
Log:
- Split V2V1Converter into 2 classes one for V2 to V1 and another for V1 to V2.
- Renamed constants so that they're shorter and less redundant now that the V2V1Converter has been split.
- Moved transform method to WSRPUtils. Should consider moving it to common, maybe re-implementing that portion of Google collections to avoid dependency.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2010-06-10 07:58:14 UTC (rev 3292)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -23,6 +23,8 @@
package org.gatein.wsrp;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
import org.gatein.common.i18n.LocaleFormat;
import org.gatein.common.net.URLTools;
import org.gatein.common.util.ConversionException;
@@ -501,6 +503,27 @@
}
/**
+ * Todo: Should be moved to common module?
+ *
+ * @param fromList
+ * @param function
+ * @param <F>
+ * @param <T>
+ * @return
+ */
+ public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function)
+ {
+ if (fromList == null)
+ {
+ return null;
+ }
+ else
+ {
+ return Lists.transform(fromList, function);
+ }
+ }
+
+ /**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
Added: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java (rev 0)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -0,0 +1,876 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.wsrp.spec.v1;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import org.gatein.common.NotYetImplemented;
+import org.gatein.pc.api.OpaqueStateString;
+import org.gatein.wsrp.WSRPExceptionFactory;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.WSRPUtils;
+import org.oasis.wsrp.v1.V1ClientData;
+import org.oasis.wsrp.v1.V1Contact;
+import org.oasis.wsrp.v1.V1CookieProtocol;
+import org.oasis.wsrp.v1.V1EmployerInfo;
+import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InteractionParams;
+import org.oasis.wsrp.v1.V1ItemDescription;
+import org.oasis.wsrp.v1.V1LocalizedString;
+import org.oasis.wsrp.v1.V1MarkupParams;
+import org.oasis.wsrp.v1.V1MarkupType;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1ModelTypes;
+import org.oasis.wsrp.v1.V1NamedString;
+import org.oasis.wsrp.v1.V1Online;
+import org.oasis.wsrp.v1.V1PersonName;
+import org.oasis.wsrp.v1.V1PortletContext;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1Postal;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1Resource;
+import org.oasis.wsrp.v1.V1ResourceList;
+import org.oasis.wsrp.v1.V1ResourceValue;
+import org.oasis.wsrp.v1.V1RuntimeContext;
+import org.oasis.wsrp.v1.V1ServiceDescription;
+import org.oasis.wsrp.v1.V1StateChange;
+import org.oasis.wsrp.v1.V1Telecom;
+import org.oasis.wsrp.v1.V1TelephoneNum;
+import org.oasis.wsrp.v1.V1Templates;
+import org.oasis.wsrp.v1.V1UploadContext;
+import org.oasis.wsrp.v1.V1UserContext;
+import org.oasis.wsrp.v1.V1UserProfile;
+import org.oasis.wsrp.v2.ClientData;
+import org.oasis.wsrp.v2.Contact;
+import org.oasis.wsrp.v2.CookieProtocol;
+import org.oasis.wsrp.v2.EmployerInfo;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.InteractionParams;
+import org.oasis.wsrp.v2.ItemDescription;
+import org.oasis.wsrp.v2.LocalizedString;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MarkupType;
+import org.oasis.wsrp.v2.ModelDescription;
+import org.oasis.wsrp.v2.ModelTypes;
+import org.oasis.wsrp.v2.NamedString;
+import org.oasis.wsrp.v2.Online;
+import org.oasis.wsrp.v2.PersonName;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.Postal;
+import org.oasis.wsrp.v2.PropertyDescription;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.Resource;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.ResourceValue;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.ServiceDescription;
+import org.oasis.wsrp.v2.SessionParams;
+import org.oasis.wsrp.v2.StateChange;
+import org.oasis.wsrp.v2.Telecom;
+import org.oasis.wsrp.v2.TelephoneNum;
+import org.oasis.wsrp.v2.Templates;
+import org.oasis.wsrp.v2.UploadContext;
+import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v2.UserProfile;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class V1ToV2Converter
+{
+ public static final V1ToV2Extension EXTENSION = new V1ToV2Extension();
+ public static final V1ToV2MarkupType MARKUPTYPE = new V1ToV2MarkupType();
+ public static final V1ToV2PortletDescription PORTLETDESCRIPTION = new V1ToV2PortletDescription();
+ public static final V1ToV2LocalizedString LOCALIZEDSTRING = new V1ToV2LocalizedString();
+ public static final V1ToV2ItemDescription ITEMDESCRIPTION = new V1ToV2ItemDescription();
+ public static final V1ToV2PropertyDescription PROPERTYDESCRIPTION = new V1ToV2PropertyDescription();
+ public static final V1ToV2Resource RESOURCE = new V1ToV2Resource();
+ public static final V1ToV2ResourceValue RESOURCEVALUE = new V1ToV2ResourceValue();
+ public static final V1ToV2NamedString NAMEDSTRING = new V1ToV2NamedString();
+ public static final V1ToV2UploadContext UPLOADCONTEXT = new V1ToV2UploadContext();
+
+ public static MarkupParams toV2MarkupParams(V1MarkupParams v1MarkupParams)
+ {
+ if (v1MarkupParams != null)
+ {
+ MarkupParams markupParams = WSRPTypeFactory.createMarkupParams(v1MarkupParams.isSecureClientCommunication(),
+ v1MarkupParams.getLocales(), v1MarkupParams.getMimeTypes(), v1MarkupParams.getMode(),
+ v1MarkupParams.getWindowState());
+ markupParams.setClientData(toV2ClientData(v1MarkupParams.getClientData()));
+
+ // we can't create an opaquestatestring if with a null string, so need to check
+ if (v1MarkupParams.getNavigationalState() != null)
+ {
+ markupParams.setNavigationalContext(WSRPTypeFactory.createNavigationalContextOrNull(
+ new OpaqueStateString(v1MarkupParams.getNavigationalState()), null));
+ }
+ markupParams.setValidateTag(v1MarkupParams.getValidateTag());
+
+ List<String> charSets = v1MarkupParams.getMarkupCharacterSets();
+ if (charSets != null)
+ {
+ markupParams.getMarkupCharacterSets().addAll(charSets);
+ }
+ List<String> validNewModes = v1MarkupParams.getValidNewModes();
+ if (validNewModes != null)
+ {
+ markupParams.getValidNewModes().addAll(validNewModes);
+ }
+ List<String> validNewWindowStates = v1MarkupParams.getValidNewWindowStates();
+ if (validNewWindowStates != null)
+ {
+ markupParams.getValidNewWindowStates().addAll(validNewWindowStates);
+ }
+
+ List<Extension> extensions = WSRPUtils.transform(v1MarkupParams.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ markupParams.getExtensions().addAll(extensions);
+ }
+ return markupParams;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static ClientData toV2ClientData(V1ClientData v1ClientData)
+ {
+ if (v1ClientData != null)
+ {
+ ClientData clientData = WSRPTypeFactory.createClientData(v1ClientData.getUserAgent());
+
+ List<V1Extension> extensions = v1ClientData.getExtensions();
+ if (extensions != null)
+ {
+ clientData.getExtensions().addAll(Lists.transform(extensions, EXTENSION));
+ }
+
+ return clientData;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static PortletContext toV2PortletContext(V1PortletContext v1PortletContext)
+ {
+ if (v1PortletContext != null)
+ {
+ PortletContext portletContext = WSRPTypeFactory.createPortletContext(v1PortletContext.getPortletHandle(), v1PortletContext.getPortletState());
+
+ List<V1Extension> extensions = v1PortletContext.getExtensions();
+ if (extensions != null)
+ {
+ portletContext.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return portletContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static RegistrationContext toV2RegistrationContext(V1RegistrationContext registrationContext)
+ {
+ if (registrationContext != null)
+ {
+ RegistrationContext result = WSRPTypeFactory.createRegistrationContext(registrationContext.getRegistrationHandle());
+ result.setRegistrationState(registrationContext.getRegistrationState());
+ List<Extension> extensions = WSRPUtils.transform(registrationContext.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static RuntimeContext toV2RuntimeContext(V1RuntimeContext v1RuntimeContext)
+ {
+ if (v1RuntimeContext != null)
+ {
+ RuntimeContext runtimeContext = WSRPTypeFactory.createRuntimeContext(v1RuntimeContext.getUserAuthentication());
+ runtimeContext.setNamespacePrefix(v1RuntimeContext.getNamespacePrefix());
+ runtimeContext.setPortletInstanceKey(v1RuntimeContext.getPortletInstanceKey());
+
+ //TODO: handle the SessionParams better
+ SessionParams sessionParams = new SessionParams();
+ sessionParams.setSessionID(v1RuntimeContext.getSessionID());
+
+ runtimeContext.setSessionParams(sessionParams);
+ runtimeContext.setTemplates(toV2Templates(v1RuntimeContext.getTemplates()));
+
+ List<V1Extension> extensions = v1RuntimeContext.getExtensions();
+ if (extensions != null)
+ {
+ runtimeContext.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return runtimeContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Templates toV2Templates(V1Templates v1Templates)
+ {
+ if (v1Templates != null)
+ {
+ //TODO: should we be using the WSRP1TypeFactory,createTemplates(PortletInvocationContext) instead?
+ Templates templates = new Templates();
+ templates.setBlockingActionTemplate(v1Templates.getBlockingActionTemplate());
+ templates.setDefaultTemplate(v1Templates.getDefaultTemplate());
+ templates.setRenderTemplate(v1Templates.getRenderTemplate());
+ templates.setResourceTemplate(v1Templates.getResourceTemplate());
+ templates.setSecureBlockingActionTemplate(v1Templates.getSecureBlockingActionTemplate());
+ templates.setSecureRenderTemplate(v1Templates.getSecureRenderTemplate());
+ templates.setSecureResourceTemplate(v1Templates.getSecureResourceTemplate());
+
+ List<V1Extension> extensions = v1Templates.getExtensions();
+ if (extensions != null)
+ {
+ templates.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return templates;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static UserContext toV2UserContext(V1UserContext v1UserContext)
+ {
+ if (v1UserContext != null)
+ {
+ UserContext userContext = WSRPTypeFactory.createUserContext(v1UserContext.getUserContextKey());
+ userContext.setProfile(toV2UserProfile(v1UserContext.getProfile()));
+
+ List<V1Extension> extensions = v1UserContext.getExtensions();
+ if (extensions != null)
+ {
+ userContext.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ if (v1UserContext.getUserCategories() != null)
+ {
+ userContext.getUserCategories().addAll(v1UserContext.getUserCategories());
+ }
+
+ return userContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static UserProfile toV2UserProfile(V1UserProfile v1UserProfile)
+ {
+ if (v1UserProfile != null)
+ {
+ UserProfile userProfile = new UserProfile();
+ userProfile.setBdate(v1UserProfile.getBdate());
+ userProfile.setBusinessInfo(toV2Context(v1UserProfile.getBusinessInfo()));
+ userProfile.setEmployerInfo(toV2EmployerInfo(v1UserProfile.getEmployerInfo()));
+ userProfile.setGender(v1UserProfile.getGender());
+ userProfile.setHomeInfo(toV2Context(v1UserProfile.getHomeInfo()));
+ userProfile.setName(toV2PersonName(v1UserProfile.getName()));
+
+ return userProfile;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static EmployerInfo toV2EmployerInfo(V1EmployerInfo v1EmployerInfo)
+ {
+ if (v1EmployerInfo != null)
+ {
+ EmployerInfo employerInfo = new EmployerInfo();
+ employerInfo.setDepartment(v1EmployerInfo.getDepartment());
+ employerInfo.setEmployer(v1EmployerInfo.getEmployer());
+ employerInfo.setJobtitle(v1EmployerInfo.getJobtitle());
+
+ List<V1Extension> extensions = v1EmployerInfo.getExtensions();
+ if (extensions != null)
+ {
+ employerInfo.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return employerInfo;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static PersonName toV2PersonName(V1PersonName v1PersonName)
+ {
+ if (v1PersonName != null)
+ {
+ PersonName personName = new PersonName();
+ personName.setFamily(v1PersonName.getFamily());
+ personName.setGiven(v1PersonName.getGiven());
+ personName.setMiddle(v1PersonName.getMiddle());
+ personName.setNickname(v1PersonName.getNickname());
+ personName.setPrefix(v1PersonName.getPrefix());
+ personName.setSuffix(v1PersonName.getSuffix());
+
+ List<V1Extension> extensions = v1PersonName.getExtensions();
+ if (extensions != null)
+ {
+ personName.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return personName;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Contact toV2Context(V1Contact v1Contact)
+ {
+ if (v1Contact != null)
+ {
+ Contact contact = new Contact();
+ contact.setOnline(toV2Online(v1Contact.getOnline()));
+ contact.setPostal(toV2Postal(v1Contact.getPostal()));
+ contact.setTelecom(toV2Telecom(v1Contact.getTelecom()));
+
+ List<V1Extension> extensions = v1Contact.getExtensions();
+ if (extensions != null)
+ {
+ contact.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return contact;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Online toV2Online(V1Online v1Online)
+ {
+ if (v1Online != null)
+ {
+ Online online = new Online();
+ online.setEmail(v1Online.getEmail());
+ online.setUri(v1Online.getUri());
+
+ List<V1Extension> extensions = v1Online.getExtensions();
+ if (extensions != null)
+ {
+ online.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return online;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Postal toV2Postal(V1Postal v1Postal)
+ {
+ if (v1Postal != null)
+ {
+ Postal postal = new Postal();
+ postal.setCity(v1Postal.getCity());
+ postal.setCountry(v1Postal.getCountry());
+ postal.setName(v1Postal.getName());
+ postal.setOrganization(v1Postal.getOrganization());
+ postal.setPostalcode(v1Postal.getPostalcode());
+ postal.setStateprov(v1Postal.getStateprov());
+ postal.setStreet(v1Postal.getStreet());
+
+ List<V1Extension> extensions = v1Postal.getExtensions();
+ if (extensions != null)
+ {
+ postal.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return postal;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Telecom toV2Telecom(V1Telecom v1Telecom)
+ {
+ if (v1Telecom != null)
+ {
+ Telecom telecom = new Telecom();
+ telecom.setFax(toV2TelephoneNum(v1Telecom.getFax()));
+ telecom.setMobile(toV2TelephoneNum(v1Telecom.getMobile()));
+ telecom.setPager(toV2TelephoneNum(v1Telecom.getPager()));
+ telecom.setTelephone(toV2TelephoneNum(v1Telecom.getTelephone()));
+
+ List<V1Extension> extensions = v1Telecom.getExtensions();
+ if (extensions != null)
+ {
+ telecom.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return telecom;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static TelephoneNum toV2TelephoneNum(V1TelephoneNum v1TelephoneNum)
+ {
+ if (v1TelephoneNum != null)
+ {
+ TelephoneNum telephoneNum = new TelephoneNum();
+ telephoneNum.setComment(v1TelephoneNum.getComment());
+ telephoneNum.setExt(v1TelephoneNum.getExt());
+ telephoneNum.setIntcode(v1TelephoneNum.getIntcode());
+ telephoneNum.setLoccode(v1TelephoneNum.getLoccode());
+ telephoneNum.setNumber(v1TelephoneNum.getNumber());
+
+ List<V1Extension> extensions = v1TelephoneNum.getExtensions();
+ if (extensions != null)
+ {
+ telephoneNum.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return telephoneNum;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static ServiceDescription toV2ServiceDescription(V1ServiceDescription v1ServiceDescription)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public static <E extends Exception> E toV2Exception(Class<E> v2ExceptionClass, Exception v1Exception)
+ {
+ if (!"org.oasis.wsrp.v2".equals(v2ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception class is not a WSRP 2 exception: " + v2ExceptionClass);
+ }
+
+ Class<? extends Exception> v1ExceptionClass = v1Exception.getClass();
+ String v1Name = v1ExceptionClass.getSimpleName();
+ int v1Index = v1Name.indexOf("V1");
+ if (v1Index != 0 && !"org.oasis.wsrp.v1".equals(v1ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception is not a WSRP 1 exception: " + v1Exception);
+ }
+
+ String v2Name = v2ExceptionClass.getSimpleName();
+ // V2 class name should match V1 class name minus "V1"
+ if (!v2Name.equals(v1Name.substring(2)))
+ {
+ throw new IllegalArgumentException("Exception names do not match. Requested: " + v2Name
+ + ", was given: " + v1Name);
+ }
+
+ return WSRPExceptionFactory.createWSException(v2ExceptionClass, v1Exception.getMessage(), v1Exception.getCause());
+ }
+
+ public static InteractionParams toV2InteractionParams(V1InteractionParams v1InteractionParams)
+ {
+ if (v1InteractionParams != null)
+ {
+ InteractionParams interactionParams = WSRPTypeFactory.createInteractionParams(toV2StateChange(v1InteractionParams.getPortletStateChange()));
+ interactionParams.setInteractionState(v1InteractionParams.getInteractionState());
+ interactionParams.getExtensions().addAll(Lists.transform(v1InteractionParams.getExtensions(), EXTENSION));
+ interactionParams.getFormParameters().addAll(Lists.transform(v1InteractionParams.getFormParameters(), NAMEDSTRING));
+ interactionParams.getUploadContexts().addAll(Lists.transform(v1InteractionParams.getUploadContexts(), UPLOADCONTEXT));
+
+ return interactionParams;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static StateChange toV2StateChange(V1StateChange v1StateChange)
+ {
+ if (v1StateChange != null)
+ {
+ return StateChange.valueOf((v1StateChange.value()));
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static LocalizedString toV2LocalizedString(V1LocalizedString localizedString)
+ {
+ return LOCALIZEDSTRING.apply(localizedString);
+ }
+
+ public static CookieProtocol toV2CookieProtocol(V1CookieProtocol v1CookieProtocol)
+ {
+ if (v1CookieProtocol != null)
+ {
+ return CookieProtocol.fromValue(v1CookieProtocol.value());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static ModelDescription toV2ModelDescription(V1ModelDescription v1ModelDescription)
+ {
+ if (v1ModelDescription != null)
+ {
+ ModelDescription result = WSRPTypeFactory.createModelDescription(WSRPUtils.transform(v1ModelDescription.getPropertyDescriptions(), PROPERTYDESCRIPTION));
+ List<Extension> extensions = WSRPUtils.transform(v1ModelDescription.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ result.setModelTypes(toV2ModelTypes(v1ModelDescription.getModelTypes()));
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static ModelTypes toV2ModelTypes(V1ModelTypes modelTypes)
+ {
+ if (modelTypes != null)
+ {
+ ModelTypes result = new ModelTypes();
+ result.setAny(modelTypes.getAny());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static ResourceList toV2ResourceList(V1ResourceList v1ResourceList)
+ {
+ if (v1ResourceList != null)
+ {
+ ResourceList result = new ResourceList();
+
+ List<Extension> extensions = WSRPUtils.transform(v1ResourceList.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ List<Resource> resources = WSRPUtils.transform(v1ResourceList.getResources(), RESOURCE);
+ if (resources != null)
+ {
+ result.getResources().addAll(resources);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static class V1ToV2Extension implements Function<V1Extension, Extension>
+ {
+ public Extension apply(V1Extension from)
+ {
+ if (from != null)
+ {
+ Extension extension = new Extension();
+ extension.setAny(from.getAny());
+ return extension;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public static class V1ToV2PortletDescription implements Function<V1PortletDescription, PortletDescription>
+ {
+
+ public PortletDescription apply(V1PortletDescription from)
+ {
+ if (from != null)
+ {
+ PortletDescription result = WSRPTypeFactory.createPortletDescription(from.getPortletHandle(),
+ WSRPUtils.transform(from.getMarkupTypes(), MARKUPTYPE));
+ result.setDescription(LOCALIZEDSTRING.apply(from.getDescription()));
+ result.setDisplayName(LOCALIZEDSTRING.apply(from.getDisplayName()));
+ List<Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ List<LocalizedString> keywords = WSRPUtils.transform(from.getKeywords(), LOCALIZEDSTRING);
+ if (keywords != null)
+ {
+ result.getKeywords().addAll(keywords);
+ }
+ List<String> userCategories = from.getUserCategories();
+ if (userCategories != null)
+ {
+ result.getUserCategories().addAll(userCategories);
+ }
+ List<String> userProfileItems = from.getUserProfileItems();
+ if (userProfileItems != null)
+ {
+ result.getUserProfileItems().addAll(userProfileItems);
+ }
+ result.setDefaultMarkupSecure(from.isDefaultMarkupSecure());
+ result.setDoesUrlTemplateProcessing(from.isDoesUrlTemplateProcessing());
+ result.setTemplatesStoredInSession(from.isTemplatesStoredInSession());
+ result.setHasUserSpecificState(from.isHasUserSpecificState());
+ result.setOnlySecure(from.isOnlySecure());
+ result.setUserContextStoredInSession(from.isUserContextStoredInSession());
+ result.setUsesMethodGet(from.isUsesMethodGet());
+ result.setShortTitle(LOCALIZEDSTRING.apply(from.getShortTitle()));
+ result.setTitle(LOCALIZEDSTRING.apply(from.getTitle()));
+
+ result.setGroupID(from.getGroupID());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public static class V1ToV2ItemDescription implements Function<V1ItemDescription, ItemDescription>
+ {
+
+ public ItemDescription apply(V1ItemDescription from)
+ {
+ if (from != null)
+ {
+ ItemDescription result = new ItemDescription();
+ result.setItemName(from.getItemName());
+ result.setDescription(LOCALIZEDSTRING.apply(from.getDescription()));
+ List<Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public static class V1ToV2NamedString implements Function<V1NamedString, NamedString>
+ {
+ public NamedString apply(V1NamedString v1NamedString)
+ {
+ if (v1NamedString != null)
+ {
+ NamedString result = new NamedString();
+ result.setName(v1NamedString.getName());
+ result.setValue(v1NamedString.getValue());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public static class V1ToV2UploadContext implements Function<V1UploadContext, UploadContext>
+ {
+
+ public UploadContext apply(V1UploadContext v1UploadContext)
+ {
+ if (v1UploadContext != null)
+ {
+ UploadContext result = WSRPTypeFactory.createUploadContext(v1UploadContext.getMimeType(), v1UploadContext.getUploadData());
+ result.getExtensions().addAll(Lists.transform(v1UploadContext.getExtensions(), EXTENSION));
+ result.getMimeAttributes().addAll(Lists.transform(v1UploadContext.getMimeAttributes(), NAMEDSTRING));
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ }
+
+ public static class V1ToV2MarkupType implements Function<V1MarkupType, MarkupType>
+ {
+
+ public MarkupType apply(V1MarkupType from)
+ {
+ if (from != null)
+ {
+ MarkupType result = WSRPTypeFactory.createMarkupType(from.getMimeType(), from.getModes(), from.getWindowStates(), from.getLocales());
+ List<Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public static class V1ToV2LocalizedString implements Function<V1LocalizedString, LocalizedString>
+ {
+
+ public LocalizedString apply(V1LocalizedString from)
+ {
+ if (from != null)
+ {
+ return WSRPTypeFactory.createLocalizedString(from.getLang(), from.getResourceName(), from.getValue());
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+ }
+
+ public static class V1ToV2Resource implements Function<V1Resource, Resource>
+ {
+ public Resource apply(V1Resource from)
+ {
+ if (from != null)
+ {
+ Resource result = new Resource();
+ result.setResourceName(from.getResourceName());
+ List<ResourceValue> values = WSRPUtils.transform(from.getValues(), RESOURCEVALUE);
+ if (values != null)
+ {
+ result.getValues().addAll(values);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ }
+
+ public static class V1ToV2ResourceValue implements Function<V1ResourceValue, ResourceValue>
+ {
+ public ResourceValue apply(V1ResourceValue from)
+ {
+ if (from != null)
+ {
+ ResourceValue result = new ResourceValue();
+ result.setLang(from.getLang());
+ result.setValue(from.getValue());
+ List<Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public static class V1ToV2PropertyDescription implements Function<V1PropertyDescription, PropertyDescription>
+ {
+ public PropertyDescription apply(V1PropertyDescription from)
+ {
+ if (from != null)
+ {
+ PropertyDescription result = WSRPTypeFactory.createPropertyDescription(from.getName(), from.getType());
+ result.setHint(toV2LocalizedString(from.getHint()));
+ result.setLabel(toV2LocalizedString(from.getLabel()));
+ List<Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
Copied: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java (from rev 3284, components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java)
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java (rev 0)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -0,0 +1,981 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.gatein.wsrp.spec.v1;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import org.gatein.common.NotYetImplemented;
+import org.gatein.wsrp.WSRPUtils;
+import org.oasis.wsrp.v1.V1CacheControl;
+import org.oasis.wsrp.v1.V1ClientData;
+import org.oasis.wsrp.v1.V1Contact;
+import org.oasis.wsrp.v1.V1CookieProtocol;
+import org.oasis.wsrp.v1.V1EmployerInfo;
+import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InteractionParams;
+import org.oasis.wsrp.v1.V1ItemDescription;
+import org.oasis.wsrp.v1.V1LocalizedString;
+import org.oasis.wsrp.v1.V1MarkupContext;
+import org.oasis.wsrp.v1.V1MarkupParams;
+import org.oasis.wsrp.v1.V1MarkupType;
+import org.oasis.wsrp.v1.V1ModelDescription;
+import org.oasis.wsrp.v1.V1ModelTypes;
+import org.oasis.wsrp.v1.V1NamedString;
+import org.oasis.wsrp.v1.V1Online;
+import org.oasis.wsrp.v1.V1PersonName;
+import org.oasis.wsrp.v1.V1PortletContext;
+import org.oasis.wsrp.v1.V1PortletDescription;
+import org.oasis.wsrp.v1.V1Postal;
+import org.oasis.wsrp.v1.V1PropertyDescription;
+import org.oasis.wsrp.v1.V1RegistrationContext;
+import org.oasis.wsrp.v1.V1Resource;
+import org.oasis.wsrp.v1.V1ResourceList;
+import org.oasis.wsrp.v1.V1ResourceValue;
+import org.oasis.wsrp.v1.V1RuntimeContext;
+import org.oasis.wsrp.v1.V1SessionContext;
+import org.oasis.wsrp.v1.V1StateChange;
+import org.oasis.wsrp.v1.V1Telecom;
+import org.oasis.wsrp.v1.V1TelephoneNum;
+import org.oasis.wsrp.v1.V1Templates;
+import org.oasis.wsrp.v1.V1UpdateResponse;
+import org.oasis.wsrp.v1.V1UploadContext;
+import org.oasis.wsrp.v1.V1UserContext;
+import org.oasis.wsrp.v1.V1UserProfile;
+import org.oasis.wsrp.v2.CacheControl;
+import org.oasis.wsrp.v2.ClientData;
+import org.oasis.wsrp.v2.Contact;
+import org.oasis.wsrp.v2.CookieProtocol;
+import org.oasis.wsrp.v2.EmployerInfo;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.InteractionParams;
+import org.oasis.wsrp.v2.ItemDescription;
+import org.oasis.wsrp.v2.LocalizedString;
+import org.oasis.wsrp.v2.MarkupContext;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MarkupType;
+import org.oasis.wsrp.v2.ModelDescription;
+import org.oasis.wsrp.v2.ModelTypes;
+import org.oasis.wsrp.v2.NamedString;
+import org.oasis.wsrp.v2.Online;
+import org.oasis.wsrp.v2.PersonName;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.Postal;
+import org.oasis.wsrp.v2.PropertyDescription;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.Resource;
+import org.oasis.wsrp.v2.ResourceList;
+import org.oasis.wsrp.v2.ResourceValue;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.SessionContext;
+import org.oasis.wsrp.v2.StateChange;
+import org.oasis.wsrp.v2.Telecom;
+import org.oasis.wsrp.v2.TelephoneNum;
+import org.oasis.wsrp.v2.Templates;
+import org.oasis.wsrp.v2.UpdateResponse;
+import org.oasis.wsrp.v2.UploadContext;
+import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v2.UserProfile;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class V2ToV1Converter
+{
+
+ public static final V2ToV1Extension EXTENSION = new V2ToV1Extension();
+ public static final V2ToV1MarkupType MARKUPTYPE = new V2ToV1MarkupType();
+ public static final V2ToV1PortletDescription PORTLETDESCRIPTION = new V2ToV1PortletDescription();
+ public static final V2ToV1LocalizedString LOCALIZEDSTRING = new V2ToV1LocalizedString();
+ public static final V2ToV1ItemDescription ITEMDESCRIPTION = new V2ToV1ItemDescription();
+ public static final V2ToV1PropertyDescription PROPERTYDESCRIPTION = new V2ToV1PropertyDescription();
+ public static final V2ToV1Resource RESOURCE = new V2ToV1Resource();
+ public static final V2ToV1ResourceValue RESOURCEVALUE = new V2ToV1ResourceValue();
+ public static final V2ToV1NamedString NAMEDSTRING = new V2ToV1NamedString();
+ public static final V2ToV1UploadContext UPLOADCONTEXT = new V2ToV1UploadContext();
+
+
+ public static V1PortletDescription toV1PortletDescription(PortletDescription portletDescription)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public static V1PortletContext toV1PortletContext(PortletContext portletContext)
+ {
+ if (portletContext != null)
+ {
+ V1PortletContext v1PortletContext = WSRP1TypeFactory.createPortletContext(portletContext.getPortletHandle(), portletContext.getPortletState());
+
+ List<V1Extension> extensions = WSRPUtils.transform(portletContext.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ v1PortletContext.getExtensions().addAll(extensions);
+ }
+
+ return v1PortletContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1MarkupParams toV1MarkupParams(MarkupParams markupParams)
+ {
+ if (markupParams != null)
+ {
+ V1MarkupParams v1MarkupParams = WSRP1TypeFactory.createMarkupParams(markupParams.isSecureClientCommunication(), markupParams.getLocales(),
+ markupParams.getMimeTypes(), markupParams.getMode(), markupParams.getWindowState());
+
+ v1MarkupParams.setClientData(toV1ClientData(markupParams.getClientData()));
+ v1MarkupParams.setNavigationalState(markupParams.getNavigationalContext().getOpaqueValue());
+ v1MarkupParams.setValidateTag(markupParams.getValidateTag());
+
+ List<String> charSets = markupParams.getMarkupCharacterSets();
+ if (charSets != null)
+ {
+ v1MarkupParams.getMarkupCharacterSets().addAll(charSets);
+ }
+
+ List<String> validNewModes = markupParams.getValidNewModes();
+ if (validNewModes != null)
+ {
+ v1MarkupParams.getValidNewModes().addAll(validNewModes);
+ }
+
+ List<String> validNewWindowStates = markupParams.getValidNewWindowStates();
+ if (validNewWindowStates != null)
+ {
+ v1MarkupParams.getValidNewWindowStates().addAll(validNewWindowStates);
+ }
+
+ List<V1Extension> extensions = WSRPUtils.transform(markupParams.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ v1MarkupParams.getExtensions().addAll(extensions);
+ }
+
+ return v1MarkupParams;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private static V1ClientData toV1ClientData(ClientData clientData)
+ {
+ if (clientData != null)
+ {
+ V1ClientData v1ClientData = WSRP1TypeFactory.createClientData(clientData.getUserAgent());
+
+ List<Extension> extensions = clientData.getExtensions();
+ if (extensions != null)
+ {
+ v1ClientData.getExtensions().addAll(Lists.transform(extensions, EXTENSION));
+ }
+
+ return v1ClientData;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1RuntimeContext toV1RuntimeContext(RuntimeContext runtimeContext)
+ {
+ if (runtimeContext != null)
+ {
+ V1RuntimeContext v1RuntimeContext = WSRP1TypeFactory.createRuntimeContext(runtimeContext.getUserAuthentication());
+ v1RuntimeContext.setNamespacePrefix(runtimeContext.getNamespacePrefix());
+ v1RuntimeContext.setPortletInstanceKey(runtimeContext.getPortletInstanceKey());
+ v1RuntimeContext.setSessionID(runtimeContext.getSessionParams().getSessionID());
+ v1RuntimeContext.setTemplates(V2ToV1Converter.toV1Templates(runtimeContext.getTemplates()));
+
+ List<Extension> extensions = runtimeContext.getExtensions();
+ if (extensions != null)
+ {
+ v1RuntimeContext.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1RuntimeContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1Templates toV1Templates(Templates templates)
+ {
+ if (templates != null)
+ {
+ //TODO: should we be using the WSRP1TypeFactory,createTemplates(PortletInvocationContext) instead?
+ V1Templates v1Templates = new V1Templates();
+ v1Templates.setBlockingActionTemplate(templates.getBlockingActionTemplate());
+ v1Templates.setDefaultTemplate(templates.getDefaultTemplate());
+ v1Templates.setRenderTemplate(templates.getRenderTemplate());
+ v1Templates.setResourceTemplate(templates.getResourceTemplate());
+ v1Templates.setSecureBlockingActionTemplate(templates.getSecureBlockingActionTemplate());
+ v1Templates.setSecureRenderTemplate(templates.getSecureRenderTemplate());
+ v1Templates.setSecureResourceTemplate(templates.getSecureResourceTemplate());
+
+ List<Extension> extensions = templates.getExtensions();
+ if (extensions != null)
+ {
+ v1Templates.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1Templates;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1UserContext toV1UserContext(UserContext userContext)
+ {
+ if (userContext != null)
+ {
+ V1UserContext v1UserContext = WSRP1TypeFactory.createUserContext(userContext.getUserContextKey());
+
+ v1UserContext.setProfile(toV1UserProfile(userContext.getProfile()));
+
+ List<Extension> extensions = userContext.getExtensions();
+ if (extensions != null)
+ {
+ v1UserContext.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ if (userContext.getUserCategories() != null)
+ {
+ v1UserContext.getUserCategories().addAll(userContext.getUserCategories());
+ }
+
+ return v1UserContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1UserProfile toV1UserProfile(UserProfile userProfile)
+ {
+ if (userProfile != null)
+ {
+ V1UserProfile v1UserProfile = new V1UserProfile();
+ v1UserProfile.setBdate(userProfile.getBdate());
+ v1UserProfile.setBusinessInfo(toV1Context(userProfile.getBusinessInfo()));
+ v1UserProfile.setEmployerInfo(toV1EmployerInfo(userProfile.getEmployerInfo()));
+ v1UserProfile.setGender(userProfile.getGender());
+ v1UserProfile.setHomeInfo(toV1Context(userProfile.getHomeInfo()));
+ v1UserProfile.setName(toV1PersonName(userProfile.getName()));
+
+ return v1UserProfile;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1EmployerInfo toV1EmployerInfo(EmployerInfo employerInfo)
+ {
+ if (employerInfo != null)
+ {
+ V1EmployerInfo v1EmployerInfo = new V1EmployerInfo();
+ v1EmployerInfo.setDepartment(employerInfo.getDepartment());
+ v1EmployerInfo.setEmployer(employerInfo.getEmployer());
+ v1EmployerInfo.setJobtitle(employerInfo.getJobtitle());
+
+ List<Extension> extensions = employerInfo.getExtensions();
+ if (extensions != null)
+ {
+ v1EmployerInfo.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1EmployerInfo;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1PersonName toV1PersonName(PersonName personName)
+ {
+ if (personName != null)
+ {
+ V1PersonName v1PersonName = new V1PersonName();
+ v1PersonName.setFamily(personName.getFamily());
+ v1PersonName.setGiven(personName.getGiven());
+ v1PersonName.setMiddle(personName.getMiddle());
+ v1PersonName.setNickname(personName.getNickname());
+ v1PersonName.setPrefix(personName.getPrefix());
+ v1PersonName.setSuffix(personName.getSuffix());
+
+ List<Extension> extensions = personName.getExtensions();
+ if (extensions != null)
+ {
+ v1PersonName.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1PersonName;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1Contact toV1Context(Contact contact)
+ {
+ if (contact != null)
+ {
+ V1Contact v1Contact = new V1Contact();
+ v1Contact.setOnline(toV1Online(contact.getOnline()));
+ v1Contact.setPostal(toV1Postal(contact.getPostal()));
+ v1Contact.setTelecom(toV1Telecom(contact.getTelecom()));
+
+ List<Extension> extensions = contact.getExtensions();
+ if (extensions != null)
+ {
+ v1Contact.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1Contact;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1Online toV1Online(Online online)
+ {
+ if (online != null)
+ {
+ V1Online v1Online = new V1Online();
+ v1Online.setEmail(online.getEmail());
+ v1Online.setUri(online.getUri());
+
+ List<Extension> extensions = online.getExtensions();
+ if (extensions != null)
+ {
+ v1Online.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1Online;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1Postal toV1Postal(Postal postal)
+ {
+ if (postal != null)
+ {
+ V1Postal v1Postal = new V1Postal();
+ v1Postal.setCity(postal.getCity());
+ v1Postal.setCountry(postal.getCountry());
+ v1Postal.setName(postal.getName());
+ v1Postal.setOrganization(postal.getOrganization());
+ v1Postal.setPostalcode(postal.getPostalcode());
+ v1Postal.setStateprov(postal.getStateprov());
+ v1Postal.setStreet(postal.getStreet());
+
+ List<Extension> extensions = postal.getExtensions();
+ if (extensions != null)
+ {
+ v1Postal.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1Postal;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1Telecom toV1Telecom(Telecom telecom)
+ {
+ if (telecom != null)
+ {
+ V1Telecom v1Telecom = new V1Telecom();
+ v1Telecom.setFax(toV1TelephoneNum(telecom.getFax()));
+ v1Telecom.setMobile(toV1TelephoneNum(telecom.getMobile()));
+ v1Telecom.setPager(toV1TelephoneNum(telecom.getPager()));
+ v1Telecom.setTelephone(toV1TelephoneNum(telecom.getTelephone()));
+
+ List<Extension> extensions = telecom.getExtensions();
+ if (extensions != null)
+ {
+ v1Telecom.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1Telecom;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1TelephoneNum toV1TelephoneNum(TelephoneNum telephoneNum)
+ {
+ if (telephoneNum != null)
+ {
+ V1TelephoneNum v1TelephoneNum = new V1TelephoneNum();
+ v1TelephoneNum.setComment(telephoneNum.getComment());
+ v1TelephoneNum.setExt(telephoneNum.getExt());
+ v1TelephoneNum.setIntcode(telephoneNum.getIntcode());
+ v1TelephoneNum.setLoccode(telephoneNum.getLoccode());
+ v1TelephoneNum.setNumber(telephoneNum.getNumber());
+
+ List<Extension> extensions = telephoneNum.getExtensions();
+ if (extensions != null)
+ {
+ v1TelephoneNum.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1TelephoneNum;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1MarkupContext toV1MarkupContext(MarkupContext markupContext)
+ {
+ if (markupContext != null)
+ {
+ V1MarkupContext v1MarkupContext = new V1MarkupContext();
+ v1MarkupContext.setMarkupBinary(markupContext.getItemBinary());
+ v1MarkupContext.setMarkupString(markupContext.getItemString());
+ v1MarkupContext.setCacheControl(toV1CacheControl(markupContext.getCacheControl()));
+ v1MarkupContext.setLocale(markupContext.getLocale());
+ v1MarkupContext.setMimeType(markupContext.getMimeType());
+ v1MarkupContext.setPreferredTitle(markupContext.getPreferredTitle());
+ v1MarkupContext.setRequiresUrlRewriting(markupContext.isRequiresRewriting());
+ v1MarkupContext.setUseCachedMarkup(markupContext.isUseCachedItem());
+
+ List<Extension> extensions = markupContext.getExtensions();
+ if (extensions != null)
+ {
+ v1MarkupContext.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1MarkupContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1CacheControl toV1CacheControl(CacheControl cacheControl)
+ {
+ if (cacheControl != null)
+ {
+ V1CacheControl v1CacheControl = WSRP1TypeFactory.createCacheControl(cacheControl.getExpires(), cacheControl.getUserScope());
+ v1CacheControl.setValidateTag(cacheControl.getValidateTag());
+
+ List<Extension> extensions = cacheControl.getExtensions();
+ if (extensions != null)
+ {
+ v1CacheControl.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
+ }
+
+ return v1CacheControl;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1RegistrationContext toV1RegistrationContext(RegistrationContext registrationContext)
+ {
+ if (registrationContext != null)
+ {
+ V1RegistrationContext result = WSRP1TypeFactory.createRegistrationContext(registrationContext.getRegistrationHandle());
+ result.setRegistrationState(registrationContext.getRegistrationState());
+ List<V1Extension> extensions = WSRPUtils.transform(registrationContext.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static <E extends Exception> E toV1Exception(Class<E> v1ExceptionClass, Exception v2Exception)
+ {
+ if (!"org.oasis.wsrp.v1".equals(v1ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception class is not a WSRP 1 exception: " + v1ExceptionClass);
+ }
+
+ Class<? extends Exception> v2ExceptionClass = v2Exception.getClass();
+ String v1Name = v2ExceptionClass.getSimpleName();
+ if (!"org.oasis.wsrp.v2".equals(v2ExceptionClass.getPackage().getName()))
+ {
+ throw new IllegalArgumentException("Specified exception is not a WSRP 2 exception: " + v2Exception);
+ }
+
+ String v2Name = v2ExceptionClass.getSimpleName();
+ // V1 class name should match V2 class name plus "V1"
+ if (!v2Name.equals(v1Name.substring(2)))
+ {
+ throw new IllegalArgumentException("Exception names do not match. Requested: " + v1Name
+ + ", was given: " + v2Name);
+ }
+
+ return WSRP1ExceptionFactory.createWSException(v1ExceptionClass, v2Exception.getMessage(), v2Exception.getCause());
+ }
+
+ public static V1CookieProtocol toV1CookieProtocol(CookieProtocol requiresInitCookie)
+ {
+ if (requiresInitCookie != null)
+ {
+ return V1CookieProtocol.fromValue(requiresInitCookie.value());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1ModelDescription toV1ModelDescription(ModelDescription modelDescription)
+ {
+ if (modelDescription != null)
+ {
+ V1ModelDescription result = WSRP1TypeFactory.createModelDescription(WSRPUtils.transform(modelDescription.getPropertyDescriptions(), PROPERTYDESCRIPTION));
+ List<V1Extension> extensions = WSRPUtils.transform(modelDescription.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ result.setModelTypes(toV1ModelTypes(modelDescription.getModelTypes()));
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1ModelTypes toV1ModelTypes(ModelTypes modelTypes)
+ {
+ if (modelTypes != null)
+ {
+ V1ModelTypes result = new V1ModelTypes();
+ result.setAny(modelTypes.getAny());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1ResourceList toV1ResourceList(ResourceList resourceList)
+ {
+ if (resourceList != null)
+ {
+ V1ResourceList result = new V1ResourceList();
+ List<V1Extension> extensions = WSRPUtils.transform(resourceList.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ List<V1Resource> v1Resources = WSRPUtils.transform(resourceList.getResources(), RESOURCE);
+ if (v1Resources != null)
+ {
+ result.getResources().addAll(v1Resources);
+ }
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1InteractionParams toV1InteractionParams(InteractionParams interactionParams)
+ {
+ if (interactionParams != null)
+ {
+ V1InteractionParams v1InteractionParams = WSRP1TypeFactory.createInteractionParams(toV1StateChange(interactionParams.getPortletStateChange()));
+ v1InteractionParams.setInteractionState(interactionParams.getInteractionState());
+
+ List<Extension> extensions = interactionParams.getExtensions();
+ if (extensions != null)
+ {
+ v1InteractionParams.getExtensions().addAll(Lists.transform(extensions, EXTENSION));
+ }
+
+ List<NamedString> formParameters = interactionParams.getFormParameters();
+ if (formParameters != null)
+ {
+ v1InteractionParams.getFormParameters().addAll(Lists.transform(formParameters, NAMEDSTRING));
+ }
+
+ List<UploadContext> uploadContext = interactionParams.getUploadContexts();
+ if (uploadContext != null)
+ {
+ v1InteractionParams.getUploadContexts().addAll(Lists.transform(uploadContext, UPLOADCONTEXT));
+ }
+
+ return v1InteractionParams;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+
+ public static V1StateChange toV1StateChange(StateChange stateChange)
+ {
+ if (stateChange != null)
+ {
+ return V1StateChange.valueOf(stateChange.value());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1UpdateResponse toV1UpdateResponse(UpdateResponse updateResponse)
+ {
+ if (updateResponse != null)
+ {
+ V1UpdateResponse v1UpdateResponse = WSRP1TypeFactory.createUpdateResponse();
+ v1UpdateResponse.setMarkupContext(toV1MarkupContext(updateResponse.getMarkupContext()));
+ v1UpdateResponse.setNavigationalState(updateResponse.getNavigationalContext().getOpaqueValue());
+ v1UpdateResponse.setNewWindowState(updateResponse.getNewWindowState());
+ v1UpdateResponse.setPortletContext(toV1PortletContext(updateResponse.getPortletContext()));
+ v1UpdateResponse.setSessionContext(toV1SessionContext(updateResponse.getSessionContext()));
+ v1UpdateResponse.setNewMode(updateResponse.getNewMode());
+ return v1UpdateResponse;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static V1LocalizedString toV1LocalizedString(LocalizedString localizedString)
+ {
+ return LOCALIZEDSTRING.apply(localizedString);
+ }
+
+ public static V1SessionContext toV1SessionContext(SessionContext sessionContext)
+ {
+ if (sessionContext != null)
+ {
+ V1SessionContext v1SessionContext = WSRP1TypeFactory.createSessionContext(sessionContext.getSessionID(), sessionContext.getExpires().intValue());
+ v1SessionContext.getExtensions().addAll(Lists.transform(sessionContext.getExtensions(), EXTENSION));
+
+ return v1SessionContext;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private static class V2ToV1Extension implements Function<Extension, V1Extension>
+ {
+ public V1Extension apply(Extension from)
+ {
+ if (from != null)
+ {
+ V1Extension extension = new V1Extension();
+ extension.setAny(from.getAny());
+ return extension;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ private static class V2ToV1PortletDescription implements Function<PortletDescription, V1PortletDescription>
+ {
+
+ public V1PortletDescription apply(PortletDescription from)
+ {
+ if (from != null)
+ {
+ V1PortletDescription result = WSRP1TypeFactory.createPortletDescription(from.getPortletHandle(),
+ WSRPUtils.transform(from.getMarkupTypes(), MARKUPTYPE));
+ result.setDescription(LOCALIZEDSTRING.apply(from.getDescription()));
+ result.setDisplayName(LOCALIZEDSTRING.apply(from.getDisplayName()));
+ List<V1Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ List<V1LocalizedString> keywords = WSRPUtils.transform(from.getKeywords(), LOCALIZEDSTRING);
+ if (keywords != null)
+ {
+ result.getKeywords().addAll(keywords);
+ }
+ List<String> userCategories = from.getUserCategories();
+ if (userCategories != null)
+ {
+ result.getUserCategories().addAll(userCategories);
+ }
+ List<String> userProfileItems = from.getUserProfileItems();
+ if (userProfileItems != null)
+ {
+ result.getUserProfileItems().addAll(userProfileItems);
+ }
+ result.setDefaultMarkupSecure(from.isDefaultMarkupSecure());
+ result.setDoesUrlTemplateProcessing(from.isDoesUrlTemplateProcessing());
+ result.setTemplatesStoredInSession(from.isTemplatesStoredInSession());
+ result.setHasUserSpecificState(from.isHasUserSpecificState());
+ result.setOnlySecure(from.isOnlySecure());
+ result.setUserContextStoredInSession(from.isUserContextStoredInSession());
+ result.setUsesMethodGet(from.isUsesMethodGet());
+ result.setShortTitle(LOCALIZEDSTRING.apply(from.getShortTitle()));
+ result.setTitle(LOCALIZEDSTRING.apply(from.getTitle()));
+
+ result.setGroupID(from.getGroupID());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ private static class V2ToV1ItemDescription implements Function<ItemDescription, V1ItemDescription>
+ {
+
+ public V1ItemDescription apply(ItemDescription from)
+ {
+ if (from != null)
+ {
+ V1ItemDescription result = new V1ItemDescription();
+ result.setItemName(from.getItemName());
+ result.setDescription(LOCALIZEDSTRING.apply(from.getDescription()));
+ List<V1Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+
+ public static class V2ToV1NamedString implements Function<NamedString, V1NamedString>
+ {
+ public V1NamedString apply(NamedString namedString)
+ {
+ if (namedString != null)
+ {
+ V1NamedString result = new V1NamedString();
+ result.setName(namedString.getName());
+ result.setValue(namedString.getValue());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public static class V2ToV1UploadContext implements Function<UploadContext, V1UploadContext>
+ {
+
+ public V1UploadContext apply(UploadContext uploadContext)
+ {
+ if (uploadContext != null)
+ {
+ V1UploadContext result = WSRP1TypeFactory.createUploadContext(uploadContext.getMimeType(), uploadContext.getUploadData());
+
+ List<Extension> extensions = uploadContext.getExtensions();
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(Lists.transform(extensions, EXTENSION));
+ }
+
+ List<NamedString> mimeAttributes = uploadContext.getMimeAttributes();
+ if (mimeAttributes != null)
+ {
+ result.getMimeAttributes().addAll(Lists.transform(mimeAttributes, NAMEDSTRING));
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ }
+
+ private static class V2ToV1MarkupType implements Function<MarkupType, V1MarkupType>
+ {
+
+ public V1MarkupType apply(MarkupType from)
+ {
+ if (from != null)
+ {
+ V1MarkupType result = WSRP1TypeFactory.createMarkupType(from.getMimeType(), from.getModes(), from.getWindowStates(), from.getLocales());
+ List<V1Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ private static class V2ToV1LocalizedString implements Function<LocalizedString, V1LocalizedString>
+ {
+
+ public V1LocalizedString apply(LocalizedString from)
+ {
+ if (from != null)
+ {
+ return WSRP1TypeFactory.createLocalizedString(from.getLang(), from.getResourceName(), from.getValue());
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+ }
+
+ private static class V2ToV1PropertyDescription implements Function<PropertyDescription, V1PropertyDescription>
+ {
+
+ public V1PropertyDescription apply(PropertyDescription from)
+ {
+ if (from != null)
+ {
+ V1PropertyDescription result = WSRP1TypeFactory.createPropertyDescription(from.getName().toString(), from.getType());
+ result.setHint(toV1LocalizedString(from.getHint()));
+ result.setLabel(toV1LocalizedString(from.getLabel()));
+ List<V1Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ private static class V2ToV1Resource implements Function<Resource, V1Resource>
+ {
+ public V1Resource apply(Resource from)
+ {
+ if (from != null)
+ {
+ V1Resource result = new V1Resource();
+ result.setResourceName(from.getResourceName());
+ List<V1ResourceValue> values = WSRPUtils.transform(from.getValues(), RESOURCEVALUE);
+ if (values != null)
+ {
+ result.getValues().addAll(values);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ }
+
+ private static class V2ToV1ResourceValue implements Function<ResourceValue, V1ResourceValue>
+ {
+ public V1ResourceValue apply(ResourceValue from)
+ {
+ if (from != null)
+ {
+ V1ResourceValue result = new V1ResourceValue();
+ result.setLang(from.getLang());
+ result.setValue(from.getValue());
+ List<V1Extension> extensions = WSRPUtils.transform(from.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+}
Deleted: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-10 07:58:14 UTC (rev 3292)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -1,1770 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
- * contributors as indicated by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of
- * individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.gatein.wsrp.spec.v1;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import org.gatein.common.NotYetImplemented;
-import org.gatein.pc.api.OpaqueStateString;
-import org.gatein.wsrp.WSRPExceptionFactory;
-import org.gatein.wsrp.WSRPTypeFactory;
-import org.oasis.wsrp.v1.V1CacheControl;
-import org.oasis.wsrp.v1.V1ClientData;
-import org.oasis.wsrp.v1.V1Contact;
-import org.oasis.wsrp.v1.V1CookieProtocol;
-import org.oasis.wsrp.v1.V1EmployerInfo;
-import org.oasis.wsrp.v1.V1Extension;
-import org.oasis.wsrp.v1.V1Fault;
-import org.oasis.wsrp.v1.V1InteractionParams;
-import org.oasis.wsrp.v1.V1ItemDescription;
-import org.oasis.wsrp.v1.V1LocalizedString;
-import org.oasis.wsrp.v1.V1MarkupContext;
-import org.oasis.wsrp.v1.V1MarkupParams;
-import org.oasis.wsrp.v1.V1MarkupType;
-import org.oasis.wsrp.v1.V1ModelDescription;
-import org.oasis.wsrp.v1.V1ModelTypes;
-import org.oasis.wsrp.v1.V1NamedString;
-import org.oasis.wsrp.v1.V1Online;
-import org.oasis.wsrp.v1.V1PersonName;
-import org.oasis.wsrp.v1.V1PortletContext;
-import org.oasis.wsrp.v1.V1PortletDescription;
-import org.oasis.wsrp.v1.V1Postal;
-import org.oasis.wsrp.v1.V1PropertyDescription;
-import org.oasis.wsrp.v1.V1RegistrationContext;
-import org.oasis.wsrp.v1.V1Resource;
-import org.oasis.wsrp.v1.V1ResourceList;
-import org.oasis.wsrp.v1.V1ResourceValue;
-import org.oasis.wsrp.v1.V1RuntimeContext;
-import org.oasis.wsrp.v1.V1ServiceDescription;
-import org.oasis.wsrp.v1.V1SessionContext;
-import org.oasis.wsrp.v1.V1StateChange;
-import org.oasis.wsrp.v1.V1Telecom;
-import org.oasis.wsrp.v1.V1TelephoneNum;
-import org.oasis.wsrp.v1.V1Templates;
-import org.oasis.wsrp.v1.V1UpdateResponse;
-import org.oasis.wsrp.v1.V1UploadContext;
-import org.oasis.wsrp.v1.V1UserContext;
-import org.oasis.wsrp.v1.V1UserProfile;
-import org.oasis.wsrp.v2.CacheControl;
-import org.oasis.wsrp.v2.ClientData;
-import org.oasis.wsrp.v2.Contact;
-import org.oasis.wsrp.v2.CookieProtocol;
-import org.oasis.wsrp.v2.EmployerInfo;
-import org.oasis.wsrp.v2.Extension;
-import org.oasis.wsrp.v2.InteractionParams;
-import org.oasis.wsrp.v2.ItemDescription;
-import org.oasis.wsrp.v2.LocalizedString;
-import org.oasis.wsrp.v2.MarkupContext;
-import org.oasis.wsrp.v2.MarkupParams;
-import org.oasis.wsrp.v2.MarkupType;
-import org.oasis.wsrp.v2.ModelDescription;
-import org.oasis.wsrp.v2.ModelTypes;
-import org.oasis.wsrp.v2.NamedString;
-import org.oasis.wsrp.v2.Online;
-import org.oasis.wsrp.v2.PersonName;
-import org.oasis.wsrp.v2.PortletContext;
-import org.oasis.wsrp.v2.PortletDescription;
-import org.oasis.wsrp.v2.Postal;
-import org.oasis.wsrp.v2.PropertyDescription;
-import org.oasis.wsrp.v2.RegistrationContext;
-import org.oasis.wsrp.v2.Resource;
-import org.oasis.wsrp.v2.ResourceList;
-import org.oasis.wsrp.v2.ResourceValue;
-import org.oasis.wsrp.v2.RuntimeContext;
-import org.oasis.wsrp.v2.ServiceDescription;
-import org.oasis.wsrp.v2.SessionContext;
-import org.oasis.wsrp.v2.SessionParams;
-import org.oasis.wsrp.v2.StateChange;
-import org.oasis.wsrp.v2.Telecom;
-import org.oasis.wsrp.v2.TelephoneNum;
-import org.oasis.wsrp.v2.Templates;
-import org.oasis.wsrp.v2.UpdateResponse;
-import org.oasis.wsrp.v2.UploadContext;
-import org.oasis.wsrp.v2.UserContext;
-import org.oasis.wsrp.v2.UserProfile;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class V2V1Converter
-{
- public static final V1ToV2Extension V1_TO_V2_EXTENSION = new V1ToV2Extension();
-
- public static final V2ToV1Extension V2_TO_V1_EXTENSION = new V2ToV1Extension();
- public static final V2ToV1MarkupType V2_TO_V1_MARKUPTYPE = new V2ToV1MarkupType();
- public static final V1ToV2MarkupType V1_TO_V2_MARKUPTYPE = new V1ToV2MarkupType();
- public static final V2ToV1PortletDescription V2_TO_V1_PORTLETDESCRIPTION = new V2ToV1PortletDescription();
- public static final V1ToV2PortletDescription V1_TO_V2_PORTLETDESCRIPTION = new V1ToV2PortletDescription();
- public static final V2ToV1LocalizedString V2_TO_V1_LOCALIZEDSTRING = new V2ToV1LocalizedString();
- public static final V1ToV2LocalizedString V1_TO_V2_LOCALIZEDSTRING = new V1ToV2LocalizedString();
- public static final V2ToV1ItemDescription V2_TO_V1_ITEMDESCRIPTION = new V2ToV1ItemDescription();
-
- public static final V1ToV2ItemDescription V1_TO_V2_ITEMDESCRIPTION = new V1ToV2ItemDescription();
- public static final V2ToV1PropertyDescription V2_TO_V1_PROPERTYDESCRIPTION = new V2ToV1PropertyDescription();
- public static final V2ToV1Resource V2_TO_V1_RESOURCE = new V2ToV1Resource();
- public static final V2ToV1ResourceValue V2_TO_V1_RESOURCEVALUE = new V2ToV1ResourceValue();
- public static final V1ToV2PropertyDescription V1_TO_V2_PROPERTYDESCRIPTION = new V1ToV2PropertyDescription();
- public static final V1ToV2Resource V1_TO_V2_RESOURCE = new V1ToV2Resource();
- private static final V1ToV2ResourceValue V1_TO_V2_RESOURCEVALUE = new V1ToV2ResourceValue();
-
-
- public static final V1ToV2NamedString V1_TO_V2_NAMEDSTRING = new V1ToV2NamedString();
- public static final V2ToV1NamedString V2_TO_V1_NAMEDSTRING = new V2ToV1NamedString();
- public static final V1ToV2UploadContext V1_TO_V2_UPLOADCONTEXT = new V1ToV2UploadContext();
- public static final V2ToV1UploadContext V2_TO_V1_UPLOADCONTEXT = new V2ToV1UploadContext();
-
- public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function)
- {
- if (fromList == null)
- {
- return null;
- }
- else
- {
- return Lists.transform(fromList, function);
- }
- }
-
-
- public static V1PortletDescription toV1PortletDescription(PortletDescription portletDescription)
- {
- throw new NotYetImplemented();
- }
-
- public static V1PortletContext toV1PortletContext(PortletContext portletContext)
- {
- if (portletContext != null)
- {
- V1PortletContext v1PortletContext = WSRP1TypeFactory.createPortletContext(portletContext.getPortletHandle(), portletContext.getPortletState());
-
- List<V1Extension> extensions = V2V1Converter.transform(portletContext.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- v1PortletContext.getExtensions().addAll(extensions);
- }
-
- return v1PortletContext;
- }
- else
- {
- return null;
- }
- }
-
- public static MarkupParams toV2MarkupParams(V1MarkupParams v1MarkupParams)
- {
- if (v1MarkupParams != null)
- {
- MarkupParams markupParams = WSRPTypeFactory.createMarkupParams(v1MarkupParams.isSecureClientCommunication(),
- v1MarkupParams.getLocales(), v1MarkupParams.getMimeTypes(), v1MarkupParams.getMode(),
- v1MarkupParams.getWindowState());
- markupParams.setClientData(toV2ClientData(v1MarkupParams.getClientData()));
-
- // we can't create an opaquestatestring if with a null string, so need to check
- if (v1MarkupParams.getNavigationalState() != null)
- {
- markupParams.setNavigationalContext(WSRPTypeFactory.createNavigationalContextOrNull(
- new OpaqueStateString(v1MarkupParams.getNavigationalState()), null));
- }
- markupParams.setValidateTag(v1MarkupParams.getValidateTag());
-
- List<String> charSets = v1MarkupParams.getMarkupCharacterSets();
- if (charSets != null)
- {
- markupParams.getMarkupCharacterSets().addAll(charSets);
- }
- List<String> validNewModes = v1MarkupParams.getValidNewModes();
- if (validNewModes != null)
- {
- markupParams.getValidNewModes().addAll(validNewModes);
- }
- List<String> validNewWindowStates = v1MarkupParams.getValidNewWindowStates();
- if (validNewWindowStates != null)
- {
- markupParams.getValidNewWindowStates().addAll(validNewWindowStates);
- }
-
- List<Extension> extensions = V2V1Converter.transform(v1MarkupParams.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- markupParams.getExtensions().addAll(extensions);
- }
- return markupParams;
- }
- else
- {
- return null;
- }
- }
-
- public static V1MarkupParams toV1MarkupParams(MarkupParams markupParams)
- {
- if (markupParams != null)
- {
- V1MarkupParams v1MarkupParams = WSRP1TypeFactory.createMarkupParams(markupParams.isSecureClientCommunication(), markupParams.getLocales(),
- markupParams.getMimeTypes(), markupParams.getMode(), markupParams.getWindowState());
-
- v1MarkupParams.setClientData(toV1ClientData(markupParams.getClientData()));
- v1MarkupParams.setNavigationalState(markupParams.getNavigationalContext().getOpaqueValue());
- v1MarkupParams.setValidateTag(markupParams.getValidateTag());
-
- List<String> charSets = markupParams.getMarkupCharacterSets();
- if (charSets != null)
- {
- v1MarkupParams.getMarkupCharacterSets().addAll(charSets);
- }
-
- List<String> validNewModes = markupParams.getValidNewModes();
- if (validNewModes != null)
- {
- v1MarkupParams.getValidNewModes().addAll(validNewModes);
- }
-
- List<String> validNewWindowStates = markupParams.getValidNewWindowStates();
- if (validNewWindowStates != null)
- {
- v1MarkupParams.getValidNewWindowStates().addAll(validNewWindowStates);
- }
-
- List<V1Extension> extensions = V2V1Converter.transform(markupParams.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- v1MarkupParams.getExtensions().addAll(extensions);
- }
-
- return v1MarkupParams;
- }
- else
- {
- return null;
- }
- }
-
- private static ClientData toV2ClientData(V1ClientData v1ClientData)
- {
- if (v1ClientData != null)
- {
- ClientData clientData = WSRPTypeFactory.createClientData(v1ClientData.getUserAgent());
-
- List<V1Extension> extensions = v1ClientData.getExtensions();
- if (extensions != null)
- {
- clientData.getExtensions().addAll(Lists.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return clientData;
- }
- else
- {
- return null;
- }
- }
-
- private static V1ClientData toV1ClientData(ClientData clientData)
- {
- if (clientData != null)
- {
- V1ClientData v1ClientData = WSRP1TypeFactory.createClientData(clientData.getUserAgent());
-
- List<Extension> extensions = clientData.getExtensions();
- if (extensions != null)
- {
- v1ClientData.getExtensions().addAll(Lists.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1ClientData;
- }
- else
- {
- return null;
- }
- }
-
- public static PortletContext toV2PortletContext(V1PortletContext v1PortletContext)
- {
- if (v1PortletContext != null)
- {
- PortletContext portletContext = WSRPTypeFactory.createPortletContext(v1PortletContext.getPortletHandle(), v1PortletContext.getPortletState());
-
- List<V1Extension> extensions = v1PortletContext.getExtensions();
- if (extensions != null)
- {
- portletContext.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return portletContext;
- }
- else
- {
- return null;
- }
- }
-
- public static RegistrationContext toV2RegistrationContext(V1RegistrationContext registrationContext)
- {
- if (registrationContext != null)
- {
- RegistrationContext result = WSRPTypeFactory.createRegistrationContext(registrationContext.getRegistrationHandle());
- result.setRegistrationState(registrationContext.getRegistrationState());
- List<Extension> extensions = V2V1Converter.transform(registrationContext.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
- public static RuntimeContext toV2RuntimeContext(V1RuntimeContext v1RuntimeContext)
- {
- if (v1RuntimeContext != null)
- {
- RuntimeContext runtimeContext = WSRPTypeFactory.createRuntimeContext(v1RuntimeContext.getUserAuthentication());
- runtimeContext.setNamespacePrefix(v1RuntimeContext.getNamespacePrefix());
- runtimeContext.setPortletInstanceKey(v1RuntimeContext.getPortletInstanceKey());
-
- //TODO: handle the SessionParams better
- SessionParams sessionParams = new SessionParams();
- sessionParams.setSessionID(v1RuntimeContext.getSessionID());
-
- runtimeContext.setSessionParams(sessionParams);
- runtimeContext.setTemplates(V2V1Converter.toV2Templates(v1RuntimeContext.getTemplates()));
-
- List<V1Extension> extensions = v1RuntimeContext.getExtensions();
- if (extensions != null)
- {
- runtimeContext.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return runtimeContext;
- }
- else
- {
- return null;
- }
- }
-
- public static V1RuntimeContext toV1RuntimeContext(RuntimeContext runtimeContext)
- {
- if (runtimeContext != null)
- {
- V1RuntimeContext v1RuntimeContext = WSRP1TypeFactory.createRuntimeContext(runtimeContext.getUserAuthentication());
- v1RuntimeContext.setNamespacePrefix(runtimeContext.getNamespacePrefix());
- v1RuntimeContext.setPortletInstanceKey(runtimeContext.getPortletInstanceKey());
- v1RuntimeContext.setSessionID(runtimeContext.getSessionParams().getSessionID());
- v1RuntimeContext.setTemplates(V2V1Converter.toV1Templates(runtimeContext.getTemplates()));
-
- List<Extension> extensions = runtimeContext.getExtensions();
- if (extensions != null)
- {
- v1RuntimeContext.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1RuntimeContext;
- }
- else
- {
- return null;
- }
- }
-
- public static V1Templates toV1Templates(Templates templates)
- {
- if (templates != null)
- {
- //TODO: should we be using the WSRP1TypeFactory,createTemplates(PortletInvocationContext) instead?
- V1Templates v1Templates = new V1Templates();
- v1Templates.setBlockingActionTemplate(templates.getBlockingActionTemplate());
- v1Templates.setDefaultTemplate(templates.getDefaultTemplate());
- v1Templates.setRenderTemplate(templates.getRenderTemplate());
- v1Templates.setResourceTemplate(templates.getResourceTemplate());
- v1Templates.setSecureBlockingActionTemplate(templates.getSecureBlockingActionTemplate());
- v1Templates.setSecureRenderTemplate(templates.getSecureRenderTemplate());
- v1Templates.setSecureResourceTemplate(templates.getSecureResourceTemplate());
-
- List<Extension> extensions = templates.getExtensions();
- if (extensions != null)
- {
- v1Templates.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1Templates;
- }
- else
- {
- return null;
- }
- }
-
- public static Templates toV2Templates(V1Templates v1Templates)
- {
- if (v1Templates != null)
- {
- //TODO: should we be using the WSRP1TypeFactory,createTemplates(PortletInvocationContext) instead?
- Templates templates = new Templates();
- templates.setBlockingActionTemplate(v1Templates.getBlockingActionTemplate());
- templates.setDefaultTemplate(v1Templates.getDefaultTemplate());
- templates.setRenderTemplate(v1Templates.getRenderTemplate());
- templates.setResourceTemplate(v1Templates.getResourceTemplate());
- templates.setSecureBlockingActionTemplate(v1Templates.getSecureBlockingActionTemplate());
- templates.setSecureRenderTemplate(v1Templates.getSecureRenderTemplate());
- templates.setSecureResourceTemplate(v1Templates.getSecureResourceTemplate());
-
- List<V1Extension> extensions = v1Templates.getExtensions();
- if (extensions != null)
- {
- templates.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return templates;
- }
- else
- {
- return null;
- }
- }
-
- public static UserContext toV2UserContext(V1UserContext v1UserContext)
- {
- if (v1UserContext != null)
- {
- UserContext userContext = WSRPTypeFactory.createUserContext(v1UserContext.getUserContextKey());
- userContext.setProfile(toV2UserProfile(v1UserContext.getProfile()));
-
- List<V1Extension> extensions = v1UserContext.getExtensions();
- if (extensions != null)
- {
- userContext.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- if (v1UserContext.getUserCategories() != null)
- {
- userContext.getUserCategories().addAll(v1UserContext.getUserCategories());
- }
-
- return userContext;
- }
- else
- {
- return null;
- }
- }
-
- public static V1UserContext toV1UserContext(UserContext userContext)
- {
- if (userContext != null)
- {
- V1UserContext v1UserContext = WSRP1TypeFactory.createUserContext(userContext.getUserContextKey());
-
- v1UserContext.setProfile(toV1UserProfile(userContext.getProfile()));
-
- List<Extension> extensions = userContext.getExtensions();
- if (extensions != null)
- {
- v1UserContext.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- if (userContext.getUserCategories() != null)
- {
- v1UserContext.getUserCategories().addAll(userContext.getUserCategories());
- }
-
- return v1UserContext;
- }
- else
- {
- return null;
- }
- }
-
- public static V1UserProfile toV1UserProfile (UserProfile userProfile)
- {
- if (userProfile != null)
- {
- V1UserProfile v1UserProfile = new V1UserProfile();
- v1UserProfile.setBdate(userProfile.getBdate());
- v1UserProfile.setBusinessInfo(toV1Context(userProfile.getBusinessInfo()));
- v1UserProfile.setEmployerInfo(toV1EmployerInfo(userProfile.getEmployerInfo()));
- v1UserProfile.setGender(userProfile.getGender());
- v1UserProfile.setHomeInfo(toV1Context(userProfile.getHomeInfo()));
- v1UserProfile.setName(toV1PersonName(userProfile.getName()));
-
- return v1UserProfile;
- }
- else
- {
- return null;
- }
- }
-
- public static UserProfile toV2UserProfile (V1UserProfile v1UserProfile)
- {
- if (v1UserProfile != null)
- {
- UserProfile userProfile = new UserProfile();
- userProfile.setBdate(v1UserProfile.getBdate());
- userProfile.setBusinessInfo(toV2Context(v1UserProfile.getBusinessInfo()));
- userProfile.setEmployerInfo(toV2EmployerInfo(v1UserProfile.getEmployerInfo()));
- userProfile.setGender(v1UserProfile.getGender());
- userProfile.setHomeInfo(toV2Context(v1UserProfile.getHomeInfo()));
- userProfile.setName(toV2PersonName(v1UserProfile.getName()));
-
- return userProfile;
- }
- else
- {
- return null;
- }
- }
-
- public static V1EmployerInfo toV1EmployerInfo (EmployerInfo employerInfo)
- {
- if (employerInfo != null)
- {
- V1EmployerInfo v1EmployerInfo = new V1EmployerInfo();
- v1EmployerInfo.setDepartment(employerInfo.getDepartment());
- v1EmployerInfo.setEmployer(employerInfo.getEmployer());
- v1EmployerInfo.setJobtitle(employerInfo.getJobtitle());
-
- List<Extension> extensions = employerInfo.getExtensions();
- if (extensions != null)
- {
- v1EmployerInfo.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1EmployerInfo;
- }
- else
- {
- return null;
- }
- }
-
- public static EmployerInfo toV2EmployerInfo (V1EmployerInfo v1EmployerInfo)
- {
- if (v1EmployerInfo != null)
- {
- EmployerInfo employerInfo = new EmployerInfo();
- employerInfo.setDepartment(v1EmployerInfo.getDepartment());
- employerInfo.setEmployer(v1EmployerInfo.getEmployer());
- employerInfo.setJobtitle(v1EmployerInfo.getJobtitle());
-
- List<V1Extension> extensions = v1EmployerInfo.getExtensions();
- if (extensions != null)
- {
- employerInfo.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return employerInfo;
- }
- else
- {
- return null;
- }
- }
-
- public static V1PersonName toV1PersonName (PersonName personName)
- {
- if (personName != null)
- {
- V1PersonName v1PersonName = new V1PersonName();
- v1PersonName.setFamily(personName.getFamily());
- v1PersonName.setGiven(personName.getGiven());
- v1PersonName.setMiddle(personName.getMiddle());
- v1PersonName.setNickname(personName.getNickname());
- v1PersonName.setPrefix(personName.getPrefix());
- v1PersonName.setSuffix(personName.getSuffix());
-
- List<Extension> extensions = personName.getExtensions();
- if (extensions != null)
- {
- v1PersonName.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1PersonName;
- }
- else
- {
- return null;
- }
- }
-
- public static PersonName toV2PersonName (V1PersonName v1PersonName)
- {
- if (v1PersonName != null)
- {
- PersonName personName = new PersonName();
- personName.setFamily(v1PersonName.getFamily());
- personName.setGiven(v1PersonName.getGiven());
- personName.setMiddle(v1PersonName.getMiddle());
- personName.setNickname(v1PersonName.getNickname());
- personName.setPrefix(v1PersonName.getPrefix());
- personName.setSuffix(v1PersonName.getSuffix());
-
- List<V1Extension> extensions = v1PersonName.getExtensions();
- if (extensions != null)
- {
- personName.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return personName;
- }
- else
- {
- return null;
- }
- }
-
- public static V1Contact toV1Context (Contact contact)
- {
- if (contact != null)
- {
- V1Contact v1Contact= new V1Contact();
- v1Contact.setOnline(toV1Online(contact.getOnline()));
- v1Contact.setPostal(toV1Postal(contact.getPostal()));
- v1Contact.setTelecom(toV1Telecom(contact.getTelecom()));
-
- List<Extension> extensions = contact.getExtensions();
- if (extensions != null)
- {
- v1Contact.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1Contact;
- }
- else
- {
- return null;
- }
- }
-
- public static Contact toV2Context (V1Contact v1Contact)
- {
- if (v1Contact != null)
- {
- Contact contact= new Contact();
- contact.setOnline(toV2Online(v1Contact.getOnline()));
- contact.setPostal(toV2Postal(v1Contact.getPostal()));
- contact.setTelecom(toV2Telecom(v1Contact.getTelecom()));
-
- List<V1Extension> extensions = v1Contact.getExtensions();
- if (extensions != null)
- {
- contact.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return contact;
- }
- else
- {
- return null;
- }
- }
-
- public static V1Online toV1Online (Online online)
- {
- if (online != null)
- {
- V1Online v1Online = new V1Online();
- v1Online.setEmail(online.getEmail());
- v1Online.setUri(online.getUri());
-
- List<Extension> extensions = online.getExtensions();
- if (extensions != null)
- {
- v1Online.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1Online;
- }
- else
- {
- return null;
- }
- }
-
- public static Online toV2Online (V1Online v1Online)
- {
- if (v1Online != null)
- {
- Online online = new Online();
- online.setEmail(v1Online.getEmail());
- online.setUri(v1Online.getUri());
-
- List<V1Extension> extensions = v1Online.getExtensions();
- if (extensions != null)
- {
- online.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return online;
- }
- else
- {
- return null;
- }
- }
-
- public static V1Postal toV1Postal (Postal postal)
- {
- if (postal != null)
- {
- V1Postal v1Postal = new V1Postal();
- v1Postal.setCity(postal.getCity());
- v1Postal.setCountry(postal.getCountry());
- v1Postal.setName(postal.getName());
- v1Postal.setOrganization(postal.getOrganization());
- v1Postal.setPostalcode(postal.getPostalcode());
- v1Postal.setStateprov(postal.getStateprov());
- v1Postal.setStreet(postal.getStreet());
-
- List<Extension> extensions = postal.getExtensions();
- if (extensions != null)
- {
- v1Postal.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1Postal;
- }
- else
- {
- return null;
- }
- }
-
- public static Postal toV2Postal (V1Postal v1Postal)
- {
- if (v1Postal != null)
- {
- Postal postal = new Postal();
- postal.setCity(v1Postal.getCity());
- postal.setCountry(v1Postal.getCountry());
- postal.setName(v1Postal.getName());
- postal.setOrganization(v1Postal.getOrganization());
- postal.setPostalcode(v1Postal.getPostalcode());
- postal.setStateprov(v1Postal.getStateprov());
- postal.setStreet(v1Postal.getStreet());
-
- List<V1Extension> extensions = v1Postal.getExtensions();
- if (extensions != null)
- {
- postal.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return postal;
- }
- else
- {
- return null;
- }
- }
-
- public static V1Telecom toV1Telecom(Telecom telecom)
- {
- if (telecom != null)
- {
- V1Telecom v1Telecom = new V1Telecom();
- v1Telecom.setFax(toV1TelephoneNum(telecom.getFax()));
- v1Telecom.setMobile(toV1TelephoneNum(telecom.getMobile()));
- v1Telecom.setPager(toV1TelephoneNum(telecom.getPager()));
- v1Telecom.setTelephone(toV1TelephoneNum(telecom.getTelephone()));
-
- List<Extension> extensions = telecom.getExtensions();
- if (extensions != null)
- {
- v1Telecom.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1Telecom;
- }
- else
- {
- return null;
- }
- }
-
- public static Telecom toV2Telecom(V1Telecom v1Telecom)
- {
- if (v1Telecom != null)
- {
- Telecom telecom = new Telecom();
- telecom.setFax(toV2TelephoneNum(v1Telecom.getFax()));
- telecom.setMobile(toV2TelephoneNum(v1Telecom.getMobile()));
- telecom.setPager(toV2TelephoneNum(v1Telecom.getPager()));
- telecom.setTelephone(toV2TelephoneNum(v1Telecom.getTelephone()));
-
- List<V1Extension> extensions = v1Telecom.getExtensions();
- if (extensions != null)
- {
- telecom.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return telecom;
- }
- else
- {
- return null;
- }
- }
-
- public static V1TelephoneNum toV1TelephoneNum (TelephoneNum telephoneNum)
- {
- if (telephoneNum != null)
- {
- V1TelephoneNum v1TelephoneNum = new V1TelephoneNum();
- v1TelephoneNum.setComment(telephoneNum.getComment());
- v1TelephoneNum.setExt(telephoneNum.getExt());
- v1TelephoneNum.setIntcode(telephoneNum.getIntcode());
- v1TelephoneNum.setLoccode(telephoneNum.getLoccode());
- v1TelephoneNum.setNumber(telephoneNum.getNumber());
-
- List<Extension> extensions = telephoneNum.getExtensions();
- if (extensions != null)
- {
- v1TelephoneNum.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1TelephoneNum;
- }
- else
- {
- return null;
- }
- }
-
- public static TelephoneNum toV2TelephoneNum (V1TelephoneNum v1TelephoneNum)
- {
- if (v1TelephoneNum != null)
- {
- TelephoneNum telephoneNum = new TelephoneNum();
- telephoneNum.setComment(v1TelephoneNum.getComment());
- telephoneNum.setExt(v1TelephoneNum.getExt());
- telephoneNum.setIntcode(v1TelephoneNum.getIntcode());
- telephoneNum.setLoccode(v1TelephoneNum.getLoccode());
- telephoneNum.setNumber(v1TelephoneNum.getNumber());
-
- List<V1Extension> extensions = v1TelephoneNum.getExtensions();
- if (extensions != null)
- {
- telephoneNum.getExtensions().addAll(V2V1Converter.transform(extensions, V1_TO_V2_EXTENSION));
- }
-
- return telephoneNum;
- }
- else
- {
- return null;
- }
- }
-
- public static V1MarkupContext toV1MarkupContext(MarkupContext markupContext)
- {
- if (markupContext != null)
- {
- V1MarkupContext v1MarkupContext = new V1MarkupContext();
- v1MarkupContext.setMarkupBinary(markupContext.getItemBinary());
- v1MarkupContext.setMarkupString(markupContext.getItemString());
- v1MarkupContext.setCacheControl(toV1CacheControl(markupContext.getCacheControl()));
- v1MarkupContext.setLocale(markupContext.getLocale());
- v1MarkupContext.setMimeType(markupContext.getMimeType());
- v1MarkupContext.setPreferredTitle(markupContext.getPreferredTitle());
- v1MarkupContext.setRequiresUrlRewriting(markupContext.isRequiresRewriting());
- v1MarkupContext.setUseCachedMarkup(markupContext.isUseCachedItem());
-
- List<Extension> extensions = markupContext.getExtensions();
- if (extensions != null)
- {
- v1MarkupContext.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1MarkupContext;
- }
- else
- {
- return null;
- }
- }
-
- public static V1CacheControl toV1CacheControl(CacheControl cacheControl)
- {
- if (cacheControl != null)
- {
- V1CacheControl v1CacheControl = WSRP1TypeFactory.createCacheControl(cacheControl.getExpires(), cacheControl.getUserScope());
- v1CacheControl.setValidateTag(cacheControl.getValidateTag());
-
- List<Extension> extensions = cacheControl.getExtensions();
- if (extensions != null)
- {
- v1CacheControl.getExtensions().addAll(V2V1Converter.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- return v1CacheControl;
- }
- else
- {
- return null;
- }
- }
-
- public static ServiceDescription toV2ServiceDescription(V1ServiceDescription v1ServiceDescription)
- {
- throw new NotYetImplemented();
- }
-
- public static V1RegistrationContext toV1RegistrationContext(RegistrationContext registrationContext)
- {
- if (registrationContext != null)
- {
- V1RegistrationContext result = WSRP1TypeFactory.createRegistrationContext(registrationContext.getRegistrationHandle());
- result.setRegistrationState(registrationContext.getRegistrationState());
- List<V1Extension> extensions = V2V1Converter.transform(registrationContext.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- return result;
- }
- else
- {
- return null;
- }
- }
-
- public static <E extends Exception> E toV2Exception(Class<E> v2ExceptionClass, Exception v1Exception)
- {
- if (!"org.oasis.wsrp.v2".equals(v2ExceptionClass.getPackage().getName()))
- {
- throw new IllegalArgumentException("Specified exception class is not a WSRP 2 exception: " + v2ExceptionClass);
- }
-
- Class<? extends Exception> v1ExceptionClass = v1Exception.getClass();
- String v1Name = v1ExceptionClass.getSimpleName();
- int v1Index = v1Name.indexOf("V1");
- if (v1Index != 0 && !"org.oasis.wsrp.v1".equals(v1ExceptionClass.getPackage().getName()))
- {
- throw new IllegalArgumentException("Specified exception is not a WSRP 1 exception: " + v1Exception);
- }
-
- String v2Name = v2ExceptionClass.getSimpleName();
- // V2 class name should match V1 class name minus "V1"
- if (!v2Name.equals(v1Name.substring(2)))
- {
- throw new IllegalArgumentException("Exception names do not match. Requested: " + v2Name
- + ", was given: " + v1Name);
- }
-
- return WSRPExceptionFactory.createWSException(v2ExceptionClass, v1Exception.getMessage(), v1Exception.getCause());
- }
-
- public static <E extends Exception> E toV1Exception(Class<E> v1ExceptionClass, Exception v2Exception)
- {
- if (!"org.oasis.wsrp.v1".equals(v1ExceptionClass.getPackage().getName()))
- {
- throw new IllegalArgumentException("Specified exception class is not a WSRP 1 exception: " + v1ExceptionClass);
- }
-
- Class<? extends Exception> v2ExceptionClass = v2Exception.getClass();
- String v1Name = v2ExceptionClass.getSimpleName();
- if (!"org.oasis.wsrp.v2".equals(v2ExceptionClass.getPackage().getName()))
- {
- throw new IllegalArgumentException("Specified exception is not a WSRP 2 exception: " + v2Exception);
- }
-
- String v2Name = v2ExceptionClass.getSimpleName();
- // V1 class name should match V2 class name plus "V1"
- if (!v2Name.equals(v1Name.substring(2)))
- {
- throw new IllegalArgumentException("Exception names do not match. Requested: " + v1Name
- + ", was given: " + v2Name);
- }
-
- return WSRP1ExceptionFactory.createWSException(v1ExceptionClass, v2Exception.getMessage(), v2Exception.getCause());
- }
-
- public static V1CookieProtocol toV1CookieProtocol(CookieProtocol requiresInitCookie)
- {
- if (requiresInitCookie != null)
- {
- return V1CookieProtocol.fromValue(requiresInitCookie.value());
- }
- else
- {
- return null;
- }
- }
-
- public static V1ModelDescription toV1ModelDescription(ModelDescription modelDescription)
- {
- if (modelDescription != null)
- {
- V1ModelDescription result = WSRP1TypeFactory.createModelDescription(V2V1Converter.transform(modelDescription.getPropertyDescriptions(), V2_TO_V1_PROPERTYDESCRIPTION));
- List<V1Extension> extensions = V2V1Converter.transform(modelDescription.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- result.setModelTypes(toV1ModelTypes(modelDescription.getModelTypes()));
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
- public static V1ModelTypes toV1ModelTypes(ModelTypes modelTypes)
- {
- if (modelTypes != null)
- {
- V1ModelTypes result = new V1ModelTypes();
- result.setAny(modelTypes.getAny());
- return result;
- }
- else
- {
- return null;
- }
- }
-
- public static V1ResourceList toV1ResourceList(ResourceList resourceList)
- {
- if (resourceList != null)
- {
- V1ResourceList result = new V1ResourceList();
- List<V1Extension> extensions = V2V1Converter.transform(resourceList.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- List<V1Resource> v1Resources = V2V1Converter.transform(resourceList.getResources(), V2_TO_V1_RESOURCE);
- if (v1Resources != null)
- {
- result.getResources().addAll(v1Resources);
- }
- return result;
- }
- else
- {
- return null;
- }
- }
-
- public static InteractionParams toV2InteractionParams(V1InteractionParams v1InteractionParams)
- {
- if (v1InteractionParams != null)
- {
- InteractionParams interactionParams = WSRPTypeFactory.createInteractionParams(toV2StateChange(v1InteractionParams.getPortletStateChange()));
- interactionParams.setInteractionState(v1InteractionParams.getInteractionState());
- interactionParams.getExtensions().addAll(Lists.transform(v1InteractionParams.getExtensions(), V1_TO_V2_EXTENSION));
- interactionParams.getFormParameters().addAll(Lists.transform(v1InteractionParams.getFormParameters(), V1_TO_V2_NAMEDSTRING));
- interactionParams.getUploadContexts().addAll(Lists.transform(v1InteractionParams.getUploadContexts(), V1_TO_V2_UPLOADCONTEXT));
-
- return interactionParams;
- }
- else
- {
- return null;
- }
- }
-
- public static V1InteractionParams toV1InteractionParams(InteractionParams interactionParams)
- {
- if (interactionParams != null)
- {
- V1InteractionParams v1InteractionParams = WSRP1TypeFactory.createInteractionParams(toV1StateChange(interactionParams.getPortletStateChange()));
- v1InteractionParams.setInteractionState(interactionParams.getInteractionState());
-
- List<Extension> extensions = interactionParams.getExtensions();
- if (extensions != null)
- {
- v1InteractionParams.getExtensions().addAll(Lists.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- List<NamedString> formParameters = interactionParams.getFormParameters();
- if (formParameters != null)
- {
- v1InteractionParams.getFormParameters().addAll(Lists.transform(formParameters, V2_TO_V1_NAMEDSTRING));
- }
-
- List<UploadContext> uploadContext = interactionParams.getUploadContexts();
- if (uploadContext != null)
- {
- v1InteractionParams.getUploadContexts().addAll(Lists.transform(uploadContext, V2_TO_V1_UPLOADCONTEXT));
- }
-
- return v1InteractionParams;
- }
- else
- {
- return null;
- }
- }
-
-
- public static StateChange toV2StateChange(V1StateChange v1StateChange)
- {
- if (v1StateChange != null)
- {
- return StateChange.valueOf((v1StateChange.value()));
- }
- else
- {
- return null;
- }
- }
-
- public static V1StateChange toV1StateChange(StateChange stateChange)
- {
- if (stateChange != null)
- {
- return V1StateChange.valueOf(stateChange.value());
- }
- else
- {
- return null;
- }
- }
-
- public static V1UpdateResponse toV1UpdateResponse(UpdateResponse updateResponse)
- {
- if (updateResponse != null)
- {
- V1UpdateResponse v1UpdateResponse = WSRP1TypeFactory.createUpdateResponse();
- v1UpdateResponse.setMarkupContext(toV1MarkupContext(updateResponse.getMarkupContext()));
- v1UpdateResponse.setNavigationalState(updateResponse.getNavigationalContext().getOpaqueValue());
- v1UpdateResponse.setNewWindowState(updateResponse.getNewWindowState());
- v1UpdateResponse.setPortletContext(toV1PortletContext(updateResponse.getPortletContext()));
- v1UpdateResponse.setSessionContext(toV1SessionContext(updateResponse.getSessionContext()));
- v1UpdateResponse.setNewMode(updateResponse.getNewMode());
- return v1UpdateResponse;
- }
- else
- {
- return null;
- }
- }
-
- public static V1LocalizedString toV1LocalizedString(LocalizedString localizedString)
- {
- return V2_TO_V1_LOCALIZEDSTRING.apply(localizedString);
- }
-
- public static V1SessionContext toV1SessionContext(SessionContext sessionContext)
- {
- if (sessionContext != null)
- {
- V1SessionContext v1SessionContext = WSRP1TypeFactory.createSessionContext(sessionContext.getSessionID(), sessionContext.getExpires().intValue());
- v1SessionContext.getExtensions().addAll(Lists.transform(sessionContext.getExtensions(), V2_TO_V1_EXTENSION));
-
- return v1SessionContext;
- }
- else
- {
- return null;
- }
- }
-
- public static LocalizedString toV2LocalizedString(V1LocalizedString localizedString)
- {
- return V1_TO_V2_LOCALIZEDSTRING.apply(localizedString);
- }
-
- public static CookieProtocol toV2CookieProtocol(V1CookieProtocol v1CookieProtocol)
- {
- if (v1CookieProtocol != null)
- {
- return CookieProtocol.fromValue(v1CookieProtocol.value());
- }
- else
- {
- return null;
- }
- }
-
- public static ModelDescription toV2ModelDescription(V1ModelDescription v1ModelDescription)
- {
- if (v1ModelDescription != null)
- {
- ModelDescription result = WSRPTypeFactory.createModelDescription(V2V1Converter.transform(v1ModelDescription.getPropertyDescriptions(), V1_TO_V2_PROPERTYDESCRIPTION));
- List<Extension> extensions = V2V1Converter.transform(v1ModelDescription.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- result.setModelTypes(toV2ModelTypes(v1ModelDescription.getModelTypes()));
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
- private static ModelTypes toV2ModelTypes(V1ModelTypes modelTypes)
- {
- if (modelTypes != null)
- {
- ModelTypes result = new ModelTypes();
- result.setAny(modelTypes.getAny());
- return result;
- }
- else
- {
- return null;
- }
- }
-
- public static ResourceList toV2ResourceList(V1ResourceList v1ResourceList)
- {
- if (v1ResourceList != null)
- {
- ResourceList result = new ResourceList();
-
- List<Extension> extensions = V2V1Converter.transform(v1ResourceList.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- List<Resource> resources = V2V1Converter.transform(v1ResourceList.getResources(), V1_TO_V2_RESOURCE);
- if (resources != null)
- {
- result.getResources().addAll(resources);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
- private static class V1ToV2Extension implements Function<V1Extension, Extension>
- {
- public Extension apply(V1Extension from)
- {
- if (from != null)
- {
- Extension extension = new Extension();
- extension.setAny(from.getAny());
- return extension;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V2ToV1Extension implements Function<Extension, V1Extension>
- {
- public V1Extension apply(Extension from)
- {
- if (from != null)
- {
- V1Extension extension = new V1Extension();
- extension.setAny(from.getAny());
- return extension;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V2ToV1PortletDescription implements Function<PortletDescription, V1PortletDescription>
- {
-
- public V1PortletDescription apply(PortletDescription from)
- {
- if (from != null)
- {
- V1PortletDescription result = WSRP1TypeFactory.createPortletDescription(from.getPortletHandle(),
- V2V1Converter.transform(from.getMarkupTypes(), V2_TO_V1_MARKUPTYPE));
- result.setDescription(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDescription()));
- result.setDisplayName(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDisplayName()));
- List<V1Extension> extensions = V2V1Converter.transform(from.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- List<V1LocalizedString> keywords = V2V1Converter.transform(from.getKeywords(), V2_TO_V1_LOCALIZEDSTRING);
- if (keywords != null)
- {
- result.getKeywords().addAll(keywords);
- }
- List<String> userCategories = from.getUserCategories();
- if (userCategories != null)
- {
- result.getUserCategories().addAll(userCategories);
- }
- List<String> userProfileItems = from.getUserProfileItems();
- if (userProfileItems != null)
- {
- result.getUserProfileItems().addAll(userProfileItems);
- }
- result.setDefaultMarkupSecure(from.isDefaultMarkupSecure());
- result.setDoesUrlTemplateProcessing(from.isDoesUrlTemplateProcessing());
- result.setTemplatesStoredInSession(from.isTemplatesStoredInSession());
- result.setHasUserSpecificState(from.isHasUserSpecificState());
- result.setOnlySecure(from.isOnlySecure());
- result.setUserContextStoredInSession(from.isUserContextStoredInSession());
- result.setUsesMethodGet(from.isUsesMethodGet());
- result.setShortTitle(V2_TO_V1_LOCALIZEDSTRING.apply(from.getShortTitle()));
- result.setTitle(V2_TO_V1_LOCALIZEDSTRING.apply(from.getTitle()));
-
- result.setGroupID(from.getGroupID());
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V1ToV2PortletDescription implements Function<V1PortletDescription, PortletDescription>
- {
-
- public PortletDescription apply(V1PortletDescription from)
- {
- if (from != null)
- {
- PortletDescription result = WSRPTypeFactory.createPortletDescription(from.getPortletHandle(),
- V2V1Converter.transform(from.getMarkupTypes(), V1_TO_V2_MARKUPTYPE));
- result.setDescription(V1_TO_V2_LOCALIZEDSTRING.apply(from.getDescription()));
- result.setDisplayName(V1_TO_V2_LOCALIZEDSTRING.apply(from.getDisplayName()));
- List<Extension> extensions = V2V1Converter.transform(from.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- List<LocalizedString> keywords = V2V1Converter.transform(from.getKeywords(), V1_TO_V2_LOCALIZEDSTRING);
- if (keywords != null)
- {
- result.getKeywords().addAll(keywords);
- }
- List<String> userCategories = from.getUserCategories();
- if (userCategories != null)
- {
- result.getUserCategories().addAll(userCategories);
- }
- List<String> userProfileItems = from.getUserProfileItems();
- if (userProfileItems != null)
- {
- result.getUserProfileItems().addAll(userProfileItems);
- }
- result.setDefaultMarkupSecure(from.isDefaultMarkupSecure());
- result.setDoesUrlTemplateProcessing(from.isDoesUrlTemplateProcessing());
- result.setTemplatesStoredInSession(from.isTemplatesStoredInSession());
- result.setHasUserSpecificState(from.isHasUserSpecificState());
- result.setOnlySecure(from.isOnlySecure());
- result.setUserContextStoredInSession(from.isUserContextStoredInSession());
- result.setUsesMethodGet(from.isUsesMethodGet());
- result.setShortTitle(V1_TO_V2_LOCALIZEDSTRING.apply(from.getShortTitle()));
- result.setTitle(V1_TO_V2_LOCALIZEDSTRING.apply(from.getTitle()));
-
- result.setGroupID(from.getGroupID());
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V2ToV1ItemDescription implements Function<ItemDescription, V1ItemDescription>
- {
-
- public V1ItemDescription apply(ItemDescription from)
- {
- if (from != null)
- {
- V1ItemDescription result = new V1ItemDescription();
- result.setItemName(from.getItemName());
- result.setDescription(V2_TO_V1_LOCALIZEDSTRING.apply(from.getDescription()));
- List<V1Extension> extensions = V2V1Converter.transform(from.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V1ToV2ItemDescription implements Function<V1ItemDescription, ItemDescription>
- {
-
- public ItemDescription apply(V1ItemDescription from)
- {
- if (from != null)
- {
- ItemDescription result = new ItemDescription();
- result.setItemName(from.getItemName());
- result.setDescription(V1_TO_V2_LOCALIZEDSTRING.apply(from.getDescription()));
- List<Extension> extensions = V2V1Converter.transform(from.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
-
- public static class V1ToV2NamedString implements Function<V1NamedString, NamedString>
- {
- public NamedString apply(V1NamedString v1NamedString)
- {
- if (v1NamedString != null)
- {
- NamedString result = new NamedString();
- result.setName(v1NamedString.getName());
- result.setValue(v1NamedString.getValue());
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- public static class V2ToV1NamedString implements Function<NamedString, V1NamedString>
- {
- public V1NamedString apply(NamedString namedString)
- {
- if (namedString != null)
- {
- V1NamedString result = new V1NamedString();
- result.setName(namedString.getName());
- result.setValue(namedString.getValue());
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- public static class V1ToV2UploadContext implements Function<V1UploadContext, UploadContext>
- {
-
- public UploadContext apply(V1UploadContext v1UploadContext)
- {
- if (v1UploadContext != null)
- {
- UploadContext result = WSRPTypeFactory.createUploadContext(v1UploadContext.getMimeType(), v1UploadContext.getUploadData());
- result.getExtensions().addAll(Lists.transform(v1UploadContext.getExtensions(), V1_TO_V2_EXTENSION));
- result.getMimeAttributes().addAll(Lists.transform(v1UploadContext.getMimeAttributes(), V1_TO_V2_NAMEDSTRING));
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
- }
-
- public static class V2ToV1UploadContext implements Function<UploadContext, V1UploadContext>
- {
-
- public V1UploadContext apply(UploadContext uploadContext)
- {
- if (uploadContext != null)
- {
- V1UploadContext result = WSRP1TypeFactory.createUploadContext(uploadContext.getMimeType(), uploadContext.getUploadData());
-
- List<Extension> extensions = uploadContext.getExtensions();
- if (extensions != null)
- {
- result.getExtensions().addAll(Lists.transform(extensions, V2_TO_V1_EXTENSION));
- }
-
- List<NamedString> mimeAttributes = uploadContext.getMimeAttributes();
- if (mimeAttributes != null)
- {
- result.getMimeAttributes().addAll(Lists.transform(mimeAttributes, V2_TO_V1_NAMEDSTRING));
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
- }
-
- private static class V2ToV1MarkupType implements Function<MarkupType, V1MarkupType>
- {
-
- public V1MarkupType apply(MarkupType from)
- {
- if (from != null)
- {
- V1MarkupType result = WSRP1TypeFactory.createMarkupType(from.getMimeType(), from.getModes(), from.getWindowStates(), from.getLocales());
- List<V1Extension> extensions = V2V1Converter.transform(from.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V1ToV2MarkupType implements Function<V1MarkupType, MarkupType>
- {
-
- public MarkupType apply(V1MarkupType from)
- {
- if (from != null)
- {
- MarkupType result = WSRPTypeFactory.createMarkupType(from.getMimeType(), from.getModes(), from.getWindowStates(), from.getLocales());
- List<Extension> extensions = V2V1Converter.transform(from.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V2ToV1LocalizedString implements Function<LocalizedString, V1LocalizedString>
- {
-
- public V1LocalizedString apply(LocalizedString from)
- {
- if (from != null)
- {
- return WSRP1TypeFactory.createLocalizedString(from.getLang(), from.getResourceName(), from.getValue());
- }
- else
- {
- return null;
- }
-
- }
- }
-
- private static class V1ToV2LocalizedString implements Function<V1LocalizedString, LocalizedString>
- {
-
- public LocalizedString apply(V1LocalizedString from)
- {
- if (from != null)
- {
- return WSRPTypeFactory.createLocalizedString(from.getLang(), from.getResourceName(), from.getValue());
- }
- else
- {
- return null;
- }
-
- }
- }
-
- private static class V2ToV1PropertyDescription implements Function<PropertyDescription, V1PropertyDescription>
- {
-
- public V1PropertyDescription apply(PropertyDescription from)
- {
- if (from != null)
- {
- V1PropertyDescription result = WSRP1TypeFactory.createPropertyDescription(from.getName().toString(), from.getType());
- result.setHint(toV1LocalizedString(from.getHint()));
- result.setLabel(toV1LocalizedString(from.getLabel()));
- List<V1Extension> extensions = V2V1Converter.transform(from.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V2ToV1Resource implements Function<Resource, V1Resource>
- {
- public V1Resource apply(Resource from)
- {
- if (from != null)
- {
- V1Resource result = new V1Resource();
- result.setResourceName(from.getResourceName());
- List<V1ResourceValue> values = V2V1Converter.transform(from.getValues(), V2_TO_V1_RESOURCEVALUE);
- if (values != null)
- {
- result.getValues().addAll(values);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
- }
-
- private static class V2ToV1ResourceValue implements Function<ResourceValue, V1ResourceValue>
- {
- public V1ResourceValue apply(ResourceValue from)
- {
- if (from != null)
- {
- V1ResourceValue result = new V1ResourceValue();
- result.setLang(from.getLang());
- result.setValue(from.getValue());
- List<V1Extension> extensions = V2V1Converter.transform(from.getExtensions(), V2_TO_V1_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V1ToV2Resource implements Function<V1Resource, Resource>
- {
- public Resource apply(V1Resource from)
- {
- if (from != null)
- {
- Resource result = new Resource();
- result.setResourceName(from.getResourceName());
- List<ResourceValue> values = V2V1Converter.transform(from.getValues(), V1_TO_V2_RESOURCEVALUE);
- if (values != null)
- {
- result.getValues().addAll(values);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
-
- }
-
- private static class V1ToV2ResourceValue implements Function<V1ResourceValue, ResourceValue>
- {
- public ResourceValue apply(V1ResourceValue from)
- {
- if (from != null)
- {
- ResourceValue result = new ResourceValue();
- result.setLang(from.getLang());
- result.setValue(from.getValue());
- List<Extension> extensions = V2V1Converter.transform(from.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-
- private static class V1ToV2PropertyDescription implements Function<V1PropertyDescription, PropertyDescription>
- {
- public PropertyDescription apply(V1PropertyDescription from)
- {
- if (from != null)
- {
- PropertyDescription result = WSRPTypeFactory.createPropertyDescription(from.getName(), from.getType());
- result.setHint(toV2LocalizedString(from.getHint()));
- result.setLabel(toV2LocalizedString(from.getLabel()));
- List<Extension> extensions = V2V1Converter.transform(from.getExtensions(), V1_TO_V2_EXTENSION);
- if (extensions != null)
- {
- result.getExtensions().addAll(extensions);
- }
-
- return result;
- }
- else
- {
- return null;
- }
- }
- }
-}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-06-10 07:58:14 UTC (rev 3292)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -314,7 +314,7 @@
*/
public static V1PortletDescription createPortletDescription(org.gatein.pc.api.PortletContext portletContext, List<V1MarkupType> markupTypes)
{
- V1PortletContext context = V2V1Converter.toV1PortletContext(WSRPUtils.convertToWSRPPortletContext(portletContext));
+ V1PortletContext context = V2ToV1Converter.toV1PortletContext(WSRPUtils.convertToWSRPPortletContext(portletContext));
ParameterValidation.throwIllegalArgExceptionIfNull(markupTypes, "MarkupType");
if (markupTypes.isEmpty())
Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java 2010-06-10 07:58:14 UTC (rev 3292)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/spec/v1/V2V1ConverterTestCase.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -1,24 +1,25 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.wsrp.spec.v1;
@@ -38,7 +39,7 @@
{
Throwable throwable = new Throwable();
V1OperationFailed v1OF = new V1OperationFailed("foo", new V1OperationFailedFault(), throwable);
- OperationFailed operationFailed = V2V1Converter.toV2Exception(OperationFailed.class, v1OF);
+ OperationFailed operationFailed = V1ToV2Converter.toV2Exception(OperationFailed.class, v1OF);
assertNotNull(operationFailed);
assertEquals("foo", operationFailed.getMessage());
assertEquals(throwable, operationFailed.getCause());
@@ -51,7 +52,7 @@
try
{
- V2V1Converter.toV2Exception(InvalidSession.class, v1OF);
+ V1ToV2Converter.toV2Exception(InvalidSession.class, v1OF);
fail("Should have failed as requested v2 exception doesn't match specified v1");
}
catch (IllegalArgumentException e)
@@ -67,7 +68,7 @@
try
{
- V2V1Converter.toV2Exception(IllegalArgumentException.class, v1OF);
+ V1ToV2Converter.toV2Exception(IllegalArgumentException.class, v1OF);
fail("Should have failed as requested exception is not a WSRP 2 exception class");
}
catch (IllegalArgumentException e)
@@ -80,7 +81,7 @@
{
try
{
- V2V1Converter.toV2Exception(OperationFailed.class, new IllegalArgumentException());
+ V1ToV2Converter.toV2Exception(OperationFailed.class, new IllegalArgumentException());
fail("Should have failed as specified exception is not a WSRP 1 exception");
}
catch (IllegalArgumentException e)
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java 2010-06-10 07:58:14 UTC (rev 3292)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -1,30 +1,33 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.wsrp.services.v1;
import org.gatein.common.NotYetImplemented;
+import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.services.MarkupService;
-import org.gatein.wsrp.spec.v1.V2V1Converter;
+import org.gatein.wsrp.spec.v1.V1ToV2Converter;
+import org.gatein.wsrp.spec.v1.V2ToV1Converter;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1InconsistentParameters;
@@ -95,75 +98,75 @@
{
try
{
- service.getMarkup(
- V2V1Converter.toV1RegistrationContext(registrationContext),
- V2V1Converter.toV1PortletContext(portletContext),
- V2V1Converter.toV1RuntimeContext(runtimeContext),
- V2V1Converter.toV1UserContext(userContext),
- V2V1Converter.toV1MarkupParams(markupParams),
- new Holder<V1MarkupContext>(V2V1Converter.toV1MarkupContext(markupContext.value)),
- new Holder<V1SessionContext>(V2V1Converter.toV1SessionContext(sessionContext.value)),
- new Holder<List<V1Extension>>(V2V1Converter.transform(extensions.value, V2V1Converter.V2_TO_V1_EXTENSION)));
+ service.getMarkup(
+ V2ToV1Converter.toV1RegistrationContext(registrationContext),
+ V2ToV1Converter.toV1PortletContext(portletContext),
+ V2ToV1Converter.toV1RuntimeContext(runtimeContext),
+ V2ToV1Converter.toV1UserContext(userContext),
+ V2ToV1Converter.toV1MarkupParams(markupParams),
+ new Holder<V1MarkupContext>(V2ToV1Converter.toV1MarkupContext(markupContext.value)),
+ new Holder<V1SessionContext>(V2ToV1Converter.toV1SessionContext(sessionContext.value)),
+ new Holder<List<V1Extension>>(WSRPUtils.transform(extensions.value, V2ToV1Converter.EXTENSION)));
}
catch (V1AccessDenied accessDenied)
{
- throw V2V1Converter.toV1Exception(AccessDenied.class, accessDenied);
+ throw V2ToV1Converter.toV1Exception(AccessDenied.class, accessDenied);
}
catch (V1InconsistentParameters inconsistentParameters)
{
- throw V2V1Converter.toV1Exception(InconsistentParameters.class, inconsistentParameters);
+ throw V2ToV1Converter.toV1Exception(InconsistentParameters.class, inconsistentParameters);
}
catch (V1InvalidCookie invalidCookie)
{
- throw V2V1Converter.toV1Exception(InvalidCookie.class, invalidCookie);
+ throw V2ToV1Converter.toV1Exception(InvalidCookie.class, invalidCookie);
}
catch (V1InvalidHandle invalidHandle)
{
- throw V2V1Converter.toV1Exception(InvalidHandle.class, invalidHandle);
+ throw V2ToV1Converter.toV1Exception(InvalidHandle.class, invalidHandle);
}
catch (V1InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
}
catch (V1InvalidSession invalidSession)
{
- throw V2V1Converter.toV1Exception(InvalidSession.class, invalidSession);
+ throw V2ToV1Converter.toV1Exception(InvalidSession.class, invalidSession);
}
catch (V1InvalidUserCategory invalidUserCategory)
{
- throw V2V1Converter.toV1Exception(InvalidUserCategory.class, invalidUserCategory);
+ throw V2ToV1Converter.toV1Exception(InvalidUserCategory.class, invalidUserCategory);
}
catch (V1MissingParameters missingParameter)
{
- throw V2V1Converter.toV1Exception(MissingParameters.class, missingParameter);
+ throw V2ToV1Converter.toV1Exception(MissingParameters.class, missingParameter);
}
catch (V1OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(OperationFailed.class, operationFailed);
}
catch (V1UnsupportedLocale unsupportedLocale)
{
- throw V2V1Converter.toV1Exception(UnsupportedLocale.class, unsupportedLocale);
+ throw V2ToV1Converter.toV1Exception(UnsupportedLocale.class, unsupportedLocale);
}
catch (V1UnsupportedMimeType unsupportedMimeType)
{
- throw V2V1Converter.toV1Exception(UnsupportedMimeType.class, unsupportedMimeType);
+ throw V2ToV1Converter.toV1Exception(UnsupportedMimeType.class, unsupportedMimeType);
}
catch (V1UnsupportedMode unsupportedMode)
{
- throw V2V1Converter.toV1Exception(UnsupportedMode.class, unsupportedMode);
+ throw V2ToV1Converter.toV1Exception(UnsupportedMode.class, unsupportedMode);
}
catch (V1UnsupportedWindowState unsupportedWindowState)
{
- throw V2V1Converter.toV1Exception(UnsupportedWindowState.class, unsupportedWindowState);
+ throw V2ToV1Converter.toV1Exception(UnsupportedWindowState.class, unsupportedWindowState);
}
-
+
}
@Override
public void getResource(RegistrationContext registrationContext, Holder<PortletContext> portletContext, RuntimeContext runtimeContext, UserContext userContext, ResourceParams resourceParams, Holder<ResourceContext> resourceContext, Holder<SessionContext> sessionContext, Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
{
-
+
throw new NotYetImplemented();
}
@@ -173,71 +176,71 @@
try
{
service.performBlockingInteraction(
- V2V1Converter.toV1RegistrationContext(registrationContext),
- V2V1Converter.toV1PortletContext(portletContext),
- V2V1Converter.toV1RuntimeContext(runtimeContext),
- V2V1Converter.toV1UserContext(userContext),
- V2V1Converter.toV1MarkupParams(markupParams),
- V2V1Converter.toV1InteractionParams(interactionParams),
- new Holder<V1UpdateResponse>(V2V1Converter.toV1UpdateResponse(updateResponse.value)),
- redirectURL,
- new Holder<List<V1Extension>>(V2V1Converter.transform(extensions.value, V2V1Converter.V2_TO_V1_EXTENSION)));
+ V2ToV1Converter.toV1RegistrationContext(registrationContext),
+ V2ToV1Converter.toV1PortletContext(portletContext),
+ V2ToV1Converter.toV1RuntimeContext(runtimeContext),
+ V2ToV1Converter.toV1UserContext(userContext),
+ V2ToV1Converter.toV1MarkupParams(markupParams),
+ V2ToV1Converter.toV1InteractionParams(interactionParams),
+ new Holder<V1UpdateResponse>(V2ToV1Converter.toV1UpdateResponse(updateResponse.value)),
+ redirectURL,
+ new Holder<List<V1Extension>>(WSRPUtils.transform(extensions.value, V2ToV1Converter.EXTENSION)));
}
catch (V1AccessDenied accessDenied)
{
- throw V2V1Converter.toV1Exception(AccessDenied.class, accessDenied);
+ throw V2ToV1Converter.toV1Exception(AccessDenied.class, accessDenied);
}
catch (V1InconsistentParameters inconsistentParameters)
{
- throw V2V1Converter.toV1Exception(InconsistentParameters.class, inconsistentParameters);
+ throw V2ToV1Converter.toV1Exception(InconsistentParameters.class, inconsistentParameters);
}
catch (V1InvalidCookie invalidCookie)
{
- throw V2V1Converter.toV1Exception(InvalidCookie.class, invalidCookie);
+ throw V2ToV1Converter.toV1Exception(InvalidCookie.class, invalidCookie);
}
catch (V1InvalidHandle invalidHandle)
{
- throw V2V1Converter.toV1Exception(InvalidHandle.class, invalidHandle);
+ throw V2ToV1Converter.toV1Exception(InvalidHandle.class, invalidHandle);
}
catch (V1InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
}
catch (V1InvalidSession invalidSession)
{
- throw V2V1Converter.toV1Exception(InvalidSession.class, invalidSession);
+ throw V2ToV1Converter.toV1Exception(InvalidSession.class, invalidSession);
}
catch (V1InvalidUserCategory invalidUserCategory)
{
- throw V2V1Converter.toV1Exception(InvalidUserCategory.class, invalidUserCategory);
+ throw V2ToV1Converter.toV1Exception(InvalidUserCategory.class, invalidUserCategory);
}
catch (V1MissingParameters missingParameters)
{
- throw V2V1Converter.toV1Exception(MissingParameters.class, missingParameters);
+ throw V2ToV1Converter.toV1Exception(MissingParameters.class, missingParameters);
}
catch (V1OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(OperationFailed.class, operationFailed);
}
catch (V1PortletStateChangeRequired portletStateChangeRequired)
{
- throw V2V1Converter.toV1Exception(PortletStateChangeRequired.class, portletStateChangeRequired);
+ throw V2ToV1Converter.toV1Exception(PortletStateChangeRequired.class, portletStateChangeRequired);
}
catch (V1UnsupportedLocale unsupportedLocale)
{
- throw V2V1Converter.toV1Exception(UnsupportedLocale.class, unsupportedLocale);
+ throw V2ToV1Converter.toV1Exception(UnsupportedLocale.class, unsupportedLocale);
}
catch (V1UnsupportedMimeType unsupportedMimeType)
{
- throw V2V1Converter.toV1Exception(UnsupportedMimeType.class, unsupportedMimeType);
+ throw V2ToV1Converter.toV1Exception(UnsupportedMimeType.class, unsupportedMimeType);
}
catch (V1UnsupportedMode unsupportedMode)
{
- throw V2V1Converter.toV1Exception(UnsupportedMode.class, unsupportedMode);
+ throw V2ToV1Converter.toV1Exception(UnsupportedMode.class, unsupportedMode);
}
catch (V1UnsupportedWindowState unsupportedWindowState)
{
- throw V2V1Converter.toV1Exception(UnsupportedWindowState.class, unsupportedWindowState);
+ throw V2ToV1Converter.toV1Exception(UnsupportedWindowState.class, unsupportedWindowState);
}
}
@@ -252,23 +255,23 @@
{
try
{
- return V2V1Converter.transform(service.releaseSessions(V2V1Converter.toV1RegistrationContext(registrationContext),sessionIDs), V2V1Converter.V1_TO_V2_EXTENSION);
+ return WSRPUtils.transform(service.releaseSessions(V2ToV1Converter.toV1RegistrationContext(registrationContext), sessionIDs), V1ToV2Converter.EXTENSION);
}
catch (V1AccessDenied accessDenied)
{
- throw V2V1Converter.toV1Exception(AccessDenied.class, accessDenied);
+ throw V2ToV1Converter.toV1Exception(AccessDenied.class, accessDenied);
}
catch (V1InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
}
catch (V1MissingParameters missingParameters)
{
- throw V2V1Converter.toV1Exception(MissingParameters.class, missingParameters);
+ throw V2ToV1Converter.toV1Exception(MissingParameters.class, missingParameters);
}
catch (V1OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(OperationFailed.class, operationFailed);
}
}
@@ -277,19 +280,19 @@
{
try
{
- return V2V1Converter.transform(service.initCookie(V2V1Converter.toV1RegistrationContext(registrationContext)), V2V1Converter.V1_TO_V2_EXTENSION);
+ return WSRPUtils.transform(service.initCookie(V2ToV1Converter.toV1RegistrationContext(registrationContext)), V1ToV2Converter.EXTENSION);
}
catch (V1AccessDenied accessDenied)
{
- throw V2V1Converter.toV1Exception(AccessDenied.class, accessDenied);
+ throw V2ToV1Converter.toV1Exception(AccessDenied.class, accessDenied);
}
catch (V1InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
}
catch (V1OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(OperationFailed.class, operationFailed);
}
}
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java 2010-06-10 07:58:14 UTC (rev 3292)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -23,8 +23,10 @@
package org.gatein.wsrp.services.v1;
+import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.services.ServiceDescriptionService;
-import org.gatein.wsrp.spec.v1.V2V1Converter;
+import org.gatein.wsrp.spec.v1.V1ToV2Converter;
+import org.gatein.wsrp.spec.v1.V2ToV1Converter;
import org.oasis.wsrp.v1.V1CookieProtocol;
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1InvalidRegistration;
@@ -78,7 +80,7 @@
Holder<Boolean> mayReturnRegistrationState, Holder<List<Extension>> extensions)
throws InvalidRegistration, ModifyRegistrationRequired, OperationFailed, ResourceSuspended
{
- V1RegistrationContext v1RegistrationContext = V2V1Converter.toV1RegistrationContext(registrationContext);
+ V1RegistrationContext v1RegistrationContext = V2ToV1Converter.toV1RegistrationContext(registrationContext);
Holder<List<V1PortletDescription>> v1OfferedPortlets = new Holder<List<V1PortletDescription>>();
Holder<List<V1ItemDescription>> v1UserCategories = new Holder<List<V1ItemDescription>>();
Holder<List<V1ItemDescription>> v1ProfileITems = new Holder<List<V1ItemDescription>>();
@@ -99,21 +101,21 @@
}
catch (V1InvalidRegistration v1InvalidRegistration)
{
- throw V2V1Converter.toV2Exception(InvalidRegistration.class, v1InvalidRegistration);
+ throw V1ToV2Converter.toV2Exception(InvalidRegistration.class, v1InvalidRegistration);
}
catch (V1OperationFailed v1OperationFailed)
{
- throw V2V1Converter.toV2Exception(OperationFailed.class, v1OperationFailed);
+ throw V1ToV2Converter.toV2Exception(OperationFailed.class, v1OperationFailed);
}
- offeredPortlets.value = V2V1Converter.transform(v1OfferedPortlets.value, V2V1Converter.V1_TO_V2_PORTLETDESCRIPTION);
- userCategoryDescriptions.value = V2V1Converter.transform(v1UserCategories.value, V2V1Converter.V1_TO_V2_ITEMDESCRIPTION);
+ offeredPortlets.value = WSRPUtils.transform(v1OfferedPortlets.value, V1ToV2Converter.PORTLETDESCRIPTION);
+ userCategoryDescriptions.value = WSRPUtils.transform(v1UserCategories.value, V1ToV2Converter.ITEMDESCRIPTION);
// customUserProfileItemDescriptions.value = description.getCustomUserProfileItemDescriptions();
- customWindowStateDescriptions.value = V2V1Converter.transform(v1WindowStates.value, V2V1Converter.V1_TO_V2_ITEMDESCRIPTION);
- customModeDescriptions.value = V2V1Converter.transform(v1Modes.value, V2V1Converter.V1_TO_V2_ITEMDESCRIPTION);
- requiresInitCookie.value = V2V1Converter.toV2CookieProtocol(v1Cookie.value);
- registrationPropertyDescription.value = V2V1Converter.toV2ModelDescription(v1RegistrationProperties.value);
- resourceList.value = V2V1Converter.toV2ResourceList(v1Resources.value);
- extensions.value = V2V1Converter.transform(v1Extensions.value, V2V1Converter.V1_TO_V2_EXTENSION);
+ customWindowStateDescriptions.value = WSRPUtils.transform(v1WindowStates.value, V1ToV2Converter.ITEMDESCRIPTION);
+ customModeDescriptions.value = WSRPUtils.transform(v1Modes.value, V1ToV2Converter.ITEMDESCRIPTION);
+ requiresInitCookie.value = V1ToV2Converter.toV2CookieProtocol(v1Cookie.value);
+ registrationPropertyDescription.value = V1ToV2Converter.toV2ModelDescription(v1RegistrationProperties.value);
+ resourceList.value = V1ToV2Converter.toV2ResourceList(v1Resources.value);
+ extensions.value = WSRPUtils.transform(v1Extensions.value, V1ToV2Converter.EXTENSION);
}
}
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java 2010-06-10 07:58:14 UTC (rev 3292)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -25,7 +25,8 @@
import com.google.common.collect.Lists;
import org.gatein.wsrp.endpoints.WSRPBaseEndpoint;
-import org.gatein.wsrp.spec.v1.V2V1Converter;
+import org.gatein.wsrp.spec.v1.V1ToV2Converter;
+import org.gatein.wsrp.spec.v1.V2ToV1Converter;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1InconsistentParameters;
@@ -112,13 +113,13 @@
forceSessionAccess();
PerformBlockingInteraction performBlockingInteraction = new PerformBlockingInteraction();
- performBlockingInteraction.setPortletContext(V2V1Converter.toV2PortletContext(portletContext));
- performBlockingInteraction.setRuntimeContext(V2V1Converter.toV2RuntimeContext(runtimeContext));
- performBlockingInteraction.setMarkupParams(V2V1Converter.toV2MarkupParams(markupParams));
- performBlockingInteraction.setInteractionParams(V2V1Converter.toV2InteractionParams(interactionParams));
+ performBlockingInteraction.setPortletContext(V1ToV2Converter.toV2PortletContext(portletContext));
+ performBlockingInteraction.setRuntimeContext(V1ToV2Converter.toV2RuntimeContext(runtimeContext));
+ performBlockingInteraction.setMarkupParams(V1ToV2Converter.toV2MarkupParams(markupParams));
+ performBlockingInteraction.setInteractionParams(V1ToV2Converter.toV2InteractionParams(interactionParams));
- performBlockingInteraction.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
- performBlockingInteraction.setUserContext(V2V1Converter.toV2UserContext(userContext));
+ performBlockingInteraction.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
+ performBlockingInteraction.setUserContext(V1ToV2Converter.toV2UserContext(userContext));
BlockingInteractionResponse interactionResponse = null;
try
@@ -128,64 +129,64 @@
}
catch (InvalidCookie invalidCookie)
{
- throw V2V1Converter.toV1Exception(V1InvalidCookie.class, invalidCookie);
+ throw V2ToV1Converter.toV1Exception(V1InvalidCookie.class, invalidCookie);
}
catch (InvalidHandle invalidHandle)
{
- throw V2V1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
}
catch (InvalidSession invalidSession)
{
- throw V2V1Converter.toV1Exception(V1InvalidSession.class, invalidSession);
+ throw V2ToV1Converter.toV1Exception(V1InvalidSession.class, invalidSession);
}
catch (UnsupportedMode unsupportedMode)
{
- throw V2V1Converter.toV1Exception(V1UnsupportedMode.class, unsupportedMode);
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedMode.class, unsupportedMode);
}
catch (UnsupportedMimeType unsupportedMimeType)
{
- throw V2V1Converter.toV1Exception(V1UnsupportedMimeType.class, unsupportedMimeType);
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedMimeType.class, unsupportedMimeType);
}
catch (OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
}
catch (UnsupportedWindowState unsupportedWindowState)
{
- throw V2V1Converter.toV1Exception(V1UnsupportedWindowState.class, unsupportedWindowState);
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedWindowState.class, unsupportedWindowState);
}
catch (UnsupportedLocale unsupportedLocale)
{
- throw V2V1Converter.toV1Exception(V1UnsupportedLocale.class, unsupportedLocale);
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedLocale.class, unsupportedLocale);
}
catch (AccessDenied accessDenied)
{
- throw V2V1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
}
catch (PortletStateChangeRequired portletStateChangeRequired)
{
- throw V2V1Converter.toV1Exception(V1PortletStateChangeRequired.class, portletStateChangeRequired);
+ throw V2ToV1Converter.toV1Exception(V1PortletStateChangeRequired.class, portletStateChangeRequired);
}
catch (InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
}
catch (MissingParameters missingParameters)
{
- throw V2V1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
}
catch (InvalidUserCategory invalidUserCategory)
{
- throw V2V1Converter.toV1Exception(V1InvalidUserCategory.class, invalidUserCategory);
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class, invalidUserCategory);
}
catch (InconsistentParameters inconsistentParameters)
{
- throw V2V1Converter.toV1Exception(V1InconsistentParameters.class, inconsistentParameters);
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class, inconsistentParameters);
}
- updateResponse.value = V2V1Converter.toV1UpdateResponse(interactionResponse.getUpdateResponse());
+ updateResponse.value = V2ToV1Converter.toV1UpdateResponse(interactionResponse.getUpdateResponse());
redirectURL.value = interactionResponse.getRedirectURL();
- extensions.value = Lists.transform(interactionResponse.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
+ extensions.value = Lists.transform(interactionResponse.getExtensions(), V2ToV1Converter.EXTENSION);
}
public List<V1Extension> releaseSessions(
@@ -196,7 +197,7 @@
forceSessionAccess();
ReleaseSessions releaseSessions = new ReleaseSessions();
- releaseSessions.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
+ releaseSessions.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
releaseSessions.getSessionIDs().addAll(sessionIDs);
ReturnAny returnAny;
@@ -206,22 +207,22 @@
}
catch (InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
}
catch (OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
}
catch (MissingParameters missingParameters)
{
- throw V2V1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
}
catch (AccessDenied accessDenied)
{
- throw V2V1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
}
- return Lists.transform(returnAny.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
+ return Lists.transform(returnAny.getExtensions(), V2ToV1Converter.EXTENSION);
}
public void getMarkup(
@@ -240,11 +241,11 @@
forceSessionAccess();
GetMarkup getMarkup = new GetMarkup();
- getMarkup.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
- getMarkup.setPortletContext(V2V1Converter.toV2PortletContext(portletContext));
- getMarkup.setRuntimeContext(V2V1Converter.toV2RuntimeContext(runtimeContext));
- getMarkup.setUserContext(V2V1Converter.toV2UserContext(userContext));
- getMarkup.setMarkupParams(V2V1Converter.toV2MarkupParams(markupParams));
+ getMarkup.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
+ getMarkup.setPortletContext(V1ToV2Converter.toV2PortletContext(portletContext));
+ getMarkup.setRuntimeContext(V1ToV2Converter.toV2RuntimeContext(runtimeContext));
+ getMarkup.setUserContext(V1ToV2Converter.toV2UserContext(userContext));
+ getMarkup.setMarkupParams(V1ToV2Converter.toV2MarkupParams(markupParams));
MarkupResponse response;
try
@@ -253,60 +254,60 @@
}
catch (UnsupportedWindowState unsupportedWindowState)
{
- throw V2V1Converter.toV1Exception(V1UnsupportedWindowState.class, unsupportedWindowState);
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedWindowState.class, unsupportedWindowState);
}
catch (InvalidCookie invalidCookie)
{
- throw V2V1Converter.toV1Exception(V1InvalidCookie.class, invalidCookie);
+ throw V2ToV1Converter.toV1Exception(V1InvalidCookie.class, invalidCookie);
}
catch (InvalidSession invalidSession)
{
- throw V2V1Converter.toV1Exception(V1InvalidSession.class, invalidSession);
+ throw V2ToV1Converter.toV1Exception(V1InvalidSession.class, invalidSession);
}
catch (AccessDenied accessDenied)
{
- throw V2V1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
}
catch (InconsistentParameters inconsistentParameters)
{
- throw V2V1Converter.toV1Exception(V1InconsistentParameters.class, inconsistentParameters);
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class, inconsistentParameters);
}
catch (InvalidHandle invalidHandle)
{
- throw V2V1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
}
catch (UnsupportedLocale unsupportedLocale)
{
- throw V2V1Converter.toV1Exception(V1UnsupportedLocale.class, unsupportedLocale);
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedLocale.class, unsupportedLocale);
}
catch (UnsupportedMode unsupportedMode)
{
- throw V2V1Converter.toV1Exception(V1UnsupportedMode.class, unsupportedMode);
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedMode.class, unsupportedMode);
}
catch (OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
}
catch (MissingParameters missingParameters)
{
- throw V2V1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
}
catch (InvalidUserCategory invalidUserCategory)
{
- throw V2V1Converter.toV1Exception(V1InvalidUserCategory.class, invalidUserCategory);
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class, invalidUserCategory);
}
catch (InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
}
catch (UnsupportedMimeType unsupportedMimeType)
{
- throw V2V1Converter.toV1Exception(V1UnsupportedMimeType.class, unsupportedMimeType);
+ throw V2ToV1Converter.toV1Exception(V1UnsupportedMimeType.class, unsupportedMimeType);
}
- markupContext.value = V2V1Converter.toV1MarkupContext(response.getMarkupContext());
- sessionContext.value = V2V1Converter.toV1SessionContext(response.getSessionContext());
- extensions.value = Lists.transform(response.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
+ markupContext.value = V2ToV1Converter.toV1MarkupContext(response.getMarkupContext());
+ sessionContext.value = V2ToV1Converter.toV1SessionContext(response.getSessionContext());
+ extensions.value = Lists.transform(response.getExtensions(), V2ToV1Converter.EXTENSION);
}
public List<V1Extension> initCookie(
@@ -316,7 +317,7 @@
forceSessionAccess();
InitCookie initCookie = new InitCookie();
- initCookie.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
+ initCookie.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
ReturnAny returnAny;
try
@@ -325,17 +326,17 @@
}
catch (AccessDenied accessDenied)
{
- throw V2V1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
}
catch (OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
}
catch (InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
}
- return Lists.transform(returnAny.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
+ return Lists.transform(returnAny.getExtensions(), V2ToV1Converter.EXTENSION);
}
}
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java 2010-06-10 07:58:14 UTC (rev 3292)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java 2010-06-10 08:41:09 UTC (rev 3293)
@@ -23,8 +23,10 @@
package org.gatein.wsrp.endpoints.v1;
+import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.endpoints.WSRPBaseEndpoint;
-import org.gatein.wsrp.spec.v1.V2V1Converter;
+import org.gatein.wsrp.spec.v1.V1ToV2Converter;
+import org.gatein.wsrp.spec.v1.V2ToV1Converter;
import org.oasis.wsrp.v1.V1CookieProtocol;
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1InvalidRegistration;
@@ -77,7 +79,7 @@
) throws V1InvalidRegistration, V1OperationFailed
{
GetServiceDescription getServiceDescription = new GetServiceDescription();
- getServiceDescription.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
+ getServiceDescription.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
getServiceDescription.getDesiredLocales().addAll(desiredLocales);
ServiceDescription description;
@@ -87,23 +89,23 @@
}
catch (InvalidRegistration invalidRegistration)
{
- throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
}
catch (OperationFailed operationFailed)
{
- throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
}
requiresRegistration.value = description.isRequiresRegistration();
- offeredPortlets.value = V2V1Converter.transform(description.getOfferedPortlets(), V2V1Converter.V2_TO_V1_PORTLETDESCRIPTION);
- userCategoryDescriptions.value = V2V1Converter.transform(description.getUserCategoryDescriptions(), V2V1Converter.V2_TO_V1_ITEMDESCRIPTION);
+ offeredPortlets.value = WSRPUtils.transform(description.getOfferedPortlets(), V2ToV1Converter.PORTLETDESCRIPTION);
+ userCategoryDescriptions.value = WSRPUtils.transform(description.getUserCategoryDescriptions(), V2ToV1Converter.ITEMDESCRIPTION);
// customUserProfileItemDescriptions.value = description.getCustomUserProfileItemDescriptions();
- customWindowStateDescriptions.value = V2V1Converter.transform(description.getCustomWindowStateDescriptions(), V2V1Converter.V2_TO_V1_ITEMDESCRIPTION);
- customModeDescriptions.value = V2V1Converter.transform(description.getCustomModeDescriptions(), V2V1Converter.V2_TO_V1_ITEMDESCRIPTION);
- requiresInitCookie.value = V2V1Converter.toV1CookieProtocol(description.getRequiresInitCookie());
- registrationPropertyDescription.value = V2V1Converter.toV1ModelDescription(description.getRegistrationPropertyDescription());
+ customWindowStateDescriptions.value = WSRPUtils.transform(description.getCustomWindowStateDescriptions(), V2ToV1Converter.ITEMDESCRIPTION);
+ customModeDescriptions.value = WSRPUtils.transform(description.getCustomModeDescriptions(), V2ToV1Converter.ITEMDESCRIPTION);
+ requiresInitCookie.value = V2ToV1Converter.toV1CookieProtocol(description.getRequiresInitCookie());
+ registrationPropertyDescription.value = V2ToV1Converter.toV1ModelDescription(description.getRegistrationPropertyDescription());
locales.value = description.getLocales();
- resourceList.value = V2V1Converter.toV1ResourceList(description.getResourceList());
- extensions.value = V2V1Converter.transform(description.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
+ resourceList.value = V2ToV1Converter.toV1ResourceList(description.getResourceList());
+ extensions.value = WSRPUtils.transform(description.getExtensions(), V2ToV1Converter.EXTENSION);
}
}
14 years, 6 months
gatein SVN: r3292 - in portal/trunk: webui/eXo/src/main/java/org/exoplatform/webui/organization and 1 other directory.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2010-06-10 03:58:14 -0400 (Thu, 10 Jun 2010)
New Revision: 3292
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/UIRegisterInputSet.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIAccountInputSet.java
Log:
GTNPORTAL-1245 Show message wrong when input First/last Name in New Staff page contain special characters
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/UIRegisterInputSet.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/UIRegisterInputSet.java 2010-06-10 06:46:05 UTC (rev 3291)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/UIRegisterInputSet.java 2010-06-10 07:58:14 UTC (rev 3292)
@@ -75,13 +75,11 @@
addUIFormInput(new UIFormStringInput(CONFIRM_PASSWORD, CONFIRM_PASSWORD, null).setType(UIFormStringInput.PASSWORD_TYPE)
.addValidator(MandatoryValidator.class).addValidator(PasswordStringLengthValidator.class, 6, 30));
- addUIFormInput(new UIFormStringInput(FIRST_NAME, FIRST_NAME, null).addValidator(StringLengthValidator.class, 3,
- 45).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class, Utils.FIRST_CHARACTER_NAME_VALIDATOR_REGEX,
- "FirstCharacterNameValidator.msg"));
+ addUIFormInput(new UIFormStringInput(FIRST_NAME, FIRST_NAME, null).addValidator(StringLengthValidator.class, 1,
+ 45).addValidator(MandatoryValidator.class));
- addUIFormInput(new UIFormStringInput(LAST_NAME, LAST_NAME, null).addValidator(StringLengthValidator.class, 3,
- 45).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class, Utils.FIRST_CHARACTER_NAME_VALIDATOR_REGEX,
- "FirstCharacterNameValidator.msg"));
+ addUIFormInput(new UIFormStringInput(LAST_NAME, LAST_NAME, null).addValidator(StringLengthValidator.class, 1,
+ 45).addValidator(MandatoryValidator.class));
addUIFormInput(new UIFormStringInput(EMAIL_ADDRESS, EMAIL_ADDRESS, null).addValidator(MandatoryValidator.class).addValidator(
EmailAddressValidator.class));
Modified: portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIAccountInputSet.java
===================================================================
--- portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIAccountInputSet.java 2010-06-10 06:46:05 UTC (rev 3291)
+++ portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIAccountInputSet.java 2010-06-10 07:58:14 UTC (rev 3292)
@@ -67,12 +67,10 @@
.addValidator(MandatoryValidator.class).addValidator(PasswordStringLengthValidator.class, 6, 30));
addUIFormInput(new UIFormStringInput(PASSWORD2X, "password", null).setType(UIFormStringInput.PASSWORD_TYPE)
.addValidator(MandatoryValidator.class).addValidator(PasswordStringLengthValidator.class, 6, 30));
- addUIFormInput(new UIFormStringInput("firstName", "firstName", null).addValidator(StringLengthValidator.class, 3,
- 45).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class,
- Utils.FIRST_CHARACTER_NAME_VALIDATOR_REGEX, "FirstCharacterNameValidator.msg"));
- addUIFormInput(new UIFormStringInput("lastName", "lastName", null).addValidator(StringLengthValidator.class, 3,
- 45).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class,
- Utils.FIRST_CHARACTER_NAME_VALIDATOR_REGEX, "FirstCharacterNameValidator.msg"));
+ addUIFormInput(new UIFormStringInput("firstName", "firstName", null).addValidator(StringLengthValidator.class, 1,
+ 45).addValidator(MandatoryValidator.class));
+ addUIFormInput(new UIFormStringInput("lastName", "lastName", null).addValidator(StringLengthValidator.class, 1,
+ 45).addValidator(MandatoryValidator.class));
addUIFormInput(new UIFormStringInput("email", "email", null).addValidator(MandatoryValidator.class).addValidator(
EmailAddressValidator.class));
}
14 years, 6 months
gatein SVN: r3291 - portal/trunk/component/portal/src/main/java.
by do-not-reply@jboss.org
Author: trong.tran
Date: 2010-06-10 02:46:05 -0400 (Thu, 10 Jun 2010)
New Revision: 3291
Modified:
portal/trunk/component/portal/src/main/java/gatein_objects_1_0.xsd
Log:
GTNPORTAL-1263 Revert the committed code and see what we should do with this kind of issue later
Modified: portal/trunk/component/portal/src/main/java/gatein_objects_1_0.xsd
===================================================================
--- portal/trunk/component/portal/src/main/java/gatein_objects_1_0.xsd 2010-06-10 06:35:57 UTC (rev 3290)
+++ portal/trunk/component/portal/src/main/java/gatein_objects_1_0.xsd 2010-06-10 06:46:05 UTC (rev 3291)
@@ -165,8 +165,6 @@
<xs:element name="show-info-bar" type="xs:boolean" minOccurs="1" maxOccurs="1"/>
<xs:element name="show-application-state" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
<xs:element name="show-application-mode" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
- <xs:element name="width" type="xs:string" minOccurs="0" maxOccurs="1"/>
- <xs:element name="height" type="xs:string" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
14 years, 6 months
gatein SVN: r3290 - epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-06-10 02:35:57 -0400 (Thu, 10 Jun 2010)
New Revision: 3290
Modified:
epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Book_Info.xml
Log:
Changed <productnumber> to 5.0
Modified: epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Book_Info.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Book_Info.xml 2010-06-10 04:34:23 UTC (rev 3289)
+++ epp/docs/branches/EPP_5_0_Branch/Site_Publisher_Release_Notes/en-US/Book_Info.xml 2010-06-10 06:35:57 UTC (rev 3290)
@@ -5,9 +5,9 @@
]>
<bookinfo id="book-Site_Publisher_Release_Notes-Site_Publisher_Release_Notes">
<title>Site Publisher Release Notes</title>
- <subtitle>Release Notes for the JBoss Enterprise Portal Platform Site Publisher Technical Preview</subtitle>
+ <subtitle>Release Notes for the JBoss Enterprise Portal Platform Site Publisher (powered by eXo) Technical Preview</subtitle>
<productname>JBoss Enterprise Portal Platform</productname>
- <productnumber>5.0.1</productnumber>
+ <productnumber>5.0</productnumber>
<edition>1</edition>
<pubsnumber>1.0</pubsnumber>
<abstract>
14 years, 6 months
gatein SVN: r3289 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-06-10 00:34:23 -0400 (Thu, 10 Jun 2010)
New Revision: 3289
Added:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_POR_14_04_006_CutPasteSystemNode.html
Log:
TESTVN-399: Create new GateIn Selenium Scrips
Added: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_POR_14_04_006_CutPasteSystemNode.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_POR_14_04_006_CutPasteSystemNode.html (rev 0)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_POR_14_04_006_CutPasteSystemNode.html 2010-06-10 04:34:23 UTC (rev 3289)
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>Test_POR_14_04_006_CutPasteSystemNode</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Test_POR_14_04_006_CutPasteSystemNode</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/portal/public/classic/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>--Login portal--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign in</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAt</td>
+ <td>link=Sign in</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>root</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>gtn</td>
+</tr>
+<tr>
+ <td>clickAt</td>
+ <td>//div[@id='UIPortalLoginFormAction']/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>--Open Navigation Management pop-up --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Site</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAt</td>
+ <td>link=Site</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Edit Navigation</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAt</td>
+ <td>link=Edit Navigation</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>--Cut system node--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>componentExoContextMenu</td>
+ <td>//a[@title='Register']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Cut Node</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAt</td>
+ <td>link=Cut Node</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>--Verify text Message--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>Cannot cut a system node</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Cannot cut a system node</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIPortalNavigationPortlet']/div[2]//div[2]//div[3]/div//div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAt</td>
+ <td>//div[@id='UIPortalNavigationPortlet']/div[2]//div[2]//div[3]/div//div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UINavigationManagement']//table[@class='ActionContainer']//tr//td[2]//a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAt</td>
+ <td>//div[@id='UINavigationManagement']//table[@class='ActionContainer']//tr//td[2]//a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Sign out--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAt</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
14 years, 6 months
gatein SVN: r3288 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-06-10 00:33:58 -0400 (Thu, 10 Jun 2010)
New Revision: 3288
Modified:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_POR_01_002_SignInByAdminAccount.html
Log:
TESTVN-399: Clean and improve
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_POR_01_002_SignInByAdminAccount.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_POR_01_002_SignInByAdminAccount.html 2010-06-10 03:49:41 UTC (rev 3287)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_POR_01_002_SignInByAdminAccount.html 2010-06-10 04:33:58 UTC (rev 3288)
@@ -52,15 +52,10 @@
<td></td>
</tr>
<tr>
- <td>waitForElementPresent</td>
+ <td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
</tr>
-<tr>
- <td>clickAt</td>
- <td>link=Sign out</td>
- <td></td>
-</tr>
</tbody></table>
</body>
14 years, 6 months
gatein SVN: r3287 - portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2010-06-09 23:49:41 -0400 (Wed, 09 Jun 2010)
New Revision: 3287
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java
Log:
GTNPORTAL-1310 Set language selection's value is [language]_[country] instead of [language] with country variant
Modified: portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java
===================================================================
--- portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java 2010-06-10 01:52:33 UTC (rev 3286)
+++ portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIUserProfileInputSet.java 2010-06-10 03:49:41 UTC (rev 3287)
@@ -156,6 +156,7 @@
if (country != null && country.length() > 0)
{
displayLanguage = displayName + " (" + locale.getDisplayCountry(currentLocale) + ")";
+ language = language + "_" + country;
}
else
{
14 years, 6 months
gatein SVN: r3286 - in portal/trunk/portlet/dashboard/src/main: webapp/WEB-INF/classes/locale/portlet/dashboard and 1 other directory.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2010-06-09 21:52:33 -0400 (Wed, 09 Jun 2010)
New Revision: 3286
Modified:
portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_ru.properties
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_uk.properties
portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_vi.properties
Log:
GTNPORTAL-1252 Always show message Only alpha, digit, underscore, dash and space characters allowed in Dashboard pageafter refresh program
Modified: portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
===================================================================
--- portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2010-06-10 01:32:52 UTC (rev 3285)
+++ portal/trunk/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2010-06-10 01:52:33 UTC (rev 3286)
@@ -428,7 +428,14 @@
String newTabLabel = context.getRequestParameter(UIComponent.OBJECTID);
if (!tabPane.validateName(newTabLabel))
{
- context.getUIApplication().addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", null));
+ //TODO nguyenanhkien2a(a)gmail.com
+ //We should redirect to current node while adding new tab fails
+ PageNode currentNode = tabPane.uiPortal.getSelectedNode();
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() + currentNode.getUri());
+
+ Object[] args = {newTabLabel};
+ context.getUIApplication().addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
return;
}
String uri = tabPane.createNewPageNode(newTabLabel);
@@ -463,7 +470,14 @@
String newTabLabel = context.getRequestParameter(RENAMED_TAB_LABEL_PARAMETER);
if (!tabPane.validateName(newTabLabel))
{
- context.getUIApplication().addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", null));
+ //TODO nguyenanhkien2a(a)gmail.com
+ //We should redirect to current node while renaming fails
+ PageNode currentNode = tabPane.uiPortal.getSelectedNode();
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() + currentNode.getUri());
+
+ Object[] args = {newTabLabel};
+ context.getUIApplication().addMessage(new ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
return;
}
String newUri = tabPane.renamePageNode(nodeIndex, newTabLabel);
Modified: portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties
===================================================================
--- portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties 2010-06-10 01:32:52 UTC (rev 3285)
+++ portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties 2010-06-10 01:52:33 UTC (rev 3286)
@@ -21,4 +21,4 @@
UITabPaneDashboard.action.switchShowRange=Switch Range
UITabPaneDashboard.msg.deleteTab=Really want to remove this dashboard?
UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
-UITabPaneDashboard.msg.wrongTabName=Only alpha, digit, underscore, dash and space characters allowed.
\ No newline at end of file
+UITabPaneDashboard.msg.wrongTabName={0}: is invalid; only alpha, digit, underscore, dash and space characters allowed.
\ No newline at end of file
Modified: portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties
===================================================================
--- portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties 2010-06-10 01:32:52 UTC (rev 3285)
+++ portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties 2010-06-10 01:52:33 UTC (rev 3286)
@@ -21,4 +21,4 @@
UITabPaneDashboard.action.switchShowRange =Decale
UITabPaneDashboard.msg.deleteTab=Really want to remove this dashboard?
UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
-UITabPaneDashboard.msg.wrongTabName=Only alpha, digit, underscore, dash and space characters allowed.
\ No newline at end of file
+UITabPaneDashboard.msg.wrongTabName={0}: is invalid; only alpha, digit, underscore, dash and space characters allowed.
\ No newline at end of file
Modified: portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_ru.properties
===================================================================
--- portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_ru.properties 2010-06-10 01:32:52 UTC (rev 3285)
+++ portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_ru.properties 2010-06-10 01:52:33 UTC (rev 3286)
@@ -21,4 +21,4 @@
UITabPaneDashboard.action.switchShowRange=Изменить область
UITabPaneDashboard.msg.deleteTab=Вы действительно хотите удалить эту доску?
UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
-UITabPaneDashboard.msg.wrongTabName=Only alpha, digit, underscore, dash and space characters allowed.
\ No newline at end of file
+UITabPaneDashboard.msg.wrongTabName={0}: is invalid; only alpha, digit, underscore, dash and space characters allowed.
Modified: portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_uk.properties
===================================================================
--- portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_uk.properties 2010-06-10 01:32:52 UTC (rev 3285)
+++ portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_uk.properties 2010-06-10 01:52:33 UTC (rev 3286)
@@ -21,4 +21,4 @@
UITabPaneDashboard.action.switchShowRange =Перемикач діапазону
UITabPaneDashboard.msg.deleteTab=Really want to remove this dashboard?
UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
-UITabPaneDashboard.msg.wrongTabName=Only alpha, digit, underscore, dash and space characters allowed.
\ No newline at end of file
+UITabPaneDashboard.msg.wrongTabName={0}: is invalid; only alpha, digit, underscore, dash and space characters allowed.
Modified: portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_vi.properties
===================================================================
--- portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_vi.properties 2010-06-10 01:32:52 UTC (rev 3285)
+++ portal/trunk/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_vi.properties 2010-06-10 01:52:33 UTC (rev 3286)
@@ -21,4 +21,4 @@
UITabPaneDashboard.action.switchShowRange=Switch Range
UITabPaneDashboard.msg.deleteTab=Bạn muốn xóa dashboard này?
UITabPaneDashboard.msg.cannotDeleteLastTab=Không thể xóa tab cuối cùng.
-UITabPaneDashboard.msg.wrongTabName=Chỉ cho phép chữ cái, chữ số, kí tự '_', kí tự '-' và kí tự cách.
\ No newline at end of file
+UITabPaneDashboard.msg.wrongTabName={0}: không hợp lệ, chỉ cho phép chữ cái, chữ số, kí tự '_', kí tự '-' và kí tự cách.
14 years, 6 months