forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-47038 Search: Add the content creator's display name to the index (…
- Loading branch information
1 parent
683a351
commit 9b5f03b
Showing
14 changed files
with
260 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
import org.sakaiproject.tool.api.Session; | ||
import org.sakaiproject.tool.api.Tool; | ||
import org.sakaiproject.tool.api.ToolSession; | ||
import org.sakaiproject.user.api.User; | ||
|
||
/** | ||
* @author Adrian Fish ([email protected]) | ||
|
@@ -59,6 +60,8 @@ public interface SakaiProxy { | |
|
||
public String getDisplayNameForTheUser(String userId); | ||
|
||
public User getUser(String userId); | ||
|
||
public boolean isCurrentUserAdmin(); | ||
|
||
public String getPortalUrl(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
import org.sakaiproject.commons.api.PersistenceManager; | ||
import org.sakaiproject.commons.api.QueryBean; | ||
import org.sakaiproject.commons.api.SakaiProxy; | ||
import org.sakaiproject.user.api.User; | ||
|
||
/** | ||
* @author Adrian Fish ([email protected]) | ||
|
@@ -163,7 +164,11 @@ public Comment readSqlResultRecord(ResultSet result) { | |
if (comments.size() > 0) { | ||
Comment comment = comments.get(0); | ||
comment.setPost(comment.getPost()); | ||
comment.setCreatorDisplayName(sakaiProxy.getDisplayNameForTheUser(comment.getCreatorId())); | ||
User user = sakaiProxy.getUser(comment.getCreatorId()); | ||
if (user != null ) { | ||
comment.setCreatorDisplayName(user.getDisplayName()); | ||
comment.setCreatorUserName(user.getEid()); | ||
} | ||
return Optional.of(comment); | ||
} else { | ||
log.warn("No comment for id {}", commentId); | ||
|
@@ -359,8 +364,13 @@ private Post loadPostFromResult(ResultSet result, boolean loadComments) { | |
|
||
try { | ||
Post post = new Post(result); | ||
post.setCreatorDisplayName( | ||
sakaiProxy.getDisplayNameForTheUser(post.getCreatorId())); | ||
|
||
User user = sakaiProxy.getUser(post.getCreatorId()); | ||
if (user != null ) { | ||
post.setCreatorDisplayName(user.getDisplayName()); | ||
post.setCreatorUserName(user.getEid()); | ||
} | ||
|
||
if (loadComments) { | ||
List<Comment> comments = sqlService.dbRead(COMMENTS_SELECT | ||
, new Object[] {post.getId()} | ||
|
@@ -369,8 +379,11 @@ public Comment readSqlResultRecord(ResultSet commentResult) { | |
|
||
try { | ||
Comment comment = new Comment(commentResult); | ||
comment.setCreatorDisplayName( | ||
sakaiProxy.getDisplayNameForTheUser(comment.getCreatorId())); | ||
User user = sakaiProxy.getUser(comment.getCreatorId()); | ||
if (user != null ) { | ||
comment.setCreatorDisplayName(user.getDisplayName()); | ||
comment.setCreatorUserName(user.getEid()); | ||
} | ||
String toolId = sakaiProxy.getCommonsToolId(post.getSiteId()); | ||
String url = sakaiProxy.getPortalUrl() + "/directtool/" | ||
+ toolId + "?state=post&postId=" + post.getId(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.