Skip to content

Commit de8ed75

Browse files
authored
Merge pull request #44 from ableneo/feature/liferay_upgrade_74
Feature/liferay upgrade 74
2 parents 3d9eadd + 3728328 commit de8ed75

File tree

10 files changed

+67
-18
lines changed

10 files changed

+67
-18
lines changed

README.adoc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= Liferay Portal DB setup core
2-
:liferay-version: 7.4.3.86
3-
:current-db-setup-core-version: 7.4.3860
2+
:liferay-version: 7.4.3.125
3+
:current-db-setup-core-version: 7.4.3863
44
:TOC:
55

66
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]
@@ -318,6 +318,13 @@ They are probably not perfect, please let me know if anything feels wrong or inc
318318

319319
=== Version 7.4.3860
320320

321+
==== Features & bug fixes
322+
* switched to JDK21
323+
* api compatible with Liferay 7.4.3.125
324+
* fixed category import (updating parent)
325+
326+
=== Version 7.4.3860
327+
321328
==== Features & bug fixes
322329
* switched to JDK11
323330
* 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

bnd.bnd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ Import-Package: \
22
!com.liferay.portal.kernel.test.portlet.*,\
33
*;resolution:=optional
44
-exportcontents: com.ableneo.*
5+
-noee: true

pom.xml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<version>9</version>
99
</parent>
1010

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

1919
<properties>
2020
<!-- 7.4: -->
21-
<liferay.version>7.4.3.86</liferay.version>
22-
<liferay.version.portal.api>${liferay.version}-ga86</liferay.version.portal.api>
21+
<liferay.version>7.4.3.125</liferay.version>
22+
<liferay.version.portal.api>${liferay.version}-ga125</liferay.version.portal.api>
2323
<junit.version>5.10.1</junit.version>
2424
<mockito.version>4.11.0</mockito.version>
2525
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2626
<bnd.version>5.2.0</bnd.version>
2727
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
2828
<sonar.organization>ableneo</sonar.organization>
2929
<sonar.projectKey>ableneo_liferay-db-setup-core</sonar.projectKey>
30+
<byte-buddy.version>1.14.17</byte-buddy.version>
3031
</properties>
3132

3233
<build>
@@ -164,6 +165,11 @@
164165
<version>${junit.version}</version>
165166
</dependency>
166167
</dependencies>
168+
<configuration>
169+
<argLine>
170+
--add-opens java.base/java.lang.invoke=ALL-UNNAMED
171+
</argLine>
172+
</configuration>
167173
</plugin>
168174

169175
<plugin>
@@ -386,6 +392,18 @@
386392
<version>${junit.version}</version>
387393
<scope>test</scope>
388394
</dependency>
395+
<dependency>
396+
<groupId>net.bytebuddy</groupId>
397+
<artifactId>byte-buddy</artifactId>
398+
<version>${byte-buddy.version}</version>
399+
<scope>test</scope>
400+
</dependency>
401+
<dependency>
402+
<groupId>net.bytebuddy</groupId>
403+
<artifactId>byte-buddy-agent</artifactId>
404+
<version>${byte-buddy.version}</version>
405+
<scope>test</scope>
406+
</dependency>
389407
<dependency>
390408
<groupId>org.mockito</groupId>
391409
<artifactId>mockito-junit-jupiter</artifactId>
@@ -397,6 +415,16 @@
397415
<artifactId>mockito-core</artifactId>
398416
<version>${mockito.version}</version>
399417
<scope>test</scope>
418+
<exclusions>
419+
<exclusion>
420+
<groupId>net.bytebuddy</groupId>
421+
<artifactId>byte-buddy</artifactId>
422+
</exclusion>
423+
<exclusion>
424+
<groupId>net.bytebuddy</groupId>
425+
<artifactId>byte-buddy-agent</artifactId>
426+
</exclusion>
427+
</exclusions>
400428
</dependency>
401429
<dependency>
402430
<groupId>org.mockito</groupId>

src/main/java/com/ableneo/liferay/portal/setup/core/SetupArticles.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
import com.ableneo.liferay.portal.setup.domain.Site;
1717
import com.ableneo.liferay.portal.setup.domain.StructureType;
1818
import com.liferay.asset.kernel.model.AssetEntry;
19-
import com.liferay.asset.kernel.model.AssetLinkConstants;
2019
import com.liferay.asset.kernel.service.AssetEntryLocalServiceUtil;
21-
import com.liferay.asset.kernel.service.AssetLinkLocalServiceUtil;
20+
import com.liferay.asset.link.constants.AssetLinkConstants;
21+
import com.liferay.asset.link.service.AssetLinkLocalServiceUtil;
2222
import com.liferay.dynamic.data.lists.model.DDLRecordSet;
2323
import com.liferay.dynamic.data.lists.service.DDLRecordSetLocalServiceUtil;
2424
import com.liferay.dynamic.data.mapping.constants.DDMTemplateConstants;
@@ -383,6 +383,7 @@ public static void addDDMTemplate(final ArticleTemplate template, long groupId)
383383

384384
long runAsUserId = SetupConfigurationThreadLocal.getRunAsUserId();
385385
DDMTemplate newTemplate = DDMTemplateLocalServiceUtil.addTemplate(
386+
null,
386387
runAsUserId,
387388
groupId,
388389
classNameId,
@@ -452,6 +453,7 @@ public static void addDDMTemplate(final Adt template, final long groupId) throws
452453
}
453454
long runAsUserId = SetupConfigurationThreadLocal.getRunAsUserId();
454455
DDMTemplate newTemplate = DDMTemplateLocalServiceUtil.addTemplate(
456+
null,
455457
runAsUserId,
456458
groupId,
457459
classNameId,
@@ -586,7 +588,9 @@ public static void addJournalArticle(final Article article, final long groupId)
586588
true,
587589
true,
588590
false,
589-
StringPool.BLANK,
591+
0,
592+
0,
593+
null,
590594
null,
591595
null,
592596
StringPool.BLANK,

src/main/java/com/ableneo/liferay/portal/setup/core/SetupCategorization.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ private static void setupCategory(
323323
assetCategory.setUuid(category.getUuid());
324324
update = true;
325325
}
326+
if (assetCategory.getParentCategoryId() != parentCategoryId) {
327+
assetCategory.setParentCategoryId(parentCategoryId);
328+
update = true;
329+
}
326330

327331
try {
328332
if (update) {

src/main/java/com/ableneo/liferay/portal/setup/core/SetupMenus.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private static void setMenu(long groupId, Menu newMenu) {
7979
if (menu == null) {
8080
LOG.info(" i '" + name + "' create..");
8181
try {
82-
menu = SiteNavigationMenuLocalServiceUtil.addSiteNavigationMenu(userId, groupId, name, serviceContext);
82+
menu = SiteNavigationMenuLocalServiceUtil.addSiteNavigationMenu(null, userId, groupId, name, serviceContext);
8383
LOG.info(" i '" + name + "' create OK");
8484
} catch (PortalException e) {
8585
LOG.error("Could not create new menu '" + name + "'", e);
@@ -192,6 +192,7 @@ private static SiteNavigationMenuItem createMenuItem(
192192
LOG.info("Inserting menu-item[" + newMenuItem.getName() + "]");
193193
savedItem =
194194
SiteNavigationMenuItemLocalServiceUtil.addSiteNavigationMenuItem(
195+
null,
195196
userId,
196197
groupId,
197198
parentMenuId,

src/main/java/com/ableneo/liferay/portal/setup/core/SetupOrganizations.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
import com.liferay.portal.kernel.model.Organization;
1414
import com.liferay.portal.kernel.model.OrganizationConstants;
1515
import com.liferay.portal.kernel.model.User;
16-
import com.liferay.portal.kernel.service.GroupLocalServiceUtil;
17-
import com.liferay.portal.kernel.service.OrganizationLocalServiceUtil;
18-
import com.liferay.portal.kernel.service.ServiceContext;
19-
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
16+
import com.liferay.portal.kernel.service.*;
2017
import com.liferay.portal.kernel.util.LocaleThreadLocal;
2118
import java.util.HashMap;
2219
import java.util.List;
@@ -64,13 +61,17 @@ public static void setupOrganizations(
6461
);
6562

6663
Organization newOrganization = OrganizationLocalServiceUtil.addOrganization(
64+
null,
6765
SetupConfigurationThreadLocal.getRunAsUserId(),
6866
OrganizationConstants.DEFAULT_PARENT_ORGANIZATION_ID,
6967
organization.getName(),
7068
"organization",
7169
0,
7270
0,
73-
ListTypeConstants.ORGANIZATION_STATUS_DEFAULT,
71+
ListTypeLocalServiceUtil.getListTypeId(
72+
companyId,
73+
ListTypeConstants.ORGANIZATION_STATUS_DEFAULT,
74+
ListTypeConstants.ORGANIZATION_STATUS),
7475
"Created by setup module.",
7576
false,
7677
new ServiceContext()

src/main/java/com/ableneo/liferay/portal/setup/core/SetupPages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ private static Layout createLinkPage(
499499
try {
500500
layout =
501501
LayoutLocalServiceUtil.addLayout(
502+
null,
502503
userId,
503504
groupId,
504505
false,
@@ -597,6 +598,7 @@ private static Layout createPage(
597598
friendlyURLMap.put(locale, currentPage.getFriendlyUrl());
598599

599600
return LayoutLocalServiceUtil.addLayout(
601+
null,
600602
SetupConfigurationThreadLocal.getRunAsUserId(),
601603
groupId,
602604
isPrivate,

src/main/java/com/ableneo/liferay/portal/setup/core/util/DocumentUtil.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static void updateFile(
101101
fe.getMimeType(), fe.getTitle(), parseToUrlTitle(fe.getTitle()), fe.getDescription(),
102102
"update content",
103103
DLVersionNumberIncrease.MINOR,
104-
content, null, null, new ServiceContext());
104+
content, null, null, null, new ServiceContext());
105105
} catch (Exception e) {
106106
LOG.error(String.format("Can not update Liferay Document entry with ID:%1$s", fe.getFileEntryId()), e);
107107
}
@@ -169,7 +169,7 @@ public static FileEntry createDocument(
169169
try {
170170

171171
Date expDate = Date.valueOf(LocalDate.now().plusYears(4L));
172-
Date reviewDate = Date.valueOf(LocalDate.now());
172+
Date todayDate = Date.valueOf(LocalDate.now());
173173
ServiceContext serviceContext = new ServiceContext();
174174
serviceContext.setCompanyId(SetupConfigurationThreadLocal.getRunInCompanyId());
175175
serviceContext.setScopeGroupId(groupId);
@@ -187,8 +187,9 @@ public static FileEntry createDocument(
187187
title,
188188
"Ableneo import",
189189
content,
190+
todayDate,
190191
expDate,
191-
reviewDate,
192+
todayDate,
192193
serviceContext
193194
);
194195
} catch (PortalException e) {

src/test/java/com/ableneo/liferay/portal/setup/SetupConfigurationThreadLocalTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ void getRunInCompanyId() throws PortalException {
5252
@Test
5353
void setRunInCompanyId() {
5454
SetupConfigurationThreadLocal.setRunAsUserId(1l);
55-
assertEquals(new Long(1l), SetupConfigurationThreadLocal.getRunAsUserId());
55+
assertEquals(Long.valueOf(1l), SetupConfigurationThreadLocal.getRunAsUserId());
5656
}
5757
}

0 commit comments

Comments
 (0)