Git Product home page Git Product logo

liferay-db-setup-core-lunde's Introduction

Artifact Javadocs

Liferay Portal DB Setup core

Library that allows to setup a number of Liferay artifacts in a DB. It uses xml configuration and Liferay APIs to add all configured artifacts. Artifacts in the database are created by Liferay common upgrade process. Each step of the upgrade process consists of one or more xml files, in which you can define artifacts to create or update.

Usage

First add this dependency into your OSGi module project's pom.xml.

<dependency>
    <groupId>eu.lundegaard.liferay</groupId>
    <artifactId>liferay-db-setup-core</artifactId>
    <version>3.1.0</version>
</dependency>

and specify the dependency in your bnd.bnd file as a resource to include.

Include-Resource: @liferay-db-setup-core-3.1.0.jar

Second create UpgradeStepRegistrator component to register your upgrade steps, e.g.

@Component(immediate = true, service = UpgradeStepRegistrator.class)
public class MyPortalUpgrade implements UpgradeStepRegistrator {

    @Override
    public void register(Registry registry) {
        String packageName = MyPortalUpgrade.class.getPackage().getName();
        registry.register(packageName, "1.0.0", "1.0.1", new GenericUpgradeStep("v1_0_1"));
    }
    
}

You can also call one of the LiferaySetup.setup methods directly to setup the database.

XML File content

XML file of an upgrade step has usually this structure:

<?xml version="1.0" encoding="UTF-8" ?>
<setup xmlns="http://www.lundegaard.eu/liferay/setup">
    <configuration>
        <runasuser>[email protected]</runasuser>
    </configuration>

    <!-- Artifacts to manage --> 
</setup>

runasuser defines under which user artifacts will be created. Then you can specify as many artifacts to setup as you want.

For instance, this will create Role with Publisher as a name.

<?xml version="1.0" encoding="UTF-8" ?>
<setup xmlns="http://www.lundegaard.eu/liferay/setup">
    <configuration>
        <runasuser>[email protected]</runasuser>
    </configuration>
 
    <roles>
        <role name="Publisher"/>
    </roles>
</setup>

Features

In Artifacts to manage section you can specify a lot of artifacts.

Role

<roles>
    <role name="Publisher"/>
</roles>

Expando attribute

This will create expando attribute canonical-url with permissions to view by guest user.

<customFields>
    <field name="canonical-url" type="string" className="com.liferay.portal.kernel.model.Layout">
        <role-permission role-name="Guest">
            <permission-action action-name="VIEW"/>
        </role-permission>
    </field>
</customFields>

Site

Site element must always have site-friendly-url filled. Guest site is determined by default attribute with true value. Other sites are specified by name attribute.

<sites>
    <site default="true" site-friendly-url="/guest">
    </site>
    <site name="My web" default="false" >
    </site>
</sites>

Document

Document's file itself is determined by file-system-name attribute which defines resource on classpath.

<document file-system-name="my-project/documents/icons/icon-home.svg"
          document-folder-name="/Icons"
          document-filename="icon-home.svg"
          document-title="icon-home.svg"/>

Articles

Article's content is determined by path attribute which defines resource on classpath. The resource contains article content in the form of XML.

<article title="Footer"
         path="my-project/articles/homepage/web_content/footer.xml"
         article-structure-key="BASIC-WEB-CONTENT"
         article-template-key="BASIC-WEB-CONTENT"
         articleId="FOOTER"
         article-folder-path="/Footer">
</article>

<article-structure key="BANNER-MAIN"
                   path="my-project/articles/homepage/structures/banner-main.json"
                   name="Banner - main"/>

<article-template key="BANNER-MAIN"
                  path="my-project/articles/homepage/templates/banner-main.ftl"
                  article-structure-key="BANNER-MAIN" name="Banner - main" cacheable="true"/>

Others

You can create/update/set many other artifacts like User, Organization, Page, Portlet placement, Permission, ... See source code.

Compatibility

|| Liferay Portal Version || Version || | 7.3.x | 3.1.x | | 7.2.x | 3.0.x | | older | use original Mimacom library |

liferay-db-setup-core-lunde's People

Contributors

abenitezsan avatar alesrybak avatar dmmrch avatar gustavnovotny avatar ktor avatar marcelfadtke avatar ntrp avatar raptor22fa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.