Skip to content

Commit

Permalink
Merge branch 'release/7.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasuyuki Takeo committed Apr 14, 2020
2 parents a2df3c1 + ec0e82a commit ba3157c
Show file tree
Hide file tree
Showing 31 changed files with 765 additions and 496 deletions.
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,28 @@ Dummy Factory generates dummy data for debugging use. Please don't use this for

## Required environment
* Java 1.8 or above
* Liferay 7.2 GA1 / Liferay DXP 7.2 GA1 or above (Master / Develop branch)
* Liferay 7.0 (Please see 7.0.x branch)
* Liferay 7.3 GA1 (Master / Develop branch)
* Liferay 7.2 GA1 / Liferay DXP 7.2 GA1 or above (Please see 7.2.x branch)
* Liferay 7.1 (Please see 7.1.x branch)
* Liferay 7.0 (Please see 7.0.x branch)

## Usage
### For 7.2
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.
| Version | Link |
| ------------- |:------------- |
| 7.3 | [https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/master/latest](https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/master/latest) |
| 7.2 | [https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/7.2.x/latest](https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/7.2.x/latest) |
| 7.1 | [https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/7.1.x/latest](https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/7.1.x/latest) |
| 7.0 | [https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/7.0.x/latest](https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/7.0.x/latest) |

1. Download jar file according to the version above and place it int `${liferay-home}/deploy `
2. Start Liferay bundle and login as an administrator.
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.
4. Now you are ready to create dummy data! Enjoy!

### For 7.1
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.
2. Start Liferay bundle and login as an administrator.
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.
4. Now you are ready to create dummy data! Enjoy!

### For 7.0
Please download file from[here](https://github.com/yasuflatland-lf/liferay-dummy-factory/tree/7.0.x/latest) and follow the same steps above.

## How can I compile Dummy Factory on my own?
1. Create a Liferay Workspace for 7.2 (or 7.0 for 7.0.x branch and 7.1 for 7.1.x branch)
2. Clone this repository to ```${liferay_workspace_home}/modules```.
3. At the root directory, run ```../gradlew clean assemble``` or ```blade gw assemble``` if you've installed `blade` tool. ```liferay.dummy.factory-x.x.x.jar``` will be created under ```/build/libs/``` directory.
1. Create a Liferay Workspace for appropriate version (7.2.x branch is for 7.2, for example)
2. Clone this repository to `${liferay_workspace_home}/modules`.
3. At the root directory, run `../gradlew clean assemble` or `blade gw assemble` if you've installed `blade` tool. ```liferay.dummy.factory-x.x.x.jar``` will be created under ```/build/libs/``` directory.
4. To install onto your Liferay bundle, startup Liferay bundle on your local and run ```blade deploy```. Dummy Factory portlet will be deployed.

## Bug / Enhancement request
Expand Down
2 changes: 1 addition & 1 deletion bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bundle-Name: Liferay Dummy Factory Portlet
Bundle-SymbolicName: liferay.dummy.factory
Bundle-Version: 7.2.3
Bundle-Version: 7.3.0
Web-ContextPath: /liferay-dummy-factory
-dsannotations-options: inherit
-sources: true
Expand Down
84 changes: 43 additions & 41 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,46 +64,48 @@ dependencies {
compile group: "commons-fileupload", name: "commons-fileupload", version: "1.3.3"
compile group: "org.apache.felix", name: "org.apache.felix.gogo.runtime", version: "0.10.0"

compile group: "com.liferay", name: "com.liferay.application.list.api", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.frontend.taglib", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.frontend.taglib.clay", version: "2.0.0"
compile group: "com.liferay", name: "com.liferay.frontend.taglib.util", version: "2.0.0"
compile group: "com.liferay", name: "com.liferay.item.selector.api", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.item.selector.criteria.api", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.item.selector.taglib", version: "3.0.0"
compile group: "com.liferay", name: "com.liferay.trash.taglib", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.portal.spring.extender", version: "2.1.+"
compile group: "com.liferay", name: "com.liferay.portal.instances.api", version: "3.0.0"
compile "com.liferay:com.liferay.application.list.api"
compile "com.liferay:com.liferay.frontend.taglib"
compile "com.liferay:com.liferay.frontend.taglib.clay"
compile "com.liferay:com.liferay.frontend.taglib.util"
compile "com.liferay:com.liferay.item.selector.api"
compile "com.liferay:com.liferay.item.selector.criteria.api"
compile "com.liferay:com.liferay.item.selector.taglib"
compile "com.liferay:com.liferay.trash.taglib"
compile "com.liferay:com.liferay.portal.spring.extender:2.1.+"
compile "com.liferay:com.liferay.portal.instances.api"

compile group: "com.liferay", name: "com.liferay.frontend.js.loader.modules.extender.api", version: "3.0.0"

compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "4.0.0"
compile group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "4.0.0"
compile group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.message.boards.api", version: "5.0.0"
compile group: "com.liferay", name: "com.liferay.message.boards.service", version: "3.0.0"
compile group: "com.liferay", name: "com.liferay.blogs.api", version: "5.0.0"

compile group: "com.liferay", name: "com.liferay.portal.settings.api", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.portal.settings.lang", version: "3.0.0"

compile group: "com.liferay", name: "com.liferay.journal.api", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.journal.service", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.wiki.api", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.wiki.service", version: "3.0.0"
compile group: "com.liferay", name: "com.liferay.petra.string", version: "3.0.0"
compile group: "com.liferay", name: "com.liferay.petra.function", version: "3.0.0"

compile group: "com.liferay", name: "com.liferay.dynamic.data.lists.service", version: "3.0.0"
compile group: "com.liferay", name: "com.liferay.dynamic.data.lists.api", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.dynamic.data.mapping.api", version: "5.0.0"
compile group: "com.liferay", name: "com.liferay.dynamic.data.mapping.service", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.dynamic.data.mapping.taglib", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.dynamic.data.mapping.io", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.dynamic.data.mapping.validator", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.portal.configuration.metatype", version: "2.0.+"
compile group: "com.liferay", name: "com.liferay.portal.background.task.api", version: "4.0.0"
compile group: "com.liferay", name: "com.liferay.document.library.api", version: "5.0.0"
compile "com.liferay:com.liferay.frontend.js.loader.modules.extender.api"

compile "com.liferay.portal:com.liferay.portal.kernel"
compile "com.liferay.portal:com.liferay.portal.impl"
compile "com.liferay.portal:com.liferay.util.taglib"
compile "com.liferay:com.liferay.message.boards.api"
compile "com.liferay:com.liferay.message.boards.service"
compile "com.liferay:com.liferay.blogs.api"

compile "com.liferay:com.liferay.portal.settings.api"
compile "com.liferay:com.liferay.portal.settings.lang"

compile "com.liferay:com.liferay.journal.api"
compile "com.liferay:com.liferay.journal.service"
compile "com.liferay:com.liferay.wiki.api"
compile "com.liferay:com.liferay.wiki.service"
compile "com.liferay:com.liferay.wiki.web"

compile "com.liferay:com.liferay.petra.string"
compile "com.liferay:com.liferay.petra.function"

compile "com.liferay:com.liferay.dynamic.data.lists.service"
compile "com.liferay:com.liferay.dynamic.data.lists.api"
compile "com.liferay:com.liferay.dynamic.data.mapping.api"
compile "com.liferay:com.liferay.dynamic.data.mapping.service"
compile "com.liferay:com.liferay.dynamic.data.mapping.taglib"
compile "com.liferay:com.liferay.dynamic.data.mapping.io:4.0.+"
compile "com.liferay:com.liferay.dynamic.data.mapping.validator"
compile "com.liferay:com.liferay.portal.configuration.metatype:2.0.+"
compile "com.liferay:com.liferay.portal.background.task.api"
compile "com.liferay:com.liferay.document.library.api"

compile group: "javax.portlet", name: "portlet-api", version: "3.0.0"
compile group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
Expand All @@ -114,8 +116,8 @@ dependencies {
testCompile 'org.codehaus.groovy:groovy-all:2.5.+'
testCompile group: 'cglib', name: 'cglib-nodep', version:'latest.integration'
testCompile group: 'junit', name: 'junit', version:'4.12'
testCompile group: 'org.apache.tika', name: 'tika-core', version: '1.19.1'
testCompile group: 'org.apache.tika', name: 'tika-parsers', version: '1.19.1'
testCompile group: 'org.apache.tika', name: 'tika-core', version: '1.22'
testCompile group: 'org.apache.tika', name: 'tika-parsers', version: '1.22'

testCompile group: 'org.hamcrest', name: 'hamcrest-core', version:'latest.integration'
testCompile group: 'org.objenesis', name: 'objenesis', version:'latest.integration'
Expand Down
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed Apr 08 16:42:57 JST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"lodash": "^4.17.15"
},
"devDependencies": {
"liferay-npm-bundler": "^2.13.2",
"liferay-npm-scripts": "^9.5.0"
"liferay-npm-bundler": "^2.18.4",
"liferay-npm-scripts": "^29.0.0"
},
"scripts": {
"build": "liferay-npm-bundler"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public void create(ActionRequest request) throws Exception {

TimeKeeper timeKeeper = new TimeKeeper();
timeKeeper.start();


// Execute creation process
exec(request, paramContext);

timeKeeper.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,89 +8,92 @@
import com.liferay.portal.kernel.service.CompanyLocalService;
import com.liferay.support.tools.common.DummyGenerator;
import com.liferay.support.tools.utils.ProgressManager;

import javax.portlet.ActionRequest;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

/**
* Company Generator
*
* @author Yasuyuki Takeo
*/
@Component(immediate = true, service = CompanyDefaultDummyGenerator.class)
public class CompanyDefaultDummyGenerator extends DummyGenerator<CompanyContext> {

@Override
protected CompanyContext getContext(ActionRequest request) throws Exception {
return new CompanyContext(request);
}

@Override
protected void exec(ActionRequest request, CompanyContext paramContext)
throws Exception {
//Tracking progress start
ProgressManager progressManager = new ProgressManager();
progressManager.start(request);
System.out.println("Starting to create " + paramContext.getNumberOfCompanies() + " companies");
for (long i = 1; i <= paramContext.getNumberOfCompanies(); i++) {
//Update progress
progressManager.trackProgress(i, paramContext.getNumberOfCompanies());
//Create company web id
StringBundler webId = new StringBundler(2);
webId.append(paramContext.getWebId());
//Create company Virtual Host Name
StringBundler virtualHostname = new StringBundler(2);
virtualHostname.append(paramContext.getVirtualHostname());

//Create company Mail Domain
StringBundler mx = new StringBundler(2);
mx.append(paramContext.getMx());

//Add number more then one company
if(1 < paramContext.getNumberOfCompanies()) {
webId.append(i);
virtualHostname.append(i);
mx.append(i);
}
try {
if(_log.isDebugEnabled()) {
_log.debug("-----");
}
Company company = _companyLocalService.addCompany(
webId.toString(),
virtualHostname.toString(),
mx.toString(),
paramContext.isSystem(),
paramContext.getMaxUsers(),
paramContext.isActive());
_portalInstancesLocalService.initializePortalInstance(
paramContext.getServletContext(), company.getWebId());
} catch (Exception e) {
//Finish progress
progressManager.finish();
throw e;
}
}
//Finish progress
progressManager.finish();
System.out.println("Finished creating " + paramContext.getNumberOfCompanies() + " companies");
}

@Reference
private CompanyLocalService _companyLocalService;
@Reference
private PortalInstancesLocalService _portalInstancesLocalService;

private static final Log _log = LogFactoryUtil.getLog(CompanyDefaultDummyGenerator.class);
private static final Log _log = LogFactoryUtil.getLog(CompanyDefaultDummyGenerator.class);

@Reference
private CompanyLocalService _companyLocalService;

@Reference
private PortalInstancesLocalService _portalInstancesLocalService;

@Override
protected CompanyContext getContext(ActionRequest request) throws Exception {
return new CompanyContext(request);
}

@Override
protected void exec(ActionRequest request, CompanyContext paramContext)
throws Exception {

//Tracking progress start
ProgressManager progressManager = new ProgressManager();
progressManager.start(request);

System.out.println("Starting to create " + paramContext.getNumberOfCompanies() + " companies");

for (long i = 1; i <= paramContext.getNumberOfCompanies(); i++) {
//Update progress
progressManager.trackProgress(i, paramContext.getNumberOfCompanies());

//Create company web id
StringBundler webId = new StringBundler(2);
webId.append(paramContext.getWebId());

//Create company Virtual Host Name
StringBundler virtualHostname = new StringBundler(2);
virtualHostname.append(paramContext.getVirtualHostname());

//Create company Mail Domain
StringBundler mx = new StringBundler(2);
mx.append(paramContext.getMx());

//Add number more then one company
if (1 < paramContext.getNumberOfCompanies()) {
webId.append(i);
virtualHostname.append(i);
mx.append(i);
}

try {
if (_log.isDebugEnabled()) {
_log.debug("-----");
}

Company company = _companyLocalService.addCompany(
webId.toString(),
virtualHostname.toString(),
mx.toString(),
paramContext.isSystem(),
paramContext.getMaxUsers(),
paramContext.isActive());

_portalInstancesLocalService.initializePortalInstance(
paramContext.getServletContext(), company.getWebId());

} catch (Exception e) {
//Finish progress
progressManager.finish();
throw e;
}
}

//Finish progress
progressManager.finish();

System.out.println("Finished creating " + paramContext.getNumberOfCompanies() + " companies");

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.liferay.message.boards.service.MBCategoryLocalService;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.service.GroupLocalService;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.support.tools.common.DummyGenerator;
import com.liferay.support.tools.utils.CommonUtil;
Expand Down Expand Up @@ -59,13 +60,18 @@ protected void exec(ActionRequest request, MBContext paramContext) throws Portal

try {

// Set current site scope ID to the Service Context
ServiceContext serviceContext =
paramContext.getServiceContext();
serviceContext.setScopeGroupId(paramContext.getSiteGroupId());

// Generate category
_MBCategoryLocalService.addCategory(
paramContext.getServiceContext().getUserId(), // userId
paramContext.getParentCategoryId(), // parentCategoryId
actualName.toString(), // name
paramContext.getDescription(), // description,
paramContext.getServiceContext());
serviceContext);

} catch (Throwable e) {
// Finish progress
Expand Down
Loading

0 comments on commit ba3157c

Please sign in to comment.