Discussion forum summary dashlet

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@41057 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamie Allison
2012-08-30 14:12:27 +00:00
parent f50f6cdfb6
commit bc839bdcdc
3 changed files with 45 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ package org.alfresco.repo.discussion;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
@@ -383,6 +384,7 @@ public class DiscussionServiceImplTest
@Test public void createUpdateDeleteEntries() throws Exception
{
TopicInfo siteTopic;
TopicInfo siteTopic2;
TopicInfo nodeTopic;
PostInfo post;
PostInfo reply;
@@ -397,6 +399,8 @@ public class DiscussionServiceImplTest
testNodesToTidy.add(siteTopic.getNodeRef());
testNodesToTidy.add(nodeTopic.getNodeRef());
// Create a second object with the same topic as siteTopic to test equals.
siteTopic2 = DISCUSSION_SERVICE.getForNodeRef(siteTopic.getNodeRef()).getFirst();
// Check them
assertEquals("Site Title", siteTopic.getTitle());
@@ -407,6 +411,10 @@ public class DiscussionServiceImplTest
assertEquals(TEST_USER, nodeTopic.getCreator());
assertEquals(0, nodeTopic.getTags().size());
// Check that the overridden equals is correct.
assertEquals(siteTopic, siteTopic2);
// Ensure they are not pointing to the same object.
assertNotSame(siteTopic, siteTopic2);
// Change them
siteTopic.setTitle("Site Changed");

View File

@@ -41,6 +41,7 @@ public class TopicInfoImpl implements TopicInfo
private String modifier;
private Date createdAt;
private Date modifiedAt;
private String shortSiteName;
private List<String> tags = new ArrayList<String>();
/**
@@ -144,4 +145,35 @@ public class TopicInfoImpl implements TopicInfo
{
this.tags = tags;
}
@Override
public int hashCode()
{
return nodeRef.hashCode();
}
@Override
public boolean equals(Object obj)
{
if (obj instanceof TopicInfoImpl)
{
TopicInfoImpl tii = (TopicInfoImpl) obj;
if(nodeRef.equals(tii.nodeRef))
{
return true;
}
}
return false;
}
@Override
public String getShortSiteName()
{
return shortSiteName;
}
public void setShortSiteName(String shortSiteName)
{
this.shortSiteName = shortSiteName;
}
}

View File

@@ -87,4 +87,9 @@ public interface TopicInfo extends Serializable, PermissionCheckValue
* @return the Tags associated with the topic
*/
List<String> getTags();
/**
* @return the site this topic is associated with
*/
String getShortSiteName();
}