Author: mfranklin
Date: Tue Oct 16 22:42:13 2012
New Revision: 1399029

URL: http://svn.apache.org/viewvc?rev=1399029&view=rev
Log:
Added marshaller context

Added:
    
rave/branches/mongo/rave-components/rave-jpa/src/main/resources/org/apache/rave/marshaller-applicationContext.xml
    
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPortalPreference.java
    
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongDbPageTemplateConverter.java
    
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongoDbPortalPreferenceConverter.java
    
rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/marshaller-applicationContext.xml
Modified:
    
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbApplicationDataRepository.java
    
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbAuthorityRepository.java
    
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbCategoryRepository.java
    
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPortalPreferenceRepository.java
    
rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/applicationContext.xml
    
rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/dispatcher-servlet.xml

Added: 
rave/branches/mongo/rave-components/rave-jpa/src/main/resources/org/apache/rave/marshaller-applicationContext.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-jpa/src/main/resources/org/apache/rave/marshaller-applicationContext.xml?rev=1399029&view=auto
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-jpa/src/main/resources/org/apache/rave/marshaller-applicationContext.xml
 (added)
+++ 
rave/branches/mongo/rave-components/rave-jpa/src/main/resources/org/apache/rave/marshaller-applicationContext.xml
 Tue Oct 16 22:42:13 2012
@@ -0,0 +1,42 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:context="http://www.springframework.org/schema/context";
+       xmlns:mvc="http://www.springframework.org/schema/mvc";
+       xmlns:oxm="http://www.springframework.org/schema/oxm";
+       xmlns:p="http://www.springframework.org/schema/p";
+       xsi:schemaLocation="http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc.xsd
+        http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd
+        http://www.springframework.org/schema/oxm 
http://www.springframework.org/schema/oxm/spring-oxm.xsd";>
+
+
+    <oxm:jaxb2-marshaller id="xmlMarshaller">
+        <oxm:class-to-be-bound name="org.apache.rave.portal.model.JpaUser"/>
+        <oxm:class-to-be-bound name="org.apache.rave.portal.model.JpaPage"/>
+        <oxm:class-to-be-bound name="org.apache.rave.portal.model.JpaRegion"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.JpaRegionWidget"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.JpaRegionWidgetPreference"/>
+        <oxm:class-to-be-bound name="org.apache.rave.portal.model.JpaWidget"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.web.model.RegionWidgetPreferenceListWrapper"/>
+    </oxm:jaxb2-marshaller>
+
+</beans>
\ No newline at end of file

Added: 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPortalPreference.java
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPortalPreference.java?rev=1399029&view=auto
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPortalPreference.java
 (added)
+++ 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPortalPreference.java
 Tue Oct 16 22:42:13 2012
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.rave.portal.model;
+
+import org.apache.rave.portal.model.impl.PortalPreferenceImpl;
+
+public class MongoDbPortalPreference extends PortalPreferenceImpl {
+    
+    private Long id;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+}

Added: 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongDbPageTemplateConverter.java
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongDbPageTemplateConverter.java?rev=1399029&view=auto
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongDbPageTemplateConverter.java
 (added)
+++ 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongDbPageTemplateConverter.java
 Tue Oct 16 22:42:13 2012
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.rave.portal.model.conversion.impl;
+
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.rave.portal.model.MongoDbPageTemplateWidget;
+import org.apache.rave.portal.model.PageTemplate;
+import org.apache.rave.portal.model.PageTemplateRegion;
+import org.apache.rave.portal.model.PageTemplateWidget;
+import org.apache.rave.portal.model.conversion.HydratingModelConverter;
+import org.apache.rave.portal.model.impl.PageTemplateImpl;
+import org.apache.rave.portal.repository.WidgetRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MongDbPageTemplateConverter implements 
HydratingModelConverter<PageTemplate, PageTemplateImpl> {
+    @Autowired
+    private WidgetRepository widgetRepository;
+
+    @Override
+    public void hydrate(PageTemplateImpl dehydrated) {
+        for(PageTemplateRegion region : dehydrated.getPageTemplateRegions()) {
+            region.setPageTemplate(dehydrated);
+            for(PageTemplateWidget widget : region.getPageTemplateWidgets()) {
+                
((MongoDbPageTemplateWidget)widget).setWidgetRepository(widgetRepository);
+                widget.setPageTemplateRegion(region);
+            }
+        }
+    }
+
+    @Override
+    public Class<PageTemplate> getSourceType() {
+        return PageTemplate.class;
+    }
+
+    @Override
+    public PageTemplateImpl convert(PageTemplate source) {
+        throw new NotImplementedException("Page Templates are currently not 
saved by the Portal");
+    }
+}

Added: 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongoDbPortalPreferenceConverter.java
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongoDbPortalPreferenceConverter.java?rev=1399029&view=auto
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongoDbPortalPreferenceConverter.java
 (added)
+++ 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/impl/MongoDbPortalPreferenceConverter.java
 Tue Oct 16 22:42:13 2012
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.rave.portal.model.conversion.impl;
+
+import org.apache.rave.portal.model.MongoDbPortalPreference;
+import org.apache.rave.portal.model.PortalPreference;
+import org.apache.rave.portal.model.conversion.HydratingModelConverter;
+import org.springframework.stereotype.Component;
+
+import static org.apache.rave.portal.model.util.MongoDbModelUtil.generateId;
+
+@Component
+public class MongoDbPortalPreferenceConverter implements 
HydratingModelConverter<PortalPreference, MongoDbPortalPreference> {
+    @Override
+    public void hydrate(MongoDbPortalPreference dehydrated) {
+        //NOOP
+    }
+
+    @Override
+    public Class<PortalPreference> getSourceType() {
+        return PortalPreference.class;
+    }
+
+    @Override
+    public MongoDbPortalPreference convert(PortalPreference source) {
+        MongoDbPortalPreference converted = source instanceof 
MongoDbPortalPreference ? ((MongoDbPortalPreference)source) : new 
MongoDbPortalPreference();
+        converted.setId(generateId());
+        converted.setKey(source.getKey());
+        converted.setValues(source.getValues());
+        return converted;
+    }
+}

Modified: 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbApplicationDataRepository.java
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbApplicationDataRepository.java?rev=1399029&r1=1399028&r2=1399029&view=diff
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbApplicationDataRepository.java
 (original)
+++ 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbApplicationDataRepository.java
 Tue Oct 16 22:42:13 2012
@@ -21,40 +21,58 @@ package org.apache.rave.portal.repositor
 
 
 import org.apache.rave.portal.model.ApplicationData;
+import org.apache.rave.portal.model.impl.ApplicationDataImpl;
 import org.apache.rave.portal.repository.ApplicationDataRepository;
+import org.apache.rave.util.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoOperations;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
 
+import static org.apache.rave.portal.model.util.MongoDbModelUtil.generateId;
+import static org.springframework.data.mongodb.core.query.Criteria.where;
+import static org.springframework.data.mongodb.core.query.Query.query;
+
 @Repository
 public class MongoDbApplicationDataRepository implements 
ApplicationDataRepository {
+    public static final String COLLECTION = "appData";
+    public static final Class<ApplicationDataImpl> CLASS = 
ApplicationDataImpl.class;
+
+    @Autowired
+    private MongoOperations template;
+
     @Override
     public List<ApplicationData> getApplicationData(List<String> userIds, 
String appId) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return 
CollectionUtils.<ApplicationData>toBaseTypedList(template.find(query(where("appUrl").is(appId).andOperator(where("userId").in(userIds))),
 CLASS, COLLECTION));
     }
 
     @Override
     public ApplicationData getApplicationData(String personId, String appId) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return 
template.findOne(query(where("appUrl").is(appId).andOperator(where("userId").is(personId))),
 CLASS, COLLECTION);
     }
 
     @Override
     public Class<? extends ApplicationData> getType() {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return CLASS;
     }
 
     @Override
     public ApplicationData get(long id) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return template.findById(id, CLASS, COLLECTION);
     }
 
     @Override
     public ApplicationData save(ApplicationData item) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        if(item.getId() == null) {
+            item.setId(generateId());
+        }
+        template.save(item, COLLECTION);
+        return item;
     }
 
     @Override
     public void delete(ApplicationData item) {
-        //To change body of implemented methods use File | Settings | File 
Templates.
+        template.remove(item, COLLECTION);
     }
 }

Modified: 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbAuthorityRepository.java
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbAuthorityRepository.java?rev=1399029&r1=1399028&r2=1399029&view=diff
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbAuthorityRepository.java
 (original)
+++ 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbAuthorityRepository.java
 Tue Oct 16 22:42:13 2012
@@ -19,51 +19,76 @@
 
 package org.apache.rave.portal.repository.impl;
 
+import org.apache.rave.exception.NotSupportedException;
 import org.apache.rave.portal.model.Authority;
+import org.apache.rave.portal.model.impl.AuthorityImpl;
 import org.apache.rave.portal.repository.AuthorityRepository;
+import org.apache.rave.util.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoOperations;
+import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
 
+import static org.springframework.data.mongodb.core.query.Criteria.where;
+import static org.springframework.data.mongodb.core.query.Query.query;
+
 @Repository
 public class MongoDbAuthorityRepository implements AuthorityRepository {
+
+    public static final String COLLECTION = "authority";
+    public static final Class<AuthorityImpl> CLASS = AuthorityImpl.class;
+
+    @Autowired
+    private MongoOperations template;
+
     @Override
     public Authority getByAuthority(String authorityName) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return template.findOne(query(where("authority").is(authorityName)), 
CLASS, COLLECTION);
     }
 
     @Override
     public List<Authority> getAll() {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return 
CollectionUtils.<Authority>toBaseTypedList(template.findAll(CLASS, COLLECTION));
     }
 
     @Override
     public List<Authority> getAllDefault() {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return 
CollectionUtils.<Authority>toBaseTypedList(template.find(query(where("defaultForNewUser").is(true)),
 CLASS, COLLECTION));
     }
 
     @Override
     public int getCountAll() {
-        return 0;  //To change body of implemented methods use File | Settings 
| File Templates.
+        return (int)template.count(new Query(), COLLECTION);
     }
 
     @Override
     public Class<? extends Authority> getType() {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return AuthorityImpl.class;
     }
 
     @Override
     public Authority get(long id) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        throw new NotSupportedException();
     }
 
     @Override
     public Authority save(Authority item) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        Authority fromDb = getByAuthority(item.getAuthority());
+        Authority save;
+        if(fromDb == null) {
+            save = item;
+        } else {
+            fromDb.setDefaultForNewUser(item.isDefaultForNewUser());
+            save=fromDb;
+        }
+        template.save(save, COLLECTION);
+        return save;
     }
 
     @Override
     public void delete(Authority item) {
-        //To change body of implemented methods use File | Settings | File 
Templates.
+        template.remove(getByAuthority(item.getAuthority()), COLLECTION);
     }
 }

Modified: 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbCategoryRepository.java
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbCategoryRepository.java?rev=1399029&r1=1399028&r2=1399029&view=diff
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbCategoryRepository.java
 (original)
+++ 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbCategoryRepository.java
 Tue Oct 16 22:42:13 2012
@@ -21,6 +21,7 @@ package org.apache.rave.portal.repositor
 
 import org.apache.rave.portal.model.Category;
 import org.apache.rave.portal.model.conversion.HydratingConverterFactory;
+import org.apache.rave.portal.model.impl.CategoryImpl;
 import org.apache.rave.portal.repository.CategoryRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoOperations;
@@ -31,6 +32,9 @@ import java.util.List;
 @Repository
 public class MongoDbCategoryRepository implements CategoryRepository {
 
+    public static final String COLLECTION = "category";
+    public static final Class<CategoryImpl> CLASS = CategoryImpl.class;
+
     @Autowired
     private MongoOperations template;
 

Modified: 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPortalPreferenceRepository.java
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPortalPreferenceRepository.java?rev=1399029&r1=1399028&r2=1399029&view=diff
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPortalPreferenceRepository.java
 (original)
+++ 
rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPortalPreferenceRepository.java
 Tue Oct 16 22:42:13 2012
@@ -19,41 +19,67 @@
 
 package org.apache.rave.portal.repository.impl;
 
+import org.apache.rave.portal.model.MongoDbPortalPreference;
 import org.apache.rave.portal.model.PortalPreference;
+import org.apache.rave.portal.model.conversion.HydratingConverterFactory;
+import org.apache.rave.portal.model.impl.PortalPreferenceImpl;
 import org.apache.rave.portal.repository.PortalPreferenceRepository;
+import org.apache.rave.util.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoOperations;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
 
+import static org.springframework.data.mongodb.core.query.Criteria.where;
+import static org.springframework.data.mongodb.core.query.Query.query;
+
 @Repository
 public class MongoDbPortalPreferenceRepository implements 
PortalPreferenceRepository {
+
+    public static final String COLLECTION = "portalPreference";
+    public static final Class<PortalPreferenceImpl> CLASS = 
PortalPreferenceImpl.class;
+
+    @Autowired
+    private MongoOperations template;
+
+    @Autowired
+    private HydratingConverterFactory converter;
+
     @Override
     public List<PortalPreference> getAll() {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return 
CollectionUtils.<PortalPreference>toBaseTypedList(template.findAll(CLASS, 
COLLECTION));
     }
 
     @Override
     public PortalPreference getByKey(String key) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return template.findOne(query(where("key").is(key)), CLASS, 
COLLECTION);
     }
 
     @Override
     public Class<? extends PortalPreference> getType() {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return CLASS;
     }
 
     @Override
     public PortalPreference get(long id) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        return template.findById(id, CLASS, COLLECTION);
     }
 
     @Override
     public PortalPreference save(PortalPreference item) {
-        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
+        PortalPreference fromDb = getByKey(item.getKey());
+        MongoDbPortalPreference converted = converter.convert(item, 
PortalPreference.class);
+        if(fromDb != null) {
+            converted.setId(((MongoDbPortalPreference)fromDb).getId());
+        }
+        template.save(converted, COLLECTION);
+        converter.hydrate(converted, PortalPreference.class);
+        return converted;
     }
 
     @Override
     public void delete(PortalPreference item) {
-        //To change body of implemented methods use File | Settings | File 
Templates.
+        template.remove(getByKey(item.getKey()), COLLECTION);
     }
 }

Added: 
rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/marshaller-applicationContext.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/marshaller-applicationContext.xml?rev=1399029&view=auto
==============================================================================
--- 
rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/marshaller-applicationContext.xml
 (added)
+++ 
rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/marshaller-applicationContext.xml
 Tue Oct 16 22:42:13 2012
@@ -0,0 +1,38 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing,
+  ~  software distributed under the License is distributed on an
+  ~  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~  KIND, either express or implied.  See the License for the
+  ~  specific language governing permissions and limitations
+  ~  under the License.
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:oxm="http://www.springframework.org/schema/oxm";
+       xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+
+        http://www.springframework.org/schema/oxm 
http://www.springframework.org/schema/oxm/spring-oxm.xsd";>
+
+
+    <oxm:jaxb2-marshaller id="xmlMarshaller">
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.MongoDbUser"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.MongoDbPage"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.impl.RegionImpl"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.MongoDbRegionWidget"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.impl.RegionWidgetPreferenceImpl"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.MongoDbWidget"/>
+        <oxm:class-to-be-bound 
name="org.apache.rave.portal.web.model.RegionWidgetPreferenceListWrapper"/>
+    </oxm:jaxb2-marshaller>
+
+</beans>
\ No newline at end of file

Modified: 
rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/applicationContext.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/applicationContext.xml?rev=1399029&r1=1399028&r2=1399029&view=diff
==============================================================================
--- 
rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/applicationContext.xml
 (original)
+++ 
rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/applicationContext.xml
 Tue Oct 16 22:42:13 2012
@@ -27,7 +27,7 @@
                            
http://www.springframework.org/schema/util/spring-util.xsd";>
 
     <import resource="classpath*:org/apache/rave/core-applicationContext.xml"/>
-    <import resource="classpath*:org/apache/rave/jpa-applicationContext.xml"/>
+    <import 
resource="classpath*:org/apache/rave/persistence-applicationContext.xml"/>
     <import resource="classpath*:org/apache/rave/web-applicationContext.xml"/>
     <import 
resource="classpath*:org/apache/rave/opensocial-provider-applicationContext.xml"/>
     <import 
resource="classpath*:org/apache/rave/w3c-provider-applicationContext.xml"/>

Modified: 
rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/dispatcher-servlet.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/dispatcher-servlet.xml?rev=1399029&r1=1399028&r2=1399029&view=diff
==============================================================================
--- 
rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/dispatcher-servlet.xml
 (original)
+++ 
rave/branches/mongo/rave-portal-resources/src/main/webapp/WEB-INF/dispatcher-servlet.xml
 Tue Oct 16 22:42:13 2012
@@ -27,6 +27,8 @@
         http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/oxm 
http://www.springframework.org/schema/oxm/spring-oxm.xsd";>
 
+    <import 
resource="classpath*:/org/apache/rave/marshaller-applicationContext.xml" />
+
     <!--
     Scans the classpath of this application for @Components to deploy as beans
     NOTE: only the controllers (api and controller packages) are scanned here 
in dispatcher-servlet.xml. All other
@@ -89,16 +91,6 @@
         <property name="suffix" value=".jsp"/>
     </bean>
 
-    <oxm:jaxb2-marshaller id="xmlMarshaller">
-        <oxm:class-to-be-bound name="org.apache.rave.portal.model.JpaUser"/>
-        <oxm:class-to-be-bound name="org.apache.rave.portal.model.JpaPage"/>
-        <oxm:class-to-be-bound name="org.apache.rave.portal.model.JpaRegion"/>
-        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.JpaRegionWidget"/>
-        <oxm:class-to-be-bound 
name="org.apache.rave.portal.model.JpaRegionWidgetPreference"/>
-        <oxm:class-to-be-bound name="org.apache.rave.portal.model.JpaWidget"/>
-        <oxm:class-to-be-bound 
name="org.apache.rave.portal.web.model.RegionWidgetPreferenceListWrapper"/>
-    </oxm:jaxb2-marshaller>
-
     <bean 
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
         <property name="messageConverters">
             <list>


Reply via email to