Skip to content

Commit a2df3c1

Browse files
author
Yasuyuki Takeo
committed
Merge branch 'release/7.2.3'
2 parents d93de3d + 2f0874d commit a2df3c1

File tree

19 files changed

+458
-243
lines changed

19 files changed

+458
-243
lines changed

.eslintrc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
3+
*
4+
* This library is free software; you can redistribute it and/or modify it under
5+
* the terms of the GNU Lesser General Public License as published by the Free
6+
* Software Foundation; either version 2.1 of the License, or (at your option)
7+
* any later version.
8+
*
9+
* This library is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11+
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12+
* details.
13+
*/
14+
15+
module.exports = {
16+
globals: {
17+
_: true
18+
}
19+
};

.npmbundlerrc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"verbose": true,
3+
"sources": ["src"],
4+
"packages": {
5+
"is-object": {
6+
"copy-plugins": ["exclude-imports"],
7+
"plugins": ["replace-browser-modules"],
8+
".babelrc:": {
9+
"presets": ["liferay-standard"]
10+
},
11+
"post-plugins": [
12+
"namespace-packages",
13+
"inject-imports-dependencies",
14+
"inject-peer-dependencies"
15+
]
16+
}
17+
},
18+
"rules": [{
19+
"test": "\\.js$",
20+
"exclude": "node_modules",
21+
"use": [{
22+
"loader": "babel-loader",
23+
"options": {
24+
"presets": ["env"]
25+
}
26+
}]
27+
}]
28+
}

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ Dummy Factory generates dummy data for debugging use. Please don't use this for
2828
### For 7.2
2929
1. Download jar file from [here](https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/master/latest) and place it in ${liferay-home}/deploy folder.
3030
2. Start Liferay bundle and login as an administrator.
31-
3. Dummy Factory uses lodash libraly and it's disabled for 7.2 by default. Please navigate `Control Panel → Configuration → System Settings → Third Party` and check Lodash to true.
32-
4. After the jar is properly installed, navigate to ```Control Panel``` in the left pane and under ```Apps``` folder, Dummy Factory portlet will be found. Please place that on a page.
33-
5. Now you are ready to create dummy data! Enjoy!
31+
3. After the jar is properly installed, navigate to ```Control Panel``` in the left pane and under ```Apps``` folder, Dummy Factory portlet will be found. Please place that on a page.
32+
4. Now you are ready to create dummy data! Enjoy!
3433

3534
### For 7.1
3635
1. Download jar file from [here](https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/7.1.x/latest) and place it in ${liferay-home}/deploy folder.
@@ -49,3 +48,6 @@ Please download file from[here](https://github.com/yasuflatland-lf/liferay-dummy
4948

5049
## Bug / Enhancement request
5150
Please create a issue on this repository.
51+
52+
## Known issues
53+
- Wiki generator gets error and does not work due to denied access to JSON APIs before the initilization. Wiki looks like bing initialized at the first access to the Wiki Admin page in the control panel, right after spining up the Liferay bundle.

bnd.bnd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Bundle-Name: Liferay Dummy Factory Portlet
22
Bundle-SymbolicName: liferay.dummy.factory
3-
Bundle-Version: 7.2.2
3+
Bundle-Version: 7.2.3
4+
Web-ContextPath: /liferay-dummy-factory
45
-dsannotations-options: inherit
6+
-sources: true
57

68
Import-Package:\
79
!org.apache.commons.fileupload.*,\

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ dependencies {
7474
compile group: "com.liferay", name: "com.liferay.trash.taglib", version: "4.0.0"
7575
compile group: "com.liferay", name: "com.liferay.portal.spring.extender", version: "2.1.+"
7676
compile group: "com.liferay", name: "com.liferay.portal.instances.api", version: "3.0.0"
77+
78+
compile group: "com.liferay", name: "com.liferay.frontend.js.loader.modules.extender.api", version: "3.0.0"
79+
7780
compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "4.0.0"
7881
compile group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "4.0.0"
7982
compile group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "4.0.0"
11.1 MB
Binary file not shown.

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "liferay-dummy-factory",
3+
"version": "1.0.0",
4+
"dependencies": {
5+
"lodash": "^4.17.15"
6+
},
7+
"devDependencies": {
8+
"liferay-npm-bundler": "^2.13.2",
9+
"liferay-npm-scripts": "^9.5.0"
10+
},
11+
"scripts": {
12+
"build": "liferay-npm-bundler"
13+
}
14+
}

src/main/java/com/liferay/support/tools/portlet/LiferayDummyFactoryPortlet.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.liferay.support.tools.portlet;
22

3+
import com.liferay.frontend.js.loader.modules.extender.npm.NPMResolver;
34
import com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil;
45
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;
56
import com.liferay.support.tools.constants.LDFPortletKeys;
67
import com.liferay.support.tools.portlet.actions.DummyFactoryConfiguration;
8+
import com.liferay.support.tools.utils.LodashResolver;
79

810
import java.io.IOException;
911
import java.util.Map;
@@ -17,6 +19,7 @@
1719
import org.osgi.service.component.annotations.Component;
1820
import org.osgi.service.component.annotations.ConfigurationPolicy;
1921
import org.osgi.service.component.annotations.Modified;
22+
import org.osgi.service.component.annotations.Reference;
2023

2124
/**
2225
* Dummy Factory Portlet
@@ -56,7 +59,10 @@ public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
5659
throws IOException, PortletException {
5760

5861
renderRequest.setAttribute(DummyFactoryConfiguration.class.getName(), _dummyFactoryConfiguration);
59-
62+
63+
//Loading Lodash
64+
LodashResolver.exec(renderRequest, _npmResolver);
65+
6066
super.doView(renderRequest, renderResponse);
6167
}
6268

@@ -77,5 +83,8 @@ protected void activate(Map<Object, Object> properties) {
7783
_dummyFactoryConfiguration = ConfigurableUtil.createConfigurable(DummyFactoryConfiguration.class, properties);
7884
}
7985

80-
private volatile DummyFactoryConfiguration _dummyFactoryConfiguration;
86+
@Reference
87+
private NPMResolver _npmResolver;
88+
private volatile DummyFactoryConfiguration _dummyFactoryConfiguration;
89+
8190
}

src/main/java/com/liferay/support/tools/portlet/actions/CommonMVCRenderCommand.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package com.liferay.support.tools.portlet.actions;
22

3+
import com.liferay.frontend.js.loader.modules.extender.npm.NPMResolver;
34
import com.liferay.portal.kernel.log.Log;
45
import com.liferay.portal.kernel.log.LogFactoryUtil;
56
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCRenderCommand;
6-
import com.liferay.portal.kernel.util.*;
7+
import com.liferay.portal.kernel.util.ParamUtil;
78
import com.liferay.support.tools.constants.LDFPortletKeys;
89
import com.liferay.support.tools.constants.LDFPortletWebKeys;
910
import com.liferay.support.tools.utils.CommonUtil;
11+
import com.liferay.support.tools.utils.LodashResolver;
1012
import com.liferay.support.tools.utils.WikiCommons;
1113

1214
import javax.portlet.PortletException;
@@ -63,6 +65,9 @@ public String render(RenderRequest renderRequest, RenderResponse renderResponse)
6365
.getOrDefault(mode, LDFPortletKeys.JSP_ORGANIZAION) + ">");
6466
}
6567

68+
//Loading Lodash
69+
LodashResolver.exec(renderRequest, _npmResolver);
70+
6671
return _commonUtil
6772
.getPageFromMode()
6873
.getOrDefault(mode, LDFPortletKeys.JSP_ORGANIZAION);
@@ -73,6 +78,9 @@ public String render(RenderRequest renderRequest, RenderResponse renderResponse)
7378

7479
@Reference
7580
private WikiCommons _wikiCommons;
81+
82+
@Reference
83+
private NPMResolver _npmResolver;
7684

7785
private static Log _log = LogFactoryUtil
7886
.getLog(CommonMVCRenderCommand.class);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.liferay.support.tools.utils;
2+
3+
import com.liferay.frontend.js.loader.modules.extender.npm.JSPackage;
4+
import com.liferay.frontend.js.loader.modules.extender.npm.NPMResolver;
5+
6+
import javax.portlet.RenderRequest;
7+
8+
public class LodashResolver {
9+
10+
static public void exec(RenderRequest renderRequest, NPMResolver npmResolver) {
11+
JSPackage jsPackage = npmResolver.getDependencyJSPackage("lodash");
12+
renderRequest.setAttribute("bootstrapRequire", jsPackage.getResolvedId());
13+
}
14+
}

0 commit comments

Comments
 (0)