Skip to content

Feature/liferay upgrade 74 #44

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

Merged
merged 3 commits into from
Dec 2, 2024
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
11 changes: 9 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= Liferay Portal DB setup core
:liferay-version: 7.4.3.86
:current-db-setup-core-version: 7.4.3860
:liferay-version: 7.4.3.125
:current-db-setup-core-version: 7.4.3863
:TOC:

image:https://maven-badges.herokuapp.com/maven-central/com.ableneo.liferay/com.ableneo.liferay.db.setup.core/badge.svg?color=blue[Maven Central,link=https://search.maven.org/search?q=g:com.ableneo.liferay%20AND%20a:com.ableneo.liferay.db.setup.core]
Expand Down Expand Up @@ -318,6 +318,13 @@ They are probably not perfect, please let me know if anything feels wrong or inc

=== Version 7.4.3860

==== Features & bug fixes
* switched to JDK21
* api compatible with Liferay 7.4.3.125
* fixed category import (updating parent)

=== Version 7.4.3860

==== Features & bug fixes
* switched to JDK11
* upgraded and tested all features in link:./com.ableneo.liferay.site.example/src/main/resources/setup-ableneo-site.xml[example setup] with Liferay Portal 7.4.3.86
Expand Down
1 change: 1 addition & 0 deletions bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Import-Package: \
!com.liferay.portal.kernel.test.portlet.*,\
*;resolution:=optional
-exportcontents: com.ableneo.*
-noee: true
34 changes: 31 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>9</version>
</parent>

<version>7.4.3862-SNAPSHOT</version>
<version>7.4.3863-SNAPSHOT</version>
<groupId>com.ableneo.liferay</groupId>
<artifactId>com.ableneo.liferay.db.setup.core</artifactId>
<description>Creates Liferay Portal data (permissions, roles, sites, pages etc.) from XML declaration.</description>
Expand All @@ -18,15 +18,16 @@

<properties>
<!-- 7.4: -->
<liferay.version>7.4.3.86</liferay.version>
<liferay.version.portal.api>${liferay.version}-ga86</liferay.version.portal.api>
<liferay.version>7.4.3.125</liferay.version>
<liferay.version.portal.api>${liferay.version}-ga125</liferay.version.portal.api>
<junit.version>5.10.1</junit.version>
<mockito.version>4.11.0</mockito.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<bnd.version>5.2.0</bnd.version>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>ableneo</sonar.organization>
<sonar.projectKey>ableneo_liferay-db-setup-core</sonar.projectKey>
<byte-buddy.version>1.14.17</byte-buddy.version>
</properties>

<build>
Expand Down Expand Up @@ -164,6 +165,11 @@
<version>${junit.version}</version>
</dependency>
</dependencies>
<configuration>
<argLine>
--add-opens java.base/java.lang.invoke=ALL-UNNAMED
</argLine>
</configuration>
</plugin>

<plugin>
Expand Down Expand Up @@ -386,6 +392,18 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${byte-buddy.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>${byte-buddy.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
Expand All @@ -397,6 +415,16 @@
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</exclusion>
<exclusion>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import com.ableneo.liferay.portal.setup.domain.Site;
import com.ableneo.liferay.portal.setup.domain.StructureType;
import com.liferay.asset.kernel.model.AssetEntry;
import com.liferay.asset.kernel.model.AssetLinkConstants;
import com.liferay.asset.kernel.service.AssetEntryLocalServiceUtil;
import com.liferay.asset.kernel.service.AssetLinkLocalServiceUtil;
import com.liferay.asset.link.constants.AssetLinkConstants;
import com.liferay.asset.link.service.AssetLinkLocalServiceUtil;
import com.liferay.dynamic.data.lists.model.DDLRecordSet;
import com.liferay.dynamic.data.lists.service.DDLRecordSetLocalServiceUtil;
import com.liferay.dynamic.data.mapping.constants.DDMTemplateConstants;
Expand Down Expand Up @@ -383,6 +383,7 @@ public static void addDDMTemplate(final ArticleTemplate template, long groupId)

long runAsUserId = SetupConfigurationThreadLocal.getRunAsUserId();
DDMTemplate newTemplate = DDMTemplateLocalServiceUtil.addTemplate(
null,
runAsUserId,
groupId,
classNameId,
Expand Down Expand Up @@ -452,6 +453,7 @@ public static void addDDMTemplate(final Adt template, final long groupId) throws
}
long runAsUserId = SetupConfigurationThreadLocal.getRunAsUserId();
DDMTemplate newTemplate = DDMTemplateLocalServiceUtil.addTemplate(
null,
runAsUserId,
groupId,
classNameId,
Expand Down Expand Up @@ -586,7 +588,9 @@ public static void addJournalArticle(final Article article, final long groupId)
true,
true,
false,
StringPool.BLANK,
0,
0,
null,
null,
null,
StringPool.BLANK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ private static void setupCategory(
assetCategory.setUuid(category.getUuid());
update = true;
}
if (assetCategory.getParentCategoryId() != parentCategoryId) {
assetCategory.setParentCategoryId(parentCategoryId);
update = true;
}

try {
if (update) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static void setMenu(long groupId, Menu newMenu) {
if (menu == null) {
LOG.info(" i '" + name + "' create..");
try {
menu = SiteNavigationMenuLocalServiceUtil.addSiteNavigationMenu(userId, groupId, name, serviceContext);
menu = SiteNavigationMenuLocalServiceUtil.addSiteNavigationMenu(null, userId, groupId, name, serviceContext);
LOG.info(" i '" + name + "' create OK");
} catch (PortalException e) {
LOG.error("Could not create new menu '" + name + "'", e);
Expand Down Expand Up @@ -192,6 +192,7 @@ private static SiteNavigationMenuItem createMenuItem(
LOG.info("Inserting menu-item[" + newMenuItem.getName() + "]");
savedItem =
SiteNavigationMenuItemLocalServiceUtil.addSiteNavigationMenuItem(
null,
userId,
groupId,
parentMenuId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import com.liferay.portal.kernel.model.Organization;
import com.liferay.portal.kernel.model.OrganizationConstants;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.service.GroupLocalServiceUtil;
import com.liferay.portal.kernel.service.OrganizationLocalServiceUtil;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
import com.liferay.portal.kernel.service.*;
import com.liferay.portal.kernel.util.LocaleThreadLocal;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -64,13 +61,17 @@ public static void setupOrganizations(
);

Organization newOrganization = OrganizationLocalServiceUtil.addOrganization(
null,
SetupConfigurationThreadLocal.getRunAsUserId(),
OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID,
organization.getName(),
"organization",
0,
0,
ListTypeConstants.ORGANIZATION_STATUS_DEFAULT,
ListTypeLocalServiceUtil.getListTypeId(
companyId,
ListTypeConstants.ORGANIZATION_STATUS_DEFAULT,
ListTypeConstants.ORGANIZATION_STATUS),
"Created by setup module.",
false,
new ServiceContext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ private static Layout createLinkPage(
try {
layout =
LayoutLocalServiceUtil.addLayout(
null,
userId,
groupId,
false,
Expand Down Expand Up @@ -597,6 +598,7 @@ private static Layout createPage(
friendlyURLMap.put(locale, currentPage.getFriendlyUrl());

return LayoutLocalServiceUtil.addLayout(
null,
SetupConfigurationThreadLocal.getRunAsUserId(),
groupId,
isPrivate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static void updateFile(
fe.getMimeType(), fe.getTitle(), parseToUrlTitle(fe.getTitle()), fe.getDescription(),
"update content",
DLVersionNumberIncrease.MINOR,
content, null, null, new ServiceContext());
content, null, null, null, new ServiceContext());
} catch (Exception e) {
LOG.error(String.format("Can not update Liferay Document entry with ID:%1$s", fe.getFileEntryId()), e);
}
Expand Down Expand Up @@ -169,7 +169,7 @@ public static FileEntry createDocument(
try {

Date expDate = Date.valueOf(LocalDate.now().plusYears(4L));
Date reviewDate = Date.valueOf(LocalDate.now());
Date todayDate = Date.valueOf(LocalDate.now());
ServiceContext serviceContext = new ServiceContext();
serviceContext.setCompanyId(SetupConfigurationThreadLocal.getRunInCompanyId());
serviceContext.setScopeGroupId(groupId);
Expand All @@ -187,8 +187,9 @@ public static FileEntry createDocument(
title,
"Ableneo import",
content,
todayDate,
expDate,
reviewDate,
todayDate,
serviceContext
);
} catch (PortalException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ void getRunInCompanyId() throws PortalException {
@Test
void setRunInCompanyId() {
SetupConfigurationThreadLocal.setRunAsUserId(1l);
assertEquals(new Long(1l), SetupConfigurationThreadLocal.getRunAsUserId());
assertEquals(Long.valueOf(1l), SetupConfigurationThreadLocal.getRunAsUserId());
}
}
Loading