-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change will upgrade services to use spring instead of Kernel & WS.
- Loading branch information
Showing
78 changed files
with
4,299 additions
and
5,836 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 |
---|---|---|
@@ -1,19 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
|
@@ -29,94 +33,29 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
<properties> | ||
<rest.api.doc.title>App-center Rest Api</rest.api.doc.title> | ||
<rest.api.doc.version>1.0</rest.api.doc.version> | ||
<rest.api.doc.description>App-center addon rest endpoints</rest.api.doc.description> | ||
<rest.api.doc.description>App-center addon Rest endpoints</rest.api.doc.description> | ||
|
||
<exo.test.coverage.ratio>0.72</exo.test.coverage.ratio> | ||
<exo.test.coverage.ratio>0.71</exo.test.coverage.ratio> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.exoplatform.core</groupId> | ||
<artifactId>exo.core.component.organization.api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.exoplatform.gatein.portal</groupId> | ||
<artifactId>exo.portal.component.common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.exoplatform.commons</groupId> | ||
<artifactId>commons-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.exoplatform.gatein.portal</groupId> | ||
<artifactId>exo.portal.component.file-storage</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.exoplatform.social</groupId> | ||
<artifactId>social-component-service</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.exoplatform.gatein.portal</groupId> | ||
<artifactId>exo.portal.component.identity</artifactId> | ||
<scope>test</scope> | ||
<type>test-jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.exoplatform.gatein.portal</groupId> | ||
<artifactId>exo.portal.component.common</artifactId> | ||
<scope>test</scope> | ||
<type>test-jar</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
<artifactId>social-component-core</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.hsqldb</groupId> | ||
<artifactId>hsqldb</artifactId> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>com.vaadin.external.google</groupId> | ||
<artifactId>android-json</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.openapitools.swagger</groupId> | ||
<artifactId>swagger-maven-plugin</artifactId> | ||
<configuration> | ||
<useResourcePackagesChildren>true</useResourcePackagesChildren> | ||
<resourcePackages> | ||
<locations>org.exoplatform.appcenter.rest</locations> | ||
</resourcePackages> | ||
<swaggerConfig> | ||
<info> | ||
<title>${rest.api.doc.title}</title> | ||
<version>${rest.api.doc.version}</version> | ||
<description>${rest.api.doc.description}</description> | ||
<license> | ||
<url>https://www.gnu.org/licenses/lgpl-3.0.en.html</url> | ||
<name>LGPL</name> | ||
</license> | ||
</info> | ||
</swaggerConfig> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<systemProperties> | ||
<property> | ||
<name>exo.files.storage.dir</name> | ||
<value>target/exo-files</value> | ||
</property> | ||
</systemProperties> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
<finalName>${project.artifactId}</finalName> | ||
</build> | ||
</project> |
66 changes: 66 additions & 0 deletions
66
app-center-services/src/main/java/io/meeds/appcenter/dao/ApplicationDAO.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,66 @@ | ||
/** | ||
* 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.appcenter.dao; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Component; | ||
|
||
import io.meeds.appcenter.entity.ApplicationEntity; | ||
|
||
@Component | ||
public interface ApplicationDAO extends JpaRepository<ApplicationEntity, Long> { | ||
|
||
@Query(""" | ||
SELECT app FROM ApplicationEntity app | ||
WHERE app.active = TRUE | ||
AND app.isMandatory = TRUE | ||
""") | ||
List<ApplicationEntity> getMandatoryActiveApps(); | ||
|
||
@Query(""" | ||
SELECT app FROM ApplicationEntity app | ||
ORDER BY LOWER(app.title) | ||
""") | ||
List<ApplicationEntity> getApplications(); | ||
|
||
@Query(""" | ||
SELECT app FROM ApplicationEntity app | ||
WHERE LOWER(app.title) LIKE ?1 | ||
OR LOWER(app.description) like ?1 | ||
OR LOWER(app.url) LIKE ?1 | ||
ORDER BY LOWER(app.title) | ||
""") | ||
List<ApplicationEntity> getApplications(String keyword); | ||
|
||
@Query(""" | ||
SELECT app FROM ApplicationEntity app | ||
WHERE app.system = TRUE | ||
""") | ||
List<ApplicationEntity> getSystemApplications(); | ||
|
||
@Query(""" | ||
SELECT app FROM ApplicationEntity app | ||
WHERE app.title = ?1 | ||
""") | ||
ApplicationEntity getApplicationByTitle(String title); | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
app-center-services/src/main/java/io/meeds/appcenter/dao/FavoriteApplicationDAO.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,59 @@ | ||
/** | ||
* 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.appcenter.dao; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import io.meeds.appcenter.entity.FavoriteApplicationEntity; | ||
|
||
public interface FavoriteApplicationDAO extends JpaRepository<FavoriteApplicationEntity, Long> { | ||
|
||
@Query(""" | ||
SELECT favoriteApp FROM FavoriteApplicationEntity favoriteApp | ||
WHERE favoriteApp.userName = ?1 | ||
ORDER BY favoriteApp.order NULLS LAST | ||
""") | ||
List<FavoriteApplicationEntity> getFavoriteAppsByUser(String userName); | ||
|
||
@Query(""" | ||
SELECT distinct(favoriteApp) FROM FavoriteApplicationEntity favoriteApp | ||
WHERE favoriteApp.application.id = ?1 | ||
AND favoriteApp.userName = ?2 | ||
""") | ||
FavoriteApplicationEntity getFavoriteAppByUserNameAndAppId(Long applicationId, String userName); | ||
|
||
@Query(""" | ||
SELECT count(*) FROM FavoriteApplicationEntity favoriteApp | ||
WHERE favoriteApp.userName = ?1 | ||
""") | ||
long countFavoritesForUser(String username); | ||
|
||
@Transactional | ||
@Modifying(clearAutomatically = true, flushAutomatically = true) | ||
@Query(""" | ||
DELETE FROM FavoriteApplicationEntity favoriteApp | ||
WHERE favoriteApp.application.id = ?1 | ||
""") | ||
void removeAllFavoritesOfApplication(Long applicationId); | ||
} |
97 changes: 97 additions & 0 deletions
97
app-center-services/src/main/java/io/meeds/appcenter/entity/ApplicationEntity.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,97 @@ | ||
/** | ||
* 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.appcenter.entity; | ||
|
||
import java.util.Collection; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Entity(name = "ApplicationEntity") | ||
@Table(name = "AC_APPLICATION") | ||
public class ApplicationEntity { | ||
|
||
@Id | ||
@SequenceGenerator(name = "SEQ_APPLICATION_ID", sequenceName = "SEQ_APPLICATION_ID", allocationSize = 1) | ||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_APPLICATION_ID") | ||
@Column(name = "ID") | ||
private Long id; | ||
|
||
@Column(name = "TITLE") | ||
private String title; | ||
|
||
@Column(name = "URL") | ||
private String url; | ||
|
||
@Column(name = "HELP_PAGE_URL") | ||
private String helpPageUrl; | ||
|
||
@Column(name = "IMAGE_FILE_ID") | ||
private Long imageFileId; | ||
|
||
@Column(name = "DESCRIPTION") | ||
private String description; | ||
|
||
@Column(name = "ACTIVE") | ||
private boolean active; | ||
|
||
@Column(name = "BY_DEFAULT") | ||
private boolean isMandatory; | ||
|
||
@Column(name = "IS_MOBILE") | ||
private boolean isMobile; | ||
|
||
@Column(name = "IS_SYSTEM") | ||
private boolean system; | ||
|
||
@Column(name = "PERMISSIONS") | ||
private String permissions; | ||
|
||
@Column(name = "IS_CHANGED_MANUALLY") | ||
private boolean isChangedManually; | ||
|
||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "application", cascade = CascadeType.REMOVE) | ||
private Collection<FavoriteApplicationEntity> favorites; | ||
|
||
public ApplicationEntity(Long id, // NOSONAR | ||
String title, | ||
String url, | ||
Long imageFileId, | ||
String description, | ||
boolean active, | ||
boolean isMandatory, | ||
String permissions, | ||
boolean isChangedManually) { | ||
this.id = id; | ||
this.title = title; | ||
this.url = url; | ||
this.imageFileId = imageFileId; | ||
this.description = description; | ||
this.active = active; | ||
this.isMandatory = isMandatory; | ||
this.permissions = permissions; | ||
this.isChangedManually = isChangedManually; | ||
} | ||
|
||
} |
Oops, something went wrong.