Skip to content

Commit

Permalink
feat: Add Space Template Management Backoffice - MEED-7607 - Meeds-io…
Browse files Browse the repository at this point in the history
…/MIPs#150 (#4118)

This change will add a new portlet for Space Template Management with
its Backend using spring Beans.
  • Loading branch information
boubaker authored and exo-swf committed Oct 18, 2024
1 parent 9b28566 commit e6df321
Show file tree
Hide file tree
Showing 68 changed files with 6,086 additions and 530 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ String getTranslationLabel(String objectType,
String fieldName,
Locale locale);

/**
* Retrieves the Translation Label for a given field of an Object (identified
* by its type and id) with a designated {@link Locale}. not.
*
* @param objectType Object type for which the Translation Metadata will be
* attached
* @param objectId Object unique identifier
* @param fieldName Object field
* @param locale {@link Locale}
* @return the translated label for a given {@link Locale}
*/
String getTranslationLabelOrDefault(String objectType,
long objectId,
String fieldName,
Locale locale);

/**
* Saves Translation Labels for a given Object's field. This will replace any
* existing list of translations
Expand Down Expand Up @@ -201,4 +217,5 @@ void deleteTranslationLabel(String objectType,
* @param objectType Object type
*/
void removePlugin(String objectType);

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@

/**
* Definition of space template model.
* @deprecated will be replaced by a managed/stored Space Template
*/
@NoArgsConstructor
@AllArgsConstructor
@Deprecated(forRemoval = true, since = "7.0")
public class SpaceTemplate implements Cloneable {

private String name;

private String resolvedLabel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.exoplatform.social.core.space;

import org.exoplatform.services.security.MembershipEntry;
import org.exoplatform.social.core.space.model.Space;

import java.util.List;

import org.exoplatform.services.security.MembershipEntry;

/**
* Service to manage administration of spaces
*/
Expand Down Expand Up @@ -45,4 +44,15 @@ public interface SpacesAdministrationService {
*/
boolean canCreateSpace(String username) ;

/**
* Checks if the user is a super manager of all spaces
*
* @param username user name
* @return true if the user is member of super administrators groups, else
* false
*/
default boolean isSuperManager(String username) {
throw new UnsupportedOperationException();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public class Space implements CacheEntry {
/** The template. */
private String template;

@Getter
@Setter
private long templateId;

/** The url. */
private String url;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.time.Instant;
import java.util.List;
import java.util.Map;

import org.exoplatform.commons.exception.ObjectNotFoundException;
import org.exoplatform.commons.utils.ListAccess;
Expand Down Expand Up @@ -1255,4 +1256,11 @@ default String getSpacePublicSiteName(Space space) {
throw new UnsupportedOperationException();
}

/**
* @return the count of spaces by Space Template identifier
*/
default Map<Long, Long> countSpacesByTemplate() {
throw new UnsupportedOperationException();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.time.Instant;
import java.util.List;
import java.util.Map;

/**
* @author <a href="mailto:[email protected]">Alain Defrance</a>
Expand Down Expand Up @@ -852,4 +853,11 @@ default int countCommonSpaces(String userId, String otherUserId){
default Instant getSpaceMembershipDate(long spaceId, String username) {
throw new UnsupportedOperationException();
}

/**
* @return the count of spaces by Space Template identifier
*/
default Map<Long, Long> countSpacesByTemplate() {
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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.constant;

public enum Priority {
HIGH, INTERMEDIATE, LOW
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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.constant;

public enum PublicSiteVisibility {
MANAGER, MEMBER, INTERNAL, AUTHENTICATED, EVERYONE;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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.constant;

public enum Registration {
OPEN, VALIDATION, CLOSED
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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.constant;

public enum Visibility {
PUBLIC, PRIVATE, HIDDEN
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* 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.template.dao;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import io.meeds.social.space.template.entity.SpaceTemplateEntity;

@Repository
public interface SpaceTemplateDAO extends JpaRepository<SpaceTemplateEntity, Long> {

List<SpaceTemplateEntity> findByDeletedFalse(Pageable pageable);

List<SpaceTemplateEntity> findByDeletedFalseAndEnabledTrue(Pageable pageable);

}
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 - 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.template.entity;

import java.util.List;

import org.exoplatform.commons.utils.StringListConverter;

import io.meeds.social.space.constant.Registration;
import io.meeds.social.space.constant.Visibility;

import jakarta.persistence.Column;
import jakarta.persistence.Convert;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.SequenceGenerator;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity(name = "SpaceTemplate")
@Table(name = "SOC_SPACE_TEMPLATES")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SpaceTemplateEntity {

@Id
@SequenceGenerator(name = "SEQ_SOC_SPACE_TEMPLATE_ID", sequenceName = "SEQ_SOC_SPACE_TEMPLATE_ID", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SOC_SPACE_TEMPLATE_ID")
@Column(name = "ID")
private Long id;

@Column(name = "ICON")
private String icon;

@Column(name = "ENABLED")
private boolean enabled;

@Column(name = "DELETED")
private boolean deleted;

@Column(name = "IS_SYSTEM")
private boolean system;

@Column(name = "TEMPLATE_ORDER")
private long order;

@Convert(converter = StringListConverter.class)
@Column(name = "PERMISSIONS")
private List<String> permissions;

@Convert(converter = StringListConverter.class)
@Column(name = "SPACE_LAYOUT_PERMISSIONS")
private List<String> spaceLayoutPermissions;

@Convert(converter = StringListConverter.class)
@Column(name = "SPACE_DELETE_PERMISSIONS")
private List<String> spaceDeletePermissions;

@Convert(converter = StringListConverter.class)
@Column(name = "SPACE_FIELDS")
private List<String> spaceFields;

@Column(name = "SPACE_DEFAULT_VISIBILITY")
private Visibility spaceDefaultVisibility;

@Column(name = "SPACE_DEFAULT_ACCESS")
private Registration spaceDefaultRegistration;

@Column(name = "SPACE_ALLOW_CONTENT_CREATION")
private boolean spaceAllowContentCreation;

}
Loading

0 comments on commit e6df321

Please sign in to comment.