gatein SVN: r3285 - portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2010-06-09 21:32:52 -0400 (Wed, 09 Jun 2010)
New Revision: 3285
Modified:
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css
Log:
GTNPORTAL-1265 IE7: Don't show edit/delete icon when move mouse on container to detele all container in this layout
Modified: portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css 2010-06-09 20:30:08 UTC (rev 3284)
+++ portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css 2010-06-10 01:32:52 UTC (rev 3285)
@@ -241,6 +241,7 @@
.EdittingContainer .NormalContainerBlock {
background: white;
border: 1px dashed #a2a2a2;
+ height: 100%;
}
.EdittingContainer .NormalContainerBlock .LeftContainerBlock,
14 years, 6 months
gatein SVN: r3284 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1.
by do-not-reply@jboss.org
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();
14 years, 6 months
gatein SVN: r3283 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-06-09 16:11:46 -0400 (Wed, 09 Jun 2010)
New Revision: 3283
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
Log:
Filling in empty methods.
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 18:31:04 UTC (rev 3282)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-09 20:11:46 UTC (rev 3283)
@@ -92,6 +92,7 @@
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;
@@ -154,7 +155,22 @@
public static V1PortletContext toV1PortletContext(PortletContext portletContext)
{
- throw new NotYetImplemented();
+ 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)
@@ -165,8 +181,13 @@
v1MarkupParams.getLocales(), v1MarkupParams.getMimeTypes(), v1MarkupParams.getMode(),
v1MarkupParams.getWindowState());
markupParams.setClientData(toV2ClientData(v1MarkupParams.getClientData()));
- markupParams.setNavigationalContext(WSRPTypeFactory.createNavigationalContextOrNull(
- new OpaqueStateString(v1MarkupParams.getNavigationalState()), null));
+
+ // 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();
@@ -241,9 +262,24 @@
}
}
- private static ClientData toV2ClientData(V1ClientData clientData)
+ private static ClientData toV2ClientData(V1ClientData v1ClientData)
{
- throw new NotYetImplemented();
+ 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)
@@ -266,9 +302,24 @@
}
}
- public static PortletContext toV2PortletContext(V1PortletContext portletContext)
+ public static PortletContext toV2PortletContext(V1PortletContext v1PortletContext)
{
- throw new NotYetImplemented();
+ 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)
@@ -291,9 +342,33 @@
}
}
- public static RuntimeContext toV2RuntimeContext(V1RuntimeContext runtimeContext)
+ public static RuntimeContext toV2RuntimeContext(V1RuntimeContext v1RuntimeContext)
{
- throw new NotYetImplemented();
+ 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)
@@ -348,10 +423,59 @@
}
}
- public static UserContext toV2UserContext(V1UserContext userContext)
+ public static Templates toV2Templates(V1Templates v1Templates)
{
- throw new NotYetImplemented();
+ 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)
{
@@ -400,6 +524,26 @@
}
}
+ 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)
@@ -423,6 +567,29 @@
}
}
+ 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)
@@ -449,6 +616,32 @@
}
}
+ 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)
@@ -472,6 +665,29 @@
}
}
+ 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)
@@ -494,6 +710,28 @@
}
}
+ 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)
@@ -521,6 +759,33 @@
}
}
+ 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)
@@ -545,6 +810,30 @@
}
}
+ 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)
@@ -570,6 +859,31 @@
}
}
+ 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)
{
throw new NotYetImplemented();
14 years, 6 months
gatein SVN: r3282 - in components/wsrp/trunk: consumer/src/main/java/org/gatein/wsrp/services/v1 and 1 other directory.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-06-09 14:31:04 -0400 (Wed, 09 Jun 2010)
New Revision: 3282
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java
Log:
Fill in empty methods in V1MarkupService and update V2V1Converter to include corresponding conversion methods.
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 14:49:42 UTC (rev 3281)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-09 18:31:04 UTC (rev 3282)
@@ -30,8 +30,11 @@
import org.gatein.wsrp.WSRPExceptionFactory;
import org.gatein.wsrp.WSRPTypeFactory;
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;
@@ -41,8 +44,11 @@
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;
@@ -52,11 +58,17 @@
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.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;
@@ -67,8 +79,11 @@
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;
@@ -78,9 +93,13 @@
import org.oasis.wsrp.v2.ServiceDescription;
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;
@@ -111,7 +130,9 @@
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)
{
@@ -177,12 +198,74 @@
}
}
+ 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 clientData)
{
throw new NotYetImplemented();
}
+ 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 portletContext)
{
throw new NotYetImplemented();
@@ -213,11 +296,280 @@
throw new NotYetImplemented();
}
+ 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 UserContext toV2UserContext(V1UserContext userContext)
{
throw new NotYetImplemented();
}
+ 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 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 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 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 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 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 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 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 V1MarkupContext toV1MarkupContext(MarkupContext markupContext)
{
throw new NotYetImplemented();
@@ -384,6 +736,40 @@
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)
{
@@ -396,6 +782,18 @@
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)
{
@@ -715,6 +1113,24 @@
}
}
+ 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>
{
@@ -735,7 +1151,38 @@
}
}
+
+ 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>
{
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-09 14:49:42 UTC (rev 3281)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java 2010-06-09 18:31:04 UTC (rev 3282)
@@ -24,6 +24,25 @@
import org.gatein.common.NotYetImplemented;
import org.gatein.wsrp.services.MarkupService;
+import org.gatein.wsrp.spec.v1.V2V1Converter;
+import org.oasis.wsrp.v1.V1AccessDenied;
+import org.oasis.wsrp.v1.V1Extension;
+import org.oasis.wsrp.v1.V1InconsistentParameters;
+import org.oasis.wsrp.v1.V1InvalidCookie;
+import org.oasis.wsrp.v1.V1InvalidHandle;
+import org.oasis.wsrp.v1.V1InvalidRegistration;
+import org.oasis.wsrp.v1.V1InvalidSession;
+import org.oasis.wsrp.v1.V1InvalidUserCategory;
+import org.oasis.wsrp.v1.V1MarkupContext;
+import org.oasis.wsrp.v1.V1MissingParameters;
+import org.oasis.wsrp.v1.V1OperationFailed;
+import org.oasis.wsrp.v1.V1PortletStateChangeRequired;
+import org.oasis.wsrp.v1.V1SessionContext;
+import org.oasis.wsrp.v1.V1UnsupportedLocale;
+import org.oasis.wsrp.v1.V1UnsupportedMimeType;
+import org.oasis.wsrp.v1.V1UnsupportedMode;
+import org.oasis.wsrp.v1.V1UnsupportedWindowState;
+import org.oasis.wsrp.v1.V1UpdateResponse;
import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.EventParams;
@@ -74,19 +93,152 @@
@Override
public void getMarkup(RegistrationContext registrationContext, PortletContext portletContext, RuntimeContext runtimeContext, UserContext userContext, MarkupParams markupParams, Holder<MarkupContext> markupContext, Holder<SessionContext> sessionContext, Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
{
- throw new NotYetImplemented();
+ 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)));
+ }
+ catch (V1AccessDenied accessDenied)
+ {
+ throw V2V1Converter.toV1Exception(AccessDenied.class, accessDenied);
+ }
+ catch (V1InconsistentParameters inconsistentParameters)
+ {
+ throw V2V1Converter.toV1Exception(InconsistentParameters.class, inconsistentParameters);
+ }
+ catch (V1InvalidCookie invalidCookie)
+ {
+ throw V2V1Converter.toV1Exception(InvalidCookie.class, invalidCookie);
+ }
+ catch (V1InvalidHandle invalidHandle)
+ {
+ throw V2V1Converter.toV1Exception(InvalidHandle.class, invalidHandle);
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
+ }
+ catch (V1InvalidSession invalidSession)
+ {
+ throw V2V1Converter.toV1Exception(InvalidSession.class, invalidSession);
+ }
+ catch (V1InvalidUserCategory invalidUserCategory)
+ {
+ throw V2V1Converter.toV1Exception(InvalidUserCategory.class, invalidUserCategory);
+ }
+ catch (V1MissingParameters missingParameter)
+ {
+ throw V2V1Converter.toV1Exception(MissingParameters.class, missingParameter);
+ }
+ catch (V1OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(OperationFailed.class, operationFailed);
+ }
+ catch (V1UnsupportedLocale unsupportedLocale)
+ {
+ throw V2V1Converter.toV1Exception(UnsupportedLocale.class, unsupportedLocale);
+ }
+ catch (V1UnsupportedMimeType unsupportedMimeType)
+ {
+ throw V2V1Converter.toV1Exception(UnsupportedMimeType.class, unsupportedMimeType);
+ }
+ catch (V1UnsupportedMode unsupportedMode)
+ {
+ throw V2V1Converter.toV1Exception(UnsupportedMode.class, unsupportedMode);
+ }
+ catch (V1UnsupportedWindowState unsupportedWindowState)
+ {
+ throw V2V1Converter.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();
}
@Override
public void performBlockingInteraction(RegistrationContext registrationContext, PortletContext portletContext, RuntimeContext runtimeContext, UserContext userContext, MarkupParams markupParams, InteractionParams interactionParams, Holder<UpdateResponse> updateResponse, Holder<String> redirectURL, Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, PortletStateChangeRequired, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
{
- throw new NotYetImplemented();
+ 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)));
+ }
+ catch (V1AccessDenied accessDenied)
+ {
+ throw V2V1Converter.toV1Exception(AccessDenied.class, accessDenied);
+ }
+ catch (V1InconsistentParameters inconsistentParameters)
+ {
+ throw V2V1Converter.toV1Exception(InconsistentParameters.class, inconsistentParameters);
+ }
+ catch (V1InvalidCookie invalidCookie)
+ {
+ throw V2V1Converter.toV1Exception(InvalidCookie.class, invalidCookie);
+ }
+ catch (V1InvalidHandle invalidHandle)
+ {
+ throw V2V1Converter.toV1Exception(InvalidHandle.class, invalidHandle);
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
+ }
+ catch (V1InvalidSession invalidSession)
+ {
+ throw V2V1Converter.toV1Exception(InvalidSession.class, invalidSession);
+ }
+ catch (V1InvalidUserCategory invalidUserCategory)
+ {
+ throw V2V1Converter.toV1Exception(InvalidUserCategory.class, invalidUserCategory);
+ }
+ catch (V1MissingParameters missingParameters)
+ {
+ throw V2V1Converter.toV1Exception(MissingParameters.class, missingParameters);
+ }
+ catch (V1OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(OperationFailed.class, operationFailed);
+ }
+ catch (V1PortletStateChangeRequired portletStateChangeRequired)
+ {
+ throw V2V1Converter.toV1Exception(PortletStateChangeRequired.class, portletStateChangeRequired);
+ }
+ catch (V1UnsupportedLocale unsupportedLocale)
+ {
+ throw V2V1Converter.toV1Exception(UnsupportedLocale.class, unsupportedLocale);
+ }
+ catch (V1UnsupportedMimeType unsupportedMimeType)
+ {
+ throw V2V1Converter.toV1Exception(UnsupportedMimeType.class, unsupportedMimeType);
+ }
+ catch (V1UnsupportedMode unsupportedMode)
+ {
+ throw V2V1Converter.toV1Exception(UnsupportedMode.class, unsupportedMode);
+ }
+ catch (V1UnsupportedWindowState unsupportedWindowState)
+ {
+ throw V2V1Converter.toV1Exception(UnsupportedWindowState.class, unsupportedWindowState);
+ }
}
@Override
@@ -98,12 +250,46 @@
@Override
public List<Extension> releaseSessions(RegistrationContext registrationContext, List<String> sessionIDs, UserContext userContext) throws AccessDenied, InvalidRegistration, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ try
+ {
+ return V2V1Converter.transform(service.releaseSessions(V2V1Converter.toV1RegistrationContext(registrationContext),sessionIDs), V2V1Converter.V1_TO_V2_EXTENSION);
+ }
+ catch (V1AccessDenied accessDenied)
+ {
+ throw V2V1Converter.toV1Exception(AccessDenied.class, accessDenied);
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
+ }
+ catch (V1MissingParameters missingParameters)
+ {
+ throw V2V1Converter.toV1Exception(MissingParameters.class, missingParameters);
+ }
+ catch (V1OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(OperationFailed.class, operationFailed);
+ }
}
@Override
public List<Extension> initCookie(RegistrationContext registrationContext, UserContext userContext) throws AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed, OperationNotSupported, ResourceSuspended
{
- throw new NotYetImplemented();
+ try
+ {
+ return V2V1Converter.transform(service.initCookie(V2V1Converter.toV1RegistrationContext(registrationContext)), V2V1Converter.V1_TO_V2_EXTENSION);
+ }
+ catch (V1AccessDenied accessDenied)
+ {
+ throw V2V1Converter.toV1Exception(AccessDenied.class, accessDenied);
+ }
+ catch (V1InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(InvalidRegistration.class, invalidRegistration);
+ }
+ catch (V1OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(OperationFailed.class, operationFailed);
+ }
}
}
14 years, 6 months
gatein SVN: r3281 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-09 10:49:42 -0400 (Wed, 09 Jun 2010)
New Revision: 3281
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
Log:
- Checking for null.
- Removed unneeded constant (reminder of previous merge).
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 14:45:11 UTC (rev 3280)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-09 14:49:42 UTC (rev 3281)
@@ -112,7 +112,6 @@
public static final V1ToV2NamedString V1_TO_V2_NAMEDSTRING = new V1ToV2NamedString();
public static final V1ToV2UploadContext V1_TO_V2_UPLOADCONTEXT = new V1ToV2UploadContext();
- public static final V2ToV1PropertyDescription V2_TO_V1_PROPERTY_DESCRIPTION = new V2ToV1PropertyDescription();
public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function)
{
@@ -370,18 +369,32 @@
public static InteractionParams toV2InteractionParams(V1InteractionParams v1InteractionParams)
{
- 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));
+ 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;
+ return interactionParams;
+ }
+ else
+ {
+ return null;
+ }
}
public static StateChange toV2StateChange(V1StateChange v1StateChange)
{
- return StateChange.valueOf((v1StateChange.value()));
+ if (v1StateChange != null)
+ {
+ return StateChange.valueOf((v1StateChange.value()));
+ }
+ else
+ {
+ return null;
+ }
}
public static V1UpdateResponse toV1UpdateResponse(UpdateResponse updateResponse)
@@ -688,10 +701,17 @@
{
public NamedString apply(V1NamedString v1NamedString)
{
- NamedString result = new NamedString();
- result.setName(v1NamedString.getName());
- result.setValue(v1NamedString.getValue());
- return result;
+ if (v1NamedString != null)
+ {
+ NamedString result = new NamedString();
+ result.setName(v1NamedString.getName());
+ result.setValue(v1NamedString.getValue());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
}
}
@@ -700,11 +720,18 @@
public UploadContext apply(V1UploadContext v1UploadContext)
{
- 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));
+ 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;
+ return result;
+ }
+ else
+ {
+ return null;
+ }
}
}
14 years, 6 months
gatein SVN: r3280 - components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-09 10:45:11 -0400 (Wed, 09 Jun 2010)
New Revision: 3280
Modified:
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java
Log:
- Fixed error in parameter name.
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-09 14:37:04 UTC (rev 3279)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java 2010-06-09 14:45:11 UTC (rev 3280)
@@ -23,15 +23,12 @@
package org.gatein.wsrp.endpoints.v1;
-import org.gatein.common.NotYetImplemented;
+import com.google.common.collect.Lists;
import org.gatein.wsrp.endpoints.WSRPBaseEndpoint;
import org.gatein.wsrp.spec.v1.V2V1Converter;
import org.oasis.wsrp.v1.V1AccessDenied;
-import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
import org.oasis.wsrp.v1.V1Extension;
-import org.oasis.wsrp.v1.V1GetMarkup;
import org.oasis.wsrp.v1.V1InconsistentParameters;
-import org.oasis.wsrp.v1.V1InitCookie;
import org.oasis.wsrp.v1.V1InteractionParams;
import org.oasis.wsrp.v1.V1InvalidCookie;
import org.oasis.wsrp.v1.V1InvalidHandle;
@@ -40,15 +37,11 @@
import org.oasis.wsrp.v1.V1InvalidUserCategory;
import org.oasis.wsrp.v1.V1MarkupContext;
import org.oasis.wsrp.v1.V1MarkupParams;
-import org.oasis.wsrp.v1.V1MarkupResponse;
import org.oasis.wsrp.v1.V1MissingParameters;
import org.oasis.wsrp.v1.V1OperationFailed;
-import org.oasis.wsrp.v1.V1PerformBlockingInteraction;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletStateChangeRequired;
import org.oasis.wsrp.v1.V1RegistrationContext;
-import org.oasis.wsrp.v1.V1ReleaseSessions;
-import org.oasis.wsrp.v1.V1ReturnAny;
import org.oasis.wsrp.v1.V1RuntimeContext;
import org.oasis.wsrp.v1.V1SessionContext;
import org.oasis.wsrp.v1.V1UnsupportedLocale;
@@ -80,8 +73,6 @@
import org.oasis.wsrp.v2.UnsupportedMode;
import org.oasis.wsrp.v2.UnsupportedWindowState;
-import com.google.common.collect.Lists;
-
import javax.jws.HandlerChain;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
@@ -117,15 +108,15 @@
V1UnsupportedLocale, V1InconsistentParameters, V1PortletStateChangeRequired, V1InvalidHandle, V1InvalidRegistration,
V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
{
-
- forceSessionAccess();
+ 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.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
performBlockingInteraction.setUserContext(V2V1Converter.toV2UserContext(userContext));
@@ -191,7 +182,7 @@
{
throw V2V1Converter.toV1Exception(V1InconsistentParameters.class, inconsistentParameters);
}
-
+
updateResponse.value = V2V1Converter.toV1UpdateResponse(interactionResponse.getUpdateResponse());
redirectURL.value = interactionResponse.getRedirectURL();
extensions.value = Lists.transform(interactionResponse.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
@@ -241,7 +232,7 @@
@WebParam(name = "markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1MarkupParams markupParams,
@WebParam(mode = WebParam.Mode.OUT, name = "markupContext", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<V1MarkupContext> markupContext,
@WebParam(mode = WebParam.Mode.OUT, name = "sessionContext", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<V1SessionContext> sessionContext,
- @WebParam(mode = WebParam.Mode.OUT, name = "eUnsupportedWindowStatextensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>> extensions
+ @WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>> extensions
) throws V1UnsupportedMimeType, V1UnsupportedMode, V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession, V1MissingParameters,
V1UnsupportedLocale, V1InconsistentParameters, V1InvalidHandle, V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied,
V1OperationFailed
14 years, 6 months
gatein SVN: r3279 - in components/wsrp/trunk: common/src/main/java/org/gatein/wsrp/spec/v1 and 2 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-06-09 10:37:04 -0400 (Wed, 09 Jun 2010)
New Revision: 3279
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
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/WSRP1TypeFactory.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/ServiceDescriptionEndpoint.java
Log:
- Finished end-to-end implementation of ServiceDescription for WSRP 1.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-06-09 13:48:51 UTC (rev 3278)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-06-09 14:37:04 UTC (rev 3279)
@@ -38,13 +38,13 @@
import org.gatein.pc.api.WindowState;
import org.gatein.pc.api.cache.CacheLevel;
import org.gatein.pc.api.spi.PortletInvocationContext;
+import org.gatein.wsrp.spec.v2.ErrorCodes;
import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.CacheControl;
import org.oasis.wsrp.v2.ClientData;
import org.oasis.wsrp.v2.ClonePortlet;
import org.oasis.wsrp.v2.DestroyPortlets;
import org.oasis.wsrp.v2.DestroyPortletsResponse;
-import org.gatein.wsrp.spec.v2.ErrorCodes;
import org.oasis.wsrp.v2.FailedPortlets;
import org.oasis.wsrp.v2.GetMarkup;
import org.oasis.wsrp.v2.GetPortletDescription;
@@ -328,6 +328,22 @@
return portletDescription;
}
+ public static PortletDescription createPortletDescription(String portletHandle, List<MarkupType> markupTypes)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
+ checkPortletHandle(portletHandle);
+ ParameterValidation.throwIllegalArgExceptionIfNull(markupTypes, "MarkupType");
+ if (markupTypes.isEmpty())
+ {
+ throw new IllegalArgumentException("Cannot create a PortletDescription with an empty list of MarkupTypes!");
+ }
+
+ PortletDescription portletDescription = new PortletDescription();
+ portletDescription.setPortletHandle(portletHandle);
+ portletDescription.getMarkupTypes().addAll(markupTypes);
+ return portletDescription;
+ }
+
private static void checkPortletHandle(String portletHandle)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", "PortletDescription");
@@ -1162,9 +1178,9 @@
}
/**
- * reason(LocalizedString)?, resourceList(ResourceList)?, extensions(Extension)*
- * errorCode(ErrorCodes)
+ * reason(LocalizedString)?, resourceList(ResourceList)?, extensions(Extension)* errorCode(ErrorCodes)
* portletHandles(xsd:string)+
+ *
* @param portletHandles
* @param reason
* @return
@@ -1181,7 +1197,7 @@
failedPortlets.setReason(createLocalizedString(reason));
}
failedPortlets.setErrorCode(ErrorCodes.OperationFailed);
-
+
return failedPortlets;
}
@@ -1190,13 +1206,14 @@
/**
* failedPortlets(FailedPortlets)*, extensions(Extension)*
+ *
* @param failedPortlets
* @return
*/
public static DestroyPortletsResponse createDestroyPortletsResponse(List<FailedPortlets> failedPortlets)
{
DestroyPortletsResponse dpr = new DestroyPortletsResponse();
- if(ParameterValidation.existsAndIsNotEmpty(failedPortlets))
+ if (ParameterValidation.existsAndIsNotEmpty(failedPortlets))
{
dpr.getFailedPortlets().addAll(failedPortlets);
}
@@ -1217,7 +1234,7 @@
}
}
- if(ParameterValidation.existsAndIsNotEmpty(publicNavigationalState))
+ if (ParameterValidation.existsAndIsNotEmpty(publicNavigationalState))
{
// todo: public NS GTNWSRP-38
for (Map.Entry<String, String[]> entry : publicNavigationalState.entrySet())
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 13:48:51 UTC (rev 3278)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-09 14:37:04 UTC (rev 3279)
@@ -23,9 +23,6 @@
package org.gatein.wsrp.spec.v1;
-import java.io.NotActiveException;
-import java.util.List;
-
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.gatein.common.NotYetImplemented;
@@ -42,16 +39,19 @@
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.V1ModelTypes;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
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.V1UpdateResponse;
import org.oasis.wsrp.v1.V1UploadContext;
import org.oasis.wsrp.v1.V1UserContext;
@@ -65,22 +65,23 @@
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.ModelTypes;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
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.StateChange;
import org.oasis.wsrp.v2.UpdateResponse;
import org.oasis.wsrp.v2.UploadContext;
import org.oasis.wsrp.v2.UserContext;
-import org.oasis.wsrp.v1.V1StateChange;
-import org.oasis.wsrp.v2.StateChange;
import java.util.List;
/**
@@ -93,10 +94,22 @@
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 V1ToV2UploadContext V1_TO_V2_UPLOADCONTEXT = new V1ToV2UploadContext();
public static final V2ToV1PropertyDescription V2_TO_V1_PROPERTY_DESCRIPTION = new V2ToV1PropertyDescription();
@@ -178,7 +191,22 @@
public static RegistrationContext toV2RegistrationContext(V1RegistrationContext registrationContext)
{
- throw new NotYetImplemented();
+ 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 runtimeContext)
@@ -287,7 +315,7 @@
{
if (modelDescription != null)
{
- V1ModelDescription result = WSRP1TypeFactory.createModelDescription(V2V1Converter.transform(modelDescription.getPropertyDescriptions(), V2_TO_V1_PROPERTY_DESCRIPTION));
+ 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)
{
@@ -305,30 +333,57 @@
public static V1ModelTypes toV1ModelTypes(ModelTypes modelTypes)
{
- throw new NotYetImplemented();
+ if (modelTypes != null)
+ {
+ V1ModelTypes result = new V1ModelTypes();
+ result.setAny(modelTypes.getAny());
+ return result;
+ }
+ else
+ {
+ return null;
+ }
}
public static V1ResourceList toV1ResourceList(ResourceList resourceList)
{
- throw new NotYetImplemented();
+ 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)
{
- 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;
+ 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;
}
-
- public static StateChange toV2StateChange (V1StateChange v1StateChange)
+
+ public static StateChange toV2StateChange(V1StateChange v1StateChange)
{
return StateChange.valueOf((v1StateChange.value()));
}
-
+
public static V1UpdateResponse toV1UpdateResponse(UpdateResponse updateResponse)
{
if (updateResponse != null)
@@ -351,15 +406,15 @@
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 v1SessionContext = WSRP1TypeFactory.createSessionContext(sessionContext.getSessionID(), sessionContext.getExpires().intValue());
v1SessionContext.getExtensions().addAll(Lists.transform(sessionContext.getExtensions(), V2_TO_V1_EXTENSION));
-
+
return v1SessionContext;
}
else
@@ -367,7 +422,83 @@
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)
@@ -453,6 +584,57 @@
}
}
+ 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>
{
@@ -477,6 +659,31 @@
}
}
+ 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)
@@ -487,7 +694,7 @@
return result;
}
}
-
+
public static class V1ToV2UploadContext implements Function<V1UploadContext, UploadContext>
{
@@ -496,12 +703,12 @@
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;
}
-
+
}
-
+
private static class V2ToV1MarkupType implements Function<MarkupType, V1MarkupType>
{
@@ -509,7 +716,14 @@
{
if (from != null)
{
- return WSRP1TypeFactory.createMarkupType(from.getMimeType(), from.getModes(), from.getWindowStates(), from.getLocales());
+ 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
{
@@ -518,6 +732,29 @@
}
}
+ 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>
{
@@ -535,6 +772,23 @@
}
}
+ 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>
{
@@ -544,6 +798,13 @@
{
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
@@ -552,4 +813,124 @@
}
}
}
+
+ 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-09 13:48:51 UTC (rev 3278)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/WSRP1TypeFactory.java 2010-06-09 14:37:04 UTC (rev 3279)
@@ -331,6 +331,7 @@
public static V1PortletDescription createPortletDescription(String portletHandle, List<V1MarkupType> markupTypes)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
+ checkPortletHandle(portletHandle);
ParameterValidation.throwIllegalArgExceptionIfNull(markupTypes, "MarkupType");
if (markupTypes.isEmpty())
{
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-09 13:48:51 UTC (rev 3278)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1ServiceDescriptionService.java 2010-06-09 14:37:04 UTC (rev 3279)
@@ -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.services.v1;
@@ -104,10 +105,15 @@
{
throw V2V1Converter.toV2Exception(OperationFailed.class, v1OperationFailed);
}
- /*service.getServiceDescription(registrationContext, desiredLocales, portletHandles, userContext,
- requiresRegistration, offeredPortlets, userCategoryDescriptions, extensionDescriptions,
- customWindowStateDescriptions, customModeDescriptions, requiresInitCookie, registrationPropertyDescription,
- locales, resourceList, eventDescriptions, schemaType, supportedOptions, exportDescription,
- mayReturnRegistrationState, extensions);*/
+
+ offeredPortlets.value = V2V1Converter.transform(v1OfferedPortlets.value, V2V1Converter.V1_TO_V2_PORTLETDESCRIPTION);
+ userCategoryDescriptions.value = V2V1Converter.transform(v1UserCategories.value, V2V1Converter.V1_TO_V2_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);
}
}
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-09 13:48:51 UTC (rev 3278)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/ServiceDescriptionEndpoint.java 2010-06-09 14:37:04 UTC (rev 3279)
@@ -80,7 +80,7 @@
getServiceDescription.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
getServiceDescription.getDesiredLocales().addAll(desiredLocales);
- ServiceDescription description = null;
+ ServiceDescription description;
try
{
description = producer.getServiceDescription(getServiceDescription);
14 years, 6 months
gatein SVN: r3278 - in components/wsrp/trunk: wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1 and 1 other directory.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-06-09 09:48:51 -0400 (Wed, 09 Jun 2010)
New Revision: 3278
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java
Log:
- Fill in empty methods in MarkupEndpoint and update V2V1Converter to include converter methods required.
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 11:04:13 UTC (rev 3277)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V2V1Converter.java 2010-06-09 13:48:51 UTC (rev 3278)
@@ -23,6 +23,9 @@
package org.gatein.wsrp.spec.v1;
+import java.io.NotActiveException;
+import java.util.List;
+
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.gatein.common.NotYetImplemented;
@@ -32,12 +35,14 @@
import org.oasis.wsrp.v1.V1ClientData;
import org.oasis.wsrp.v1.V1CookieProtocol;
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.V1NamedString;
import org.oasis.wsrp.v1.V1ModelTypes;
import org.oasis.wsrp.v1.V1PortletContext;
import org.oasis.wsrp.v1.V1PortletDescription;
@@ -46,16 +51,21 @@
import org.oasis.wsrp.v1.V1ResourceList;
import org.oasis.wsrp.v1.V1RuntimeContext;
import org.oasis.wsrp.v1.V1ServiceDescription;
+import org.oasis.wsrp.v1.V1SessionContext;
+import org.oasis.wsrp.v1.V1UpdateResponse;
+import org.oasis.wsrp.v1.V1UploadContext;
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v2.ClientData;
import org.oasis.wsrp.v2.CookieProtocol;
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.NamedString;
import org.oasis.wsrp.v2.ModelTypes;
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.PortletDescription;
@@ -64,8 +74,13 @@
import org.oasis.wsrp.v2.ResourceList;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.ServiceDescription;
+import org.oasis.wsrp.v2.SessionContext;
+import org.oasis.wsrp.v2.UpdateResponse;
+import org.oasis.wsrp.v2.UploadContext;
import org.oasis.wsrp.v2.UserContext;
+import org.oasis.wsrp.v1.V1StateChange;
+import org.oasis.wsrp.v2.StateChange;
import java.util.List;
/**
@@ -81,6 +96,9 @@
public static final V2ToV1PortletDescription V2_TO_V1_PORTLETDESCRIPTION = new V2ToV1PortletDescription();
public static final V2ToV1LocalizedString V2_TO_V1_LOCALIZEDSTRING = new V2ToV1LocalizedString();
public static final V2ToV1ItemDescription V2_TO_V1_ITEMDESCRIPTION = new V2ToV1ItemDescription();
+
+ public static final V1ToV2NamedString V1_TO_V2_NAMEDSTRING = new V1ToV2NamedString();
+ public static final V1ToV2UploadContext V1_TO_V2_UPLOADCONTEXT = new V1ToV2UploadContext();
public static final V2ToV1PropertyDescription V2_TO_V1_PROPERTY_DESCRIPTION = new V2ToV1PropertyDescription();
public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function)
@@ -294,12 +312,62 @@
{
throw new NotYetImplemented();
}
+
+ public static InteractionParams toV2InteractionParams(V1InteractionParams v1InteractionParams)
+ {
+ 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;
+ }
+
+ public static StateChange toV2StateChange (V1StateChange v1StateChange)
+ {
+ return StateChange.valueOf((v1StateChange.value()));
+ }
+
+ 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;
+ }
}
-
+
private static class V1ToV2Extension implements Function<V1Extension, Extension>
{
public Extension apply(V1Extension from)
@@ -409,6 +477,31 @@
}
}
+ public static class V1ToV2NamedString implements Function<V1NamedString, NamedString>
+ {
+ public NamedString apply(V1NamedString v1NamedString)
+ {
+ NamedString result = new NamedString();
+ result.setName(v1NamedString.getName());
+ result.setValue(v1NamedString.getValue());
+ return result;
+ }
+ }
+
+ public static class V1ToV2UploadContext implements Function<V1UploadContext, UploadContext>
+ {
+
+ public UploadContext apply(V1UploadContext v1UploadContext)
+ {
+ 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;
+ }
+
+ }
+
private static class V2ToV1MarkupType implements Function<MarkupType, V1MarkupType>
{
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-09 11:04:13 UTC (rev 3277)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java 2010-06-09 13:48:51 UTC (rev 3278)
@@ -25,6 +25,7 @@
import org.gatein.common.NotYetImplemented;
import org.gatein.wsrp.endpoints.WSRPBaseEndpoint;
+import org.gatein.wsrp.spec.v1.V2V1Converter;
import org.oasis.wsrp.v1.V1AccessDenied;
import org.oasis.wsrp.v1.V1BlockingInteractionResponse;
import org.oasis.wsrp.v1.V1Extension;
@@ -57,14 +58,30 @@
import org.oasis.wsrp.v1.V1UpdateResponse;
import org.oasis.wsrp.v1.V1UserContext;
import org.oasis.wsrp.v1.WSRPV1MarkupPortType;
+import org.oasis.wsrp.v2.AccessDenied;
import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.InconsistentParameters;
import org.oasis.wsrp.v2.InitCookie;
+import org.oasis.wsrp.v2.InvalidCookie;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.InvalidUserCategory;
import org.oasis.wsrp.v2.MarkupResponse;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PerformBlockingInteraction;
+import org.oasis.wsrp.v2.PortletStateChangeRequired;
import org.oasis.wsrp.v2.ReleaseSessions;
import org.oasis.wsrp.v2.ReturnAny;
+import org.oasis.wsrp.v2.UnsupportedLocale;
+import org.oasis.wsrp.v2.UnsupportedMimeType;
+import org.oasis.wsrp.v2.UnsupportedMode;
+import org.oasis.wsrp.v2.UnsupportedWindowState;
+import com.google.common.collect.Lists;
+
import javax.jws.HandlerChain;
import javax.jws.WebParam;
import javax.xml.ws.Holder;
@@ -100,23 +117,84 @@
V1UnsupportedLocale, V1InconsistentParameters, V1PortletStateChangeRequired, V1InvalidHandle, V1InvalidRegistration,
V1InvalidUserCategory, V1AccessDenied, V1OperationFailed
{
- /*forceSessionAccess();
+
+ forceSessionAccess();
PerformBlockingInteraction performBlockingInteraction = new PerformBlockingInteraction();
- performBlockingInteraction.setPortletContext(portletContext);
- performBlockingInteraction.setRuntimeContext(runtimeContext);
- performBlockingInteraction.setMarkupParams(markupParams);
- performBlockingInteraction.setInteractionParams(interactionParams);
- performBlockingInteraction.setRegistrationContext(registrationContext);
- performBlockingInteraction.setUserContext(userContext);
+ performBlockingInteraction.setPortletContext(V2V1Converter.toV2PortletContext(portletContext));
+ performBlockingInteraction.setRuntimeContext(V2V1Converter.toV2RuntimeContext(runtimeContext));
+ performBlockingInteraction.setMarkupParams(V2V1Converter.toV2MarkupParams(markupParams));
+ performBlockingInteraction.setInteractionParams(V2V1Converter.toV2InteractionParams(interactionParams));
+
+ performBlockingInteraction.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
+ performBlockingInteraction.setUserContext(V2V1Converter.toV2UserContext(userContext));
- BlockingInteractionResponse interactionResponse = producer.performBlockingInteraction(performBlockingInteraction);
+ BlockingInteractionResponse interactionResponse = null;
+ try
+ {
+ interactionResponse = producer.performBlockingInteraction(performBlockingInteraction);
- updateResponse.value = interactionResponse.getUpdateResponse();
+ }
+ catch (InvalidCookie invalidCookie)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidCookie.class, invalidCookie);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (InvalidSession invalidSession)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidSession.class, invalidSession);
+ }
+ catch (UnsupportedMode unsupportedMode)
+ {
+ throw V2V1Converter.toV1Exception(V1UnsupportedMode.class, unsupportedMode);
+ }
+ catch (UnsupportedMimeType unsupportedMimeType)
+ {
+ throw V2V1Converter.toV1Exception(V1UnsupportedMimeType.class, unsupportedMimeType);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (UnsupportedWindowState unsupportedWindowState)
+ {
+ throw V2V1Converter.toV1Exception(V1UnsupportedWindowState.class, unsupportedWindowState);
+ }
+ catch (UnsupportedLocale unsupportedLocale)
+ {
+ throw V2V1Converter.toV1Exception(V1UnsupportedLocale.class, unsupportedLocale);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2V1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (PortletStateChangeRequired portletStateChangeRequired)
+ {
+ throw V2V1Converter.toV1Exception(V1PortletStateChangeRequired.class, portletStateChangeRequired);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2V1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidUserCategory.class, invalidUserCategory);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2V1Converter.toV1Exception(V1InconsistentParameters.class, inconsistentParameters);
+ }
+
+ updateResponse.value = V2V1Converter.toV1UpdateResponse(interactionResponse.getUpdateResponse());
redirectURL.value = interactionResponse.getRedirectURL();
- extensions.value = interactionResponse.getExtensions();*/
-
- throw new NotYetImplemented();
+ extensions.value = Lists.transform(interactionResponse.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
}
public List<V1Extension> releaseSessions(
@@ -124,17 +202,35 @@
@WebParam(name = "sessionIDs", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") List<String> sessionIDs
) throws V1MissingParameters, V1InvalidRegistration, V1AccessDenied, V1OperationFailed
{
- /*forceSessionAccess();
+ forceSessionAccess();
ReleaseSessions releaseSessions = new ReleaseSessions();
- releaseSessions.setRegistrationContext(registrationContext);
+ releaseSessions.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
releaseSessions.getSessionIDs().addAll(sessionIDs);
- ReturnAny returnAny = producer.releaseSessions(releaseSessions);
+ ReturnAny returnAny;
+ try
+ {
+ returnAny = producer.releaseSessions(releaseSessions);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2V1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2V1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
- return returnAny.getExtensions();*/
-
- throw new NotYetImplemented();
+ return Lists.transform(returnAny.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
}
public void getMarkup(
@@ -145,42 +241,110 @@
@WebParam(name = "markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1MarkupParams markupParams,
@WebParam(mode = WebParam.Mode.OUT, name = "markupContext", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<V1MarkupContext> markupContext,
@WebParam(mode = WebParam.Mode.OUT, name = "sessionContext", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<V1SessionContext> sessionContext,
- @WebParam(mode = WebParam.Mode.OUT, name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>> extensions
+ @WebParam(mode = WebParam.Mode.OUT, name = "eUnsupportedWindowStatextensions", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") Holder<List<V1Extension>> extensions
) throws V1UnsupportedMimeType, V1UnsupportedMode, V1UnsupportedWindowState, V1InvalidCookie, V1InvalidSession, V1MissingParameters,
V1UnsupportedLocale, V1InconsistentParameters, V1InvalidHandle, V1InvalidRegistration, V1InvalidUserCategory, V1AccessDenied,
V1OperationFailed
{
- /*forceSessionAccess();
+ forceSessionAccess();
GetMarkup getMarkup = new GetMarkup();
- getMarkup.setRegistrationContext(registrationContext);
- getMarkup.setPortletContext(portletContext);
- getMarkup.setRuntimeContext(runtimeContext);
- getMarkup.setUserContext(userContext);
- getMarkup.setMarkupParams(markupParams);
+ 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));
- MarkupResponse response = producer.getMarkup(getMarkup);
+ MarkupResponse response;
+ try
+ {
+ response = producer.getMarkup(getMarkup);
+ }
+ catch (UnsupportedWindowState unsupportedWindowState)
+ {
+ throw V2V1Converter.toV1Exception(V1UnsupportedWindowState.class, unsupportedWindowState);
+ }
+ catch (InvalidCookie invalidCookie)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidCookie.class, invalidCookie);
+ }
+ catch (InvalidSession invalidSession)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidSession.class, invalidSession);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2V1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (InconsistentParameters inconsistentParameters)
+ {
+ throw V2V1Converter.toV1Exception(V1InconsistentParameters.class, inconsistentParameters);
+ }
+ catch (InvalidHandle invalidHandle)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidHandle.class, invalidHandle);
+ }
+ catch (UnsupportedLocale unsupportedLocale)
+ {
+ throw V2V1Converter.toV1Exception(V1UnsupportedLocale.class, unsupportedLocale);
+ }
+ catch (UnsupportedMode unsupportedMode)
+ {
+ throw V2V1Converter.toV1Exception(V1UnsupportedMode.class, unsupportedMode);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (MissingParameters missingParameters)
+ {
+ throw V2V1Converter.toV1Exception(V1MissingParameters.class, missingParameters);
+ }
+ catch (InvalidUserCategory invalidUserCategory)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidUserCategory.class, invalidUserCategory);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ }
+ catch (UnsupportedMimeType unsupportedMimeType)
+ {
+ throw V2V1Converter.toV1Exception(V1UnsupportedMimeType.class, unsupportedMimeType);
+ }
- markupContext.value = response.getMarkupContext();
- sessionContext.value = response.getSessionContext();
- extensions.value = response.getExtensions();*/
-
- throw new NotYetImplemented();
+ markupContext.value = V2V1Converter.toV1MarkupContext(response.getMarkupContext());
+ sessionContext.value = V2V1Converter.toV1SessionContext(response.getSessionContext());
+ extensions.value = Lists.transform(response.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
}
public List<V1Extension> initCookie(
@WebParam(name = "registrationContext", targetNamespace = "urn:oasis:names:tc:wsrp:v1:types") V1RegistrationContext registrationContext
) throws V1InvalidRegistration, V1AccessDenied, V1OperationFailed
{
- /*forceSessionAccess();
+ forceSessionAccess();
InitCookie initCookie = new InitCookie();
- initCookie.setRegistrationContext(registrationContext);
+ initCookie.setRegistrationContext(V2V1Converter.toV2RegistrationContext(registrationContext));
- ReturnAny returnAny = producer.initCookie(initCookie);
+ ReturnAny returnAny;
+ try
+ {
+ returnAny = producer.initCookie(initCookie);
+ }
+ catch (AccessDenied accessDenied)
+ {
+ throw V2V1Converter.toV1Exception(V1AccessDenied.class, accessDenied);
+ }
+ catch (OperationFailed operationFailed)
+ {
+ throw V2V1Converter.toV1Exception(V1OperationFailed.class, operationFailed);
+ }
+ catch (InvalidRegistration invalidRegistration)
+ {
+ throw V2V1Converter.toV1Exception(V1InvalidRegistration.class, invalidRegistration);
+ }
- return returnAny.getExtensions();*/
-
- throw new NotYetImplemented();
+ return Lists.transform(returnAny.getExtensions(), V2V1Converter.V2_TO_V1_EXTENSION);
}
}
14 years, 6 months
gatein SVN: r3277 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component.
by do-not-reply@jboss.org
Author: thanh_tung_do
Date: 2010-06-09 07:04:13 -0400 (Wed, 09 Jun 2010)
New Revision: 3277
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java
Log:
GTNPORTAL-1214: Display exception message if membership was deleted
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java 2010-06-09 09:29:29 UTC (rev 3276)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java 2010-06-09 11:04:13 UTC (rev 3277)
@@ -98,30 +98,31 @@
UIApplication uiApp = event.getRequestContext().getUIApplication();
UIPopupWindow uiPopup = uiForm.getParent();
OrganizationService service = uiForm.getApplicationComponent(OrganizationService.class);
+
Membership formMembership = service.getMembershipHandler().findMembership(uiForm.membershipId);
+ if (formMembership == null)
+ {
+ uiApp.addMessage(new ApplicationMessage("UIGroupEditMembershipForm.msg.membership-delete", null));
+ uiPopup.setUIComponent(null);
+ uiPopup.setShow(false);
+ return;
+ }
String userName = formMembership.getUserName();
Group group = service.getGroupHandler().findGroupById(uiForm.groupId);
User user = service.getUserHandler().findUserByName(userName);
MembershipHandler memberShipHandler = service.getMembershipHandler();
- String memberShipType = uiForm.getUIFormSelectBox(MEMBER_SHIP).getValue();
- try
+ String memberShipTypeStr = uiForm.getUIFormSelectBox(MEMBER_SHIP).getValue();
+ MembershipType membershipType = service.getMembershipTypeHandler().findMembershipType(memberShipTypeStr);
+ Membership membership =
+ memberShipHandler.findMembershipByUserGroupAndType(userName, group.getId(), membershipType.getName());
+ if (membership != null)
{
- MembershipType membershipType = service.getMembershipTypeHandler().findMembershipType(memberShipType);
- Membership membership =
- memberShipHandler.findMembershipByUserGroupAndType(userName, group.getId(), membershipType.getName());
- if (membership != null)
- {
- uiApp.addMessage(new ApplicationMessage("UIGroupEditMembershipForm.msg.membership-exist", null));
- return;
- }
- memberShipHandler.removeMembership(uiForm.membershipId, true);
- memberShipHandler.linkMembership(user, group, membershipType, true);
+ uiApp.addMessage(new ApplicationMessage("UIGroupEditMembershipForm.msg.membership-exist", null));
+ return;
}
- catch (Exception e)
- {
- // membership removed
- uiApp.addMessage(new ApplicationMessage("UIGroupEditMembershipForm.msg.membership-delete", null));
- }
+ memberShipHandler.removeMembership(uiForm.membershipId, true);
+ memberShipHandler.linkMembership(user, group, membershipType, true);
+
uiPopup.setUIComponent(null);
uiPopup.setShow(false);
}
14 years, 6 months
gatein SVN: r3276 - portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2010-06-09 05:29:29 -0400 (Wed, 09 Jun 2010)
New Revision: 3276
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml
Log:
GTNPORTAL-1174: Edit permission on PortalConfig of new group is not properly initiated
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml 2010-06-09 08:36:05 UTC (rev 3275)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/group/template/group/group.xml 2010-06-09 09:29:29 UTC (rev 3276)
@@ -27,7 +27,7 @@
<portal-name>@owner@</portal-name>
<locale>en</locale>
<access-permissions>Everyone</access-permissions>
- <edit-permission>*:/platform/administrators</edit-permission>
+ <edit-permission>manager:@owner@</edit-permission>
<properties>
<entry key="sessionAlive">onDemand</entry>
</properties>
14 years, 6 months