Skip to content

Commit 382f0d9

Browse files
committed
chore: reformat codebase with mvn prettier:write
1 parent fdfe1b5 commit 382f0d9

37 files changed

+754
-448
lines changed

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)