Skip to content

Commit 65d4162

Browse files
authored
Merge pull request #45 from ktor/master
new ddm structure json import format support
2 parents 70c90fc + 507d58d commit 65d4162

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+790
-653
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ jobs:
1313
- uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16-
- name: Set up JDK 11
16+
- name: Set up JDK 21
1717
uses: actions/setup-java@v4
1818
with:
19-
java-version: 11
19+
distribution: 'temurin'
20+
java-version: 21
2021
- name: Cache SonarCloud packages
2122
uses: actions/cache@v4
2223
with:

.github/workflows/sonarcloud.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ jobs:
2020
- uses: actions/checkout@v4
2121
with:
2222
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
23-
- name: Set up JDK 11
23+
- name: Set up JDK 21
2424
uses: actions/setup-java@v4
2525
with:
26-
java-version: 11
26+
distribution: 'temurin'
27+
java-version: 21
2728
- name: Cache Maven packages
2829
uses: actions/cache@v4
2930
with:

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"java.configuration.runtimes": [
3+
{
4+
"name": "JavaSE-21",
5+
"path": "/etc/jdk21",
6+
"default": true
7+
}
8+
]
9+
}

README.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= Liferay Portal DB setup core
22
:liferay-version: 7.4.3.125
3-
:current-db-setup-core-version: 7.4.3125.0
3+
:current-db-setup-core-version: 7.4.3125.1
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]
@@ -15,6 +15,7 @@ Library that allows to automate https://github.com/liferay[Liferay] data setup.
1515
|Liferay Portal version|DB setup core version
1616

1717
|{liferay-version} |{current-db-setup-core-version} link:https://github.com/ableneo/liferay-db-setup-core/tree/master[source]
18+
|7.4.3.125 | 7.4.3125.1 link:https://central.sonatype.com/artifact/com.ableneo.liferay/com.ableneo.liferay.db.setup.core/7.4.3125.1[jar] link:https://github.com/ableneo/liferay-db-setup-core/tree/7.4.3125.1[source]
1819
|7.4.3.86 | 7.4.3861 link:https://central.sonatype.com/artifact/com.ableneo.liferay/com.ableneo.liferay.db.setup.core/7.4.3861[jar] link:https://github.com/ableneo/liferay-db-setup-core/tree/7.4.3861[source]
1920
|7.3.6 | 7.3.605 link:https://central.sonatype.com/artifact/com.ableneo.liferay/com.ableneo.liferay.db.setup.core/7.3.605[jar] link:https://github.com/ableneo/liferay-db-setup-core/tree/7.3.6[source]
2021
|7.3.6 | 7.3.605 link:https://central.sonatype.com/artifact/com.ableneo.liferay/com.ableneo.liferay.db.setup.core/7.3.605[jar] link:https://github.com/ableneo/liferay-db-setup-core/tree/7.3.6[source]
@@ -357,6 +358,10 @@ They are probably not perfect, please let me know if anything feels wrong or inc
357358

358359
== Changelog
359360

361+
=== Version 7.4.3125.1
362+
==== Features & bug fixes
363+
* fixed SetupArticles bug so it works with data definition json export
364+
360365
=== Version 7.4.3125.0
361366

362367
==== Features & bug fixes

pom.xml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,33 @@
5252
</pluginManagement>
5353

5454
<plugins>
55+
<plugin>
56+
<artifactId>maven-shade-plugin</artifactId>
57+
<version>3.6.0</version>
58+
<executions>
59+
<execution>
60+
<phase>package</phase>
61+
<goals>
62+
<goal>shade</goal>
63+
</goals>
64+
</execution>
65+
</executions>
66+
<configuration>
67+
<artifactSet>
68+
<includes>
69+
<include>com.liferay:com.liferay.journal.web</include>
70+
</includes>
71+
</artifactSet>
72+
<filters>
73+
<filter>
74+
<artifact>com.liferay:com.liferay.journal.web</artifact>
75+
<includes>
76+
<include>**/DataDefinitionUtil.class</include>
77+
</includes>
78+
</filter>
79+
</filters>
80+
</configuration>
81+
</plugin>
5582
<plugin>
5683
<groupId>org.apache.maven.plugins</groupId>
5784
<artifactId>maven-source-plugin</artifactId>
@@ -104,7 +131,6 @@
104131
<target>21</target>
105132
</configuration>
106133
</plugin>
107-
108134
<plugin>
109135
<groupId>org.codehaus.mojo</groupId>
110136
<artifactId>license-maven-plugin</artifactId>
@@ -238,7 +264,7 @@
238264
<artifactId>prettier-maven-plugin</artifactId>
239265
<version>0.21</version>
240266
<configuration>
241-
<prettierJavaVersion>2.5.0</prettierJavaVersion>
267+
<prettierJavaVersion>2.7.1</prettierJavaVersion>
242268
<printWidth>120</printWidth>
243269
<useTabs>false</useTabs>
244270
<tabWidth>4</tabWidth>
@@ -273,6 +299,15 @@
273299
</execution>
274300
</executions>
275301
</plugin>
302+
<plugin>
303+
<groupId>org.apache.maven.plugins</groupId>
304+
<artifactId>maven-compiler-plugin</artifactId>
305+
<configuration>
306+
<source>21</source>
307+
<target>21</target>
308+
<compilerArgs>--enable-preview</compilerArgs>
309+
</configuration>
310+
</plugin>
276311

277312
</plugins>
278313
</build>
@@ -313,6 +348,11 @@
313348
</dependencies>
314349
</dependencyManagement>
315350
<dependencies>
351+
<dependency>
352+
<groupId>com.liferay</groupId>
353+
<artifactId>com.liferay.journal.web</artifactId>
354+
<version>5.0.191</version>
355+
</dependency>
316356
<!-- TODO remove debug deps start -->
317357
<dependency>
318358
<groupId>com.liferay</groupId>

src/main/java/com/ableneo/liferay/portal/setup/LiferaySetup.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
import java.io.InputStream;
3333
import java.util.List;
3434
import java.util.Locale;
35-
3635
import org.osgi.framework.Bundle;
3736
import org.slf4j.Logger;
3837
import org.slf4j.LoggerFactory;
3938

4039
public final class LiferaySetup {
40+
4141
private static final Logger LOG = LoggerFactory.getLogger(LiferaySetup.class);
4242

4343
private LiferaySetup() {}
@@ -127,7 +127,13 @@ public static boolean setup(final Setup setup, Bundle callerBundle) {
127127
}
128128
}
129129
} else {
130-
setupCompany(setup, callerBundle, SetupConfigurationThreadLocal.getRunInCompanyId(), null, runAsUserEmail);
130+
setupCompany(
131+
setup,
132+
callerBundle,
133+
SetupConfigurationThreadLocal.getRunInCompanyId(),
134+
null,
135+
runAsUserEmail
136+
);
131137
}
132138
} catch (PortalException | RuntimeException e) {
133139
LOG.error("An error occured while executing the portal setup", e);
@@ -142,7 +148,13 @@ public static boolean setup(final Setup setup, Bundle callerBundle) {
142148
return true;
143149
}
144150

145-
private static void setupCompany(Setup setup, Bundle callerBundle, long companyId, String groupName, String runAsUserEmail) throws PortalException {
151+
private static void setupCompany(
152+
Setup setup,
153+
Bundle callerBundle,
154+
long companyId,
155+
String groupName,
156+
String runAsUserEmail
157+
) throws PortalException {
146158
SetupConfigurationThreadLocal.configureThreadLocalContent(runAsUserEmail, companyId, callerBundle);
147159
executeSetupConfiguration(setup);
148160

@@ -163,8 +175,7 @@ private static void setupCompany(Setup setup, Bundle callerBundle, long companyI
163175
}
164176
}
165177

166-
private static void setupGroup(Setup setup, long companyId, String groupName)
167-
throws PortalException {
178+
private static void setupGroup(Setup setup, long companyId, String groupName) throws PortalException {
168179
Group group = GroupLocalServiceUtil.getGroup(companyId, groupName);
169180
SetupConfigurationThreadLocal.setRunInGroupId(group.getGroupId());
170181
setupPortalGroup(setup);

src/main/java/com/ableneo/liferay/portal/setup/MarshallUtil.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import com.ableneo.liferay.portal.setup.domain.ObjectFactory;
44
import com.ableneo.liferay.portal.setup.domain.Setup;
55
import com.liferay.petra.string.StringPool;
6-
import org.slf4j.Logger;
7-
import org.slf4j.LoggerFactory;
8-
import org.xml.sax.InputSource;
9-
import org.xml.sax.SAXException;
10-
import org.xml.sax.XMLReader;
11-
6+
import java.io.File;
7+
import java.io.FileInputStream;
8+
import java.io.FileNotFoundException;
9+
import java.io.IOException;
10+
import java.io.InputStream;
11+
import java.io.OutputStream;
1212
import javax.xml.XMLConstants;
1313
import javax.xml.bind.JAXBContext;
1414
import javax.xml.bind.JAXBException;
@@ -21,14 +21,14 @@
2121
import javax.xml.validation.Schema;
2222
import javax.xml.validation.SchemaFactory;
2323
import javax.xml.validation.Validator;
24-
import java.io.File;
25-
import java.io.FileInputStream;
26-
import java.io.FileNotFoundException;
27-
import java.io.IOException;
28-
import java.io.InputStream;
29-
import java.io.OutputStream;
24+
import org.slf4j.Logger;
25+
import org.slf4j.LoggerFactory;
26+
import org.xml.sax.InputSource;
27+
import org.xml.sax.SAXException;
28+
import org.xml.sax.XMLReader;
3029

3130
public final class MarshallUtil {
31+
3232
private static final Logger LOG = LoggerFactory.getLogger(MarshallUtil.class);
3333

3434
private static final SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -93,11 +93,9 @@ public static void toXmlStream(Setup setup, OutputStream os) {
9393
Marshaller m = getMarshaller();
9494
try {
9595
if (MarshallUtil.skipValidate) {
96-
m.setEventHandler(
97-
event -> {
98-
return true; //all-valid
99-
}
100-
);
96+
m.setEventHandler(event -> {
97+
return true; //all-valid
98+
});
10199
}
102100
m.marshal(setup, os);
103101
} catch (JAXBException e) {

src/main/java/com/ableneo/liferay/portal/setup/SetupConfigurationThreadLocal.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
import java.util.List;
2222
import java.util.Locale;
2323
import java.util.Objects;
24-
2524
import org.osgi.framework.Bundle;
2625
import org.slf4j.Logger;
2726
import org.slf4j.LoggerFactory;
2827

2928
public final class SetupConfigurationThreadLocal {
29+
3030
private static final Logger LOG = LoggerFactory.getLogger(SetupConfigurationThreadLocal.class);
3131

3232
private static final ThreadLocal<Long> _runAsUserId = new CentralizedThreadLocal<>(
@@ -50,9 +50,10 @@ public final class SetupConfigurationThreadLocal {
5050
SetupConfigurationThreadLocal.class + "._runInGroupId",
5151
() -> {
5252
try {
53-
return GroupLocalServiceUtil
54-
.getGroup(PortalUtil.getDefaultCompanyId(), GroupConstants.GUEST)
55-
.getGroupId();
53+
return GroupLocalServiceUtil.getGroup(
54+
PortalUtil.getDefaultCompanyId(),
55+
GroupConstants.GUEST
56+
).getGroupId();
5657
} catch (PortalException e) {
5758
LOG.error("Failed to get Guest group id for default company", e);
5859
}
@@ -128,13 +129,13 @@ public static void cleanUp(
128129
static void configureThreadLocalContent(String runAsUserEmail, long companyId, Group group) throws PortalException {
129130
Objects.requireNonNull(group);
130131
configureGroupExecutionContext(group);
131-
configureThreadLocalContent(runAsUserEmail, companyId, (Bundle)null);
132+
configureThreadLocalContent(runAsUserEmail, companyId, (Bundle) null);
132133
}
133134

134135
public static void configureGroupExecutionContext(Group group) {
135136
Objects.requireNonNull(group);
136137
setRunInGroupId(group.getGroupId());
137-
LocaleThreadLocal.setDefaultLocale(Locale.forLanguageTag(group.getDefaultLanguageId().replace('_','-')));
138+
LocaleThreadLocal.setDefaultLocale(Locale.forLanguageTag(group.getDefaultLanguageId().replace('_', '-')));
138139
}
139140

140141
/**
@@ -147,7 +148,8 @@ public static void configureGroupExecutionContext(Group group) {
147148
* @throws PortalException user was not found, breaks the setup execution, we presume that if user email was
148149
* provided it is important to set up data as the user e.g. for easier cleanup
149150
*/
150-
static void configureThreadLocalContent(String runAsUserEmail, long companyId, Bundle callerBundle) throws PortalException {
151+
static void configureThreadLocalContent(String runAsUserEmail, long companyId, Bundle callerBundle)
152+
throws PortalException {
151153
if (Validator.isBlank(runAsUserEmail)) {
152154
setRunInCompanyId(companyId);
153155
setCallerBundle(callerBundle);
@@ -201,5 +203,4 @@ private static User getRandomAdminUser() {
201203
throw new IllegalStateException("Cannot obtain Liferay role for role name: " + administratorRoleName, e);
202204
}
203205
}
204-
205206
}

0 commit comments

Comments
 (0)