From 589200d2dac6eb7d92172dcf346cd1428f018725 Mon Sep 17 00:00:00 2001 From: Selena Aungst Date: Fri, 20 Sep 2024 17:50:15 -0700 Subject: [PATCH 01/15] LPD-35068 Add themeId to style-book-service --- modules/apps/style-book/style-book-service/service.xml | 1 + .../book/service/impl/StyleBookEntryLocalServiceImpl.java | 2 +- .../book/service/impl/StyleBookEntryServiceImpl.java | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/apps/style-book/style-book-service/service.xml b/modules/apps/style-book/style-book-service/service.xml index 6b2c3035feff05..225bebc5ab8b18 100644 --- a/modules/apps/style-book/style-book-service/service.xml +++ b/modules/apps/style-book/style-book-service/service.xml @@ -28,6 +28,7 @@ + diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java index 0d5185f25e48a1..055901faf57c08 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java @@ -52,7 +52,7 @@ public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, String name, String styleBookEntryKey, - ServiceContext serviceContext) + ServiceContext serviceContext, String themeId) throws PortalException { User user = _userLocalService.getUser(userId); diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java index a3905265ccd7e8..2a2545596ace0f 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java @@ -43,14 +43,15 @@ public StyleBookEntry addStyleBookEntry( return styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, getUserId(), groupId, false, - StringPool.BLANK, name, styleBookEntryKey, serviceContext); + StringPool.BLANK, name, styleBookEntryKey, serviceContext, + StringPool.BLANK); } @Override public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - ServiceContext serviceContext) + ServiceContext serviceContext, String themeId) throws PortalException { _portletResourcePermission.check( @@ -59,7 +60,8 @@ public StyleBookEntry addStyleBookEntry( return styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, getUserId(), groupId, false, - frontendTokensValues, name, styleBookEntryKey, serviceContext); + frontendTokensValues, name, styleBookEntryKey, serviceContext, + themeId); } @Override From 6fb88515c96602698c0704e60354c5ada06f7664 Mon Sep 17 00:00:00 2001 From: Selena Aungst Date: Mon, 23 Sep 2024 17:50:07 -0700 Subject: [PATCH 02/15] LPD-35068 buildService # breaking ## What modules/apps/style-book/style-book-service/service.xml Added themeId and themeName to modules/apps/style-book/style-book-service/service.xml ## Why To allow the user to choose a token definition for a new Style Book to be based on. These changes were added and the bundle version was updated by buildService in style-book-api/bnd.bnd. ---- --- .../apps/style-book/style-book-api/bnd.bnd | 2 +- .../style/book/model/StyleBookEntryModel.java | 15 ++++++ .../style/book/model/StyleBookEntryTable.java | 2 + .../model/StyleBookEntryVersionModel.java | 15 ++++++ .../model/StyleBookEntryVersionTable.java | 3 ++ .../model/StyleBookEntryVersionWrapper.java | 27 +++++++++++ .../book/model/StyleBookEntryWrapper.java | 27 +++++++++++ .../service/StyleBookEntryLocalService.java | 2 +- .../StyleBookEntryLocalServiceUtil.java | 6 ++- .../StyleBookEntryLocalServiceWrapper.java | 6 ++- .../book/service/StyleBookEntryService.java | 2 +- .../service/StyleBookEntryServiceUtil.java | 5 +- .../service/StyleBookEntryServiceWrapper.java | 5 +- .../model/impl/StyleBookEntryCacheModel.java | 20 +++++++- .../model/impl/StyleBookEntryModelImpl.java | 45 +++++++++++++++++- .../impl/StyleBookEntryVersionCacheModel.java | 20 +++++++- .../impl/StyleBookEntryVersionModelImpl.java | 46 ++++++++++++++++++- .../StyleBookEntryLocalServiceBaseImpl.java | 1 + .../http/StyleBookEntryServiceHttp.java | 7 +-- .../impl/StyleBookEntryPersistenceImpl.java | 1 + .../StyleBookEntryVersionPersistenceImpl.java | 1 + .../main/resources/META-INF/module-hbm.xml | 2 + .../META-INF/portlet-model-hints.xml | 2 + .../main/resources/META-INF/sql/tables.sql | 2 + .../test/StyleBookEntryPersistenceTest.java | 15 +++++- .../StyleBookEntryVersionPersistenceTest.java | 9 +++- 26 files changed, 266 insertions(+), 22 deletions(-) diff --git a/modules/apps/style-book/style-book-api/bnd.bnd b/modules/apps/style-book/style-book-api/bnd.bnd index e7244ec8af2294..4d2c7b6b7651ee 100644 --- a/modules/apps/style-book/style-book-api/bnd.bnd +++ b/modules/apps/style-book/style-book-api/bnd.bnd @@ -1,6 +1,6 @@ Bundle-Name: Liferay Style Book API Bundle-SymbolicName: com.liferay.style.book.api -Bundle-Version: 8.0.1 +Bundle-Version: 9.0.0 Export-Package:\ com.liferay.style.book.constants,\ com.liferay.style.book.exception,\ diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryModel.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryModel.java index 27087920136c93..8fdc44048139b0 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryModel.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryModel.java @@ -347,6 +347,21 @@ public interface StyleBookEntryModel */ public void setStyleBookEntryKey(String styleBookEntryKey); + /** + * Returns the theme ID of this style book entry. + * + * @return the theme ID of this style book entry + */ + @AutoEscape + public String getThemeId(); + + /** + * Sets the theme ID of this style book entry. + * + * @param themeId the theme ID of this style book entry + */ + public void setThemeId(String themeId); + @Override public StyleBookEntry cloneWithOriginalValues(); diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryTable.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryTable.java index cea36460bc85fc..f01596904d4c84 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryTable.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryTable.java @@ -73,6 +73,8 @@ public class StyleBookEntryTable extends BaseTable { createColumn( "styleBookEntryKey", String.class, Types.VARCHAR, Column.FLAG_DEFAULT); + public final Column themeId = createColumn( + "themeId", String.class, Types.VARCHAR, Column.FLAG_DEFAULT); private StyleBookEntryTable() { super("StyleBookEntry", StyleBookEntryTable::new); diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionModel.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionModel.java index 9be607cf7f58da..432a35d84b0ad8 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionModel.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionModel.java @@ -358,6 +358,21 @@ public interface StyleBookEntryVersionModel */ public void setStyleBookEntryKey(String styleBookEntryKey); + /** + * Returns the theme ID of this style book entry version. + * + * @return the theme ID of this style book entry version + */ + @AutoEscape + public String getThemeId(); + + /** + * Sets the theme ID of this style book entry version. + * + * @param themeId the theme ID of this style book entry version + */ + public void setThemeId(String themeId); + @Override public StyleBookEntryVersion cloneWithOriginalValues(); diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionTable.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionTable.java index e26dafd75ed187..bc8a45b2fabdfb 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionTable.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionTable.java @@ -82,6 +82,9 @@ public class StyleBookEntryVersionTable createColumn( "styleBookEntryKey", String.class, Types.VARCHAR, Column.FLAG_DEFAULT); + public final Column themeId = + createColumn( + "themeId", String.class, Types.VARCHAR, Column.FLAG_DEFAULT); private StyleBookEntryVersionTable() { super("StyleBookEntryVersion", StyleBookEntryVersionTable::new); diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionWrapper.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionWrapper.java index cba52248abbb21..9c7337df7beb21 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionWrapper.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryVersionWrapper.java @@ -55,6 +55,7 @@ public Map getModelAttributes() { attributes.put("name", getName()); attributes.put("previewFileEntryId", getPreviewFileEntryId()); attributes.put("styleBookEntryKey", getStyleBookEntryKey()); + attributes.put("themeId", getThemeId()); return attributes; } @@ -172,6 +173,12 @@ public void setModelAttributes(Map attributes) { if (styleBookEntryKey != null) { setStyleBookEntryKey(styleBookEntryKey); } + + String themeId = (String)attributes.get("themeId"); + + if (themeId != null) { + setThemeId(themeId); + } } @Override @@ -329,6 +336,16 @@ public long getStyleBookEntryVersionId() { return model.getStyleBookEntryVersionId(); } + /** + * Returns the theme ID of this style book entry version. + * + * @return the theme ID of this style book entry version + */ + @Override + public String getThemeId() { + return model.getThemeId(); + } + /** * Returns the user ID of this style book entry version. * @@ -539,6 +556,16 @@ public void setStyleBookEntryVersionId(long styleBookEntryVersionId) { model.setStyleBookEntryVersionId(styleBookEntryVersionId); } + /** + * Sets the theme ID of this style book entry version. + * + * @param themeId the theme ID of this style book entry version + */ + @Override + public void setThemeId(String themeId) { + model.setThemeId(themeId); + } + /** * Sets the user ID of this style book entry version. * diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryWrapper.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryWrapper.java index 062f62ded3aa08..3bf8b87ffeab3c 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryWrapper.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/model/StyleBookEntryWrapper.java @@ -53,6 +53,7 @@ public Map getModelAttributes() { attributes.put("name", getName()); attributes.put("previewFileEntryId", getPreviewFileEntryId()); attributes.put("styleBookEntryKey", getStyleBookEntryKey()); + attributes.put("themeId", getThemeId()); return attributes; } @@ -163,6 +164,12 @@ public void setModelAttributes(Map attributes) { if (styleBookEntryKey != null) { setStyleBookEntryKey(styleBookEntryKey); } + + String themeId = (String)attributes.get("themeId"); + + if (themeId != null) { + setThemeId(themeId); + } } @Override @@ -327,6 +334,16 @@ public String getStyleBookEntryKey() { return model.getStyleBookEntryKey(); } + /** + * Returns the theme ID of this style book entry. + * + * @return the theme ID of this style book entry + */ + @Override + public String getThemeId() { + return model.getThemeId(); + } + /** * Returns the user ID of this style book entry. * @@ -540,6 +557,16 @@ public void setStyleBookEntryKey(String styleBookEntryKey) { model.setStyleBookEntryKey(styleBookEntryKey); } + /** + * Sets the theme ID of this style book entry. + * + * @param themeId the theme ID of this style book entry + */ + @Override + public void setThemeId(String themeId) { + model.setThemeId(themeId); + } + /** * Sets the user ID of this style book entry. * diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalService.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalService.java index 4b9fa7c62facb1..dd88d3f2809d15 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalService.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalService.java @@ -69,7 +69,7 @@ public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, String name, String styleBookEntryKey, - ServiceContext serviceContext) + ServiceContext serviceContext, String themeId) throws PortalException; /** diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceUtil.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceUtil.java index bac01f57a74d13..a4d33c74dcfbca 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceUtil.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceUtil.java @@ -40,12 +40,14 @@ public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext) + com.liferay.portal.kernel.service.ServiceContext serviceContext, + String themeId) throws PortalException { return getService().addStyleBookEntry( externalReferenceCode, userId, groupId, defaultStyleBookEntry, - frontendTokensValues, name, styleBookEntryKey, serviceContext); + frontendTokensValues, name, styleBookEntryKey, serviceContext, + themeId); } /** diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceWrapper.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceWrapper.java index 8f818e3f75bcc8..1d3fa7aab372ea 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceWrapper.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceWrapper.java @@ -37,12 +37,14 @@ public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext) + com.liferay.portal.kernel.service.ServiceContext serviceContext, + String themeId) throws com.liferay.portal.kernel.exception.PortalException { return _styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, userId, groupId, defaultStyleBookEntry, - frontendTokensValues, name, styleBookEntryKey, serviceContext); + frontendTokensValues, name, styleBookEntryKey, serviceContext, + themeId); } /** diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java index 9c2e112bfdc678..9df95f598f9422 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java @@ -51,7 +51,7 @@ public StyleBookEntry addStyleBookEntry( public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - ServiceContext serviceContext) + ServiceContext serviceContext, String themeId) throws PortalException; public StyleBookEntry copyStyleBookEntry( diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java index 2f90a4daee8332..171c731a7dadd7 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java @@ -42,12 +42,13 @@ public static StyleBookEntry addStyleBookEntry( public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext) + com.liferay.portal.kernel.service.ServiceContext serviceContext, + String themeId) throws PortalException { return getService().addStyleBookEntry( externalReferenceCode, groupId, frontendTokensValues, name, - styleBookEntryKey, serviceContext); + styleBookEntryKey, serviceContext, themeId); } public static StyleBookEntry copyStyleBookEntry( diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java index 1a4f09c11a3c03..2809ef691b0097 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java @@ -44,12 +44,13 @@ public StyleBookEntry addStyleBookEntry( public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext) + com.liferay.portal.kernel.service.ServiceContext serviceContext, + String themeId) throws com.liferay.portal.kernel.exception.PortalException { return _styleBookEntryService.addStyleBookEntry( externalReferenceCode, groupId, frontendTokensValues, name, - styleBookEntryKey, serviceContext); + styleBookEntryKey, serviceContext, themeId); } @Override diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryCacheModel.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryCacheModel.java index 89e4d525bbb681..8558628388d5dc 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryCacheModel.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryCacheModel.java @@ -68,7 +68,7 @@ public void setMvccVersion(long mvccVersion) { @Override public String toString() { - StringBundler sb = new StringBundler(35); + StringBundler sb = new StringBundler(37); sb.append("{mvccVersion="); sb.append(mvccVersion); @@ -104,6 +104,8 @@ public String toString() { sb.append(previewFileEntryId); sb.append(", styleBookEntryKey="); sb.append(styleBookEntryKey); + sb.append(", themeId="); + sb.append(themeId); sb.append("}"); return sb.toString(); @@ -183,6 +185,13 @@ public StyleBookEntry toEntityModel() { styleBookEntryImpl.setStyleBookEntryKey(styleBookEntryKey); } + if (themeId == null) { + styleBookEntryImpl.setThemeId(""); + } + else { + styleBookEntryImpl.setThemeId(themeId); + } + styleBookEntryImpl.resetOriginalValues(); return styleBookEntryImpl; @@ -219,6 +228,7 @@ public void readExternal(ObjectInput objectInput) previewFileEntryId = objectInput.readLong(); styleBookEntryKey = objectInput.readUTF(); + themeId = objectInput.readUTF(); } @Override @@ -287,6 +297,13 @@ public void writeExternal(ObjectOutput objectOutput) throws IOException { else { objectOutput.writeUTF(styleBookEntryKey); } + + if (themeId == null) { + objectOutput.writeUTF(""); + } + else { + objectOutput.writeUTF(themeId); + } } public long mvccVersion; @@ -307,5 +324,6 @@ public void writeExternal(ObjectOutput objectOutput) throws IOException { public String name; public long previewFileEntryId; public String styleBookEntryKey; + public String themeId; } \ No newline at end of file diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryModelImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryModelImpl.java index 7342710bd168ba..d59219fa6ba820 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryModelImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryModelImpl.java @@ -76,7 +76,7 @@ public class StyleBookEntryModelImpl {"defaultStyleBookEntry", Types.BOOLEAN}, {"frontendTokensValues", Types.CLOB}, {"name", Types.VARCHAR}, {"previewFileEntryId", Types.BIGINT}, - {"styleBookEntryKey", Types.VARCHAR} + {"styleBookEntryKey", Types.VARCHAR}, {"themeId", Types.VARCHAR} }; public static final Map TABLE_COLUMNS_MAP = @@ -101,10 +101,11 @@ public class StyleBookEntryModelImpl TABLE_COLUMNS_MAP.put("name", Types.VARCHAR); TABLE_COLUMNS_MAP.put("previewFileEntryId", Types.BIGINT); TABLE_COLUMNS_MAP.put("styleBookEntryKey", Types.VARCHAR); + TABLE_COLUMNS_MAP.put("themeId", Types.VARCHAR); } public static final String TABLE_SQL_CREATE = - "create table StyleBookEntry (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,headId LONG,head BOOLEAN,styleBookEntryId LONG not null,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultStyleBookEntry BOOLEAN,frontendTokensValues TEXT null,name VARCHAR(75) null,previewFileEntryId LONG,styleBookEntryKey VARCHAR(75) null,primary key (styleBookEntryId, ctCollectionId))"; + "create table StyleBookEntry (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,headId LONG,head BOOLEAN,styleBookEntryId LONG not null,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultStyleBookEntry BOOLEAN,frontendTokensValues TEXT null,name VARCHAR(75) null,previewFileEntryId LONG,styleBookEntryKey VARCHAR(75) null,themeId VARCHAR(75) null,primary key (styleBookEntryId, ctCollectionId))"; public static final String TABLE_SQL_DROP = "drop table StyleBookEntry"; @@ -323,6 +324,7 @@ private static class AttributeGetterFunctionsHolder { "previewFileEntryId", StyleBookEntry::getPreviewFileEntryId); attributeGetterFunctions.put( "styleBookEntryKey", StyleBookEntry::getStyleBookEntryKey); + attributeGetterFunctions.put("themeId", StyleBookEntry::getThemeId); _attributeGetterFunctions = Collections.unmodifiableMap( attributeGetterFunctions); @@ -402,6 +404,9 @@ private static class AttributeSetterBiConsumersHolder { "styleBookEntryKey", (BiConsumer) StyleBookEntry::setStyleBookEntryKey); + attributeSetterBiConsumers.put( + "themeId", + (BiConsumer)StyleBookEntry::setThemeId); _attributeSetterBiConsumers = Collections.unmodifiableMap( (Map)attributeSetterBiConsumers); @@ -430,6 +435,7 @@ public void populateVersionModel( styleBookEntryVersion.setName(getName()); styleBookEntryVersion.setPreviewFileEntryId(getPreviewFileEntryId()); styleBookEntryVersion.setStyleBookEntryKey(getStyleBookEntryKey()); + styleBookEntryVersion.setThemeId(getThemeId()); } @JSON @@ -854,6 +860,26 @@ public String getOriginalStyleBookEntryKey() { return getColumnOriginalValue("styleBookEntryKey"); } + @JSON + @Override + public String getThemeId() { + if (_themeId == null) { + return ""; + } + else { + return _themeId; + } + } + + @Override + public void setThemeId(String themeId) { + if (_columnOriginalValues == Collections.EMPTY_MAP) { + _setColumnOriginalValues(); + } + + _themeId = themeId; + } + @Override public StagedModelType getStagedModelType() { return new StagedModelType( @@ -933,6 +959,7 @@ public Object clone() { styleBookEntryImpl.setName(getName()); styleBookEntryImpl.setPreviewFileEntryId(getPreviewFileEntryId()); styleBookEntryImpl.setStyleBookEntryKey(getStyleBookEntryKey()); + styleBookEntryImpl.setThemeId(getThemeId()); styleBookEntryImpl.resetOriginalValues(); @@ -976,6 +1003,8 @@ public StyleBookEntry cloneWithOriginalValues() { this.getColumnOriginalValue("previewFileEntryId")); styleBookEntryImpl.setStyleBookEntryKey( this.getColumnOriginalValue("styleBookEntryKey")); + styleBookEntryImpl.setThemeId( + this.getColumnOriginalValue("themeId")); return styleBookEntryImpl; } @@ -1150,6 +1179,14 @@ public CacheModel toCacheModel() { styleBookEntryCacheModel.styleBookEntryKey = null; } + styleBookEntryCacheModel.themeId = getThemeId(); + + String themeId = styleBookEntryCacheModel.themeId; + + if ((themeId != null) && (themeId.length() == 0)) { + styleBookEntryCacheModel.themeId = null; + } + return styleBookEntryCacheModel; } @@ -1230,6 +1267,7 @@ private static class EscapedModelProxyProviderFunctionHolder { private String _name; private long _previewFileEntryId; private String _styleBookEntryKey; + private String _themeId; public T getColumnValue(String columnName) { if (columnName.equals("head")) { @@ -1286,6 +1324,7 @@ private void _setColumnOriginalValues() { _columnOriginalValues.put("name", _name); _columnOriginalValues.put("previewFileEntryId", _previewFileEntryId); _columnOriginalValues.put("styleBookEntryKey", _styleBookEntryKey); + _columnOriginalValues.put("themeId", _themeId); } private static final Map _attributeNames; @@ -1345,6 +1384,8 @@ public static long getColumnBitmask(String columnName) { columnBitmasks.put("styleBookEntryKey", 131072L); + columnBitmasks.put("themeId", 262144L); + _columnBitmasks = Collections.unmodifiableMap(columnBitmasks); } diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionCacheModel.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionCacheModel.java index abfd96146a50d5..44b16ed97772f6 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionCacheModel.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionCacheModel.java @@ -69,7 +69,7 @@ public void setMvccVersion(long mvccVersion) { @Override public String toString() { - StringBundler sb = new StringBundler(37); + StringBundler sb = new StringBundler(39); sb.append("{mvccVersion="); sb.append(mvccVersion); @@ -107,6 +107,8 @@ public String toString() { sb.append(previewFileEntryId); sb.append(", styleBookEntryKey="); sb.append(styleBookEntryKey); + sb.append(", themeId="); + sb.append(themeId); sb.append("}"); return sb.toString(); @@ -191,6 +193,13 @@ public StyleBookEntryVersion toEntityModel() { styleBookEntryVersionImpl.setStyleBookEntryKey(styleBookEntryKey); } + if (themeId == null) { + styleBookEntryVersionImpl.setThemeId(""); + } + else { + styleBookEntryVersionImpl.setThemeId(themeId); + } + styleBookEntryVersionImpl.resetOriginalValues(); return styleBookEntryVersionImpl; @@ -227,6 +236,7 @@ public void readExternal(ObjectInput objectInput) previewFileEntryId = objectInput.readLong(); styleBookEntryKey = objectInput.readUTF(); + themeId = objectInput.readUTF(); } @Override @@ -295,6 +305,13 @@ public void writeExternal(ObjectOutput objectOutput) throws IOException { else { objectOutput.writeUTF(styleBookEntryKey); } + + if (themeId == null) { + objectOutput.writeUTF(""); + } + else { + objectOutput.writeUTF(themeId); + } } public long mvccVersion; @@ -315,5 +332,6 @@ public void writeExternal(ObjectOutput objectOutput) throws IOException { public String name; public long previewFileEntryId; public String styleBookEntryKey; + public String themeId; } \ No newline at end of file diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionModelImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionModelImpl.java index 98de618c842582..c478aa919766e8 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionModelImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionModelImpl.java @@ -72,7 +72,7 @@ public class StyleBookEntryVersionModelImpl {"defaultStyleBookEntry", Types.BOOLEAN}, {"frontendTokensValues", Types.CLOB}, {"name", Types.VARCHAR}, {"previewFileEntryId", Types.BIGINT}, - {"styleBookEntryKey", Types.VARCHAR} + {"styleBookEntryKey", Types.VARCHAR}, {"themeId", Types.VARCHAR} }; public static final Map TABLE_COLUMNS_MAP = @@ -97,10 +97,11 @@ public class StyleBookEntryVersionModelImpl TABLE_COLUMNS_MAP.put("name", Types.VARCHAR); TABLE_COLUMNS_MAP.put("previewFileEntryId", Types.BIGINT); TABLE_COLUMNS_MAP.put("styleBookEntryKey", Types.VARCHAR); + TABLE_COLUMNS_MAP.put("themeId", Types.VARCHAR); } public static final String TABLE_SQL_CREATE = - "create table StyleBookEntryVersion (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,styleBookEntryVersionId LONG not null,version INTEGER,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,styleBookEntryId LONG,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultStyleBookEntry BOOLEAN,frontendTokensValues TEXT null,name VARCHAR(75) null,previewFileEntryId LONG,styleBookEntryKey VARCHAR(75) null,primary key (styleBookEntryVersionId, ctCollectionId))"; + "create table StyleBookEntryVersion (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,styleBookEntryVersionId LONG not null,version INTEGER,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,styleBookEntryId LONG,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultStyleBookEntry BOOLEAN,frontendTokensValues TEXT null,name VARCHAR(75) null,previewFileEntryId LONG,styleBookEntryKey VARCHAR(75) null,themeId VARCHAR(75) null,primary key (styleBookEntryVersionId, ctCollectionId))"; public static final String TABLE_SQL_DROP = "drop table StyleBookEntryVersion"; @@ -319,6 +320,8 @@ private static class AttributeGetterFunctionsHolder { attributeGetterFunctions.put( "styleBookEntryKey", StyleBookEntryVersion::getStyleBookEntryKey); + attributeGetterFunctions.put( + "themeId", StyleBookEntryVersion::getThemeId); _attributeGetterFunctions = Collections.unmodifiableMap( attributeGetterFunctions); @@ -410,6 +413,10 @@ private static class AttributeSetterBiConsumersHolder { "styleBookEntryKey", (BiConsumer) StyleBookEntryVersion::setStyleBookEntryKey); + attributeSetterBiConsumers.put( + "themeId", + (BiConsumer) + StyleBookEntryVersion::setThemeId); _attributeSetterBiConsumers = Collections.unmodifiableMap( (Map)attributeSetterBiConsumers); @@ -438,6 +445,7 @@ public void populateVersionedModel(StyleBookEntry styleBookEntry) { styleBookEntry.setName(getName()); styleBookEntry.setPreviewFileEntryId(getPreviewFileEntryId()); styleBookEntry.setStyleBookEntryKey(getStyleBookEntryKey()); + styleBookEntry.setThemeId(getThemeId()); } @Override @@ -842,6 +850,25 @@ public String getOriginalStyleBookEntryKey() { return getColumnOriginalValue("styleBookEntryKey"); } + @Override + public String getThemeId() { + if (_themeId == null) { + return ""; + } + else { + return _themeId; + } + } + + @Override + public void setThemeId(String themeId) { + if (_columnOriginalValues == Collections.EMPTY_MAP) { + _setColumnOriginalValues(); + } + + _themeId = themeId; + } + public long getColumnBitmask() { if (_columnBitmask > 0) { return _columnBitmask; @@ -923,6 +950,7 @@ public Object clone() { styleBookEntryVersionImpl.setPreviewFileEntryId( getPreviewFileEntryId()); styleBookEntryVersionImpl.setStyleBookEntryKey(getStyleBookEntryKey()); + styleBookEntryVersionImpl.setThemeId(getThemeId()); styleBookEntryVersionImpl.resetOriginalValues(); @@ -970,6 +998,8 @@ public StyleBookEntryVersion cloneWithOriginalValues() { this.getColumnOriginalValue("previewFileEntryId")); styleBookEntryVersionImpl.setStyleBookEntryKey( this.getColumnOriginalValue("styleBookEntryKey")); + styleBookEntryVersionImpl.setThemeId( + this.getColumnOriginalValue("themeId")); return styleBookEntryVersionImpl; } @@ -1158,6 +1188,14 @@ public CacheModel toCacheModel() { styleBookEntryVersionCacheModel.styleBookEntryKey = null; } + styleBookEntryVersionCacheModel.themeId = getThemeId(); + + String themeId = styleBookEntryVersionCacheModel.themeId; + + if ((themeId != null) && (themeId.length() == 0)) { + styleBookEntryVersionCacheModel.themeId = null; + } + return styleBookEntryVersionCacheModel; } @@ -1239,6 +1277,7 @@ private static class EscapedModelProxyProviderFunctionHolder { private String _name; private long _previewFileEntryId; private String _styleBookEntryKey; + private String _themeId; public T getColumnValue(String columnName) { columnName = _attributeNames.getOrDefault(columnName, columnName); @@ -1292,6 +1331,7 @@ private void _setColumnOriginalValues() { _columnOriginalValues.put("name", _name); _columnOriginalValues.put("previewFileEntryId", _previewFileEntryId); _columnOriginalValues.put("styleBookEntryKey", _styleBookEntryKey); + _columnOriginalValues.put("themeId", _themeId); } private static final Map _attributeNames; @@ -1351,6 +1391,8 @@ public static long getColumnBitmask(String columnName) { columnBitmasks.put("styleBookEntryKey", 131072L); + columnBitmasks.put("themeId", 262144L); + _columnBitmasks = Collections.unmodifiableMap(columnBitmasks); } diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/base/StyleBookEntryLocalServiceBaseImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/base/StyleBookEntryLocalServiceBaseImpl.java index 99205dae707536..792981fdc1b7bf 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/base/StyleBookEntryLocalServiceBaseImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/base/StyleBookEntryLocalServiceBaseImpl.java @@ -896,6 +896,7 @@ private StyleBookEntry _createDraft(StyleBookEntry publishedStyleBookEntry) publishedStyleBookEntry.getPreviewFileEntryId()); draftStyleBookEntry.setStyleBookEntryKey( publishedStyleBookEntry.getStyleBookEntryKey()); + draftStyleBookEntry.setThemeId(publishedStyleBookEntry.getThemeId()); draftStyleBookEntry.resetOriginalValues(); diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java index 5292432f559da7..55c9ca99dc3abc 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java @@ -88,7 +88,8 @@ public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( HttpPrincipal httpPrincipal, String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext) + com.liferay.portal.kernel.service.ServiceContext serviceContext, + String themeId) throws com.liferay.portal.kernel.exception.PortalException { try { @@ -98,7 +99,7 @@ public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( MethodHandler methodHandler = new MethodHandler( methodKey, externalReferenceCode, groupId, frontendTokensValues, - name, styleBookEntryKey, serviceContext); + name, styleBookEntryKey, serviceContext, themeId); Object returnObj = null; @@ -639,7 +640,7 @@ public static com.liferay.style.book.model.StyleBookEntry updateName( private static final Class[] _addStyleBookEntryParameterTypes1 = new Class[] { String.class, long.class, String.class, String.class, String.class, - com.liferay.portal.kernel.service.ServiceContext.class + com.liferay.portal.kernel.service.ServiceContext.class, String.class }; private static final Class[] _copyStyleBookEntryParameterTypes2 = new Class[] { diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/persistence/impl/StyleBookEntryPersistenceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/persistence/impl/StyleBookEntryPersistenceImpl.java index 74343dd699ded0..2c8f7ceb909395 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/persistence/impl/StyleBookEntryPersistenceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/persistence/impl/StyleBookEntryPersistenceImpl.java @@ -9697,6 +9697,7 @@ public List getUniqueIndexColumnNames() { ctStrictColumnNames.add("name"); ctStrictColumnNames.add("previewFileEntryId"); ctStrictColumnNames.add("styleBookEntryKey"); + ctStrictColumnNames.add("themeId"); _ctColumnNamesMap.put( CTColumnResolutionType.CONTROL, ctControlColumnNames); diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/persistence/impl/StyleBookEntryVersionPersistenceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/persistence/impl/StyleBookEntryVersionPersistenceImpl.java index 2ecb57892fc1e5..90990f4fb1f6c8 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/persistence/impl/StyleBookEntryVersionPersistenceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/persistence/impl/StyleBookEntryVersionPersistenceImpl.java @@ -9451,6 +9451,7 @@ public List getUniqueIndexColumnNames() { ctStrictColumnNames.add("name"); ctStrictColumnNames.add("previewFileEntryId"); ctStrictColumnNames.add("styleBookEntryKey"); + ctStrictColumnNames.add("themeId"); _ctColumnNamesMap.put( CTColumnResolutionType.CONTROL, ctControlColumnNames); diff --git a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/module-hbm.xml b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/module-hbm.xml index 4f1932807c4a6c..6262f80340602b 100644 --- a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/module-hbm.xml +++ b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/module-hbm.xml @@ -25,6 +25,7 @@ + @@ -47,5 +48,6 @@ + \ No newline at end of file diff --git a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/portlet-model-hints.xml b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/portlet-model-hints.xml index e91565bff2812a..84f95201916c06 100644 --- a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/portlet-model-hints.xml +++ b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/portlet-model-hints.xml @@ -21,6 +21,7 @@ + @@ -43,5 +44,6 @@ + \ No newline at end of file diff --git a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/sql/tables.sql b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/sql/tables.sql index 4529029ec782db..aee332765c94c7 100644 --- a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/sql/tables.sql +++ b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/sql/tables.sql @@ -17,6 +17,7 @@ create table StyleBookEntry ( name VARCHAR(75) null, previewFileEntryId LONG, styleBookEntryKey VARCHAR(75) null, + themeId VARCHAR(75) null, primary key (styleBookEntryId, ctCollectionId) ); @@ -39,5 +40,6 @@ create table StyleBookEntryVersion ( name VARCHAR(75) null, previewFileEntryId LONG, styleBookEntryKey VARCHAR(75) null, + themeId VARCHAR(75) null, primary key (styleBookEntryVersionId, ctCollectionId) ); \ No newline at end of file diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/persistence/test/StyleBookEntryPersistenceTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/persistence/test/StyleBookEntryPersistenceTest.java index 2d9d4c28c526b8..841c46e0c8f084 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/persistence/test/StyleBookEntryPersistenceTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/persistence/test/StyleBookEntryPersistenceTest.java @@ -151,6 +151,8 @@ public void testUpdateExisting() throws Exception { newStyleBookEntry.setStyleBookEntryKey(RandomTestUtil.randomString()); + newStyleBookEntry.setThemeId(RandomTestUtil.randomString()); + _styleBookEntries.add(_persistence.update(newStyleBookEntry)); StyleBookEntry existingStyleBookEntry = _persistence.findByPrimaryKey( @@ -203,6 +205,9 @@ public void testUpdateExisting() throws Exception { Assert.assertEquals( existingStyleBookEntry.getStyleBookEntryKey(), newStyleBookEntry.getStyleBookEntryKey()); + Assert.assertEquals( + existingStyleBookEntry.getThemeId(), + newStyleBookEntry.getThemeId()); } @Test @@ -235,6 +240,7 @@ public void testCreateDraft() throws Exception { styleBookEntry.getPreviewFileEntryId()); draftStyleBookEntry.setStyleBookEntryKey( styleBookEntry.getStyleBookEntryKey()); + draftStyleBookEntry.setThemeId(styleBookEntry.getThemeId()); _styleBookEntries.add(_persistence.update(draftStyleBookEntry)); @@ -279,6 +285,8 @@ public void testCreateDraft() throws Exception { Assert.assertEquals( styleBookEntry.getStyleBookEntryKey(), draftStyleBookEntry.getStyleBookEntryKey()); + Assert.assertEquals( + styleBookEntry.getThemeId(), draftStyleBookEntry.getThemeId()); } @Test( @@ -327,6 +335,8 @@ public void testCreateWithExistingExternalReferenceCodeHead() styleBookEntry2.setStyleBookEntryKey(RandomTestUtil.randomString()); + styleBookEntry2.setThemeId(RandomTestUtil.randomString()); + _styleBookEntries.add(_persistence.update(styleBookEntry2)); } @@ -546,7 +556,8 @@ protected OrderByComparator getOrderByComparator() { "styleBookEntryId", true, "groupId", true, "companyId", true, "userId", true, "userName", true, "createDate", true, "modifiedDate", true, "defaultStyleBookEntry", true, "name", true, - "previewFileEntryId", true, "styleBookEntryKey", true); + "previewFileEntryId", true, "styleBookEntryKey", true, "themeId", + true); } @Test @@ -891,6 +902,8 @@ protected StyleBookEntry addStyleBookEntry() throws Exception { styleBookEntry.setStyleBookEntryKey(RandomTestUtil.randomString()); + styleBookEntry.setThemeId(RandomTestUtil.randomString()); + _styleBookEntries.add(_persistence.update(styleBookEntry)); return styleBookEntry; diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/persistence/test/StyleBookEntryVersionPersistenceTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/persistence/test/StyleBookEntryVersionPersistenceTest.java index f6dd4788a6fbf7..6aef060688b801 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/persistence/test/StyleBookEntryVersionPersistenceTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/persistence/test/StyleBookEntryVersionPersistenceTest.java @@ -155,6 +155,8 @@ public void testUpdateExisting() throws Exception { newStyleBookEntryVersion.setStyleBookEntryKey( RandomTestUtil.randomString()); + newStyleBookEntryVersion.setThemeId(RandomTestUtil.randomString()); + _styleBookEntryVersions.add( _persistence.update(newStyleBookEntryVersion)); @@ -218,6 +220,9 @@ public void testUpdateExisting() throws Exception { Assert.assertEquals( existingStyleBookEntryVersion.getStyleBookEntryKey(), newStyleBookEntryVersion.getStyleBookEntryKey()); + Assert.assertEquals( + existingStyleBookEntryVersion.getThemeId(), + newStyleBookEntryVersion.getThemeId()); } @Test @@ -395,7 +400,7 @@ protected OrderByComparator getOrderByComparator() { "groupId", true, "companyId", true, "userId", true, "userName", true, "createDate", true, "modifiedDate", true, "defaultStyleBookEntry", true, "name", true, "previewFileEntryId", - true, "styleBookEntryKey", true); + true, "styleBookEntryKey", true, "themeId", true); } @Test @@ -753,6 +758,8 @@ protected StyleBookEntryVersion addStyleBookEntryVersion() styleBookEntryVersion.setStyleBookEntryKey( RandomTestUtil.randomString()); + styleBookEntryVersion.setThemeId(RandomTestUtil.randomString()); + _styleBookEntryVersions.add(_persistence.update(styleBookEntryVersion)); return styleBookEntryVersion; From 20d29d374aca9a3451c120e8457381da3fc25cd1 Mon Sep 17 00:00:00 2001 From: Selena Aungst Date: Fri, 13 Sep 2024 13:16:05 -0700 Subject: [PATCH 03/15] LPD-35068 Update LocalServiceImpl with themeId --- .../StylebookEntryStagedModelRepository.java | 3 ++- .../service/impl/StyleBookEntryLocalServiceImpl.java | 4 +++- .../zip/processor/StyleBookEntryZipProcessorImpl.java | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/exportimport/staged/model/repository/StylebookEntryStagedModelRepository.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/exportimport/staged/model/repository/StylebookEntryStagedModelRepository.java index f96bb60bc0a80d..f37a1a499c4b45 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/exportimport/staged/model/repository/StylebookEntryStagedModelRepository.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/exportimport/staged/model/repository/StylebookEntryStagedModelRepository.java @@ -50,7 +50,8 @@ public StyleBookEntry addStagedModel( styleBookEntry.getGroupId(), styleBookEntry.isDefaultStyleBookEntry(), styleBookEntry.getFrontendTokensValues(), styleBookEntry.getName(), - styleBookEntry.getStyleBookEntryKey(), serviceContext); + styleBookEntry.getStyleBookEntryKey(), serviceContext, + styleBookEntry.getThemeId()); } @Override diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java index 055901faf57c08..f9b91a430f2fbc 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java @@ -95,6 +95,7 @@ public StyleBookEntry addStyleBookEntry( styleBookEntry.setFrontendTokensValues(frontendTokensValues); styleBookEntry.setName(name); styleBookEntry.setStyleBookEntryKey(styleBookEntryKey); + styleBookEntry.setThemeId(themeId); return publishDraft(styleBookEntry); } @@ -113,7 +114,8 @@ public StyleBookEntry copyStyleBookEntry( StyleBookEntry targetStyleBookEntry = addStyleBookEntry( null, userId, groupId, false, sourceStyleBookEntry.getFrontendTokensValues(), name, - StringPool.BLANK, serviceContext); + StringPool.BLANK, serviceContext, + sourceStyleBookEntry.getThemeId()); long previewFileEntryId = _copyStyleBookEntryPreviewFileEntry( userId, groupId, sourceStyleBookEntry, targetStyleBookEntry); diff --git a/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/zip/processor/StyleBookEntryZipProcessorImpl.java b/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/zip/processor/StyleBookEntryZipProcessorImpl.java index 96c77b7b350304..2d0a0b2987a664 100644 --- a/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/zip/processor/StyleBookEntryZipProcessorImpl.java +++ b/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/zip/processor/StyleBookEntryZipProcessorImpl.java @@ -106,7 +106,7 @@ public File exportStyleBookEntries(List styleBookEntries) private StyleBookEntry _addStyleBookEntry( long groupId, String frontendTokensValues, String name, - boolean overwrite, String styleBookEntryKey) + boolean overwrite, String styleBookEntryKey, String themeId) throws Exception { StyleBookEntry styleBookEntry = @@ -122,7 +122,7 @@ private StyleBookEntry _addStyleBookEntry( styleBookEntry = _styleBookEntryEntryService.addStyleBookEntry( null, groupId, frontendTokensValues, name, styleBookEntryKey, - ServiceContextThreadLocal.getServiceContext()); + ServiceContextThreadLocal.getServiceContext(), themeId); } else { styleBookEntry = @@ -304,6 +304,8 @@ private void _importStyleBookEntries( String styleBookEntryContent = _getContent(zipFile, fileName); + String themeId = StringPool.BLANK; + if (Validator.isNotNull(styleBookEntryContent)) { JSONObject styleBookEntryJSONObject = _jsonFactory.createJSONObject( styleBookEntryContent); @@ -314,10 +316,12 @@ private void _importStyleBookEntries( zipFile, fileName, styleBookEntryJSONObject.getString("frontendTokensValuesPath")); name = styleBookEntryJSONObject.getString("name"); + themeId = styleBookEntryJSONObject.getString("themeId"); } StyleBookEntry styleBookEntry = _addStyleBookEntry( - groupId, frontendTokensValues, name, overwrite, styleBookEntryKey); + groupId, frontendTokensValues, name, overwrite, styleBookEntryKey, + themeId); if (styleBookEntry == null) { return; From 844c3b483aaa9c56802c8edf847196b8374d1246 Mon Sep 17 00:00:00 2001 From: Selena Aungst Date: Thu, 12 Sep 2024 17:07:07 -0700 Subject: [PATCH 04/15] LPD-35068 Update tests --- .../test/LayoutStagedModelDataHandlerTest.java | 3 ++- .../test/EditLayoutDesignMVCActionCommandTest.java | 2 +- ...LayoutPageTemplateEntryMVCActionCommandTest.java | 3 ++- .../LayoutPageTemplateEntryLocalServiceTest.java | 2 +- .../StyleBookEntryTableReferenceDefinitionTest.java | 3 ++- ...ookEntryVersionTableReferenceDefinitionTest.java | 2 +- .../test/StyleBookEntryLocalServiceTest.java | 8 ++++---- .../DeleteStyleBookEntryMVCActionCommandTest.java | 8 ++++---- ...teStyleBookEntryPreviewMVCActionCommandTest.java | 2 +- ...mportStyleBookEntriesMVCResourceCommandTest.java | 13 +++++++------ ...teStyleBookEntryDefaultMVCActionCommandTest.java | 8 ++++---- ...pdateStyleBookEntryNameMVCActionCommandTest.java | 10 +++++----- ...teStyleBookEntryPreviewMVCActionCommandTest.java | 4 ++-- 13 files changed, 36 insertions(+), 32 deletions(-) diff --git a/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/exportimport/data/handler/test/LayoutStagedModelDataHandlerTest.java b/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/exportimport/data/handler/test/LayoutStagedModelDataHandlerTest.java index be8c7936c36d11..09c6b51b9c2673 100644 --- a/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/exportimport/data/handler/test/LayoutStagedModelDataHandlerTest.java +++ b/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/exportimport/data/handler/test/LayoutStagedModelDataHandlerTest.java @@ -444,7 +444,8 @@ public void testStyleBookEntry() throws Exception { false, StringPool.BLANK, RandomTestUtil.randomString(), StringPool.BLANK, ServiceContextTestUtil.getServiceContext( - stagingGroup.getGroupId())); + stagingGroup.getGroupId()), + StringPool.BLANK); Layout layout = LayoutTestUtil.addTypeContentLayout(stagingGroup); diff --git a/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/portlet/action/test/EditLayoutDesignMVCActionCommandTest.java b/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/portlet/action/test/EditLayoutDesignMVCActionCommandTest.java index 8d2827c8dd6e48..a00a1ba0210251 100644 --- a/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/portlet/action/test/EditLayoutDesignMVCActionCommandTest.java +++ b/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/portlet/action/test/EditLayoutDesignMVCActionCommandTest.java @@ -89,7 +89,7 @@ public void testEditLayoutDesignDoesntChangeWithNotEditedValues() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, serviceContext); + StringPool.BLANK, serviceContext, StringPool.BLANK); FileEntry fileEntry = _dlAppLocalService.addFileEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), diff --git a/modules/apps/layout/layout-content-page-editor-web-test/src/testIntegration/java/com/liferay/layout/content/page/editor/web/internal/portlet/action/test/CreateLayoutPageTemplateEntryMVCActionCommandTest.java b/modules/apps/layout/layout-content-page-editor-web-test/src/testIntegration/java/com/liferay/layout/content/page/editor/web/internal/portlet/action/test/CreateLayoutPageTemplateEntryMVCActionCommandTest.java index 9bf9094275eefa..e25fef0015740c 100644 --- a/modules/apps/layout/layout-content-page-editor-web-test/src/testIntegration/java/com/liferay/layout/content/page/editor/web/internal/portlet/action/test/CreateLayoutPageTemplateEntryMVCActionCommandTest.java +++ b/modules/apps/layout/layout-content-page-editor-web-test/src/testIntegration/java/com/liferay/layout/content/page/editor/web/internal/portlet/action/test/CreateLayoutPageTemplateEntryMVCActionCommandTest.java @@ -155,7 +155,8 @@ public void testCreateLayoutPageTemplateEntry() throws Exception { null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), StringPool.BLANK, - ServiceContextTestUtil.getServiceContext(_group.getGroupId())); + ServiceContextTestUtil.getServiceContext(_group.getGroupId()), + StringPool.BLANK); draftLayout = _layoutLocalService.updateStyleBookEntryId( draftLayout.getGroupId(), draftLayout.isPrivateLayout(), diff --git a/modules/apps/layout/layout-page-template-test/src/testIntegration/java/com/liferay/layout/page/template/service/test/LayoutPageTemplateEntryLocalServiceTest.java b/modules/apps/layout/layout-page-template-test/src/testIntegration/java/com/liferay/layout/page/template/service/test/LayoutPageTemplateEntryLocalServiceTest.java index c4b1b926b22256..f77a702fc3b06c 100644 --- a/modules/apps/layout/layout-page-template-test/src/testIntegration/java/com/liferay/layout/page/template/service/test/LayoutPageTemplateEntryLocalServiceTest.java +++ b/modules/apps/layout/layout-page-template-test/src/testIntegration/java/com/liferay/layout/page/template/service/test/LayoutPageTemplateEntryLocalServiceTest.java @@ -150,7 +150,7 @@ public void testUpdateLayoutPageTemplateEntryName() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); Layout layout = _layoutLocalService.fetchLayout( layoutPageTemplateEntry.getPlid()); diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryTableReferenceDefinitionTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryTableReferenceDefinitionTest.java index 8284e8528974a2..fa3a9628db361c 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryTableReferenceDefinitionTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryTableReferenceDefinitionTest.java @@ -41,7 +41,8 @@ protected CTModel addCTModel() throws Exception { return _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), TestPropsValues.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, ServiceContextTestUtil.getServiceContext()); + StringPool.BLANK, ServiceContextTestUtil.getServiceContext(), + StringPool.BLANK); } @Inject diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryVersionTableReferenceDefinitionTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryVersionTableReferenceDefinitionTest.java index 4fa76a635a3c29..e7889922993ca7 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryVersionTableReferenceDefinitionTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryVersionTableReferenceDefinitionTest.java @@ -47,7 +47,7 @@ public void setUp() throws Exception { null, TestPropsValues.getUserId(), TestPropsValues.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), RandomTestUtil.randomString(), - ServiceContextTestUtil.getServiceContext()); + ServiceContextTestUtil.getServiceContext(), StringPool.BLANK); } @Override diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryLocalServiceTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryLocalServiceTest.java index 8dc0da3093712a..d96587d3f8d55a 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryLocalServiceTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryLocalServiceTest.java @@ -56,7 +56,7 @@ public void testAddStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( RandomTestUtil.randomString(), TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext); + null, _serviceContext, null); Assert.assertTrue( Validator.isNotNull(styleBookEntry.getExternalReferenceCode())); @@ -73,11 +73,11 @@ public void testAddStyleBookEntryWithExistingExternalReferenceCode() _styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext); + null, _serviceContext, null); _styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext); + null, _serviceContext, null); } @Test @@ -88,7 +88,7 @@ public void testDeleteStyleBookEntryByExternalReferenceCode() _styleBookEntryLocalService.addStyleBookEntry( RandomTestUtil.randomString(), TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext); + null, _serviceContext, null); _styleBookEntryLocalService.deleteStyleBookEntry( styleBookEntry.getExternalReferenceCode(), diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java index 26776c5ace9556..d2c4142e431bb0 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java @@ -65,13 +65,13 @@ public void testDeleteStyleBookEntries() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); StyleBookEntry styleBookEntry2 = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -99,7 +99,7 @@ public void testDeleteStyleBookEntry() throws Exception { StyleBookEntry styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, - StringPool.BLANK, name, StringPool.BLANK, _serviceContext); + StringPool.BLANK, name, StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -129,7 +129,7 @@ public void testDeleteStyleBookEntryWithPreviewFileEntry() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); FileEntry fileEntry = _addFileEntry(styleBookEntry); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryPreviewMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryPreviewMVCActionCommandTest.java index 7d85e7a913e649..7df697c7dce3d7 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryPreviewMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryPreviewMVCActionCommandTest.java @@ -64,7 +64,7 @@ public void testDeleteStyleBookEntryPreviewFileEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); FileEntry fileEntry = _addFileEntry(styleBookEntry); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java index ad340f5166f573..d832e88780f2b2 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java @@ -7,6 +7,7 @@ import com.liferay.arquillian.extension.junit.bridge.junit.Arquillian; import com.liferay.petra.string.CharPool; +import com.liferay.petra.string.StringPool; import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.model.Group; @@ -77,13 +78,13 @@ public void testExportImportMultipleStyleBookEntries() throws Exception { null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY_1", - serviceContext); + serviceContext, StringPool.BLANK); StyleBookEntry styleBookEntry2 = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY_2", - serviceContext); + serviceContext, StringPool.BLANK); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -122,7 +123,7 @@ public void testExportImportSingleStyleBookEntry() throws Exception { null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", - serviceContext); + serviceContext, StringPool.BLANK); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -174,7 +175,7 @@ public void testExportImportSingleStyleBookEntryAndNotOverwrite() null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", - serviceContext); + serviceContext, StringPool.BLANK); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -218,7 +219,7 @@ public void testExportImportSingleStyleBookEntryAndOverwrite() null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", - serviceContext); + serviceContext, StringPool.BLANK); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -283,7 +284,7 @@ public void testExportStyleBookEntries() throws Exception { null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY", - serviceContext); + serviceContext, StringPool.BLANK); FileEntry fileEntry = _addFileEntry(styleBookEntry); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryDefaultMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryDefaultMVCActionCommandTest.java index 8ef39f120cf1ff..cfbad8b6888acb 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryDefaultMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryDefaultMVCActionCommandTest.java @@ -77,7 +77,7 @@ public void testMarkAsDefaultStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -107,7 +107,7 @@ public void testReplaceDefaultStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -134,7 +134,7 @@ public void testReplaceDefaultStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -167,7 +167,7 @@ public void testUnmarkAsDefaultStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java index fdfe230e3a7969..6468d7e6bd8911 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java @@ -92,7 +92,7 @@ public void testUpdateStyleBookEntryName() throws PortalException { StyleBookEntry styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, - StringPool.BLANK, oldName, StringPool.BLANK, _serviceContext); + StringPool.BLANK, oldName, StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -134,7 +134,7 @@ public void testUpdateStyleBookEntryNameWithEmptyName() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -160,7 +160,7 @@ public void testUpdateStyleBookEntryNameWithInvalidCharPeriod() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -185,7 +185,7 @@ public void testUpdateStyleBookEntryNameWithInvalidCharSlash() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -210,7 +210,7 @@ public void testUpdateStyleBookEntryNameWithNameMaxLength() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryPreviewMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryPreviewMVCActionCommandTest.java index a7fc06436b6aba..edafade4bb2bdd 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryPreviewMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryPreviewMVCActionCommandTest.java @@ -98,7 +98,7 @@ public void testReplaceStyleBookEntryPreview() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -184,7 +184,7 @@ public void testUpdateStyleBookEntryPreview() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, _serviceContext, StringPool.BLANK); FileEntry tempFileEntry = _addFileEntry( "thumbnail.png", styleBookEntry); From 4e9168d19b5ecbe4a36b892124f89bc22209d606 Mon Sep 17 00:00:00 2001 From: Selena Aungst Date: Mon, 23 Sep 2024 18:00:48 -0700 Subject: [PATCH 05/15] LPD-35068 formatSource --- .../DeleteStyleBookEntryMVCActionCommandTest.java | 3 ++- ...ImportStyleBookEntriesMVCResourceCommandTest.java | 12 ++++++------ ...UpdateStyleBookEntryNameMVCActionCommandTest.java | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java index d2c4142e431bb0..91cc545fe84ecf 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java @@ -99,7 +99,8 @@ public void testDeleteStyleBookEntry() throws Exception { StyleBookEntry styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, - StringPool.BLANK, name, StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, name, StringPool.BLANK, _serviceContext, + StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java index d832e88780f2b2..00d13048027a8d 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java @@ -122,8 +122,8 @@ public void testExportImportSingleStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), - "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", - serviceContext, StringPool.BLANK); + "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext, + StringPool.BLANK); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -174,8 +174,8 @@ public void testExportImportSingleStyleBookEntryAndNotOverwrite() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), - "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", - serviceContext, StringPool.BLANK); + "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext, + StringPool.BLANK); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -218,8 +218,8 @@ public void testExportImportSingleStyleBookEntryAndOverwrite() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), - "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", - serviceContext, StringPool.BLANK); + "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext, + StringPool.BLANK); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java index 6468d7e6bd8911..5d3987ba140777 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java @@ -92,7 +92,8 @@ public void testUpdateStyleBookEntryName() throws PortalException { StyleBookEntry styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, - StringPool.BLANK, oldName, StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, oldName, StringPool.BLANK, _serviceContext, + StringPool.BLANK); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); From 9effec3557bf2f7337d0b6ae78cf7173a1cbe3fe Mon Sep 17 00:00:00 2001 From: Selena Aungst Date: Mon, 16 Sep 2024 12:10:07 -0700 Subject: [PATCH 06/15] LPD-35068 Update StyleBook Upgrade Process with themeId --- .../StyleBookServiceUpgradeStepRegistrator.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/upgrade/registry/StyleBookServiceUpgradeStepRegistrator.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/upgrade/registry/StyleBookServiceUpgradeStepRegistrator.java index 77608249a51f16..adf9079eec511f 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/upgrade/registry/StyleBookServiceUpgradeStepRegistrator.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/upgrade/registry/StyleBookServiceUpgradeStepRegistrator.java @@ -9,6 +9,7 @@ import com.liferay.portal.kernel.upgrade.CTModelUpgradeProcess; import com.liferay.portal.kernel.upgrade.DummyUpgradeStep; import com.liferay.portal.kernel.upgrade.MVCCVersionUpgradeProcess; +import com.liferay.portal.kernel.upgrade.UpgradeProcessFactory; import com.liferay.portal.upgrade.registry.UpgradeStepRegistrator; import com.liferay.style.book.internal.upgrade.v1_1_0.StyleBookEntryUpgradeProcess; import com.liferay.style.book.internal.upgrade.v1_2_0.StyleBookEntryVersionUpgradeProcess; @@ -73,6 +74,16 @@ protected String[][] getTableAndPrimaryKeyColumnNames() { } }); + + registry.register( + "1.5.0", "1.6.0", + UpgradeProcessFactory.addColumns( + "StyleBookEntry", "themeId VARCHAR(255) null")); + + registry.register( + "1.6.0", "1.7.0", + UpgradeProcessFactory.addColumns( + "StyleBookEntryVersion", "themeId VARCHAR(255) null")); } } \ No newline at end of file From d5828ddae86551054f975c6671355f48f52d6506 Mon Sep 17 00:00:00 2001 From: Selena Aungst Date: Tue, 24 Sep 2024 12:49:49 -0700 Subject: [PATCH 07/15] LPD-35068 baseline # breaking ## What modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/upgrade/registry/StyleBookServiceUpgradeStepRegistrator.java Added themeId and themeName to StyleBookServiceUgpradeStepRegistrator.java ## Why CI failed a previous commit because the added themeId and themeName columns could not be found after an upgrade was performed, so these columns were added to the database here. I ran foratSource and baseline in modules/apps/style-book and style-book-service/bnd.bnd was updated. ---- --- .../src/main/resources/com/liferay/style/book/model/packageinfo | 2 +- .../main/resources/com/liferay/style/book/service/packageinfo | 2 +- modules/apps/style-book/style-book-service/bnd.bnd | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/apps/style-book/style-book-api/src/main/resources/com/liferay/style/book/model/packageinfo b/modules/apps/style-book/style-book-api/src/main/resources/com/liferay/style/book/model/packageinfo index bbcbfe4fb3b987..2cd6b5a32b9b4d 100644 --- a/modules/apps/style-book/style-book-api/src/main/resources/com/liferay/style/book/model/packageinfo +++ b/modules/apps/style-book/style-book-api/src/main/resources/com/liferay/style/book/model/packageinfo @@ -1 +1 @@ -version 2.2.0 \ No newline at end of file +version 2.3.0 \ No newline at end of file diff --git a/modules/apps/style-book/style-book-api/src/main/resources/com/liferay/style/book/service/packageinfo b/modules/apps/style-book/style-book-api/src/main/resources/com/liferay/style/book/service/packageinfo index bd333699d2e121..dde115d61ba0bb 100644 --- a/modules/apps/style-book/style-book-api/src/main/resources/com/liferay/style/book/service/packageinfo +++ b/modules/apps/style-book/style-book-api/src/main/resources/com/liferay/style/book/service/packageinfo @@ -1 +1 @@ -version 4.0.0 \ No newline at end of file +version 5.0.0 \ No newline at end of file diff --git a/modules/apps/style-book/style-book-service/bnd.bnd b/modules/apps/style-book/style-book-service/bnd.bnd index 3cbe4ba019bd0b..7ccdbb26c8d03d 100644 --- a/modules/apps/style-book/style-book-service/bnd.bnd +++ b/modules/apps/style-book/style-book-service/bnd.bnd @@ -1,6 +1,6 @@ Bundle-Name: Liferay Style Book Service Bundle-SymbolicName: com.liferay.style.book.service Bundle-Version: 2.0.51 -Liferay-Require-SchemaVersion: 1.5.0 +Liferay-Require-SchemaVersion: 1.7.0 Liferay-Service: true -dsannotations-options: inherit \ No newline at end of file From d7a93094d29f916275a9933fe5f846ceb714430a Mon Sep 17 00:00:00 2001 From: Thiago Buarque Date: Tue, 24 Sep 2024 15:14:16 -0300 Subject: [PATCH 08/15] LPD-35068 themeId will soon be required to create a style book, so let's already add it in the 'add' methods --- .../service/impl/StyleBookEntryServiceImpl.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java index 2a2545596ace0f..cd2e0e45f083ba 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java @@ -34,17 +34,13 @@ public class StyleBookEntryServiceImpl extends StyleBookEntryServiceBaseImpl { @Override public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, ServiceContext serviceContext) + String styleBookEntryKey, ServiceContext serviceContext, + String themeId) throws PortalException { - _portletResourcePermission.check( - getPermissionChecker(), groupId, - StyleBookActionKeys.MANAGE_STYLE_BOOK_ENTRIES); - - return styleBookEntryLocalService.addStyleBookEntry( - externalReferenceCode, getUserId(), groupId, false, - StringPool.BLANK, name, styleBookEntryKey, serviceContext, - StringPool.BLANK); + return addStyleBookEntry( + externalReferenceCode, groupId, StringPool.BLANK, name, + styleBookEntryKey, serviceContext, themeId); } @Override From d8500e5ad1f8ea0a518d40ccfcfdb3fcb3315087 Mon Sep 17 00:00:00 2001 From: Thiago Buarque Date: Tue, 24 Sep 2024 15:15:27 -0300 Subject: [PATCH 09/15] LPD-35068 buildService --- .../liferay/style/book/service/StyleBookEntryService.java | 3 ++- .../style/book/service/StyleBookEntryServiceUtil.java | 5 +++-- .../style/book/service/StyleBookEntryServiceWrapper.java | 5 +++-- .../style/book/service/http/StyleBookEntryServiceHttp.java | 7 ++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java index 9df95f598f9422..f0a125ba6615f5 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java @@ -45,7 +45,8 @@ public interface StyleBookEntryService extends BaseService { */ public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, ServiceContext serviceContext) + String styleBookEntryKey, ServiceContext serviceContext, + String themeId) throws PortalException; public StyleBookEntry addStyleBookEntry( diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java index 171c731a7dadd7..1842d7da8dbf30 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java @@ -31,12 +31,13 @@ public class StyleBookEntryServiceUtil { public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext) + com.liferay.portal.kernel.service.ServiceContext serviceContext, + String themeId) throws PortalException { return getService().addStyleBookEntry( externalReferenceCode, groupId, name, styleBookEntryKey, - serviceContext); + serviceContext, themeId); } public static StyleBookEntry addStyleBookEntry( diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java index 2809ef691b0097..8ac417d6cd5d80 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java @@ -32,12 +32,13 @@ public StyleBookEntryServiceWrapper( public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext) + com.liferay.portal.kernel.service.ServiceContext serviceContext, + String themeId) throws com.liferay.portal.kernel.exception.PortalException { return _styleBookEntryService.addStyleBookEntry( externalReferenceCode, groupId, name, styleBookEntryKey, - serviceContext); + serviceContext, themeId); } @Override diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java index 55c9ca99dc3abc..2a5230c56ec667 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java @@ -44,7 +44,8 @@ public class StyleBookEntryServiceHttp { public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( HttpPrincipal httpPrincipal, String externalReferenceCode, long groupId, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext) + com.liferay.portal.kernel.service.ServiceContext serviceContext, + String themeId) throws com.liferay.portal.kernel.exception.PortalException { try { @@ -54,7 +55,7 @@ public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( MethodHandler methodHandler = new MethodHandler( methodKey, externalReferenceCode, groupId, name, - styleBookEntryKey, serviceContext); + styleBookEntryKey, serviceContext, themeId); Object returnObj = null; @@ -635,7 +636,7 @@ public static com.liferay.style.book.model.StyleBookEntry updateName( private static final Class[] _addStyleBookEntryParameterTypes0 = new Class[] { String.class, long.class, String.class, String.class, - com.liferay.portal.kernel.service.ServiceContext.class + com.liferay.portal.kernel.service.ServiceContext.class, String.class }; private static final Class[] _addStyleBookEntryParameterTypes1 = new Class[] { From d0210a69f9ce00a0fbd6123c2d18179c95372d73 Mon Sep 17 00:00:00 2001 From: Thiago Buarque Date: Tue, 24 Sep 2024 15:30:55 -0300 Subject: [PATCH 10/15] LPD-35068 Update usages --- .../service/test/StyleBookEntryServiceTest.java | 15 ++++++++++----- .../action/test/StyleBookEntryServiceTest.java | 3 ++- .../action/AddStyleBookEntryMVCActionCommand.java | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryServiceTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryServiceTest.java index 2cc3354c4336ea..ca95b10f4fa63f 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryServiceTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryServiceTest.java @@ -63,7 +63,8 @@ public void testAddStyleBookEntryWithoutAddPermission() throws Exception { _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext); + RandomTestUtil.randomString(), null, _serviceContext, + RandomTestUtil.randomString()); Assert.fail(); } @@ -81,7 +82,8 @@ public void testDeleteStyleBookEntryByExternalReferenceCode() StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext); + RandomTestUtil.randomString(), null, _serviceContext, + RandomTestUtil.randomString()); _styleBookEntryService.deleteStyleBookEntry( styleBookEntry.getExternalReferenceCode(), @@ -99,7 +101,8 @@ public void testDeleteStyleBookEntryByExternalReferenceCodeWithoutDeletePermissi StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext); + RandomTestUtil.randomString(), null, _serviceContext, + RandomTestUtil.randomString()); try { UserTestUtil.setUser( @@ -125,7 +128,8 @@ public void testGetStyleBookEntryByExternalReferenceCode() StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext); + RandomTestUtil.randomString(), null, _serviceContext, + RandomTestUtil.randomString()); StyleBookEntry curStyleBookEntry = _styleBookEntryService.getStyleBookEntryByExternalReferenceCode( @@ -144,7 +148,8 @@ public void testGetStyleBookEntryByExternalReferenceCodeWithoutViewPermission() StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext); + RandomTestUtil.randomString(), null, _serviceContext, + RandomTestUtil.randomString()); RoleTestUtil.removeResourcePermission( RoleConstants.GUEST, StyleBookEntry.class.getName(), diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/StyleBookEntryServiceTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/StyleBookEntryServiceTest.java index 5d46a0e9377145..196c09d02be552 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/StyleBookEntryServiceTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/StyleBookEntryServiceTest.java @@ -53,7 +53,8 @@ public void testCopyStyleBookEntry() throws Exception { _styleBookEntryService.addStyleBookEntry( null, _group.getGroupId(), RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY", - ServiceContextTestUtil.getServiceContext(_group.getGroupId())); + ServiceContextTestUtil.getServiceContext(_group.getGroupId()), + RandomTestUtil.randomString()); StyleBookEntry targetStyleBookEntry = _styleBookEntryService.copyStyleBookEntry( diff --git a/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/portlet/action/AddStyleBookEntryMVCActionCommand.java b/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/portlet/action/AddStyleBookEntryMVCActionCommand.java index dd4f34c184d054..c76707457160de 100644 --- a/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/portlet/action/AddStyleBookEntryMVCActionCommand.java +++ b/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/portlet/action/AddStyleBookEntryMVCActionCommand.java @@ -75,13 +75,14 @@ private StyleBookEntry _addStyleBookEntry(ActionRequest actionRequest) throws PortalException { String name = ParamUtil.getString(actionRequest, "name"); + String themeId = ParamUtil.getString(actionRequest, "themeId"); ServiceContext serviceContext = ServiceContextFactory.getInstance( actionRequest); return _styleBookEntryService.addStyleBookEntry( null, serviceContext.getScopeGroupId(), name, StringPool.BLANK, - serviceContext); + serviceContext, themeId); } private String _getRedirectURL( From edfdbebdab4c3cd91b53b759f6873a3424c9e56d Mon Sep 17 00:00:00 2001 From: Thiago Buarque Date: Thu, 26 Sep 2024 13:03:27 -0300 Subject: [PATCH 11/15] LPD-35068 we must specify the size on the portlet-model-hints.xml file. Otherwise new databases will differ from upgraded ones --- .../src/main/resources/META-INF/portlet-model-hints.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/portlet-model-hints.xml b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/portlet-model-hints.xml index 84f95201916c06..75365256426aa2 100644 --- a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/portlet-model-hints.xml +++ b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/portlet-model-hints.xml @@ -21,7 +21,9 @@ - + + 255 + @@ -44,6 +46,8 @@ - + + 255 + \ No newline at end of file From 4810d7c58f99470a5ff4c8b7ce85e5b547586aef Mon Sep 17 00:00:00 2001 From: Thiago Buarque Date: Thu, 26 Sep 2024 13:03:39 -0300 Subject: [PATCH 12/15] LPD-35068 buildService --- .../style/book/model/impl/StyleBookEntryModelImpl.java | 2 +- .../style/book/model/impl/StyleBookEntryVersionModelImpl.java | 2 +- .../src/main/resources/META-INF/sql/tables.sql | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryModelImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryModelImpl.java index d59219fa6ba820..6814a767627851 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryModelImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryModelImpl.java @@ -105,7 +105,7 @@ public class StyleBookEntryModelImpl } public static final String TABLE_SQL_CREATE = - "create table StyleBookEntry (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,headId LONG,head BOOLEAN,styleBookEntryId LONG not null,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultStyleBookEntry BOOLEAN,frontendTokensValues TEXT null,name VARCHAR(75) null,previewFileEntryId LONG,styleBookEntryKey VARCHAR(75) null,themeId VARCHAR(75) null,primary key (styleBookEntryId, ctCollectionId))"; + "create table StyleBookEntry (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,headId LONG,head BOOLEAN,styleBookEntryId LONG not null,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultStyleBookEntry BOOLEAN,frontendTokensValues TEXT null,name VARCHAR(75) null,previewFileEntryId LONG,styleBookEntryKey VARCHAR(75) null,themeId VARCHAR(255) null,primary key (styleBookEntryId, ctCollectionId))"; public static final String TABLE_SQL_DROP = "drop table StyleBookEntry"; diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionModelImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionModelImpl.java index c478aa919766e8..9de18f0c92b44f 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionModelImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/model/impl/StyleBookEntryVersionModelImpl.java @@ -101,7 +101,7 @@ public class StyleBookEntryVersionModelImpl } public static final String TABLE_SQL_CREATE = - "create table StyleBookEntryVersion (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,styleBookEntryVersionId LONG not null,version INTEGER,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,styleBookEntryId LONG,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultStyleBookEntry BOOLEAN,frontendTokensValues TEXT null,name VARCHAR(75) null,previewFileEntryId LONG,styleBookEntryKey VARCHAR(75) null,themeId VARCHAR(75) null,primary key (styleBookEntryVersionId, ctCollectionId))"; + "create table StyleBookEntryVersion (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,styleBookEntryVersionId LONG not null,version INTEGER,uuid_ VARCHAR(75) null,externalReferenceCode VARCHAR(75) null,styleBookEntryId LONG,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,defaultStyleBookEntry BOOLEAN,frontendTokensValues TEXT null,name VARCHAR(75) null,previewFileEntryId LONG,styleBookEntryKey VARCHAR(75) null,themeId VARCHAR(255) null,primary key (styleBookEntryVersionId, ctCollectionId))"; public static final String TABLE_SQL_DROP = "drop table StyleBookEntryVersion"; diff --git a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/sql/tables.sql b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/sql/tables.sql index aee332765c94c7..c5977e0e88ec08 100644 --- a/modules/apps/style-book/style-book-service/src/main/resources/META-INF/sql/tables.sql +++ b/modules/apps/style-book/style-book-service/src/main/resources/META-INF/sql/tables.sql @@ -17,7 +17,7 @@ create table StyleBookEntry ( name VARCHAR(75) null, previewFileEntryId LONG, styleBookEntryKey VARCHAR(75) null, - themeId VARCHAR(75) null, + themeId VARCHAR(255) null, primary key (styleBookEntryId, ctCollectionId) ); @@ -40,6 +40,6 @@ create table StyleBookEntryVersion ( name VARCHAR(75) null, previewFileEntryId LONG, styleBookEntryKey VARCHAR(75) null, - themeId VARCHAR(75) null, + themeId VARCHAR(255) null, primary key (styleBookEntryVersionId, ctCollectionId) ); \ No newline at end of file From 441162b31fdf2e236b31d36d33f6aac8c1864688 Mon Sep 17 00:00:00 2001 From: Thiago Buarque Date: Mon, 30 Sep 2024 14:28:23 -0300 Subject: [PATCH 13/15] LPD-35068 serviceContext must come last --- .../book/service/impl/StyleBookEntryLocalServiceImpl.java | 4 ++-- .../style/book/service/impl/StyleBookEntryServiceImpl.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java index f9b91a430f2fbc..80c94b4986eb1e 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java @@ -51,8 +51,8 @@ public class StyleBookEntryLocalServiceImpl public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, - String name, String styleBookEntryKey, - ServiceContext serviceContext, String themeId) + String name, String styleBookEntryKey, String themeId, + ServiceContext serviceContext) throws PortalException { User user = _userLocalService.getUser(userId); diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java index cd2e0e45f083ba..195653893ec622 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java @@ -34,8 +34,8 @@ public class StyleBookEntryServiceImpl extends StyleBookEntryServiceBaseImpl { @Override public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, ServiceContext serviceContext, - String themeId) + String styleBookEntryKey, String themeId, + ServiceContext serviceContext) throws PortalException { return addStyleBookEntry( @@ -47,7 +47,7 @@ public StyleBookEntry addStyleBookEntry( public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - ServiceContext serviceContext, String themeId) + String themeId, ServiceContext serviceContext) throws PortalException { _portletResourcePermission.check( From e8e93542ba7471ba803f14f780c7114add349b9a Mon Sep 17 00:00:00 2001 From: Thiago Buarque Date: Mon, 30 Sep 2024 14:29:10 -0300 Subject: [PATCH 14/15] LPD-35068 buildService --- .../service/StyleBookEntryLocalService.java | 4 ++-- .../StyleBookEntryLocalServiceUtil.java | 9 ++++----- .../StyleBookEntryLocalServiceWrapper.java | 9 ++++----- .../book/service/StyleBookEntryService.java | 6 +++--- .../service/StyleBookEntryServiceUtil.java | 15 +++++++------- .../service/StyleBookEntryServiceWrapper.java | 15 +++++++------- .../http/StyleBookEntryServiceHttp.java | 20 +++++++++---------- 7 files changed, 36 insertions(+), 42 deletions(-) diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalService.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalService.java index dd88d3f2809d15..df863137f02577 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalService.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalService.java @@ -68,8 +68,8 @@ public interface StyleBookEntryLocalService public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, - String name, String styleBookEntryKey, - ServiceContext serviceContext, String themeId) + String name, String styleBookEntryKey, String themeId, + ServiceContext serviceContext) throws PortalException; /** diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceUtil.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceUtil.java index a4d33c74dcfbca..580572e512b2d8 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceUtil.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceUtil.java @@ -39,15 +39,14 @@ public class StyleBookEntryLocalServiceUtil { public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, - String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext, - String themeId) + String name, String styleBookEntryKey, String themeId, + com.liferay.portal.kernel.service.ServiceContext serviceContext) throws PortalException { return getService().addStyleBookEntry( externalReferenceCode, userId, groupId, defaultStyleBookEntry, - frontendTokensValues, name, styleBookEntryKey, serviceContext, - themeId); + frontendTokensValues, name, styleBookEntryKey, themeId, + serviceContext); } /** diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceWrapper.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceWrapper.java index 1d3fa7aab372ea..0d6b50c617e723 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceWrapper.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryLocalServiceWrapper.java @@ -36,15 +36,14 @@ public StyleBookEntryLocalServiceWrapper( public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, - String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext, - String themeId) + String name, String styleBookEntryKey, String themeId, + com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException { return _styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, userId, groupId, defaultStyleBookEntry, - frontendTokensValues, name, styleBookEntryKey, serviceContext, - themeId); + frontendTokensValues, name, styleBookEntryKey, themeId, + serviceContext); } /** diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java index f0a125ba6615f5..6a3f264ed3f689 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryService.java @@ -45,14 +45,14 @@ public interface StyleBookEntryService extends BaseService { */ public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, ServiceContext serviceContext, - String themeId) + String styleBookEntryKey, String themeId, + ServiceContext serviceContext) throws PortalException; public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - ServiceContext serviceContext, String themeId) + String themeId, ServiceContext serviceContext) throws PortalException; public StyleBookEntry copyStyleBookEntry( diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java index 1842d7da8dbf30..0cb258d7394e9f 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceUtil.java @@ -30,26 +30,25 @@ public class StyleBookEntryServiceUtil { */ public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext, - String themeId) + String styleBookEntryKey, String themeId, + com.liferay.portal.kernel.service.ServiceContext serviceContext) throws PortalException { return getService().addStyleBookEntry( - externalReferenceCode, groupId, name, styleBookEntryKey, - serviceContext, themeId); + externalReferenceCode, groupId, name, styleBookEntryKey, themeId, + serviceContext); } public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext, - String themeId) + String themeId, + com.liferay.portal.kernel.service.ServiceContext serviceContext) throws PortalException { return getService().addStyleBookEntry( externalReferenceCode, groupId, frontendTokensValues, name, - styleBookEntryKey, serviceContext, themeId); + styleBookEntryKey, themeId, serviceContext); } public static StyleBookEntry copyStyleBookEntry( diff --git a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java index 8ac417d6cd5d80..b1de1c957951dd 100644 --- a/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java +++ b/modules/apps/style-book/style-book-api/src/main/java/com/liferay/style/book/service/StyleBookEntryServiceWrapper.java @@ -31,27 +31,26 @@ public StyleBookEntryServiceWrapper( @Override public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext, - String themeId) + String styleBookEntryKey, String themeId, + com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException { return _styleBookEntryService.addStyleBookEntry( - externalReferenceCode, groupId, name, styleBookEntryKey, - serviceContext, themeId); + externalReferenceCode, groupId, name, styleBookEntryKey, themeId, + serviceContext); } @Override public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext, - String themeId) + String themeId, + com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException { return _styleBookEntryService.addStyleBookEntry( externalReferenceCode, groupId, frontendTokensValues, name, - styleBookEntryKey, serviceContext, themeId); + styleBookEntryKey, themeId, serviceContext); } @Override diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java index 2a5230c56ec667..1dc2f03c683151 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/http/StyleBookEntryServiceHttp.java @@ -43,9 +43,8 @@ public class StyleBookEntryServiceHttp { public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( HttpPrincipal httpPrincipal, String externalReferenceCode, - long groupId, String name, String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext, - String themeId) + long groupId, String name, String styleBookEntryKey, String themeId, + com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException { try { @@ -55,7 +54,7 @@ public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( MethodHandler methodHandler = new MethodHandler( methodKey, externalReferenceCode, groupId, name, - styleBookEntryKey, serviceContext, themeId); + styleBookEntryKey, themeId, serviceContext); Object returnObj = null; @@ -88,9 +87,8 @@ public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( HttpPrincipal httpPrincipal, String externalReferenceCode, long groupId, String frontendTokensValues, String name, - String styleBookEntryKey, - com.liferay.portal.kernel.service.ServiceContext serviceContext, - String themeId) + String styleBookEntryKey, String themeId, + com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException { try { @@ -100,7 +98,7 @@ public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( MethodHandler methodHandler = new MethodHandler( methodKey, externalReferenceCode, groupId, frontendTokensValues, - name, styleBookEntryKey, serviceContext, themeId); + name, styleBookEntryKey, themeId, serviceContext); Object returnObj = null; @@ -635,13 +633,13 @@ public static com.liferay.style.book.model.StyleBookEntry updateName( private static final Class[] _addStyleBookEntryParameterTypes0 = new Class[] { - String.class, long.class, String.class, String.class, - com.liferay.portal.kernel.service.ServiceContext.class, String.class + String.class, long.class, String.class, String.class, String.class, + com.liferay.portal.kernel.service.ServiceContext.class }; private static final Class[] _addStyleBookEntryParameterTypes1 = new Class[] { String.class, long.class, String.class, String.class, String.class, - com.liferay.portal.kernel.service.ServiceContext.class, String.class + String.class, com.liferay.portal.kernel.service.ServiceContext.class }; private static final Class[] _copyStyleBookEntryParameterTypes2 = new Class[] { From b3fe3100663bbb343b3b74d13b2d1fa272de4082 Mon Sep 17 00:00:00 2001 From: Thiago Buarque Date: Mon, 30 Sep 2024 14:42:15 -0300 Subject: [PATCH 15/15] LPD-35068 update usages and use RandomTestUtil for the themeId value --- .../LayoutStagedModelDataHandlerTest.java | 5 ++--- .../EditLayoutDesignMVCActionCommandTest.java | 3 ++- ...PageTemplateEntryMVCActionCommandTest.java | 5 ++--- ...youtPageTemplateEntryLocalServiceTest.java | 3 ++- .../StylebookEntryStagedModelRepository.java | 4 ++-- .../impl/StyleBookEntryLocalServiceImpl.java | 4 ++-- .../impl/StyleBookEntryServiceImpl.java | 6 +++--- ...BookEntryTableReferenceDefinitionTest.java | 4 ++-- ...ryVersionTableReferenceDefinitionTest.java | 4 ++-- .../test/StyleBookEntryLocalServiceTest.java | 8 ++++---- .../test/StyleBookEntryServiceTest.java | 20 +++++++++---------- ...eteStyleBookEntryMVCActionCommandTest.java | 13 +++++++----- ...eBookEntryPreviewMVCActionCommandTest.java | 3 ++- ...tyleBookEntriesMVCResourceCommandTest.java | 19 +++++++++--------- .../test/StyleBookEntryServiceTest.java | 5 ++--- ...eBookEntryDefaultMVCActionCommandTest.java | 12 +++++++---- ...tyleBookEntryNameMVCActionCommandTest.java | 16 +++++++++------ ...eBookEntryPreviewMVCActionCommandTest.java | 6 ++++-- .../AddStyleBookEntryMVCActionCommand.java | 2 +- .../StyleBookEntryZipProcessorImpl.java | 4 ++-- 20 files changed, 79 insertions(+), 67 deletions(-) diff --git a/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/exportimport/data/handler/test/LayoutStagedModelDataHandlerTest.java b/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/exportimport/data/handler/test/LayoutStagedModelDataHandlerTest.java index 09c6b51b9c2673..cca040dd2fbe5e 100644 --- a/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/exportimport/data/handler/test/LayoutStagedModelDataHandlerTest.java +++ b/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/exportimport/data/handler/test/LayoutStagedModelDataHandlerTest.java @@ -442,10 +442,9 @@ public void testStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), stagingGroup.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, + StringPool.BLANK, RandomTestUtil.randomString(), ServiceContextTestUtil.getServiceContext( - stagingGroup.getGroupId()), - StringPool.BLANK); + stagingGroup.getGroupId())); Layout layout = LayoutTestUtil.addTypeContentLayout(stagingGroup); diff --git a/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/portlet/action/test/EditLayoutDesignMVCActionCommandTest.java b/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/portlet/action/test/EditLayoutDesignMVCActionCommandTest.java index a00a1ba0210251..03d69eec491be6 100644 --- a/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/portlet/action/test/EditLayoutDesignMVCActionCommandTest.java +++ b/modules/apps/layout/layout-admin-web-test/src/testIntegration/java/com/liferay/layout/admin/web/internal/portlet/action/test/EditLayoutDesignMVCActionCommandTest.java @@ -89,7 +89,8 @@ public void testEditLayoutDesignDoesntChangeWithNotEditedValues() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + serviceContext); FileEntry fileEntry = _dlAppLocalService.addFileEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), diff --git a/modules/apps/layout/layout-content-page-editor-web-test/src/testIntegration/java/com/liferay/layout/content/page/editor/web/internal/portlet/action/test/CreateLayoutPageTemplateEntryMVCActionCommandTest.java b/modules/apps/layout/layout-content-page-editor-web-test/src/testIntegration/java/com/liferay/layout/content/page/editor/web/internal/portlet/action/test/CreateLayoutPageTemplateEntryMVCActionCommandTest.java index e25fef0015740c..70494d9ddcaf1f 100644 --- a/modules/apps/layout/layout-content-page-editor-web-test/src/testIntegration/java/com/liferay/layout/content/page/editor/web/internal/portlet/action/test/CreateLayoutPageTemplateEntryMVCActionCommandTest.java +++ b/modules/apps/layout/layout-content-page-editor-web-test/src/testIntegration/java/com/liferay/layout/content/page/editor/web/internal/portlet/action/test/CreateLayoutPageTemplateEntryMVCActionCommandTest.java @@ -154,9 +154,8 @@ public void testCreateLayoutPageTemplateEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, - ServiceContextTestUtil.getServiceContext(_group.getGroupId()), - StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + ServiceContextTestUtil.getServiceContext(_group.getGroupId())); draftLayout = _layoutLocalService.updateStyleBookEntryId( draftLayout.getGroupId(), draftLayout.isPrivateLayout(), diff --git a/modules/apps/layout/layout-page-template-test/src/testIntegration/java/com/liferay/layout/page/template/service/test/LayoutPageTemplateEntryLocalServiceTest.java b/modules/apps/layout/layout-page-template-test/src/testIntegration/java/com/liferay/layout/page/template/service/test/LayoutPageTemplateEntryLocalServiceTest.java index f77a702fc3b06c..a2bf71c94c6d76 100644 --- a/modules/apps/layout/layout-page-template-test/src/testIntegration/java/com/liferay/layout/page/template/service/test/LayoutPageTemplateEntryLocalServiceTest.java +++ b/modules/apps/layout/layout-page-template-test/src/testIntegration/java/com/liferay/layout/page/template/service/test/LayoutPageTemplateEntryLocalServiceTest.java @@ -150,7 +150,8 @@ public void testUpdateLayoutPageTemplateEntryName() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); Layout layout = _layoutLocalService.fetchLayout( layoutPageTemplateEntry.getPlid()); diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/exportimport/staged/model/repository/StylebookEntryStagedModelRepository.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/exportimport/staged/model/repository/StylebookEntryStagedModelRepository.java index f37a1a499c4b45..b76ec6c49f27ab 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/exportimport/staged/model/repository/StylebookEntryStagedModelRepository.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/internal/exportimport/staged/model/repository/StylebookEntryStagedModelRepository.java @@ -50,8 +50,8 @@ public StyleBookEntry addStagedModel( styleBookEntry.getGroupId(), styleBookEntry.isDefaultStyleBookEntry(), styleBookEntry.getFrontendTokensValues(), styleBookEntry.getName(), - styleBookEntry.getStyleBookEntryKey(), serviceContext, - styleBookEntry.getThemeId()); + styleBookEntry.getStyleBookEntryKey(), styleBookEntry.getThemeId(), + serviceContext); } @Override diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java index 80c94b4986eb1e..01c1bdde608f9c 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java @@ -114,8 +114,8 @@ public StyleBookEntry copyStyleBookEntry( StyleBookEntry targetStyleBookEntry = addStyleBookEntry( null, userId, groupId, false, sourceStyleBookEntry.getFrontendTokensValues(), name, - StringPool.BLANK, serviceContext, - sourceStyleBookEntry.getThemeId()); + StringPool.BLANK, sourceStyleBookEntry.getThemeId(), + serviceContext); long previewFileEntryId = _copyStyleBookEntryPreviewFileEntry( userId, groupId, sourceStyleBookEntry, targetStyleBookEntry); diff --git a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java index 195653893ec622..f4c78179bc7bf8 100644 --- a/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java +++ b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryServiceImpl.java @@ -40,7 +40,7 @@ public StyleBookEntry addStyleBookEntry( return addStyleBookEntry( externalReferenceCode, groupId, StringPool.BLANK, name, - styleBookEntryKey, serviceContext, themeId); + styleBookEntryKey, themeId, serviceContext); } @Override @@ -56,8 +56,8 @@ public StyleBookEntry addStyleBookEntry( return styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, getUserId(), groupId, false, - frontendTokensValues, name, styleBookEntryKey, serviceContext, - themeId); + frontendTokensValues, name, styleBookEntryKey, themeId, + serviceContext); } @Override diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryTableReferenceDefinitionTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryTableReferenceDefinitionTest.java index fa3a9628db361c..6b8a3b4c88cb07 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryTableReferenceDefinitionTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryTableReferenceDefinitionTest.java @@ -41,8 +41,8 @@ protected CTModel addCTModel() throws Exception { return _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), TestPropsValues.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, ServiceContextTestUtil.getServiceContext(), - StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + ServiceContextTestUtil.getServiceContext()); } @Inject diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryVersionTableReferenceDefinitionTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryVersionTableReferenceDefinitionTest.java index e7889922993ca7..daab5221f1e374 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryVersionTableReferenceDefinitionTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/change/tracking/test/StyleBookEntryVersionTableReferenceDefinitionTest.java @@ -46,8 +46,8 @@ public void setUp() throws Exception { _styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), TestPropsValues.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - RandomTestUtil.randomString(), - ServiceContextTestUtil.getServiceContext(), StringPool.BLANK); + RandomTestUtil.randomString(), RandomTestUtil.randomString(), + ServiceContextTestUtil.getServiceContext()); } @Override diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryLocalServiceTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryLocalServiceTest.java index d96587d3f8d55a..a7dd4510c5ad74 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryLocalServiceTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryLocalServiceTest.java @@ -56,7 +56,7 @@ public void testAddStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( RandomTestUtil.randomString(), TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext, null); + null, RandomTestUtil.randomString(), _serviceContext); Assert.assertTrue( Validator.isNotNull(styleBookEntry.getExternalReferenceCode())); @@ -73,11 +73,11 @@ public void testAddStyleBookEntryWithExistingExternalReferenceCode() _styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext, null); + null, RandomTestUtil.randomString(), _serviceContext); _styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext, null); + null, RandomTestUtil.randomString(), _serviceContext); } @Test @@ -88,7 +88,7 @@ public void testDeleteStyleBookEntryByExternalReferenceCode() _styleBookEntryLocalService.addStyleBookEntry( RandomTestUtil.randomString(), TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext, null); + null, RandomTestUtil.randomString(), _serviceContext); _styleBookEntryLocalService.deleteStyleBookEntry( styleBookEntry.getExternalReferenceCode(), diff --git a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryServiceTest.java b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryServiceTest.java index ca95b10f4fa63f..d35a090b2e5276 100644 --- a/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryServiceTest.java +++ b/modules/apps/style-book/style-book-test/src/testIntegration/java/com/liferay/style/book/service/test/StyleBookEntryServiceTest.java @@ -63,8 +63,8 @@ public void testAddStyleBookEntryWithoutAddPermission() throws Exception { _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext, - RandomTestUtil.randomString()); + RandomTestUtil.randomString(), null, + RandomTestUtil.randomString(), _serviceContext); Assert.fail(); } @@ -82,8 +82,8 @@ public void testDeleteStyleBookEntryByExternalReferenceCode() StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext, - RandomTestUtil.randomString()); + RandomTestUtil.randomString(), null, + RandomTestUtil.randomString(), _serviceContext); _styleBookEntryService.deleteStyleBookEntry( styleBookEntry.getExternalReferenceCode(), @@ -101,8 +101,8 @@ public void testDeleteStyleBookEntryByExternalReferenceCodeWithoutDeletePermissi StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext, - RandomTestUtil.randomString()); + RandomTestUtil.randomString(), null, + RandomTestUtil.randomString(), _serviceContext); try { UserTestUtil.setUser( @@ -128,8 +128,8 @@ public void testGetStyleBookEntryByExternalReferenceCode() StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext, - RandomTestUtil.randomString()); + RandomTestUtil.randomString(), null, + RandomTestUtil.randomString(), _serviceContext); StyleBookEntry curStyleBookEntry = _styleBookEntryService.getStyleBookEntryByExternalReferenceCode( @@ -148,8 +148,8 @@ public void testGetStyleBookEntryByExternalReferenceCodeWithoutViewPermission() StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext, - RandomTestUtil.randomString()); + RandomTestUtil.randomString(), null, + RandomTestUtil.randomString(), _serviceContext); RoleTestUtil.removeResourcePermission( RoleConstants.GUEST, StyleBookEntry.class.getName(), diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java index 91cc545fe84ecf..1b036da69b1730 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryMVCActionCommandTest.java @@ -65,13 +65,15 @@ public void testDeleteStyleBookEntries() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); StyleBookEntry styleBookEntry2 = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -99,8 +101,8 @@ public void testDeleteStyleBookEntry() throws Exception { StyleBookEntry styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, - StringPool.BLANK, name, StringPool.BLANK, _serviceContext, - StringPool.BLANK); + StringPool.BLANK, name, StringPool.BLANK, + RandomTestUtil.randomString(), _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -130,7 +132,8 @@ public void testDeleteStyleBookEntryWithPreviewFileEntry() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); FileEntry fileEntry = _addFileEntry(styleBookEntry); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryPreviewMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryPreviewMVCActionCommandTest.java index 7df697c7dce3d7..2deeafa6755802 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryPreviewMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/DeleteStyleBookEntryPreviewMVCActionCommandTest.java @@ -64,7 +64,8 @@ public void testDeleteStyleBookEntryPreviewFileEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); FileEntry fileEntry = _addFileEntry(styleBookEntry); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java index 00d13048027a8d..e5950e6bb3cad8 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/ExportImportStyleBookEntriesMVCResourceCommandTest.java @@ -7,7 +7,6 @@ import com.liferay.arquillian.extension.junit.bridge.junit.Arquillian; import com.liferay.petra.string.CharPool; -import com.liferay.petra.string.StringPool; import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.model.Group; @@ -78,13 +77,13 @@ public void testExportImportMultipleStyleBookEntries() throws Exception { null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY_1", - serviceContext, StringPool.BLANK); + RandomTestUtil.randomString(), serviceContext); StyleBookEntry styleBookEntry2 = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY_2", - serviceContext, StringPool.BLANK); + RandomTestUtil.randomString(), serviceContext); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -122,8 +121,8 @@ public void testExportImportSingleStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), - "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext, - StringPool.BLANK); + "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", + RandomTestUtil.randomString(), serviceContext); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -174,8 +173,8 @@ public void testExportImportSingleStyleBookEntryAndNotOverwrite() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), - "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext, - StringPool.BLANK); + "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", + RandomTestUtil.randomString(), serviceContext); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -218,8 +217,8 @@ public void testExportImportSingleStyleBookEntryAndOverwrite() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), - "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", serviceContext, - StringPool.BLANK); + "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", + RandomTestUtil.randomString(), serviceContext); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -284,7 +283,7 @@ public void testExportStyleBookEntries() throws Exception { null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), RandomTestUtil.randomString(), "STYLE_BOOK_ENTRY_KEY", - serviceContext, StringPool.BLANK); + RandomTestUtil.randomString(), serviceContext); FileEntry fileEntry = _addFileEntry(styleBookEntry); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/StyleBookEntryServiceTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/StyleBookEntryServiceTest.java index 196c09d02be552..3b25512ecfde45 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/StyleBookEntryServiceTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/StyleBookEntryServiceTest.java @@ -52,9 +52,8 @@ public void testCopyStyleBookEntry() throws Exception { StyleBookEntry sourceStyleBookEntry = _styleBookEntryService.addStyleBookEntry( null, _group.getGroupId(), RandomTestUtil.randomString(), - "STYLE_BOOK_ENTRY_KEY", - ServiceContextTestUtil.getServiceContext(_group.getGroupId()), - RandomTestUtil.randomString()); + "STYLE_BOOK_ENTRY_KEY", RandomTestUtil.randomString(), + ServiceContextTestUtil.getServiceContext(_group.getGroupId())); StyleBookEntry targetStyleBookEntry = _styleBookEntryService.copyStyleBookEntry( diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryDefaultMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryDefaultMVCActionCommandTest.java index cfbad8b6888acb..ffddbb24d5ce49 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryDefaultMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryDefaultMVCActionCommandTest.java @@ -77,7 +77,8 @@ public void testMarkAsDefaultStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -107,7 +108,8 @@ public void testReplaceDefaultStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -134,7 +136,8 @@ public void testReplaceDefaultStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -167,7 +170,8 @@ public void testUnmarkAsDefaultStyleBookEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java index 5d3987ba140777..559956dd6b0285 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryNameMVCActionCommandTest.java @@ -92,8 +92,8 @@ public void testUpdateStyleBookEntryName() throws PortalException { StyleBookEntry styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, - StringPool.BLANK, oldName, StringPool.BLANK, _serviceContext, - StringPool.BLANK); + StringPool.BLANK, oldName, StringPool.BLANK, + RandomTestUtil.randomString(), _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -135,7 +135,8 @@ public void testUpdateStyleBookEntryNameWithEmptyName() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -161,7 +162,8 @@ public void testUpdateStyleBookEntryNameWithInvalidCharPeriod() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -186,7 +188,8 @@ public void testUpdateStyleBookEntryNameWithInvalidCharSlash() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -211,7 +214,8 @@ public void testUpdateStyleBookEntryNameWithNameMaxLength() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); diff --git a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryPreviewMVCActionCommandTest.java b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryPreviewMVCActionCommandTest.java index edafade4bb2bdd..051d0a29773fb2 100644 --- a/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryPreviewMVCActionCommandTest.java +++ b/modules/apps/style-book/style-book-web-test/src/testIntegration/java/com/liferay/style/book/web/internal/portlet/action/test/UpdateStyleBookEntryPreviewMVCActionCommandTest.java @@ -98,7 +98,8 @@ public void testReplaceStyleBookEntryPreview() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -184,7 +185,8 @@ public void testUpdateStyleBookEntryPreview() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext, StringPool.BLANK); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); FileEntry tempFileEntry = _addFileEntry( "thumbnail.png", styleBookEntry); diff --git a/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/portlet/action/AddStyleBookEntryMVCActionCommand.java b/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/portlet/action/AddStyleBookEntryMVCActionCommand.java index c76707457160de..2fa39f34e2c5e3 100644 --- a/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/portlet/action/AddStyleBookEntryMVCActionCommand.java +++ b/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/portlet/action/AddStyleBookEntryMVCActionCommand.java @@ -82,7 +82,7 @@ private StyleBookEntry _addStyleBookEntry(ActionRequest actionRequest) return _styleBookEntryService.addStyleBookEntry( null, serviceContext.getScopeGroupId(), name, StringPool.BLANK, - serviceContext, themeId); + themeId, serviceContext); } private String _getRedirectURL( diff --git a/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/zip/processor/StyleBookEntryZipProcessorImpl.java b/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/zip/processor/StyleBookEntryZipProcessorImpl.java index 2d0a0b2987a664..4310a8acac30c3 100644 --- a/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/zip/processor/StyleBookEntryZipProcessorImpl.java +++ b/modules/apps/style-book/style-book-web/src/main/java/com/liferay/style/book/web/internal/zip/processor/StyleBookEntryZipProcessorImpl.java @@ -121,8 +121,8 @@ private StyleBookEntry _addStyleBookEntry( if (styleBookEntry == null) { styleBookEntry = _styleBookEntryEntryService.addStyleBookEntry( null, groupId, frontendTokensValues, name, - styleBookEntryKey, - ServiceContextThreadLocal.getServiceContext(), themeId); + styleBookEntryKey, themeId, + ServiceContextThreadLocal.getServiceContext()); } else { styleBookEntry =