You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mf...@apache.org on 2012/10/16 02:25:11 UTC

svn commit: r1398585 - in /rave/branches/mongo/rave-components: rave-core/src/main/java/org/apache/rave/portal/model/impl/ rave-mongodb/ rave-mongodb/src/main/java/org/apache/rave/portal/model/ rave-mongodb/src/main/java/org/apache/rave/portal/model/co...

Author: mfranklin
Date: Tue Oct 16 00:25:10 2012
New Revision: 1398585

URL: http://svn.apache.org/viewvc?rev=1398585&view=rev
Log:
Added copyright

Added:
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetComment.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetTag.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbWidgetConverter.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/MongoDbTagRepository.java
    rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepositoryTest.java
      - copied, changed from r1398423, rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java
Modified:
    rave/branches/mongo/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/impl/CategoryImpl.java
    rave/branches/mongo/rave-components/rave-mongodb/pom.xml
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPage.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageLayout.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageUser.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbRegionWidget.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbUser.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidget.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/HydratingModelConverter.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbConverter.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbPageConverter.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/util/MongoDbModelUtil.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageLayoutRepository.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageRepository.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbUserRepository.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepository.java
    rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/persistence-applicationContext.xml
    rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java
    rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/portal.properties
    rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/test-applicationContext.xml

Modified: rave/branches/mongo/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/impl/CategoryImpl.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/impl/CategoryImpl.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/impl/CategoryImpl.java (original)
+++ rave/branches/mongo/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/impl/CategoryImpl.java Tue Oct 16 00:25:10 2012
@@ -40,6 +40,10 @@ public class CategoryImpl implements Cat
         this.id = id;
     }
 
+    public CategoryImpl(String text) {
+        this.text = text;
+    }
+
     @Override
     public Long getId() {
         return id;

Modified: rave/branches/mongo/rave-components/rave-mongodb/pom.xml
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/pom.xml?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/pom.xml (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/pom.xml Tue Oct 16 00:25:10 2012
@@ -1,23 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  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.
-
--->
+  ~ 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.
+  -->
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPage.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPage.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPage.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPage.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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.PageImpl;

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageLayout.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageLayout.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageLayout.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageLayout.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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.PageLayoutImpl;

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageUser.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageUser.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageUser.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbPageUser.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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.PageUserImpl;

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbRegionWidget.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbRegionWidget.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbRegionWidget.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbRegionWidget.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbUser.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbUser.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbUser.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbUser.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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.UserImpl;

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidget.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidget.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidget.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidget.java Tue Oct 16 00:25:10 2012
@@ -1,14 +1,118 @@
+/*
+ * 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 com.google.common.collect.Lists;
 import org.apache.rave.portal.model.impl.WidgetImpl;
+import org.apache.rave.portal.repository.CategoryRepository;
+import org.apache.rave.portal.repository.UserRepository;
+
+import java.util.List;
 
 /**
  */
 public class MongoDbWidget extends WidgetImpl {
 
-    public MongoDbWidget() {   }
+    private CategoryRepository categoryRepository;
+    private UserRepository userRepository;
+
+    private Long ownerId;
+    private List<Long> categoryIds;
+
+    public MongoDbWidget() { }
 
     public MongoDbWidget(long id) {
         super(id);
     }
+
+    public Long getOwnerId() {
+        return ownerId;
+    }
+
+    public void setOwnerId(Long ownerId) {
+        this.ownerId = ownerId;
+    }
+
+    public List<Long> getCategoryIds() {
+        return categoryIds;
+    }
+
+    public void setCategoryIds(List<Long> categoryIds) {
+        this.categoryIds = categoryIds;
+    }
+
+    public CategoryRepository getCategoryRepository() {
+        return categoryRepository;
+    }
+
+    public void setCategoryRepository(CategoryRepository categoryRepository) {
+        this.categoryRepository = categoryRepository;
+    }
+
+    public UserRepository getUserRepository() {
+        return userRepository;
+    }
+
+    public void setUserRepository(UserRepository userRepository) {
+        this.userRepository = userRepository;
+    }
+
+    @Override
+    public User getOwner() {
+        User user = super.getOwner();
+        if(user == null) {
+            user = userRepository.get(ownerId);
+            super.setOwner(user);
+        }
+        return user;
+    }
+
+    @Override
+    public List<Category> getCategories() {
+        List<Category> categories = super.getCategories();
+        if(categories == null || categories.isEmpty()) {
+            categories = Lists.newArrayList();
+            for(Long id : categoryIds) {
+                categories.add(categoryRepository.get(id));
+            }
+            super.setCategories(categories);
+        }
+        return categories;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof Widget)) return false;
+
+        Widget that = (Widget) o;
+
+        if (this.getId() != null ? !this.getId().equals(that.getId()) : that.getId() != null) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (getId() != null ? getId().hashCode() : 0);
+        return result;
+    }
 }

Added: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetComment.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetComment.java?rev=1398585&view=auto
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetComment.java (added)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetComment.java Tue Oct 16 00:25:10 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;
+
+import org.apache.rave.portal.model.impl.WidgetCommentImpl;
+import org.apache.rave.portal.repository.UserRepository;
+
+/**
+ */
+public class MongoDbWidgetComment extends WidgetCommentImpl {
+
+    private UserRepository userRepository;
+
+    private Long userId;
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public UserRepository getUserRepository() {
+        return userRepository;
+    }
+
+    public void setUserRepository(UserRepository userRepository) {
+        this.userRepository = userRepository;
+    }
+
+    @Override
+    public User getUser() {
+        User user = super.getUser();
+        if(user == null) {
+            user = userRepository.get(userId);
+            super.setUser(user);
+        }
+        return user;
+    }
+}

Added: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetTag.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetTag.java?rev=1398585&view=auto
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetTag.java (added)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/MongoDbWidgetTag.java Tue Oct 16 00:25:10 2012
@@ -0,0 +1,87 @@
+/*
+ * 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.WidgetTagImpl;
+import org.apache.rave.portal.repository.TagRepository;
+import org.apache.rave.portal.repository.UserRepository;
+
+/**
+ */
+public class MongoDbWidgetTag extends WidgetTagImpl {
+
+    private UserRepository userRepository;
+    private TagRepository tagRepository;
+
+    private Long userId;
+    private String tagKeyword;
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public UserRepository getUserRepository() {
+        return userRepository;
+    }
+
+    public void setUserRepository(UserRepository repository) {
+        this.userRepository = repository;
+    }
+
+    public TagRepository getTagRepository() {
+        return tagRepository;
+    }
+
+    public void setTagRepository(TagRepository tagRepository) {
+        this.tagRepository = tagRepository;
+    }
+
+    public String getTagKeyword() {
+        return tagKeyword;
+    }
+
+    public void setTagKeyword(String keyword) {
+        this.tagKeyword = keyword;
+    }
+
+    @Override
+    public Tag getTag() {
+        Tag tag = super.getTag();
+        if(tag == null) {
+            tag = tagRepository.getByKeyword(tagKeyword);
+            super.setTag(tag);
+        }
+        return tag;
+    }
+
+    @Override
+    public User getUser() {
+        User user = super.getUser();
+        if(user == null) {
+            user = userRepository.get(userId);
+            super.setUser(user);
+        }
+        return user;
+    }
+}

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/HydratingModelConverter.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/HydratingModelConverter.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/HydratingModelConverter.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/HydratingModelConverter.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbConverter.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbConverter.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbConverter.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbConverter.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 import org.apache.rave.model.ModelConverter;
@@ -16,10 +35,10 @@ import java.util.Map;
 @Component
 public class MongoDbConverter {
 
-    Map<Class<?>, HydratingModelConverter> converterMap;
+    private Map<Class<?>, HydratingModelConverter> converterMap;
 
     @Autowired
-    MongoDbConverter(List<HydratingModelConverter> converters) {
+    public void setConverters(List<HydratingModelConverter> converters) {
         converterMap = new HashMap<Class<?>, HydratingModelConverter>();
         for(HydratingModelConverter converter : converters) {
             converterMap.put(converter.getSourceType(), converter);

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbPageConverter.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbPageConverter.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbPageConverter.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbPageConverter.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 import com.google.common.collect.Lists;
@@ -44,11 +63,12 @@ public class MongoDbPageConverter implem
         page.setPageLayoutRepository(null);
         page.setUserRepository(null);
 
+        List<PageUser> convertedMembers = Lists.newArrayList();
         for (PageUser user : sourcePage.getMembers()) {
-            List<PageUser> convertedMembers = Lists.newLinkedList();
             convertedMembers.add(convert(user));
-            page.setMembers(convertedMembers);
         }
+        page.setMembers(convertedMembers);
+
         //No need to convert regions to anything special at this time
         for (Region region : page.getRegions()) {
             if (region.getId() == null) {
@@ -58,11 +78,11 @@ public class MongoDbPageConverter implem
             manipulateRegion(region, false);
         }
         if (page.getSubPages() != null) {
+            List<Page> convertedPages = Lists.newArrayList();
             for (Page subPage : sourcePage.getSubPages()) {
-                List<Page> convertedPages = Lists.newArrayList();
                 convertedPages.add(convert(subPage));
-                page.setSubPages(convertedPages);
             }
+            page.setSubPages(convertedPages);
         }
         return page;
     }

Added: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbWidgetConverter.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbWidgetConverter.java?rev=1398585&view=auto
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbWidgetConverter.java (added)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/conversion/MongoDbWidgetConverter.java Tue Oct 16 00:25:10 2012
@@ -0,0 +1,149 @@
+/*
+ * 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;
+
+import com.google.common.collect.Lists;
+import org.apache.rave.portal.model.*;
+import org.apache.rave.portal.repository.CategoryRepository;
+import org.apache.rave.portal.repository.TagRepository;
+import org.apache.rave.portal.repository.UserRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+import static org.apache.rave.portal.model.util.MongoDbModelUtil.generateId;
+
+/**
+ */
+@Component
+public class MongoDbWidgetConverter implements HydratingModelConverter<Widget, MongoDbWidget> {
+    @Autowired
+    private UserRepository userRepository;
+
+    @Autowired
+    private CategoryRepository categoryRepository;
+    
+    @Autowired
+    private TagRepository tagRepository;
+
+    @Override
+    public void hydrate(MongoDbWidget dehydrated) {
+        dehydrated.setCategoryRepository(categoryRepository);
+        dehydrated.setUserRepository(userRepository);
+        
+        for(WidgetComment comment: dehydrated.getComments()) {
+            if(comment instanceof MongoDbWidgetComment) {
+                ((MongoDbWidgetComment)comment).setUserRepository(userRepository);
+            }
+        }        
+        
+        for(WidgetTag tag: dehydrated.getTags()) {
+            if(tag instanceof MongoDbWidgetTag) {
+                ((MongoDbWidgetTag)tag).setUserRepository(userRepository);
+                ((MongoDbWidgetTag)tag).setTagRepository(tagRepository);
+            }
+        }
+    }
+
+    @Override
+    public MongoDbWidget convert(Widget source) {
+        MongoDbWidget widget = source instanceof MongoDbWidget ? (MongoDbWidget)source : new MongoDbWidget();
+        updateProperties(source, widget);
+        widget.setOwnerId(source.getOwner().getId());
+        widget.setOwner(null);
+        widget.setUserRepository(null);
+
+        List<Long> categoryIds = Lists.<Long>newArrayList();
+        for(Category category : source.getCategories()) {
+            widget.getCategoryIds().add(category.getId());
+        }
+        widget.setCategoryIds(categoryIds);
+        widget.setCategories(null);
+        widget.setCategoryRepository(null);
+
+        List<WidgetComment> convertedComments = Lists.newArrayList();
+        for(WidgetComment comment : source.getComments()) {
+            convertedComments.add(convert(comment, widget));
+        }
+        widget.setComments(convertedComments);
+
+        List<WidgetTag> convertedTags = Lists.newArrayList();
+        for(WidgetTag tag : source.getTags()) {
+            convertedTags.add(convert(tag, widget));
+        }
+        widget.setTags(convertedTags);
+
+        return widget;
+    }
+
+    private MongoDbWidgetTag convert(WidgetTag tag, Widget widget) {
+        MongoDbWidgetTag converted = tag instanceof MongoDbWidgetTag ? ((MongoDbWidgetTag)tag) : new MongoDbWidgetTag();
+
+        converted.setUserId(tag.getUser().getId());
+        converted.setUser(null);
+        converted.setTagKeyword(tag.getTag().getKeyword());
+        converted.setTag(null);
+        converted.setUserRepository(null);
+        converted.setTagRepository(null);
+
+        converted.setCreatedDate(tag.getCreatedDate());
+        converted.setWidgetId(widget.getId());
+        return converted;
+    }
+
+    private MongoDbWidgetComment convert(WidgetComment comment, Widget widget) {
+        MongoDbWidgetComment converted = comment instanceof MongoDbWidgetComment ? ((MongoDbWidgetComment)comment) : new MongoDbWidgetComment();
+        converted.setUserId(comment.getUser().getId());
+        converted.setUser(null);
+        converted.setId(comment.getId() == null ? generateId() : comment.getId());
+        converted.setUserRepository(null);
+
+        converted.setCreatedDate(comment.getCreatedDate());
+        converted.setLastModifiedDate(comment.getLastModifiedDate());
+        converted.setText(comment.getText());
+        converted.setWidgetId(widget.getId());
+        return converted;
+    }
+
+    @Override
+    public Class<Widget> getSourceType() {
+        return Widget.class;
+    }
+
+    private void updateProperties(Widget source, MongoDbWidget converted) {
+        converted.setId(source.getId() == null ? generateId() : source.getId());
+        converted.setUrl(source.getUrl());
+        converted.setType(source.getType());
+        converted.setTitle(source.getTitle());
+        converted.setTitleUrl(source.getTitleUrl());
+        converted.setUrl(source.getUrl());
+        converted.setThumbnailUrl(source.getThumbnailUrl());
+        converted.setScreenshotUrl(source.getScreenshotUrl());
+        converted.setAuthor(source.getAuthor());
+        converted.setAuthorEmail(source.getAuthorEmail());
+        converted.setDescription(source.getDescription());
+        converted.setWidgetStatus(source.getWidgetStatus());
+        converted.setComments(source.getComments());
+        converted.setDisableRendering(source.isDisableRendering());
+        converted.setRatings(source.getRatings());
+        converted.setFeatured(source.isFeatured());
+    }
+}

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/util/MongoDbModelUtil.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/util/MongoDbModelUtil.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/util/MongoDbModelUtil.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/model/util/MongoDbModelUtil.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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.util;
 
 import java.util.Random;

Added: 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=1398585&view=auto
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbCategoryRepository.java (added)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbCategoryRepository.java Tue Oct 16 00:25:10 2012
@@ -0,0 +1,59 @@
+/*
+ * 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.repository.impl;
+
+import org.apache.rave.portal.model.Category;
+import org.apache.rave.portal.repository.CategoryRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public class MongoDbCategoryRepository implements CategoryRepository {
+    @Override
+    public List<Category> getAll() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public int removeFromCreatedOrModifiedFields(long userId) {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Class<? extends Category> getType() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Category get(long id) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Category save(Category item) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void delete(Category item) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageLayoutRepository.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageLayoutRepository.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageLayoutRepository.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageLayoutRepository.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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.repository.impl;
 
 import org.apache.rave.portal.model.MongoDbPageLayout;

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageRepository.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageRepository.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageRepository.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbPageRepository.java Tue Oct 16 00:25:10 2012
@@ -1,3 +1,22 @@
+/*
+ * 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.repository.impl;
 
 import com.google.common.collect.Lists;
@@ -39,8 +58,9 @@ public class MongoDbPageRepository imple
 
     @Override
     public int deletePages(Long userId, PageType pageType) {
-        int count = getAllPages(userId, pageType).size();
-        mongoTemplate.remove(new Query(where("pageType").is(pageType).andOperator(where("ownerId").is(userId))), MongoDbPage.class);
+        Query query = new Query(where("pageType").is(pageType).andOperator(where("ownerId").is(userId)));
+        int count = (int)mongoTemplate.count(query, MongoDbPage.class);
+        mongoTemplate.remove(query, MongoDbPage.class);
         return count;
     }
 
@@ -51,7 +71,7 @@ public class MongoDbPageRepository imple
 
     @Override
     public boolean hasPersonPage(long userId) {
-        return getAllPages(userId, PageType.PERSON_PROFILE).size() > 0;
+        return mongoTemplate.count(new Query(where("pageType").is(PageType.PERSON_PROFILE).andOperator(where("ownerId").is(userId))), MongoDbPage.class) > 0;
     }
 
     @Override

Added: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbTagRepository.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbTagRepository.java?rev=1398585&view=auto
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbTagRepository.java (added)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbTagRepository.java Tue Oct 16 00:25:10 2012
@@ -0,0 +1,69 @@
+/*
+ * 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.repository.impl;
+
+import org.apache.rave.portal.model.Tag;
+import org.apache.rave.portal.repository.TagRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public class MongoDbTagRepository implements TagRepository {
+    @Override
+    public List<Tag> getAll() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public int getCountAll() {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Tag getByKeyword(String keyword) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public List<Tag> getAvailableTagsByWidgetId(Long widgetId) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Class<? extends Tag> getType() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Tag get(long id) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public Tag save(Tag item) {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void delete(Tag item) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbUserRepository.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbUserRepository.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbUserRepository.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbUserRepository.java Tue Oct 16 00:25:10 2012
@@ -1,7 +1,27 @@
+/*
+ * 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.repository.impl;
 
 import org.apache.rave.portal.model.MongoDbUser;
 import org.apache.rave.portal.model.User;
+import org.apache.rave.portal.model.conversion.MongoDbConverter;
 import org.apache.rave.portal.repository.UserRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.MongoOperations;
@@ -17,9 +37,12 @@ public class MongoDbUserRepository imple
     @Autowired
     private MongoOperations template;
 
+    @Autowired
+    private MongoDbConverter converter;
+
     @Override
     public User getByUsername(String username) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     @Override

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepository.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepository.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepository.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepository.java Tue Oct 16 00:25:10 2012
@@ -1,15 +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.
+ */
+
 package org.apache.rave.portal.repository.impl;
 
 import org.apache.rave.portal.model.*;
+import org.apache.rave.portal.model.conversion.MongoDbConverter;
 import org.apache.rave.portal.model.util.WidgetStatistics;
 import org.apache.rave.portal.repository.WidgetRepository;
+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.Criteria;
+import org.springframework.data.mongodb.core.query.Order;
+import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
 import java.util.Map;
 
+import static org.springframework.data.mongodb.core.query.Criteria.where;
+
+
 /**
  */
 @Repository
@@ -18,6 +45,9 @@ public class MongoDbWidgetRepository imp
     @Autowired
     private MongoOperations template;
 
+    @Autowired
+    private MongoDbConverter converter;
+
     @Override
     public List<Widget> getAll() {
         return null;
@@ -25,18 +55,18 @@ public class MongoDbWidgetRepository imp
 
     @Override
     public List<Widget> getLimitedList(int offset, int pageSize) {
-        return null;
+        return hydrateWidgets(template.find(new Query().skip(offset).limit(pageSize), MongoDbWidget.class));
     }
 
     @Override
     public int getCountAll() {
-        //TODO replace with native query
-        return template.findAll(MongoDbWidget.class).size();
+        return (int)template.count(new Query(), MongoDbWidget.class);
     }
 
     @Override
     public List<Widget> getByFreeTextSearch(String searchTerm, int offset, int pageSize) {
-        return null;
+        Query query = new Query(getFreeTextClause(searchTerm)).skip(offset).limit(pageSize);
+        return hydrateWidgets(template.find(query, MongoDbWidget.class));
     }
 
     @Override
@@ -46,27 +76,33 @@ public class MongoDbWidgetRepository imp
 
     @Override
     public List<Widget> getByStatus(WidgetStatus widgetStatus, int offset, int pageSize) {
-        return null;
+        Query query = new Query(where("widgetStatus").is(widgetStatus)).skip(offset).limit(pageSize);
+        query.sort().on("title", Order.ASCENDING);
+        List<MongoDbWidget> widgets = template.find(query, MongoDbWidget.class);
+        return hydrateWidgets(widgets);
     }
 
     @Override
     public int getCountByStatus(WidgetStatus widgetStatus) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return (int)template.count(new Query(where("widgetStatus").is(widgetStatus)), MongoDbWidget.class);
     }
 
     @Override
     public List<Widget> getByStatusAndTypeAndFreeTextSearch(WidgetStatus widgetStatus, String type, String searchTerm, int offset, int pageSize) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        Query query = getWidgetStatusFreeTextQuery(widgetStatus, type, searchTerm).limit(pageSize).skip(offset);
+        query.sort().on("title", Order.ASCENDING);
+        List<MongoDbWidget> widgets = template.find(query, MongoDbWidget.class);
+        return hydrateWidgets(widgets);
     }
 
     @Override
     public int getCountByStatusAndTypeAndFreeText(WidgetStatus widgetStatus, String type, String searchTerm) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+        return (int)template.count(getWidgetStatusFreeTextQuery(widgetStatus, type, searchTerm), MongoDbWidget.class);
     }
 
     @Override
     public List<Widget> getByOwner(User owner, int offset, int pageSize) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
     @Override
@@ -76,7 +112,7 @@ public class MongoDbWidgetRepository imp
 
     @Override
     public Widget getByUrl(String widgetUrl) {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return hydrateWidget(template.findOne(new Query(where("url").is(widgetUrl)), MongoDbWidget.class));
     }
 
     @Override
@@ -111,7 +147,7 @@ public class MongoDbWidgetRepository imp
 
     @Override
     public Class<? extends Widget> getType() {
-        return Widget.class;
+        return MongoDbWidget.class;
     }
 
     @Override
@@ -121,12 +157,38 @@ public class MongoDbWidgetRepository imp
 
     @Override
     public Widget save(Widget item) {
-        template.save(item);
-        return item;
+        MongoDbWidget converted = converter.convert(item, Widget.class);
+        template.save(converted);
+        converter.hydrate(converted, Widget.class);
+        return converted;
     }
 
     @Override
     public void delete(Widget item) {
-        //To change body of implemented methods use File | Settings | File Templates.
+        template.remove(template.findById(item.getId(), MongoDbWidget.class));
+    }
+
+    private List<Widget> hydrateWidgets(List<MongoDbWidget> widgets) {
+        for(MongoDbWidget widget : widgets) {
+            converter.hydrate(widget, Widget.class);
+        }
+        return CollectionUtils.<Widget>toBaseTypedList(widgets);
+    }
+
+    private Widget hydrateWidget(MongoDbWidget widget) {
+        converter.hydrate(widget, Widget.class);
+        return widget;
+    }
+
+    private Query getWidgetStatusFreeTextQuery(WidgetStatus widgetStatus, String type, String searchTerm) {
+        return new Query(where("widgetStatus").is(widgetStatus)
+                .andOperator(where("type").is(type))
+                .andOperator(getFreeTextClause(searchTerm))
+        );
+    }
+
+    private Criteria getFreeTextClause(String searchTerm) {
+        String regex = "/" + searchTerm + "/";
+        return where("title").is(regex).orOperator(where("title").is(regex));
     }
 }

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/persistence-applicationContext.xml
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/persistence-applicationContext.xml?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/persistence-applicationContext.xml (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/main/resources/org/apache/rave/persistence-applicationContext.xml Tue Oct 16 00:25:10 2012
@@ -1,21 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  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.
+  ~ 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"

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java Tue Oct 16 00:25:10 2012
@@ -1,15 +1,37 @@
+/*
+ * 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.repository.impl;
 
 import com.google.common.collect.Lists;
+import com.mongodb.Mongo;
 import org.apache.rave.portal.model.*;
 import org.apache.rave.portal.model.impl.*;
 import org.apache.rave.portal.repository.PageLayoutRepository;
 import org.apache.rave.portal.repository.PageRepository;
 import org.apache.rave.portal.repository.UserRepository;
 import org.apache.rave.portal.repository.WidgetRepository;
+import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
@@ -24,6 +46,7 @@ import static org.junit.Assert.assertTha
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = {"classpath:test-applicationContext.xml"})
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
 public class MongoDbPageRepositoryTest {
 
     @Autowired
@@ -37,9 +60,17 @@ public class MongoDbPageRepositoryTest {
 
     @Autowired
     UserRepository userRepository;
+    
+    @Autowired
+    Mongo mongo;
+    
+    @After
+    public void tearDown() {
+        mongo.dropDatabase("rave");    
+    }
 
     @Test
-    public void MongoTest() {
+    public void save_basic() {
         Page page = new PageImpl();
 
         User user1 = new MongoDbUser(12345L);

Copied: rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepositoryTest.java (from r1398423, rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java)
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepositoryTest.java?p2=rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepositoryTest.java&p1=rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java&r1=1398423&r2=1398585&rev=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbPageRepositoryTest.java (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/test/java/org/apache/rave/portal/repository/impl/MongoDbWidgetRepositoryTest.java Tue Oct 16 00:25:10 2012
@@ -1,19 +1,44 @@
+/*
+ * 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.repository.impl;
 
-import com.google.common.collect.Lists;
+import com.mongodb.Mongo;
 import org.apache.rave.portal.model.*;
 import org.apache.rave.portal.model.impl.*;
-import org.apache.rave.portal.repository.PageLayoutRepository;
-import org.apache.rave.portal.repository.PageRepository;
+import org.apache.rave.portal.repository.CategoryRepository;
 import org.apache.rave.portal.repository.UserRepository;
 import org.apache.rave.portal.repository.WidgetRepository;
+import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.annotation.DirtiesContext;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import static org.hamcrest.CoreMatchers.*;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 
 /**
@@ -24,23 +49,31 @@ import static org.junit.Assert.assertTha
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = {"classpath:test-applicationContext.xml"})
-public class MongoDbPageRepositoryTest {
+@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
+public class MongoDbWidgetRepositoryTest {
 
     @Autowired
-    PageRepository repository;
+    WidgetRepository widgetRepository;
 
     @Autowired
-    WidgetRepository widgetRepository;
+    UserRepository userRepository;
 
     @Autowired
-    PageLayoutRepository pageLayoutRepository;
+    CategoryRepository categoryRepository;
 
     @Autowired
-    UserRepository userRepository;
+    Mongo mongo;
+
+    @After
+    public void tearDown() {
+        mongo.dropDatabase("rave");
+    }
 
     @Test
     public void MongoTest() {
-        Page page = new PageImpl();
+        List<Category> categoryList = Arrays.asList((Category)new CategoryImpl("GOO"), new CategoryImpl("FOO"));
+        categoryRepository.save(categoryList.get(0));
+        categoryRepository.save(categoryList.get(1));
 
         User user1 = new MongoDbUser(12345L);
         user1.setDisplayName("GEORGE DOE");
@@ -50,51 +83,44 @@ public class MongoDbPageRepositoryTest {
         user2.setDisplayName("JANE DOE");
         userRepository.save(user2);
 
-        PageUser p = new PageUserImpl(user1, page);
-        page.setName("PAGE NAME");
-        page.setMembers(Lists.<PageUser>newLinkedList());
-        page.getMembers().add(p);
-        page.setOwner(user2);
-        page.setRegions(Lists.<Region>newLinkedList());
-
-        Region region = new RegionImpl();
-        region.setPage(page);
-        region.setRegionWidgets(Lists.<RegionWidget>newLinkedList());
-        page.getRegions().add(region);
-
-        RegionWidget regionWidget = new RegionWidgetImpl();
-        regionWidget.setRegion(region);
-        regionWidget.setPreferences(Lists.<RegionWidgetPreference>newLinkedList());
-        region.getRegionWidgets().add(regionWidget);
-
-        RegionWidgetPreference preference = new RegionWidgetPreferenceImpl();
-        preference.setName("PREF NAME");
-        preference.setValue("PREF_VALUE");
-        regionWidget.getPreferences().add(preference);
-
-        Widget widget = new MongoDbWidget(13223L);
-        widget.setAuthor("FOO");
-        widget.setDescription("BAR");
-        widgetRepository.save(widget);
-
-        regionWidget.setWidget(widget);
-
-        page.setPageType(PageType.USER);
-        PageLayout layout = new MongoDbPageLayout("LAYOUT");
-        page.setPageLayout(layout);
-        layout.setNumberOfRegions(24L);
-        pageLayoutRepository.save(layout);
-
-        Page saved = repository.save(page);
-        assertThat(saved, instanceOf(MongoDbPage.class));
-
-        Page fromDb = repository.get(saved.getId());
-        assertThat(fromDb.getMembers().get(0).getUser(), is(equalTo(saved.getMembers().get(0).getUser())));
-        assertThat(fromDb, is(sameInstance(fromDb.getMembers().get(0).getPage())));
-        assertThat(fromDb.getPageLayout(), is(equalTo(saved.getPageLayout())));
-        assertThat(fromDb.getRegions().get(0), is(equalTo(saved.getRegions().get(0))));
-        assertThat(fromDb.getRegions().get(0).getRegionWidgets().get(0), is(equalTo(saved.getRegions().get(0).getRegionWidgets().get(0))));
-        assertThat(fromDb.getRegions().get(0).getRegionWidgets().get(0).getWidget(), is(equalTo(saved.getRegions().get(0).getRegionWidgets().get(0).getWidget())));
-        assertThat(fromDb.getRegions().get(0).getRegionWidgets().get(0).getPreferences().get(0), is(equalTo(saved.getRegions().get(0).getRegionWidgets().get(0).getPreferences().get(0))));
+        Widget widget = new WidgetImpl();
+        widget.setUrl("http://localhost:8080/demogadgets/test.xml");
+        widget.setAuthor("mfranklin");
+        widget.setAuthorEmail("developer@apache.org");
+        widget.setDescription("DESCRIPTION");
+        widget.setCategories(categoryList);
+        widget.setOwner(user2);
+        widget.setTitle("TITLE");
+        widget.setTitleUrl("http://title.com");
+        widget.setType("OpenSocial");
+        widget.setWidgetStatus(WidgetStatus.PUBLISHED);
+
+        WidgetComment widgetComment = new WidgetCommentImpl();
+        widgetComment.setText("BOO HOO");
+        widgetComment.setCreatedDate(new Date());
+        widgetComment.setLastModifiedDate(new Date());
+        widgetComment.setUser(user1);
+        widget.setComments(Arrays.asList(widgetComment));
+
+        WidgetRating rating = new WidgetRatingImpl();
+        rating.setScore(10);
+        rating.setUserId(user2.getId());
+        widget.setRatings(Arrays.asList(rating));
+
+        WidgetTag tag = new WidgetTagImpl();
+        tag.setCreatedDate(new Date());
+        tag.setUser(user2);
+        tag.setTag(new TagImpl("TEST"));
+
+        Widget saved = widgetRepository.save(widget);
+
+        Widget fromDb = widgetRepository.get(saved.getId());
+        assertThat(fromDb.getOwner().getId(), is(equalTo(widget.getOwner().getId())));
+        assertThat(fromDb.getRatings().get(0).getScore(), is(equalTo(widget.getRatings().get(0).getScore())));
+        assertThat(fromDb.getComments().get(0).getUser().getId(), is(equalTo(widget.getComments().get(0).getUser().getId())));
+        assertThat(fromDb.getComments().get(0).getText(), is(equalTo(widget.getComments().get(0).getText())));
+        assertThat(fromDb.getTags().get(0).getUser().getId(), is(equalTo(widget.getTags().get(0).getUser().getId())));
+        assertThat(fromDb.getTags().get(0).getTag().getKeyword(), is(equalTo(widget.getTags().get(0).getTag().getKeyword())));
+
     }
 }

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/portal.properties
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/portal.properties?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/portal.properties (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/portal.properties Tue Oct 16 00:25:10 2012
@@ -1,20 +1,20 @@
 #
 # 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.
+#  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.
 #
 
 #

Modified: rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/test-applicationContext.xml
URL: http://svn.apache.org/viewvc/rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/test-applicationContext.xml?rev=1398585&r1=1398584&r2=1398585&view=diff
==============================================================================
--- rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/test-applicationContext.xml (original)
+++ rave/branches/mongo/rave-components/rave-mongodb/src/test/resources/test-applicationContext.xml Tue Oct 16 00:25:10 2012
@@ -1,20 +1,20 @@
 <!--
-  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.
+  ~ 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"