Skip to content

Commit

Permalink
Merge Spaces Management - Meeds-io/MIPs#160 (#4191)
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker authored Nov 18, 2024
2 parents fbffaf8 + e4c6c96 commit a9ae257
Show file tree
Hide file tree
Showing 248 changed files with 6,813 additions and 4,893 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
*/
package io.meeds.social.space.constant;

public enum Registration {
public enum SpaceRegistration {
OPEN, VALIDATION, CLOSED
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
*/
package io.meeds.social.space.constant;

public enum Visibility {
public enum SpaceVisibility {
PUBLIC, PRIVATE, HIDDEN
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 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 io.meeds.social.space.model;

import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SpacePermissions {

private List<String> layoutPermissions;

private List<String> publicSitePermissions;

private List<String> deletePermissions;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2020 - 2024 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 io.meeds.social.space.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SpaceTemplatePatch {

private long templateId;

private boolean accessRules;

private boolean editorialMode;

private boolean layoutPermissions;

private boolean publicSitePermissions;

private boolean deletePermissions;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.meeds.social.space.service;

import org.exoplatform.commons.exception.ObjectNotFoundException;
import org.exoplatform.social.core.space.model.Space;

import io.meeds.social.space.model.SpacePermissions;
import io.meeds.social.space.model.SpaceTemplatePatch;

public interface SpaceAdministrationService {

/**
* @param spaceId {@link Space} technical id
* @return Space permissions with layoutPermissions, deletePermissions and
* publicSitePermissions
* @throws ObjectNotFoundException when the space doesn't exist
*/
SpacePermissions getSpacePermissions(long spaceId) throws ObjectNotFoundException;

/**
* @param spaceId {@link Space} technical id
* @param permissions Space permissions with layoutPermissions,
* deletePermissions and publicSitePermissions
* @throws ObjectNotFoundException when the space doesn't exist
*/
void updateSpacePermissions(long spaceId, SpacePermissions permissions) throws ObjectNotFoundException;

/**
* @param spaceId {@link Space} technical id
* @param templatePatch SpaceTemplate properties to apply
* @throws ObjectNotFoundException when the space doesn't exist
*/
void applySpaceTemplate(long spaceId, SpaceTemplatePatch templatePatch) throws ObjectNotFoundException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,50 +29,46 @@
import org.exoplatform.social.core.space.model.Space;

import io.meeds.social.space.constant.SpaceMembershipStatus;
import io.meeds.social.space.constant.SpaceRegistration;
import io.meeds.social.space.constant.SpaceVisibility;

import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* @author <a href="http://hoatle.net">hoatle (hoatlevan at gmail dot com)</a>
* @since 1.2.0-GA
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
@Getter
@Setter
public class SpaceFilter implements Cloneable {

private String spaceNameSearchCondition;

private List<Space> includeSpaces;

private List<Space> exclusions;
private List<Long> excludedIds;

private String remoteId;

private long identityId;

private long templateId;

private List<Long> managingTemplateIds;

private SpaceMembershipStatus status;

private SpaceMembershipStatus extraStatus;

private SpaceRegistration registration;

private SpaceVisibility visibility;

private Sorting sorting;

private boolean favorite;

@Getter
@Setter
private List<String> tagNames;

public SpaceFilter() {
this.spaceNameSearchCondition = null;
}

public SpaceFilter(String spaceNameSearchCondition) {
this.spaceNameSearchCondition = Utils.processUnifiedSearchCondition(spaceNameSearchCondition);
}
Expand Down Expand Up @@ -102,12 +98,15 @@ public boolean isUnifiedSearch() {
public SpaceFilter clone() { // NOSONAR
return new SpaceFilter(spaceNameSearchCondition,
includeSpaces,
exclusions,
excludedIds,
remoteId,
identityId,
templateId,
managingTemplateIds,
status,
extraStatus,
registration,
visibility,
sorting,
favorite,
tagNames == null ? null : new ArrayList<>(tagNames));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class Space implements CacheEntry {
public static final String HOME_URL = "home";

/** The id. */
private String id;
private long id;

/** The display name. */
private String displayName;
Expand Down Expand Up @@ -235,6 +235,10 @@ public void setField(UpdatedField field) {
* @param id the new id
*/
public void setId(String id) {
this.id = id == null ? 0 : Long.parseLong(id);
}

public void setId(long id) {
this.id = id;
}

Expand All @@ -244,6 +248,10 @@ public void setId(String id) {
* @return the id
*/
public String getId() {
return String.valueOf(id);
}

public long getSpaceId() {
return id;
}

Expand Down Expand Up @@ -653,26 +661,15 @@ public void setCreatedTime(Long createdTime) {

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
return Long.hashCode(id);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
public boolean equals(Object o) {
if (this == o) {
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Space other = (Space) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
return o instanceof Space space && id == space.id;
}

}
Loading

0 comments on commit a9ae257

Please sign in to comment.