-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Old SearchService and Move Unified search to legacy-intranet …
…addon
- Loading branch information
Showing
18 changed files
with
702 additions
and
72 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 |
---|---|---|
|
@@ -39,6 +39,7 @@ node_modules/ | |
.classpath | ||
.project | ||
*.log | ||
.factorypath | ||
|
||
# OS | ||
.DS_Store | ||
|
37 changes: 37 additions & 0 deletions
37
...c/main/java/org/exoplatform/social/core/jpa/search/listener/IDMProfileESListenerImpl.java
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.exoplatform.social.core.jpa.search.listener; | ||
|
||
import org.exoplatform.commons.search.index.IndexingService; | ||
import org.exoplatform.commons.utils.CommonsUtils; | ||
import org.exoplatform.container.PortalContainer; | ||
import org.exoplatform.container.component.RequestLifeCycle; | ||
import org.exoplatform.services.log.ExoLogger; | ||
import org.exoplatform.services.log.Log; | ||
import org.exoplatform.services.organization.UserProfile; | ||
import org.exoplatform.services.organization.UserProfileEventListener; | ||
import org.exoplatform.social.core.identity.model.Identity; | ||
import org.exoplatform.social.core.identity.provider.OrganizationIdentityProvider; | ||
import org.exoplatform.social.core.jpa.search.ProfileIndexingServiceConnector; | ||
import org.exoplatform.social.core.manager.IdentityManager; | ||
|
||
public class IDMProfileESListenerImpl extends UserProfileEventListener { | ||
|
||
private static final Log LOG = ExoLogger.getLogger(IDMProfileESListenerImpl.class); | ||
|
||
@Override | ||
public void postSave(UserProfile user, boolean isNew) throws Exception { | ||
RequestLifeCycle.begin(PortalContainer.getInstance()); | ||
try { | ||
IndexingService indexingService = CommonsUtils.getService(IndexingService.class); | ||
IdentityManager identityManager = CommonsUtils.getService(IdentityManager.class); | ||
Identity identity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, user.getUserName()); | ||
|
||
if (identity != null) { | ||
LOG.debug("Notifying indexing service for IDM user profile update id={}", identity.getId()); | ||
indexingService.reindex(ProfileIndexingServiceConnector.TYPE, identity.getId()); | ||
} | ||
} finally { | ||
RequestLifeCycle.end(); | ||
} | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -34,40 +34,37 @@ | |
import java.util.List; | ||
|
||
/** | ||
* Created by The eXo Platform SAS | ||
* Author : eXoPlatform | ||
* [email protected] | ||
* Oct 1, 2015 | ||
* Created by The eXo Platform SAS Author : eXoPlatform [email protected] Oct | ||
* 1, 2015 | ||
*/ | ||
public class UserESListenerImpl extends UserEventListener { | ||
private static final Log LOG = ExoLogger.getLogger(UserESListenerImpl.class); | ||
public class IDMUserESListenerImpl extends UserEventListener { | ||
private static final Log LOG = ExoLogger.getLogger(IDMUserESListenerImpl.class); | ||
|
||
@Override | ||
public void preDelete(final User user) throws Exception { | ||
RequestLifeCycle.begin(PortalContainer.getInstance()); | ||
try{ | ||
try { | ||
IdentityManager idm = CommonsUtils.getService(IdentityManager.class); | ||
Identity identity = idm.getOrCreateIdentity(OrganizationIdentityProvider.NAME, user.getUserName(), false); | ||
Identity identity = idm.getOrCreateIdentity(OrganizationIdentityProvider.NAME, user.getUserName()); | ||
|
||
LOG.info("Notifying indexing service for user deletion id={}", identity.getId()); | ||
LOG.debug("Notifying indexing service for user deletion id={}", identity.getId()); | ||
|
||
CommonsUtils.getService(IndexingService.class).unindex(ProfileIndexingServiceConnector.TYPE, identity.getId()); | ||
reIndexAllConnector(identity); | ||
} finally { | ||
RequestLifeCycle.end(); | ||
} | ||
} | ||
|
||
@Override | ||
public void postSetEnabled(User user) throws Exception { | ||
RequestLifeCycle.begin(PortalContainer.getInstance()); | ||
try { | ||
IdentityManager idm = CommonsUtils.getService(IdentityManager.class); | ||
Identity identity = idm.getOrCreateIdentity(OrganizationIdentityProvider.NAME, user.getUserName(), false); | ||
|
||
LOG.info("Notifying indexing service for user enable status change id={}", identity.getId()); | ||
Identity identity = idm.getOrCreateIdentity(OrganizationIdentityProvider.NAME, user.getUserName()); | ||
|
||
if (! user.isEnabled()) { | ||
LOG.debug("Notifying indexing service for user enable status change id={}", identity.getId()); | ||
if (!user.isEnabled()) { | ||
CommonsUtils.getService(IndexingService.class).unindex(ProfileIndexingServiceConnector.TYPE, identity.getId()); | ||
} else { | ||
CommonsUtils.getService(IndexingService.class).reindex(ProfileIndexingServiceConnector.TYPE, identity.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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,21 +25,29 @@ | |
import org.exoplatform.social.core.profile.ProfileListenerPlugin; | ||
|
||
/** | ||
* Created by The eXo Platform SAS | ||
* Author : eXoPlatform | ||
* [email protected] | ||
* Sep 29, 2015 | ||
* Created by The eXo Platform SAS Author : eXoPlatform [email protected] Sep | ||
* 29, 2015 | ||
*/ | ||
public class ProfileESListenerImpl extends ProfileListenerPlugin { | ||
|
||
private static final Log LOG = ExoLogger.getLogger(ProfileESListenerImpl.class); | ||
|
||
@Override | ||
public void headerSectionUpdated(ProfileLifeCycleEvent event) { | ||
IndexingService indexingService = CommonsUtils.getService(IndexingService.class); | ||
String id = event.getProfile().getIdentity().getId(); | ||
|
||
LOG.debug("Notifying indexing service for profile header information update id={}", id); | ||
|
||
indexingService.reindex(ProfileIndexingServiceConnector.TYPE, id); | ||
} | ||
|
||
@Override | ||
public void avatarUpdated(ProfileLifeCycleEvent event) { | ||
IndexingService indexingService = CommonsUtils.getService(IndexingService.class); | ||
String id = event.getProfile().getIdentity().getId(); | ||
|
||
LOG.info("Notifying indexing service for profile avatar update id={}", id); | ||
LOG.debug("Notifying indexing service for profile avatar update id={}", id); | ||
|
||
indexingService.reindex(ProfileIndexingServiceConnector.TYPE, id); | ||
} | ||
|
@@ -49,12 +57,22 @@ public void bannerUpdated(ProfileLifeCycleEvent event) { | |
LOG.debug("Profile banner of user {} has been updated", event.getProfile().getIdentity().getId()); | ||
} | ||
|
||
@Override | ||
public void basicInfoUpdated(ProfileLifeCycleEvent event) { | ||
IndexingService indexingService = CommonsUtils.getService(IndexingService.class); | ||
String id = event.getProfile().getIdentity().getId(); | ||
|
||
LOG.debug("Notifying indexing service for the basic information update id={}", id); | ||
|
||
indexingService.reindex(ProfileIndexingServiceConnector.TYPE, id); | ||
} | ||
|
||
@Override | ||
public void contactSectionUpdated(ProfileLifeCycleEvent event) { | ||
IndexingService indexingService = CommonsUtils.getService(IndexingService.class); | ||
String id = event.getProfile().getIdentity().getId(); | ||
|
||
LOG.info("Notifying indexing service for the profile contact update id={}", id); | ||
LOG.debug("Notifying indexing service for the profile contact update id={}", id); | ||
|
||
indexingService.reindex(ProfileIndexingServiceConnector.TYPE, id); | ||
} | ||
|
@@ -63,7 +81,7 @@ public void contactSectionUpdated(ProfileLifeCycleEvent event) { | |
public void aboutMeUpdated(ProfileLifeCycleEvent event) { | ||
String id = event.getProfile().getIdentity().getId(); | ||
|
||
LOG.info("Notifying indexing service for the profile aboutme update id={}", id); | ||
LOG.debug("Notifying indexing service for the profile aboutme update id={}", id); | ||
|
||
CommonsUtils.getService(IndexingService.class).reindex(ProfileIndexingServiceConnector.TYPE, id); | ||
} | ||
|
@@ -72,7 +90,7 @@ public void aboutMeUpdated(ProfileLifeCycleEvent event) { | |
public void experienceSectionUpdated(ProfileLifeCycleEvent event) { | ||
String id = event.getProfile().getIdentity().getId(); | ||
|
||
LOG.info("Notifying indexing service for the profile experience update id={}", id); | ||
LOG.debug("Notifying indexing service for the profile experience update id={}", id); | ||
|
||
CommonsUtils.getService(IndexingService.class).reindex(ProfileIndexingServiceConnector.TYPE, id); | ||
} | ||
|
@@ -82,7 +100,7 @@ public void createProfile(ProfileLifeCycleEvent event) { | |
IndexingService indexingService = CommonsUtils.getService(IndexingService.class); | ||
String id = event.getProfile().getIdentity().getId(); | ||
|
||
LOG.info("Notifying indexing service for the profile creation id={}", id); | ||
LOG.debug("Notifying indexing service for the profile creation id={}", id); | ||
|
||
indexingService.index(ProfileIndexingServiceConnector.TYPE, id); | ||
} | ||
|
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
93 changes: 93 additions & 0 deletions
93
component/core/src/main/java/org/exoplatform/social/core/search/SearchConnector.java
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* This file is part of the Meeds project (https://meeds.io/). | ||
* Copyright (C) 2020 Meeds Association | ||
* [email protected] | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or (at your option) any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
*/ | ||
package org.exoplatform.social.core.search; | ||
|
||
/** | ||
* An object defining a plugged search connector | ||
*/ | ||
public class SearchConnector implements Cloneable { | ||
|
||
private String name; | ||
|
||
private String uri; | ||
|
||
private boolean enabled; | ||
|
||
public SearchConnector() { | ||
} | ||
|
||
public SearchConnector(String name, String uri, boolean enabled) { | ||
this.name = name; | ||
this.uri = uri; | ||
this.enabled = enabled; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getUri() { | ||
return uri; | ||
} | ||
|
||
public void setUri(String uri) { | ||
this.uri = uri; | ||
} | ||
|
||
public boolean isEnabled() { | ||
return enabled; | ||
} | ||
|
||
public void setEnabled(boolean enabled) { | ||
this.enabled = enabled; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
final int prime = 31; | ||
int result = 1; | ||
result = prime * result + ((name == null) ? 0 : name.hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
SearchConnector other = (SearchConnector) obj; | ||
if (name == null) { | ||
if (other.name != null) | ||
return false; | ||
} else if (!name.equals(other.name)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public SearchConnector clone() { // NOSONAR | ||
return new SearchConnector(name, uri, enabled); | ||
} | ||
} |
Oops, something went wrong.