-
-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-50536 profile Remove little used features
- Loading branch information
1 parent
fb2764f
commit 74d692e
Showing
256 changed files
with
461 additions
and
33,529 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
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 |
---|---|---|
|
@@ -30,26 +30,20 @@ | |
import org.sakaiproject.commons.api.datamodel.Post; | ||
import org.sakaiproject.commons.api.datamodel.PostLike; | ||
import org.sakaiproject.entity.api.Entity; | ||
import org.sakaiproject.entity.api.HttpAccess; | ||
import org.sakaiproject.entity.api.Reference; | ||
import org.sakaiproject.entity.api.ResourceProperties; | ||
import org.sakaiproject.event.api.Event; | ||
import org.sakaiproject.memory.api.Cache; | ||
import org.sakaiproject.profile2.logic.ProfileConnectionsLogic; | ||
import org.sakaiproject.profile2.model.BasicConnection; | ||
import org.sakaiproject.profile2.util.ProfileConstants; | ||
import org.sakaiproject.util.api.FormattedText; | ||
|
||
|
||
/** | ||
* @author Adrian Fish ([email protected]) | ||
*/ | ||
@Setter @Slf4j | ||
public class CommonsManagerImpl implements CommonsManager, Observer { | ||
public class CommonsManagerImpl implements CommonsManager { | ||
|
||
private CommonsSecurityManager commonsSecurityManager; | ||
private PersistenceManager persistenceManager; | ||
private ProfileConnectionsLogic profileConnectionsLogic; | ||
private SakaiProxy sakaiProxy; | ||
private FormattedText formattedText; | ||
|
||
|
@@ -73,7 +67,6 @@ public void init() { | |
log.info("Registered Commons functions."); | ||
|
||
sakaiProxy.registerEntityProducer(this); | ||
sakaiProxy.addObserver(this); | ||
} | ||
|
||
private List<Post> getPosts(String siteId) throws Exception { | ||
|
@@ -99,7 +92,6 @@ public List<Post> getPosts(QueryBean query) throws Exception { | |
if (query.isUserSite()) { | ||
log.debug("Getting posts for a user site ..."); | ||
query.getFromIds().add(query.getCallerId()); | ||
query.getFromIds().addAll(getConnectionUserIds(sakaiProxy.getCurrentUserId())); | ||
} | ||
List<Post> unfilteredPosts = persistenceManager.getAllPost(query, true); | ||
cache.put(key, unfilteredPosts); | ||
|
@@ -119,11 +111,7 @@ public Post savePost(Post post) { | |
if (newOrUpdatedPost != null) { | ||
String commonsId = post.getCommonsId(); | ||
List<String> contextIds = new ArrayList(); | ||
if (persistenceManager.getCommons(commonsId).isSocial()) { | ||
contextIds = getConnectionUserIds(sakaiProxy.getCurrentUserId()); | ||
} else { | ||
contextIds.add(post.getCommonsId()); | ||
} | ||
contextIds.add(post.getCommonsId()); | ||
removeContextIdsFromCache(contextIds); | ||
return newOrUpdatedPost; | ||
} else { | ||
|
@@ -147,13 +135,7 @@ public boolean deletePost(String postId) { | |
if (persistenceManager.deletePost(post)) { | ||
List<String> contextIds = new ArrayList(); | ||
String commonsId = post.getCommonsId(); | ||
if (persistenceManager.getCommons(commonsId).isSocial()) { | ||
String userId = post.getCreatorId(); | ||
// This is a social post. We need to invalidate the social caches of all this user's connections | ||
contextIds = getConnectionUserIds(userId); | ||
} else { | ||
contextIds.add(post.getCommonsId()); | ||
} | ||
contextIds.add(post.getCommonsId()); | ||
// Invalidate all caches for this site | ||
removeContextIdsFromCache(contextIds); | ||
return true; | ||
|
@@ -201,11 +183,7 @@ public Comment saveComment(String commonsId, Comment comment) { | |
Comment savedComment = persistenceManager.saveComment(comment); | ||
if (savedComment != null) { | ||
List<String> contextIds = new ArrayList(); | ||
if (persistenceManager.getCommons(commonsId).isSocial()) { | ||
contextIds = getConnectionUserIds(post.getCreatorId()); | ||
} else { | ||
contextIds.add(commonsId); | ||
} | ||
contextIds.add(commonsId); | ||
removeContextIdsFromCache(contextIds); | ||
return savedComment; | ||
} | ||
|
@@ -223,12 +201,7 @@ public boolean deleteComment(String siteId, String commonsId, String embedder, S | |
if (commonsSecurityManager.canCurrentUserDeleteComment(siteId, embedder, commentCreatorId, postCreatorId) | ||
&& persistenceManager.deleteComment(commentId)) { | ||
List<String> contextIds = new ArrayList(); | ||
if (embedder.equals(CommonsConstants.SOCIAL)) { | ||
//Post post = persistenceManager.getPost(postId, false); | ||
contextIds = getConnectionUserIds(postCreatorId); | ||
} else { | ||
contextIds.add(commonsId); | ||
} | ||
contextIds.add(commonsId); | ||
removeContextIdsFromCache(contextIds); | ||
return true; | ||
} | ||
|
@@ -412,12 +385,6 @@ public boolean parseEntityReference(String referenceString, Reference reference) | |
|
||
String siteId = parts[2]; | ||
String subType = parts[3]; | ||
/*String entityId = parts[4]; | ||
if ("posts".equals(subType)) { | ||
reference.set("commons", "posts", entityId, null, siteId); | ||
return true; | ||
}*/ | ||
|
||
return false; | ||
} | ||
|
@@ -449,33 +416,4 @@ private void removeContextIdsFromCache(List<String> contextIds) { | |
Cache cache = sakaiProxy.getCache(POST_CACHE); | ||
contextIds.forEach(contextId -> cache.remove(contextId)); | ||
} | ||
|
||
private List<String> getConnectionUserIds(String userId) { | ||
|
||
List<String> userIds = new ArrayList(); | ||
List<BasicConnection> conns | ||
= profileConnectionsLogic.getBasicConnectionsForUser(userId); | ||
conns.forEach(conn -> userIds.add(conn.getUuid())); | ||
userIds.add(userId); | ||
return userIds; | ||
} | ||
|
||
public void update(Observable o, final Object arg) { | ||
|
||
if (arg instanceof Event) { | ||
Event e = (Event) arg; | ||
String event = e.getEvent(); | ||
if (ProfileConstants.EVENT_FRIEND_CONFIRM.equals(event) | ||
|| ProfileConstants.EVENT_FRIEND_REMOVE.equals(event)) { | ||
String ref = e.getResource(); | ||
String[] pathParts = ref.split("/"); | ||
String from = e.getUserId(); | ||
String to = pathParts[2]; | ||
List<String> contextIds = new ArrayList(); | ||
contextIds.add(from); | ||
contextIds.add(to); | ||
removeContextIdsFromCache(contextIds); | ||
} | ||
} | ||
} | ||
} |
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
32 changes: 0 additions & 32 deletions
32
...api/src/java/org/sakaiproject/profile2/exception/MessageRecipientNotDefinedException.java
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
...2/api/src/java/org/sakaiproject/profile2/exception/ProfilePrivacyNotDefinedException.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
profile2/api/src/java/org/sakaiproject/profile2/hbm/CompanyProfile.hbm.xml
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
profile2/api/src/java/org/sakaiproject/profile2/hbm/GalleryImage.hbm.xml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.