Author: mwringe
Date: 2010-06-15 13:58:11 -0400 (Tue, 15 Jun 2010)
New Revision: 3338
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/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java
Log:
Filling in empty methods and adding corresponding converter methods.
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-15
10:03:19 UTC (rev 3337)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-06-15
17:58:11 UTC (rev 3338)
@@ -41,6 +41,7 @@
import org.oasis.wsrp.v1.V1EmployerInfo;
import org.oasis.wsrp.v1.V1Extension;
import org.oasis.wsrp.v1.V1GetMarkup;
+import org.oasis.wsrp.v1.V1GetPortletDescription;
import org.oasis.wsrp.v1.V1GetPortletProperties;
import org.oasis.wsrp.v1.V1GetPortletPropertyDescription;
import org.oasis.wsrp.v1.V1GetServiceDescription;
@@ -92,6 +93,7 @@
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.FailedPortlets;
import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.GetPortletDescription;
import org.oasis.wsrp.v2.GetPortletProperties;
import org.oasis.wsrp.v2.GetPortletPropertyDescription;
import org.oasis.wsrp.v2.GetServiceDescription;
@@ -1048,6 +1050,25 @@
return null;
}
}
+
+ public static GetPortletDescription toV2GetPortletDescription (V1GetPortletDescription
getPortletDescription)
+ {
+ if (getPortletDescription != null)
+ {
+ RegistrationContext registrationContext =
toV2RegistrationContext(getPortletDescription.getRegistrationContext());
+ PortletContext portletContext =
toV2PortletContext(getPortletDescription.getPortletContext());
+ UserContext userContext =
toV2UserContext(getPortletDescription.getUserContext());
+ GetPortletDescription result =
WSRPTypeFactory.createGetPortletDescription(registrationContext, portletContext,
userContext);
+
+ result.getDesiredLocales().addAll(getPortletDescription.getDesiredLocales());
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
public static class V1ToV2Extension implements Function<V1Extension, Extension>
{
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-15
10:03:19 UTC (rev 3337)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2ToV1Converter.java 2010-06-15
17:58:11 UTC (rev 3338)
@@ -50,6 +50,7 @@
import org.oasis.wsrp.v1.V1PersonName;
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.V1Postal;
import org.oasis.wsrp.v1.V1Property;
@@ -97,6 +98,7 @@
import org.oasis.wsrp.v2.PersonName;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.PortletDescriptionResponse;
import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v2.Postal;
import org.oasis.wsrp.v2.Property;
@@ -123,6 +125,8 @@
import org.oasis.wsrp.v2.UserContext;
import org.oasis.wsrp.v2.UserProfile;
+import sun.reflect.generics.visitor.Reifier;
+
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;
@@ -977,11 +981,18 @@
{
if (blockingInteractionResponse != null)
{
+ V1BlockingInteractionResponse result;
V1UpdateResponse updateResponse =
toV1UpdateResponse(blockingInteractionResponse.getUpdateResponse());
- V1BlockingInteractionResponse result =
WSRP1TypeFactory.createBlockingInteractionResponse(updateResponse);
-
- result.setRedirectURL(blockingInteractionResponse.getRedirectURL());
-
+ String redirectURL = blockingInteractionResponse.getRedirectURL();
+ if (redirectURL != null)
+ {
+ result = WSRP1TypeFactory.createBlockingInteractionResponse(redirectURL);
+ }
+ else
+ {
+ result = WSRP1TypeFactory.createBlockingInteractionResponse(updateResponse);
+ }
+
List<V1Extension> extensions =
WSRPUtils.transform(blockingInteractionResponse.getExtensions(), EXTENSION);
if (extensions != null)
{
@@ -1041,6 +1052,27 @@
}
}
+ public static V1PortletDescriptionResponse
toV1PortletDescriptionResponse(PortletDescriptionResponse portletDescriptionResponse)
+ {
+ if (portletDescriptionResponse != null)
+ {
+ V1PortletDescriptionResponse result =
WSRP1TypeFactory.createPortletDescriptionResponse(toV1PortletDescription(portletDescriptionResponse.getPortletDescription()));
+
result.setResourceList(toV1ResourceList(portletDescriptionResponse.getResourceList()));
+
+ List<V1Extension> extensions =
WSRPUtils.transform(portletDescriptionResponse.getExtensions(), EXTENSION);
+ if (extensions != null)
+ {
+ result.getExtensions().addAll(extensions);
+ }
+
+ return result;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
private static class V2ToV1Extension implements Function<Extension,
V1Extension>
{
public V1Extension apply(Extension from)
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15
10:03:19 UTC (rev 3337)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/v1/WSRP1Producer.java 2010-06-15
17:58:11 UTC (rev 3338)
@@ -83,6 +83,7 @@
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescriptionResponse;
import org.oasis.wsrp.v2.PortletPropertyDescriptionResponse;
import org.oasis.wsrp.v2.PortletStateChangeRequired;
import org.oasis.wsrp.v2.PropertyList;
@@ -242,7 +243,40 @@
public V1PortletDescriptionResponse getPortletDescription(V1GetPortletDescription
getPortletDescription) throws V1AccessDenied, V1InvalidHandle, V1InvalidUserCategory,
V1InconsistentParameters, V1MissingParameters, V1InvalidRegistration, V1OperationFailed
{
- throw new NotYetImplemented();
+ try
+ {
+ PortletDescriptionResponse portletDescriptionResponse =
producer.getPortletDescription(V1ToV2Converter.toV2GetPortletDescription(getPortletDescription));
+ return
V2ToV1Converter.toV1PortletDescriptionResponse(portletDescriptionResponse);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2ToV1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidUserCategory.class,
invalidUserCategory);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InconsistentParameters.class,
inconsistentParameters);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2ToV1Converter.toV1Exception(V1MissingParameters.class,
missingParameters);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2ToV1Converter.toV1Exception(V1InvalidRegistration.class,
invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2ToV1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+
}
public V1MarkupResponse getMarkup(V1GetMarkup getMarkup) throws
V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession, V1AccessDenied,
V1InconsistentParameters, V1InvalidHandle, V1UnsupportedLocale, V1UnsupportedMode,
V1OperationFailed, V1MissingParameters, V1InvalidUserCategory, V1InvalidRegistration,
V1UnsupportedMimeType