Skip to content

Commit

Permalink
feat: Adapt Space Service to remove usage of Apps Management - MEED-7638
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker committed Oct 29, 2024
1 parent 67d6dfd commit d217aab
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, see<http://www.gnu.org/licenses/>.
**/

package org.exoplatform.task.integration;

import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.exoplatform.social.core.space.SpaceListenerPlugin;
import org.exoplatform.social.core.space.model.Space;
import org.exoplatform.social.core.space.spi.SpaceLifeCycleEvent;
Expand All @@ -28,101 +31,28 @@
import org.exoplatform.task.util.ProjectUtil;
import org.exoplatform.task.util.UserUtil;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class SpaceTaskDataInitializer extends SpaceListenerPlugin {

private static final Log log = ExoLogger.getExoLogger(SpaceTaskDataInitializer.class);

private ProjectService projectService;

private StatusService statusServ;
private ProjectService projectService;

private StatusService statusServ;

public SpaceTaskDataInitializer(ProjectService pServ, StatusService statusServ) {
this.projectService = pServ;
this.statusServ = statusServ;
}

@Override
public void spaceAccessEdited(SpaceLifeCycleEvent event) {
}

@Override
public void spaceCreated(SpaceLifeCycleEvent event) {
Space space = event.getSpace();
String space_group_id = space.getGroupId();

List<String> memberships = UserUtil.getSpaceMemberships(space_group_id);
Set<String> managers = new HashSet<String>(Arrays.asList(memberships.get(0)));
Set<String> participators = new HashSet<String>(Arrays.asList(memberships.get(1)));

List<String> memberships = UserUtil.getSpaceMemberships(space.getGroupId());
Set<String> managers = new HashSet<>(Arrays.asList(memberships.get(0)));
Set<String> participators = new HashSet<>(Arrays.asList(memberships.get(1)));

ProjectDto project = ProjectUtil.newProjectInstanceDto(space.getDisplayName(), "", managers, participators);
project = projectService.createProject(project);
statusServ.createInitialStatuses(project);
}

@Override
public void spaceRemoved(SpaceLifeCycleEvent event) {
}

@Override
public void applicationActivated(SpaceLifeCycleEvent event) {
}

@Override
public void applicationAdded(SpaceLifeCycleEvent event) {
}

@Override
public void applicationDeactivated(SpaceLifeCycleEvent event) {
}

@Override
public void applicationRemoved(SpaceLifeCycleEvent event) {
}

@Override
public void grantedLead(SpaceLifeCycleEvent event) {
}

@Override
public void joined(SpaceLifeCycleEvent event) {
}

@Override
public void left(SpaceLifeCycleEvent event) {
}

@Override
public void revokedLead(SpaceLifeCycleEvent event) {
}

@Override
public void spaceRenamed(SpaceLifeCycleEvent event) {
}

@Override
public void spaceDescriptionEdited(SpaceLifeCycleEvent event) {
}

@Override
public void spaceAvatarEdited(SpaceLifeCycleEvent event) {
}

@Override
public void addInvitedUser(SpaceLifeCycleEvent event) {
}

@Override
public void addPendingUser(SpaceLifeCycleEvent event) {
}

@Override
public void spaceBannerEdited(SpaceLifeCycleEvent event) {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,45 @@
*/
package org.exoplatform.task.service;

import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.listener.ListenerService;
import org.exoplatform.social.core.storage.impl.StorageUtils;
import org.exoplatform.task.TestDtoUtils;
import org.exoplatform.task.TestUtils;
import org.exoplatform.task.dao.*;
import org.exoplatform.task.dao.ProjectHandler;
import org.exoplatform.task.dao.StatusHandler;
import org.exoplatform.task.dao.TaskHandler;
import org.exoplatform.task.dao.TaskQuery;
import org.exoplatform.task.dao.jpa.DAOHandlerJPAImpl;
import org.exoplatform.task.domain.Project;
import org.exoplatform.task.domain.Status;
import org.exoplatform.task.domain.Task;
import org.exoplatform.task.dto.ProjectDto;
import org.exoplatform.task.dto.StatusDto;
import org.exoplatform.task.dto.TaskDto;
Expand All @@ -41,23 +67,6 @@
import org.exoplatform.task.storage.impl.ProjectStorageImpl;
import org.exoplatform.task.storage.impl.StatusStorageImpl;
import org.exoplatform.task.util.ProjectUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
import org.exoplatform.task.util.StorageUtil;

@RunWith(MockitoJUnitRunner.class)
Expand Down
1 change: 0 additions & 1 deletion webapps/src/main/webapp/WEB-INF/conf/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<import>war:/conf/task-addon/notification-configuration.xml</import>
<import>war:/conf/task-addon/dynamic-container-configuration.xml</import>
<import>war:/conf/task-addon/search-configuration.xml</import>
<import>war:/conf/task-addon/spaces-templates-configuration.xml</import>
<import>war:/conf/task-addon/ckeditor-configuration.xml</import>

<import profiles="analytics">war:/conf/task-addon/analytics-configuration.xml</import>
Expand Down

This file was deleted.

0 comments on commit d217aab

Please sign in to comment.