Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Merge into develop-exo - MEED-7995, MEED-8006, MEED-7996 #4321

Merged
merged 3 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2025 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.profileproperty.model;

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

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProfilePropertyOption {

private Long id;

private String value;

private Long propertySettingId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,46 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/


package org.exoplatform.social.core.profileproperty.model;

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

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProfilePropertySetting {

private String propertyName;
private Long id;

private String propertyName;

private String propertyType;

private boolean isDropdownList;

private boolean isVisible;

private String propertyType;

private boolean isVisible;
private boolean isEditable;

private boolean isEditable;
private Long parentId;

private Long parentId;
private Long order;

private Long order;
private boolean isActive;

private boolean isActive;
private boolean isGroupSynchronized;

private boolean isGroupSynchronized;
private boolean isHiddenbale;

private boolean isHiddenbale;

private boolean isRequired;
private boolean isRequired;

private boolean isMultiValued;
private boolean isMultiValued;

private Long id;
private List<ProfilePropertyOption> propertyOptions;

private Long updated;
private Long updated;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.exoplatform.commons.cache.future.FutureExoCache;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.social.core.jpa.storage.dao.jpa.ProfilePropertyOptionDAO;
import org.exoplatform.social.core.jpa.storage.dao.jpa.ProfilePropertySettingDAO;
import org.exoplatform.social.core.profileproperty.model.ProfilePropertySetting;
import org.exoplatform.social.core.profileproperty.storage.ProfileSettingStorage;
Expand All @@ -44,8 +45,9 @@ public class CachedProfileSettingStorage extends ProfileSettingStorage {
private List<Long> profileSettingIds;

public CachedProfileSettingStorage(CacheService cacheService,
ProfilePropertySettingDAO profilePropertySettingDAO) {
super(profilePropertySettingDAO);
ProfilePropertySettingDAO profilePropertySettingDAO,
ProfilePropertyOptionDAO profilePropertyOptionDAO) {
super(profilePropertySettingDAO, profilePropertyOptionDAO);
cache = cacheService.getCacheInstance("social.profileSettings");
idByNameCache = cacheService.getCacheInstance("social.profileSettingIdsByName");
futureCache = new FutureExoCache<>((c, id) -> super.getProfileSettingById(id), cache);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2025 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.jpa.storage.dao.jpa;

import jakarta.persistence.TypedQuery;
import org.apache.commons.collections.CollectionUtils;
import org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl;
import org.exoplatform.social.core.jpa.storage.entity.ProfilePropertyOptionEntity;

import java.util.Collections;
import java.util.List;

public class ProfilePropertyOptionDAO extends GenericDAOJPAImpl<ProfilePropertyOptionEntity, Long> {

public List<ProfilePropertyOptionEntity> findPropertyOptionsBySettingId(long settingId, int offset, int limit) {
TypedQuery<ProfilePropertyOptionEntity> query =
getEntityManager().createNamedQuery("ProfilePropertyOptionEntity.findPropertyOptionsBySettingId",
ProfilePropertyOptionEntity.class);
query.setParameter("settingId", settingId);
if (offset > 0) {
query.setFirstResult(offset);
}
if (limit > 0) {
query.setMaxResults(limit);
}
List<ProfilePropertyOptionEntity> list = query.getResultList();
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
} else {
return list;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public ProfilePropertySettingEntity findProfileSettingByName(String name) {
} catch (NoResultException e) {
return null;
}

}

public List<ProfilePropertySettingEntity> findSynchronizedSettings() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2025 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.jpa.storage.entity;

import jakarta.persistence.*;
import lombok.*;

import java.io.Serializable;

@Entity(name = "SocProfilePropertyOptionEntity")
@Table(name = "SOC_PROFILE_PROPERTY_OPTION")
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@NamedQueries({
@NamedQuery(name = "ProfilePropertyOptionEntity.findPropertyOptionsBySettingId", query = "SELECT o FROM SocProfilePropertyOptionEntity o WHERE o.propertySetting.id = :settingId") })
public class ProfilePropertyOptionEntity implements Serializable {

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

@Column(name = "PROPERTY_OPTION_VALUE")
private String value;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PROPERTY_SETTING_ID", nullable = false)
@EqualsAndHashCode.Exclude
@ToString.Exclude
private ProfilePropertySettingEntity propertySetting;
}
Loading
Loading