Author: mwringe
Date: 2010-06-09 16:30:08 -0400 (Wed, 09 Jun 2010)
New Revision: 3284
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
Log:
Filling in empty methods, producer appears to be working now with simple portlets.
Modified:
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-09
20:11:46 UTC (rev 3283)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-09
20:30:08 UTC (rev 3284)
@@ -29,6 +29,7 @@
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;
@@ -65,6 +66,7 @@
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;
@@ -886,9 +888,53 @@
public static V1MarkupContext toV1MarkupContext(MarkupContext markupContext)
{
- throw new NotYetImplemented();
+ 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();