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..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,7 +442,7 @@ 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())); 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..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, 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 9bf9094275eefa..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,7 +154,7 @@ public void testCreateLayoutPageTemplateEntry() throws Exception { _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, + StringPool.BLANK, RandomTestUtil.randomString(), ServiceContextTestUtil.getServiceContext(_group.getGroupId())); draftLayout = _layoutLocalService.updateStyleBookEntryId( 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..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, RandomTestUtil.randomString(), + _serviceContext); Layout layout = _layoutLocalService.fetchLayout( layoutPageTemplateEntry.getPlid()); 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..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,7 +68,7 @@ public interface StyleBookEntryLocalService public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, - String name, String styleBookEntryKey, + 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 bac01f57a74d13..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,13 +39,14 @@ public class StyleBookEntryLocalServiceUtil { public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, - String name, String styleBookEntryKey, + 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); + 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 8f818e3f75bcc8..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,13 +36,14 @@ public StyleBookEntryLocalServiceWrapper( public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, - String name, String styleBookEntryKey, + 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); + 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 9c2e112bfdc678..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,13 +45,14 @@ public interface StyleBookEntryService extends BaseService { */ public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, ServiceContext serviceContext) + 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, 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 2f90a4daee8332..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,24 +30,25 @@ public class StyleBookEntryServiceUtil { */ public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, + String styleBookEntryKey, String themeId, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws PortalException { return getService().addStyleBookEntry( - externalReferenceCode, groupId, name, styleBookEntryKey, + externalReferenceCode, groupId, name, styleBookEntryKey, themeId, serviceContext); } public static StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, + String themeId, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws PortalException { return getService().addStyleBookEntry( externalReferenceCode, groupId, frontendTokensValues, name, - styleBookEntryKey, serviceContext); + 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 1a4f09c11a3c03..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,12 +31,12 @@ public StyleBookEntryServiceWrapper( @Override public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, + 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, + externalReferenceCode, groupId, name, styleBookEntryKey, themeId, serviceContext); } @@ -44,12 +44,13 @@ public StyleBookEntry addStyleBookEntry( public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, + 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); + styleBookEntryKey, themeId, serviceContext); } @Override 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 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/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..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,7 +50,8 @@ public StyleBookEntry addStagedModel( styleBookEntry.getGroupId(), styleBookEntry.isDefaultStyleBookEntry(), styleBookEntry.getFrontendTokensValues(), styleBookEntry.getName(), - styleBookEntry.getStyleBookEntryKey(), serviceContext); + styleBookEntry.getStyleBookEntryKey(), styleBookEntry.getThemeId(), + serviceContext); } @Override 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 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..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 @@ -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(255) 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..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 @@ -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(255) 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..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,7 +43,7 @@ public class StyleBookEntryServiceHttp { public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( HttpPrincipal httpPrincipal, String externalReferenceCode, - long groupId, String name, String styleBookEntryKey, + long groupId, String name, String styleBookEntryKey, String themeId, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException { @@ -54,7 +54,7 @@ public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( MethodHandler methodHandler = new MethodHandler( methodKey, externalReferenceCode, groupId, name, - styleBookEntryKey, serviceContext); + styleBookEntryKey, themeId, serviceContext); Object returnObj = null; @@ -87,7 +87,7 @@ 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, + String styleBookEntryKey, String themeId, com.liferay.portal.kernel.service.ServiceContext serviceContext) throws com.liferay.portal.kernel.exception.PortalException { @@ -98,7 +98,7 @@ public static com.liferay.style.book.model.StyleBookEntry addStyleBookEntry( MethodHandler methodHandler = new MethodHandler( methodKey, externalReferenceCode, groupId, frontendTokensValues, - name, styleBookEntryKey, serviceContext); + name, styleBookEntryKey, themeId, serviceContext); Object returnObj = null; @@ -633,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, + 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, com.liferay.portal.kernel.service.ServiceContext.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/impl/StyleBookEntryLocalServiceImpl.java b/modules/apps/style-book/style-book-service/src/main/java/com/liferay/style/book/service/impl/StyleBookEntryLocalServiceImpl.java index 0d5185f25e48a1..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 @@ -51,7 +51,7 @@ public class StyleBookEntryLocalServiceImpl public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long userId, long groupId, boolean defaultStyleBookEntry, String frontendTokensValues, - String name, String styleBookEntryKey, + String name, String styleBookEntryKey, String themeId, ServiceContext serviceContext) throws PortalException { @@ -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, 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 a3905265ccd7e8..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 @@ -34,23 +34,20 @@ public class StyleBookEntryServiceImpl extends StyleBookEntryServiceBaseImpl { @Override public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String name, - String styleBookEntryKey, ServiceContext serviceContext) + String styleBookEntryKey, String themeId, + ServiceContext serviceContext) throws PortalException { - _portletResourcePermission.check( - getPermissionChecker(), groupId, - StyleBookActionKeys.MANAGE_STYLE_BOOK_ENTRIES); - - return styleBookEntryLocalService.addStyleBookEntry( - externalReferenceCode, getUserId(), groupId, false, - StringPool.BLANK, name, styleBookEntryKey, serviceContext); + return addStyleBookEntry( + externalReferenceCode, groupId, StringPool.BLANK, name, + styleBookEntryKey, themeId, serviceContext); } @Override public StyleBookEntry addStyleBookEntry( String externalReferenceCode, long groupId, String frontendTokensValues, String name, String styleBookEntryKey, - ServiceContext serviceContext) + String themeId, ServiceContext serviceContext) throws PortalException { _portletResourcePermission.check( @@ -59,7 +56,8 @@ public StyleBookEntry addStyleBookEntry( return styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, getUserId(), groupId, false, - frontendTokensValues, name, styleBookEntryKey, serviceContext); + frontendTokensValues, name, styleBookEntryKey, themeId, + serviceContext); } @Override 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..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,6 +21,9 @@ + + 255 + @@ -43,5 +46,8 @@ + + 255 + \ 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..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,6 +17,7 @@ create table StyleBookEntry ( name VARCHAR(75) null, previewFileEntryId LONG, styleBookEntryKey VARCHAR(75) null, + themeId VARCHAR(255) null, primary key (styleBookEntryId, ctCollectionId) ); @@ -39,5 +40,6 @@ create table StyleBookEntryVersion ( name VARCHAR(75) null, previewFileEntryId LONG, styleBookEntryKey VARCHAR(75) null, + themeId VARCHAR(255) 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/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..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,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, 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 4fa76a635a3c29..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,7 +46,7 @@ public void setUp() throws Exception { _styleBookEntry = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), TestPropsValues.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - RandomTestUtil.randomString(), + RandomTestUtil.randomString(), RandomTestUtil.randomString(), ServiceContextTestUtil.getServiceContext()); } 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; 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..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, 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, RandomTestUtil.randomString(), _serviceContext); _styleBookEntryLocalService.addStyleBookEntry( externalReferenceCode, TestPropsValues.getUserId(), _group.getGroupId(), false, null, RandomTestUtil.randomString(), - null, _serviceContext); + 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, 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 2cc3354c4336ea..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,7 +63,8 @@ public void testAddStyleBookEntryWithoutAddPermission() throws Exception { _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext); + RandomTestUtil.randomString(), null, + RandomTestUtil.randomString(), _serviceContext); Assert.fail(); } @@ -81,7 +82,8 @@ public void testDeleteStyleBookEntryByExternalReferenceCode() StyleBookEntry styleBookEntry = _styleBookEntryService.addStyleBookEntry( RandomTestUtil.randomString(), _group.getGroupId(), - RandomTestUtil.randomString(), null, _serviceContext); + RandomTestUtil.randomString(), null, + RandomTestUtil.randomString(), _serviceContext); _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, + RandomTestUtil.randomString(), _serviceContext); 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, + RandomTestUtil.randomString(), _serviceContext); 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, + 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 26776c5ace9556..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, RandomTestUtil.randomString(), + _serviceContext); StyleBookEntry styleBookEntry2 = _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -99,7 +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, name, StringPool.BLANK, + RandomTestUtil.randomString(), _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -129,7 +132,8 @@ public void testDeleteStyleBookEntryWithPreviewFileEntry() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _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/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..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, 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 ad340f5166f573..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 @@ -77,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); + 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); + RandomTestUtil.randomString(), serviceContext); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -122,7 +122,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); + RandomTestUtil.randomString(), serviceContext); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -174,7 +174,7 @@ public void testExportImportSingleStyleBookEntryAndNotOverwrite() null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", - serviceContext); + RandomTestUtil.randomString(), serviceContext); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -218,7 +218,7 @@ public void testExportImportSingleStyleBookEntryAndOverwrite() null, TestPropsValues.getUserId(), _sourceGroup.getGroupId(), false, _read("frontend-tokens-values.json"), "Style Book Entry Name", "STYLE_BOOK_ENTRY_KEY", - serviceContext); + RandomTestUtil.randomString(), serviceContext); File file = ReflectionTestUtil.invoke( _exportStyleBookEntriesMVCResourceCommand, @@ -283,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); + 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 5d46a0e9377145..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,7 +52,7 @@ public void testCopyStyleBookEntry() throws Exception { StyleBookEntry sourceStyleBookEntry = _styleBookEntryService.addStyleBookEntry( null, _group.getGroupId(), RandomTestUtil.randomString(), - "STYLE_BOOK_ENTRY_KEY", + "STYLE_BOOK_ENTRY_KEY", RandomTestUtil.randomString(), ServiceContextTestUtil.getServiceContext(_group.getGroupId())); StyleBookEntry targetStyleBookEntry = 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..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, 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, 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, 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, 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 fdfe230e3a7969..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,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, oldName, StringPool.BLANK, + RandomTestUtil.randomString(), _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -134,7 +135,8 @@ public void testUpdateStyleBookEntryNameWithEmptyName() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -160,7 +162,8 @@ public void testUpdateStyleBookEntryNameWithInvalidCharPeriod() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -185,7 +188,8 @@ public void testUpdateStyleBookEntryNameWithInvalidCharSlash() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + StringPool.BLANK, RandomTestUtil.randomString(), + _serviceContext); MockLiferayPortletActionRequest mockLiferayPortletActionRequest = new MockLiferayPortletActionRequest(); @@ -210,7 +214,8 @@ public void testUpdateStyleBookEntryNameWithNameMaxLength() _styleBookEntryLocalService.addStyleBookEntry( null, TestPropsValues.getUserId(), _group.getGroupId(), false, StringPool.BLANK, RandomTestUtil.randomString(), - StringPool.BLANK, _serviceContext); + 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 a7fc06436b6aba..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, 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, 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 dd4f34c184d054..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 @@ -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); + 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 96c77b7b350304..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 @@ -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 = @@ -121,7 +121,7 @@ private StyleBookEntry _addStyleBookEntry( if (styleBookEntry == null) { styleBookEntry = _styleBookEntryEntryService.addStyleBookEntry( null, groupId, frontendTokensValues, name, - styleBookEntryKey, + styleBookEntryKey, themeId, ServiceContextThreadLocal.getServiceContext()); } else { @@ -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;