Author: carlucci
Date: Thu May 31 21:12:28 2012
New Revision: 1344913

URL: http://svn.apache.org/viewvc?rev=1344913&view=rev
Log:
RAVE-645: refactor WidgetComment model to interface pattern

Added:
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaWidgetComment.java
      - copied, changed from r1344888, 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetCommentImpl.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverter.java
      - copied, changed from r1344888, 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaCategoryConverter.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverterTest.java
Removed:
    
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/WidgetCommentTest.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/WidgetTest.java
Modified:
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetCommentRepository.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluator.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetCommentService.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentService.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/main/resources/META-INF/persistence.xml
    
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java
    
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentServiceTest.java
    
rave/branches/model_interfaces/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java
    
rave/branches/model_interfaces/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java

Copied: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaWidgetComment.java
 (from r1344888, 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java)
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaWidgetComment.java?p2=rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaWidgetComment.java&p1=rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java&r1=1344888&r2=1344913&rev=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/JpaWidgetComment.java
 Thu May 31 21:12:28 2012
@@ -29,11 +29,11 @@ import java.util.Date;
 @Access(AccessType.FIELD)
 @Table(name = "widget_comment")
 @NamedQueries({
-        @NamedQuery(name = WidgetComment.DELETE_ALL_BY_USER,
-                query="DELETE FROM WidgetComment wc WHERE wc.user.entityId = 
:userId")
+        @NamedQuery(name = JpaWidgetComment.DELETE_ALL_BY_USER,
+                query="DELETE FROM JpaWidgetComment wc WHERE wc.user.entityId 
= :userId")
 })
 @XmlRootElement
-public class WidgetComment implements BasicEntity, Serializable {
+public class JpaWidgetComment implements BasicEntity, Serializable, 
WidgetComment {
     public static final String DELETE_ALL_BY_USER = 
"WidgetComment.deleteAllByUserId";
 
     @Id
@@ -47,9 +47,6 @@ public class WidgetComment implements Ba
     @Column(name = "widget_id")
     private Long widgetId;
 
-//    @Basic
-//    @Column(name = "user_id")
-//    private Long userId;
     @OneToOne(fetch=FetchType.EAGER)
     @JoinColumn(name="user_id")
     private User user;
@@ -68,11 +65,11 @@ public class WidgetComment implements Ba
     @Temporal(javax.persistence.TemporalType.TIMESTAMP)
     private Date createdDate;
 
-    public WidgetComment() {
+    public JpaWidgetComment() {
 
     }
 
-    public WidgetComment(Long entityId, Long widgetId, User user, String text, 
Date lastModified, Date created) {
+    public JpaWidgetComment(Long entityId, Long widgetId, User user, String 
text, Date lastModified, Date created) {
         this.entityId = entityId;
         this.widgetId = widgetId;
         this.user = user;
@@ -82,6 +79,16 @@ public class WidgetComment implements Ba
     }
 
     @Override
+    public Long getId() {
+        return getEntityId();
+    }
+
+    @Override
+    public void setId(Long entityId) {
+        setEntityId(entityId);
+    }
+
+    @Override
     public Long getEntityId() {
         return entityId;
     }
@@ -91,58 +98,62 @@ public class WidgetComment implements Ba
         this.entityId = entityId;
     }
 
+    @Override
     public Long getWidgetId() {
         return widgetId;
     }
 
+    @Override
     public void setWidgetId(Long widgetId) {
         this.widgetId = widgetId;
     }
 
+    @Override
     public User getUser() {
         return user;
     }
 
+    @Override
     public void setUser(User user) {
         this.user = user;
     }
 
+    @Override
     public String getText() {
         return text;
     }
 
+    @Override
     public void setText(String text) {
         this.text = text;
     }
 
+    @Override
     public Date getLastModifiedDate() {
         return lastModifiedDate;
     }
 
+    @Override
     public void setLastModifiedDate(Date lastModified) {
         this.lastModifiedDate = lastModified;
     }
 
+    @Override
     public Date getCreatedDate() {
         return createdDate;
     }
 
+    @Override
     public void setCreatedDate(Date created) {
         this.createdDate = created;
     }
 
     @Override
     public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        final WidgetComment other = (WidgetComment) obj;
-        if (this.entityId != other.entityId && (this.entityId == null || 
!this.entityId.equals(other.entityId))) {
-            return false;
-        }
+        if (this == obj) return true;
+        if (obj == null || getClass() != obj.getClass()) return false;
+        JpaWidgetComment comment = (JpaWidgetComment) obj;
+        if (entityId != null ? !entityId.equals(comment.entityId) : 
comment.entityId != null) return false;
         return true;
     }
 

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/Widget.java
 Thu May 31 21:12:28 2012
@@ -160,7 +160,7 @@ public class Widget implements BasicEnti
 
     @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, 
orphanRemoval = true)
     @JoinColumn(name = "widget_id", referencedColumnName = "entity_id")
-    private List<WidgetComment> comments;
+    private List<JpaWidgetComment> comments;
 
     @ManyToOne
     @JoinColumn(name = "owner_id")
@@ -311,11 +311,18 @@ public class Widget implements BasicEnti
     }
 
     public List<WidgetComment> getComments() {
-        return comments;
+        return ConvertingListProxyFactory.createProxyList(WidgetComment.class, 
comments);
     }
 
     public void setComments(List<WidgetComment> comments) {
-        this.comments = comments;
+        if(this.comments == null) {
+            this.comments = new ArrayList<JpaWidgetComment>();
+        }
+        //Ensure that all operations go through the conversion proxy
+        this.getComments().clear();
+        if (comments != null) {
+            this.getComments().addAll(comments);
+        }
     }
 
     public User getOwner() {

Added: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java?rev=1344913&view=auto
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java
 (added)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetComment.java
 Thu May 31 21:12:28 2012
@@ -0,0 +1,45 @@
+/*
+ * 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 java.util.Date;
+
+/**
+ * The a comment by a user for a widget
+ */
+public interface WidgetComment {
+    Long getId();
+    void setId(Long id);
+
+    User getUser();
+    void setUser(User user);
+
+    Long getWidgetId();
+    void setWidgetId(Long widgetId);
+
+    String getText();
+    void setText(String text);
+
+    Date getLastModifiedDate();
+    void setLastModifiedDate(Date lastModified);
+
+    Date getCreatedDate();
+    void setCreatedDate(Date created);
+}

Added: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetCommentImpl.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetCommentImpl.java?rev=1344913&view=auto
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetCommentImpl.java
 (added)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/WidgetCommentImpl.java
 Thu May 31 21:12:28 2012
@@ -0,0 +1,100 @@
+/*
+ * 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 java.util.Date;
+
+public class WidgetCommentImpl implements WidgetComment {
+    private Long id;
+    private Long widgetId;
+    private User user;
+    private String text;
+    private Date lastModifiedDate;
+    private Date createdDate;
+
+    @Override
+    public Long getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    @Override
+    public Long getWidgetId() {
+        return widgetId;
+    }
+
+    @Override
+    public void setWidgetId(Long widgetId) {
+        this.widgetId = widgetId;
+    }
+
+    @Override
+    public User getUser() {
+        return user;
+    }
+
+    @Override
+    public void setUser(User user) {
+        this.user = user;
+    }
+
+    @Override
+    public String getText() {
+        return text;
+    }
+
+    @Override
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    @Override
+    public Date getLastModifiedDate() {
+        return lastModifiedDate;
+    }
+
+    @Override
+    public void setLastModifiedDate(Date lastModifiedDate) {
+        this.lastModifiedDate = lastModifiedDate;
+    }
+
+    @Override
+    public Date getCreatedDate() {
+        return createdDate;
+    }
+
+    @Override
+    public void setCreatedDate(Date createdDate) {
+        this.createdDate = createdDate;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) return true;
+        if (obj == null || getClass() != obj.getClass()) return false;
+        WidgetCommentImpl comment = (WidgetCommentImpl) obj;
+        if (id != null ? !id.equals(comment.id) : comment.id != null) return 
false;
+        return true;
+    }
+}

Copied: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverter.java
 (from r1344888, 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaCategoryConverter.java)
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverter.java?p2=rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverter.java&p1=rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaCategoryConverter.java&r1=1344888&r2=1344913&rev=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaCategoryConverter.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverter.java
 Thu May 31 21:12:28 2012
@@ -21,47 +21,48 @@ package org.apache.rave.portal.model.con
 import org.apache.rave.model.ModelConverter;
 import org.apache.rave.portal.model.Category;
 import org.apache.rave.portal.model.JpaCategory;
+import org.apache.rave.portal.model.JpaWidgetComment;
+import org.apache.rave.portal.model.WidgetComment;
 import org.springframework.stereotype.Component;
 
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
 
 /**
- * Converts a Category to a JpaCategory
+ * Converts a WidgetComment to a JpaWidgetComment
  */
 @Component
-public class JpaCategoryConverter implements ModelConverter<Category, 
JpaCategory> {
+public class JpaWidgetCommentConverter implements 
ModelConverter<WidgetComment, JpaWidgetComment> {
 
     @PersistenceContext
     private EntityManager manager;
 
     @Override
-    public Class<Category> getSourceType() {
-        return Category.class;
+    public Class<WidgetComment> getSourceType() {
+        return WidgetComment.class;
     }
 
     @Override
-    public JpaCategory convert(Category source) {
-        return source instanceof JpaCategory ? (JpaCategory)source : 
createEntity(source);
+    public JpaWidgetComment convert(WidgetComment source) {
+        return source instanceof JpaWidgetComment ? (JpaWidgetComment)source : 
createEntity(source);
     }
 
-    private JpaCategory createEntity(Category source) {
-        JpaCategory converted = manager.find(JpaCategory.class, 
source.getId());
+    private JpaWidgetComment createEntity(WidgetComment source) {
+        JpaWidgetComment converted = manager.find(JpaWidgetComment.class, 
source.getId());
         if(converted == null) {
-            converted = new JpaCategory();
+            converted = new JpaWidgetComment();
         }
         updateProperties(source, converted);
         return converted;
     }
 
-    private void updateProperties(Category source, JpaCategory converted) {
+    private void updateProperties(WidgetComment source, JpaWidgetComment 
converted) {
         converted.setEntityId(source.getId());
         converted.setId(source.getId());
         converted.setCreatedDate(source.getCreatedDate());
-        converted.setCreatedUser(source.getCreatedUser());
         converted.setLastModifiedDate(source.getLastModifiedDate());
-        converted.setLastModifiedUser(source.getLastModifiedUser());
         converted.setText(source.getText());
-        converted.setWidgets(source.getWidgets());
+        converted.setUser(source.getUser());
+        converted.setWidgetId(source.getWidgetId());
     }
 }

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetCommentRepository.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetCommentRepository.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetCommentRepository.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/JpaWidgetCommentRepository.java
 Thu May 31 21:12:28 2012
@@ -15,23 +15,53 @@
  */
 package org.apache.rave.portal.repository.impl;
 
-import org.apache.rave.persistence.jpa.AbstractJpaRepository;
+import org.apache.rave.portal.model.JpaWidgetComment;
 import org.apache.rave.portal.model.WidgetComment;
+import org.apache.rave.portal.model.conversion.JpaWidgetCommentConverter;
 import org.apache.rave.portal.repository.WidgetCommentRepository;
+import org.apache.rave.util.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
 
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
 import javax.persistence.TypedQuery;
+import java.util.List;
+
+import static org.apache.rave.persistence.jpa.util.JpaUtil.saveOrUpdate;
 
 @Repository
-public class JpaWidgetCommentRepository extends 
AbstractJpaRepository<WidgetComment> implements WidgetCommentRepository {
-    
-    public JpaWidgetCommentRepository() {
-        super(WidgetComment.class);
+public class JpaWidgetCommentRepository implements WidgetCommentRepository {
+    @PersistenceContext
+    private EntityManager manager;
+
+    @Autowired
+    private JpaWidgetCommentConverter widgetCommentConverter;
+
+    @Override
+    public Class<? extends WidgetComment> getType() {
+        return JpaWidgetComment.class;
+    }
+
+    @Override
+    public WidgetComment get(long id) {
+        return manager.find(JpaWidgetComment.class, id);
+    }
+
+    @Override
+    public WidgetComment save(WidgetComment item) {
+        JpaWidgetComment category = widgetCommentConverter.convert(item);
+        return saveOrUpdate(category.getEntityId(), manager, category);
+    }
+
+    @Override
+    public void delete(WidgetComment item) {
+        manager.remove(item instanceof JpaWidgetComment ? item : 
get(item.getId()));
     }
 
     @Override
     public int deleteAll(Long userId) {
-        TypedQuery<WidgetComment> query = 
manager.createNamedQuery(WidgetComment.DELETE_ALL_BY_USER, WidgetComment.class);
+        TypedQuery<JpaWidgetComment> query = 
manager.createNamedQuery(JpaWidgetComment.DELETE_ALL_BY_USER, 
JpaWidgetComment.class);
         query.setParameter("userId", userId);
         return query.executeUpdate();
     }

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluator.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluator.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluator.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluator.java
 Thu May 31 21:12:28 2012
@@ -15,19 +15,19 @@
  */
 package org.apache.rave.portal.security.impl;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
 import org.apache.rave.portal.model.User;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.rave.portal.model.WidgetComment;
 import org.apache.rave.portal.repository.WidgetCommentRepository;
-import org.apache.rave.portal.security.ModelPermissionEvaluator.Permission;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.Authentication;
 import org.springframework.stereotype.Component;
 
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  */
 @Component
@@ -35,12 +35,12 @@ public class DefaultWidgetCommentPermiss
 
     private Logger log = LoggerFactory.getLogger(getClass());
     private WidgetCommentRepository widgetCommentRepository;
-    
+
     @Autowired
     public DefaultWidgetCommentPermissionEvaluator(WidgetCommentRepository 
widgetCommentRepository) {
         this.widgetCommentRepository = widgetCommentRepository;
     }
-    
+
     @Override
     public Class<WidgetComment> getType() {
         return WidgetComment.class;
@@ -50,27 +50,27 @@ public class DefaultWidgetCommentPermiss
      * Checks to see if the Authentication object has the supplied Permission
      * on the supplied Page object.  This method invokes the private 
hasPermission
      * function with the trustedDomainObject parameter set to false since we 
don't
-     * know if the model being passed in was modified in any way from the 
+     * know if the model being passed in was modified in any way from the
      * actual entity in the database.
-     * 
+     *
      * @param authentication the current Authentication object
      * @param widgetComment the WidgetComment model object
      * @param permission the Permission to check
      * @return true if the Authentication has the proper permission, false 
otherwise
      */
     @Override
-    public boolean hasPermission(Authentication authentication, WidgetComment 
widgetComment, Permission permission) {      
+    public boolean hasPermission(Authentication authentication, WidgetComment 
widgetComment, Permission permission) {
         return hasPermission(authentication, widgetComment, permission, false);
-    }    
+    }
 
     /**
-     * Checks to see if the Authentication object has the supplied Permission 
+     * Checks to see if the Authentication object has the supplied Permission
      * for the Entity represented by the targetId(entityId) and 
targetType(model class name).
-     * This method invokes the private hasPermission function with the 
+     * This method invokes the private hasPermission function with the
      * trustedDomainObject parameter set to true since we must pull the entity
      * from the database and are guaranteed a trusted domain object,
      * before performing our permission checks.
-     * 
+     *
      * @param authentication the current Authentication object
      * @param targetId the entityId of the model to check, or a 
RaveSecurityContext object
      * @param targetType the class of the model to check
@@ -81,30 +81,30 @@ public class DefaultWidgetCommentPermiss
     public boolean hasPermission(Authentication authentication, Serializable 
targetId, String targetType, Permission permission) {
         boolean hasPermission = false;
         if (targetId instanceof RaveSecurityContext) {
-            hasPermission = verifyRaveSecurityContext(authentication, 
(RaveSecurityContext)targetId, permission);           
+            hasPermission = verifyRaveSecurityContext(authentication, 
(RaveSecurityContext)targetId, permission);
         } else {
             hasPermission = hasPermission(authentication, 
widgetCommentRepository.get((Long)targetId), permission, true);
         }
         return hasPermission;
-    }  
-    
-    private boolean hasPermission(Authentication authentication, WidgetComment 
widgetComment, Permission permission, boolean trustedDomainObject) {       
-        // this is our container of trusted page objects that can be re-used 
+    }
+
+    private boolean hasPermission(Authentication authentication, WidgetComment 
widgetComment, Permission permission, boolean trustedDomainObject) {
+        // this is our container of trusted page objects that can be re-used
         // in this method so that the same trusted page object doesn't have to
         // be looked up in the repository multiple times
-        List<WidgetComment> trustedWidgetCommentContainer = new 
ArrayList<WidgetComment>();                           
-        
+        List<WidgetComment> trustedWidgetCommentContainer = new 
ArrayList<WidgetComment>();
+
         // first execute the AbstractModelPermissionEvaluator's hasPermission 
function
-        // to see if it allows permission via it's "higher authority" logic    
            
+        // to see if it allows permission via it's "higher authority" logic
         if (super.hasPermission(authentication, widgetComment, permission)) {
             return true;
         }
-        
+
         // perform the security logic depending on the Permission type
-        boolean hasPermission = false;                       
-        switch (permission) { 
+        boolean hasPermission = false;
+        switch (permission) {
             case ADMINISTER:
-                // if you are here, you are not an administrator, so you can't 
administer pages              
+                // if you are here, you are not an administrator, so you can't 
administer pages
                 break;
             case READ:
                 hasPermission =  true;
@@ -114,17 +114,17 @@ public class DefaultWidgetCommentPermiss
                 break;
             case DELETE:
             case UPDATE:
-                // anyone can create, delete, read, or update a page that they 
own                  
-                hasPermission = isWidgetCommentOwner(authentication, 
widgetComment, trustedWidgetCommentContainer, trustedDomainObject);     
-                break;   
+                // anyone can create, delete, read, or update a page that they 
own
+                hasPermission = isWidgetCommentOwner(authentication, 
widgetComment, trustedWidgetCommentContainer, trustedDomainObject);
+                break;
             default:
                 log.warn("unknown permission: " + permission);
                 break;
         }
-        
+
         return hasPermission;
     }
-    
+
     private boolean verifyRaveSecurityContext(Authentication authentication, 
RaveSecurityContext raveSecurityContext, Permission permission) {
         Class<?> clazz = null;
         try {
@@ -135,60 +135,57 @@ public class DefaultWidgetCommentPermiss
 
         // perform the permissions check based on the class supplied to the 
RaveSecurityContext object
         if (WidgetComment.class == clazz) {
-            
-        // perform the security logic depending on the Permission type
-        boolean hasPermission = false;                       
-        switch (permission) { 
-            case ADMINISTER:
-                // if you are here, you are not an administrator, so you can't 
administer pages              
-                break;
-            case READ:
-                hasPermission = true;
-                break;
-            case CREATE:
-            case DELETE:
-            case UPDATE:
-                // anyone can create, delete, read, or update a page that they 
own                  
-                hasPermission = isWidgetCommentOwnerById(authentication, 
(Long)raveSecurityContext.getId());
-                break;   
-            default:
-                log.warn("unknown permission: " + permission);
-                break;
+            // perform the security logic depending on the Permission type
+            boolean hasPermission = false;
+            switch (permission) {
+                case ADMINISTER:
+                    // if you are here, you are not an administrator, so you 
can't administer pages
+                    break;
+                case READ:
+                    hasPermission = true;
+                    break;
+                case CREATE:
+                case DELETE:
+                case UPDATE:
+                    // anyone can create, delete, read, or update a page that 
they own
+                    hasPermission = isWidgetCommentOwnerById(authentication, 
(Long)raveSecurityContext.getId());
+                    break;
+                default:
+                    log.warn("unknown permission: " + permission);
+                    break;
             }
-
             return hasPermission;
         } else {
             throw new IllegalArgumentException("unknown RaveSecurityContext 
type: " + raveSecurityContext.getType());
         }
-    } 
-    
-    
-    // checks to see if the Authentication object principal is the owner of 
the supplied widgetComment object 
+    }
+
+    // checks to see if the Authentication object principal is the owner of 
the supplied widgetComment object
     // if trustedDomainObject is false, pull the entity from the database 
first to ensure
     // the model object is trusted and hasn't been modified
-    private boolean isWidgetCommentOwner(Authentication authentication, 
WidgetComment widgetComment, List<WidgetComment> trustedPageContainer, boolean 
trustedDomainObject) {        
+    private boolean isWidgetCommentOwner(Authentication authentication, 
WidgetComment widgetComment, List<WidgetComment> trustedPageContainer, boolean 
trustedDomainObject) {
         WidgetComment trustedWidgetComment = null;
         if (trustedDomainObject) {
             trustedWidgetComment = widgetComment;
         } else {
-            trustedWidgetComment = 
getTrustedWidgetComment(widgetComment.getEntityId(), trustedPageContainer);
-        }                  
-        
+            trustedWidgetComment = 
getTrustedWidgetComment(widgetComment.getId(), trustedPageContainer);
+        }
+
         return isWidgetCommentOwnerByUsername(authentication, 
trustedWidgetComment.getUser().getUsername());
-    }            
-    
+    }
+
     // returns a trusted Page object, either from the PageRepository, or the
     // cached container list
-    private WidgetComment getTrustedWidgetComment(long widgetCommentId, 
List<WidgetComment> trustedWidgetCommentContainer) {       
+    private WidgetComment getTrustedWidgetComment(long widgetCommentId, 
List<WidgetComment> trustedWidgetCommentContainer) {
         WidgetComment p = null;
-        if (trustedWidgetCommentContainer.isEmpty()) {           
+        if (trustedWidgetCommentContainer.isEmpty()) {
             p = widgetCommentRepository.get(widgetCommentId);
             trustedWidgetCommentContainer.add(p);
         } else {
             p = trustedWidgetCommentContainer.get(0);
         }
-        return p;       
-    }     
+        return p;
+    }
 
     private boolean isWidgetCommentOwnerByUsername(Authentication 
authentication, String username) {
         return 
((User)authentication.getPrincipal()).getUsername().equals(username);

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetCommentService.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetCommentService.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetCommentService.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/WidgetCommentService.java
 Thu May 31 21:12:28 2012
@@ -20,14 +20,14 @@ import org.springframework.security.acce
 import org.springframework.security.access.prepost.PreAuthorize;
 
 public interface WidgetCommentService {
-    
+
     @PostAuthorize("hasPermission(returnObject, 'read')")
     WidgetComment getWidgetComment(Long id);
-    
+
     @PreAuthorize("hasPermission(#widgetComment, 'create_or_update')")
     void saveWidgetComment(WidgetComment widgetComment);
-    
-    @PreAuthorize("hasPermission(#id, 
'org.apache.rave.portal.model.WidgetComment', 'delete')") 
+
+    @PreAuthorize("hasPermission(#id, 
'org.apache.rave.portal.model.WidgetComment', 'delete')")
     void removeWidgetComment(Long id);
 
     /**

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentService.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentService.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentService.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentService.java
 Thu May 31 21:12:28 2012
@@ -25,14 +25,14 @@ import org.springframework.transaction.a
 
 @Service
 public class DefaultWidgetCommentService implements WidgetCommentService {
-    
+
     private final WidgetCommentRepository widgetCommentRepository;
-    
+
     @Autowired
     public DefaultWidgetCommentService(WidgetCommentRepository 
widgetCommentRepository) {
         this.widgetCommentRepository = widgetCommentRepository;
     }
-    
+
     @Override
     public WidgetComment getWidgetComment(Long id) {
         return widgetCommentRepository.get(id);

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/main/resources/META-INF/persistence.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/main/resources/META-INF/persistence.xml?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/main/resources/META-INF/persistence.xml
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/main/resources/META-INF/persistence.xml
 Thu May 31 21:12:28 2012
@@ -29,7 +29,7 @@
             <class>org.apache.rave.portal.model.RegionWidget</class>
             <class>org.apache.rave.portal.model.RegionWidgetPreference</class>
             <class>org.apache.rave.portal.model.Widget</class>
-            <class>org.apache.rave.portal.model.WidgetComment</class>
+            <class>org.apache.rave.portal.model.JpaWidgetComment</class>
             <class>org.apache.rave.portal.model.WidgetRating</class>
             <class>org.apache.rave.portal.model.PageLayout</class>
             <class>org.apache.rave.portal.model.Authority</class>

Added: 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverterTest.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverterTest.java?rev=1344913&view=auto
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverterTest.java
 (added)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/model/conversion/JpaWidgetCommentConverterTest.java
 Thu May 31 21:12:28 2012
@@ -0,0 +1,70 @@
+/*
+ * 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.portal.model.JpaWidgetComment;
+import org.apache.rave.portal.model.User;
+import org.apache.rave.portal.model.WidgetComment;
+import org.apache.rave.portal.model.WidgetCommentImpl;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.util.Date;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:test-dataContext.xml", 
"classpath:test-applicationContext.xml"})
+public class JpaWidgetCommentConverterTest {
+
+    @Autowired
+    private JpaWidgetCommentConverter widgetCommentConverter;
+
+    @Test
+    public void noConversion() {
+        WidgetComment comment = new JpaWidgetComment();
+        assertThat(widgetCommentConverter.convert(comment), 
is(sameInstance(comment)));
+    }
+
+    @Test
+    public void newComment() {
+        WidgetComment comment = new WidgetCommentImpl();
+        comment.setCreatedDate(new Date());
+        comment.setId(9L);
+        comment.setLastModifiedDate(new Date());
+        comment.setText("hello");
+        comment.setUser(new User(1L));
+        comment.setWidgetId(9L);
+
+        JpaWidgetComment converted = widgetCommentConverter.convert(comment);
+        assertThat(converted, is(not(sameInstance(comment))));
+        assertThat(converted, is(instanceOf(JpaWidgetComment.class)));
+        assertThat(converted.getCreatedDate(), 
is(equalTo(comment.getCreatedDate())));
+        assertThat(converted.getEntityId(), is(equalTo(comment.getId())));
+        assertThat(converted.getId(), is(equalTo(comment.getId())));
+        assertThat(converted.getLastModifiedDate(), 
is(equalTo(comment.getLastModifiedDate())));
+        assertThat(converted.getText(), is(equalTo(comment.getText())));
+        assertThat(converted.getUser(), is(equalTo(comment.getUser())));
+        assertThat(converted.getWidgetId(), 
is(equalTo(comment.getWidgetId())));
+    }
+}
\ No newline at end of file

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/security/impl/DefaultWidgetCommentPermissionEvaluatorTest.java
 Thu May 31 21:12:28 2012
@@ -17,6 +17,7 @@ package org.apache.rave.portal.security.
 
 import org.apache.rave.portal.model.User;
 import org.apache.rave.portal.model.WidgetComment;
+import org.apache.rave.portal.model.WidgetCommentImpl;
 import org.apache.rave.portal.repository.WidgetCommentRepository;
 import org.apache.rave.portal.security.ModelPermissionEvaluator.Permission;
 import org.apache.rave.portal.security.util.AuthenticationUtils;
@@ -65,8 +66,8 @@ public class DefaultWidgetCommentPermiss
         user2 = new User();
         user2.setUsername(VALID_USERNAME2);
         user2.setEntityId(INVALID_USER_ID);
-        widgetComment = new WidgetComment();
-        widgetComment.setEntityId(VALID_COMMENT_ID);
+        widgetComment = new WidgetCommentImpl();
+        widgetComment.setId(VALID_COMMENT_ID);
         widgetComment.setUser(user);
         grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
         grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
@@ -223,7 +224,7 @@ public class DefaultWidgetCommentPermiss
         expect(mockAuthentication.getPrincipal()).andReturn(user).anyTimes();
         replay(mockAuthentication);
 
-        WidgetComment localWidgetComment = new WidgetComment();
+        WidgetComment localWidgetComment = new WidgetCommentImpl();
         User localUser = new User();
         localUser.setEntityId(VALID_USER_ID);
         localWidgetComment.setUser(localUser);

Modified: 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentServiceTest.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentServiceTest.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentServiceTest.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-core/src/test/java/org/apache/rave/portal/service/impl/DefaultWidgetCommentServiceTest.java
 Thu May 31 21:12:28 2012
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertThat;
 
 import org.apache.rave.portal.model.WidgetComment;
+import org.apache.rave.portal.model.WidgetCommentImpl;
 import org.apache.rave.portal.repository.WidgetCommentRepository;
 import org.apache.rave.portal.service.WidgetCommentService;
 import org.junit.Before;
@@ -43,8 +44,8 @@ public class DefaultWidgetCommentService
 
     @Test
     public void getWidgetComment() {
-        WidgetComment comment = new WidgetComment();
-        comment.setEntityId(1L);
+        WidgetComment comment = new WidgetCommentImpl();
+        comment.setId(1L);
         expect(widgetCommentRepository.get(1L)).andReturn(comment);
         replay(widgetCommentRepository);
 
@@ -54,8 +55,8 @@ public class DefaultWidgetCommentService
 
     @Test
     public void saveWidgetComment() {
-        WidgetComment comment = new WidgetComment();
-        comment.setEntityId(1L);
+        WidgetComment comment = new WidgetCommentImpl();
+        comment.setId(1L);
         expect(widgetCommentRepository.save(comment)).andReturn(comment);
         replay(widgetCommentRepository);
 
@@ -65,8 +66,8 @@ public class DefaultWidgetCommentService
 
     @Test
     public void deleteWidgetComment() {
-        WidgetComment comment = new WidgetComment();
-        comment.setEntityId(1L);
+        WidgetComment comment = new WidgetCommentImpl();
+        comment.setId(1L);
         expect(widgetCommentRepository.get(1L)).andReturn(comment);
         widgetCommentRepository.delete(comment);
         replay(widgetCommentRepository);

Modified: 
rave/branches/model_interfaces/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/api/rest/WidgetApi.java
 Thu May 31 21:12:28 2012
@@ -66,7 +66,7 @@ public class WidgetApi extends AbstractR
     public void createWidgetComment(@PathVariable long widgetId,
                                     @RequestParam String text,
                                     HttpServletResponse response) {
-        WidgetComment widgetComment = new WidgetComment();
+        WidgetComment widgetComment = new WidgetCommentImpl();
         widgetComment.setWidgetId(widgetId);
         widgetComment.setUser(userService.getAuthenticatedUser());
         widgetComment.setText(text);
@@ -92,7 +92,7 @@ public class WidgetApi extends AbstractR
 
         WidgetComment widgetComment = 
widgetCommentService.getWidgetComment(widgetCommentId);
         if (widgetComment == null) {
-            widgetComment = new WidgetComment();
+            widgetComment = new WidgetCommentImpl();
             widgetComment.setWidgetId(widgetId);
             widgetComment.setUser(userService.getAuthenticatedUser());
             widgetComment.setCreatedDate(new Date());

Modified: 
rave/branches/model_interfaces/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java
URL: 
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java?rev=1344913&r1=1344912&r2=1344913&view=diff
==============================================================================
--- 
rave/branches/model_interfaces/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java
 (original)
+++ 
rave/branches/model_interfaces/rave-components/rave-web/src/test/java/org/apache/rave/portal/web/api/rest/WidgetApiTest.java
 Thu May 31 21:12:28 2012
@@ -31,8 +31,10 @@ import java.util.ArrayList;
 import java.util.List;
 
 import static org.easymock.EasyMock.*;
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.sameInstance;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 
 public class WidgetApiTest {
     private WidgetApi widgetApi;
@@ -93,13 +95,13 @@ public class WidgetApiTest {
 
     @Test
     public void getWidgetComment() {
-        WidgetComment widgetComment = new WidgetComment();
-        widgetComment.setEntityId(2L);
+        WidgetComment widgetComment = new WidgetCommentImpl();
+        widgetComment.setId(2L);
         
expect(widgetCommentService.getWidgetComment(2L)).andReturn(widgetComment);
         replay(widgetCommentService);
 
         WidgetComment foundComment = widgetApi.getWidgetComment(1L, 2L);
-        assertEquals(widgetComment.getEntityId(), foundComment.getEntityId());
+        assertEquals(widgetComment.getId(), foundComment.getId());
 
         verify(widgetCommentService);
     }
@@ -107,7 +109,7 @@ public class WidgetApiTest {
     @Test
     public void updateNonExistentWidgetComment() {
         String message = "message";
-        WidgetComment widgetComment = new WidgetComment();
+        WidgetComment widgetComment = new WidgetCommentImpl();
         widgetComment.setWidgetId(2L);
         widgetComment.setText(message);
         widgetComment.setUser(new User(VALID_USER_ID, "John.Doe"));
@@ -129,8 +131,8 @@ public class WidgetApiTest {
     @Test
     public void updateWidgetComment() {
         String message = "updated comment";
-        WidgetComment widgetComment = new WidgetComment();
-        widgetComment.setEntityId(2L);
+        WidgetComment widgetComment = new WidgetCommentImpl();
+        widgetComment.setId(2L);
 
         
expect(widgetCommentService.getWidgetComment(2L)).andReturn(widgetComment);
         widgetCommentService.saveWidgetComment(widgetComment);
@@ -203,12 +205,12 @@ public class WidgetApiTest {
 
         verify(userService);
     }
-    
+
     @Test
     public void getTags() {
         
expect(tagService.getAvailableTagsByWidgetId(VALID_WIDGET_ID)).andReturn(tagList);
         replay(tagService);
-        
+
         assertThat(widgetApi.getTags(VALID_WIDGET_ID), is(tagList));
         verify(tagService);
     }
@@ -228,7 +230,7 @@ public class WidgetApiTest {
         Tag tag = new Tag(1L, TAG_TEXT);
         WidgetTag widgetTag = new WidgetTag();
         widgetTag.setTag(tag);
-                        
+
         
expect(widgetTagService.getWidgetTagByWidgetIdAndKeyword(VALID_WIDGET_ID, 
TAG_TEXT)).andReturn(null);
         expect(userService.getAuthenticatedUser()).andReturn(user);
         expect(tagService.getTagByKeyword(TAG_TEXT)).andReturn(null);


Reply via email to