Coder Social home page Coder Social logo

mariodavid / cuba-component-db-update-wizard Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 1.0 86 KB

CUBA component for defining & executing custom DB updates through the UI

License: Apache License 2.0

Groovy 74.76% Java 22.15% Shell 3.09%
cuba-platform db wizard cuba-component administration cuba

cuba-component-db-update-wizard's Introduction

Download license Build Status

CUBA Platform Component - DB-Update Wizard

This application component can be used for creating one-off custom DB updates that should be executed by the administrator through the UI.

For normal / small-delta changes of the DB, the default CUBA DB-update scripts mechanisms should be used. But sometimes there are migrations from an existing database schema from another framework e.g, which are hard to do through the default mechanisms. This is where this application components comes into play.

Installation

  1. Add the following maven repository https://dl.bintray.com/mariodavid/cuba-components to the build.gradle of your CUBA application:

    buildscript {

     //...
     
     repositories {
     
         // ...
     
         maven {
             url  "https://dl.bintray.com/mariodavid/cuba-components"
         }
     }
     
     // ...
    

    }

  2. Select a version of the add-on which is compatible with the platform version used in your project:

Platform Version Add-on Version
6.6.x 0.2.x
6.5.x 0.1.x

The latest version is: Download

Add custom application component to your project:

  • Artifact group: de.diedavids.cuba.dbupdatewizard
  • Artifact name: db-update-wizard-global
  • Version: add-on version

Usage

To create a custom DB-Update in your code, where you want to connect to another Database or doing some other crazy stuff, that is not really possible through the normal Update scripts of CUBA, you can create a class in your application that will extend DefaultDbUpdateWizardService like this:

class MyCustomDbUpdateWizardServiceBean extends DefaultDbUpdateWizardServiceBean {

    @Override
    public boolean isUpdateAvaliable() {
        return true;
    }

    @Override
    public String getDbUpdateWizardStartMessage() {
        return "my start message";
    }

    @Override
    public Collection<Message> validatePreconditions() {
        // do pre-condition checks and return a Collection of Messages that will be displayed in the UI
        // If it contains a Message with MessageType.ERROR, the UI will not allow the user to proceed
        
        return null;
    }

    @Override
    public Collection<Message> executeUpdate() {
        // do the actual update and return a Collection of Messages that will be displayed in the UI
        
        return null;
    }
}

In order to make the db wizard aware of your bean, you have to register it in the spring.xml of the core module of your application like this:

 <bean id="ddcduw_DbUpdateWizardService" class="com.company.myapp.core.MyCustomDbUpdateWizardServiceBean" />

DB Update Wizard

The UI that the User can use to run the custom DB Update is placed under "Administration" > "DB-Update Wizard".

cuba-component-db-update-wizard's People

Contributors

mariodavid avatar

Watchers

 avatar  avatar  avatar

Forkers

flavio58it

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.