GithubHelp home page GithubHelp logo

robotoworks / mechanoid Goto Github PK

View Code? Open in Web Editor NEW
58.0 58.0 26.0 69.66 MB

Eclipse plugin providing a set of DSL's for the rapid development of Android apps

Shell 0.03% Java 91.33% GAP 6.99% Xtend 1.43% Groovy 0.02% HTML 0.02% CSS 0.01% XSLT 0.06% Ruby 0.05% PHP 0.01% FreeMarker 0.05%

mechanoid's People

Contributors

fluxtah avatar groupsky avatar imminent avatar ironsteel avatar maciejciemiega avatar onyxvd avatar rosomack avatar sebastienrouif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mechanoid's Issues

ERD Diagram of database

A diagram view that illustrates the current state of the database (all migrations applied, or up to a specific migration).

[MECHDB] Strip mechdb comments from generated code

It is possible to comment using standard // and /**/ style comments in mechdb files however when serialized and used in the generated API comments are not stripped out which would cause database errors

Comments should be stripped out

Add a drop recreate statement to migrations

Migrations are pretty cool but during development it can introduce to many migrations especially in the case where you have large view statements.

An option to drop recreate would allow previous migrations to be modified and force all devices for a particular version to drop recreate which would then recreate the new schema.

The syntax could be as follows:

migration {
    drop recreate;
}

which would drop all tables, views and triggers and then recreate the database by calling the open helpers onCreate();

[MECHDB] blob type produces invalid code

when a column is declared as a blob the following illegal methods are called

  • readByte[] instead of readByteArray.
  • getByte[] instead of getByteArray.
  • writeByte[] instead of writeByteArray.

Add feature to delete all or delete database

Add an option to delete from all tables, possibly in the contract such as:

RecipesContract.deleteAll();

And possibly some way to delete the database such as:

RecipesContract.dropDatabase();

[MECHDB] authority lookup location

In the Contract class in the initAuthority() there is a lookup for the authority in the ContentProviderAuthority class, however it is lookup up in the com.justeat.app.data namespace, would it not he beter to lookup in the namespace of the database, as declared at the top of the mechdb file.
ie. (for namespace a.b.c)

Class<?> clz = loader.loadClass("a.b.c.MeterReaderContentProviderAuthority");

not

Class<?> clz = loader.loadClass("com.justeat.app.data.MeterReaderContentProviderAuthority");

Add selectMap(...) method to SQuery

When selecting ActiveRecord's with SQuery it would be nice to have a selectMap method, ie:-

public HashMap<String, T> selectMap(Uri uri, String keyColumnName);

Where keyColumnName specifies the column that should become the key for items in the map.

[mechDB] Version 0.1.0.201303051159 makes troubles

After upgrade to 0.1.0.201303051159 my project is uncompileable
All migrationfiles are missing.
Do I miss something ?

...
import info.mypack.mechanoid.migrations.DefaultMyDB2DBMigrationV13; //unresolveable
import info.mypack.mechanoid.migrations.DefaultMyDB2DBMigrationV14; //unresolveable
...
protected SQLiteMigration createMyDB2DBMigrationV13() {
    return new DefaultMyDB2DBMigrationV13(); //unresolveable
}
protected SQLiteMigration createMyDB2DBMigrationV14() {
    return new DefaultMyDB2DBMigrationV14(); //unresolveable
}

Revert to old version encounters a problem too

No repository found containing: org.eclipse.update.feature,com.robotoworks.mechanoid.feature,0.1.0.201303041255

Make Initial Database Schema a Migration

I think it makes since to create a v1 migration, instead of doing it in the onCreate(). You can do

@Override
public void onCreate(SQLiteDatabase database) {
    createMigration(1).up(database);
}

/**
 * <p>Migrates from an older version of the database.</p>
 * @param database the database
 * @param old_version the old version number
 * @param new_version the new version number
 */
@Override
public void onUpgrade(SQLiteDatabase database, int old_version, int new_version) {
    for (int i = (old_version + 1); i <= new_version; i++)
        createMigration(i).up(database);
}

Then it would reflect how it was defined in the .mechdb file. All generated migrations can be in the migrations package.

Improve Mechanoid File Wizard

At the moment its fairly generic and does not help to create an initial file, for instance it could ask for package name, entity name, etc

view with float cast

I try to create a view with cast to float. I need it because of decimal digits, but without success.

    create view TableSum as
        select single_id as _id, sum(minutes) as minutes, round(cast(sum(minutes) as float) / 60,2) as hours_acc 
        from TableSingle group by single_id;

As workaround I defined all fields as 'real'.
Maybe you enable float cast in a future version, but it's not important, because there is a workaround.

mechPrefs with integer default values

I like your mechDB, so I start to use mechPrefs, but during last update (thank you)

preferences tracker {
    TrackerTime : int = 5 
}

the generated source become uncompileable

public int getTrackerTime() {
    return mPreferences.getInt(Keys.TRACKER_TIME, 5.0f);
}

as you see, default is not used as int

alter table

I guess, it's a not important minor bug. The new field 'datstr' is unknown

migration {
    alter table table1 add column datstr text;
    drop view view1; 
    create view view1 as
        select _id as _id, datstr as datstr, ....
}

[MECHDB] group by without _id field

Is it possible to use machanoid with this query ?
I need field _id for SimpleCursor, first I try to create a view with generated _id, but rowid is not known by mechanoid

select rowid as _id, strftime('%Y-%m-%d',createdate) , count(*) from mytable
group by strftime('%Y-%m-%d',createdate)

Is there a way ?

[MECHNET] Remove the generate keyword from entity declarations

The generate keyword seems to be easy to forget and would just add confusion for new users, it would be best to remove it and always generate entities.

If in the future there is a need to no generate then then a nogen keyword would be a better option.

own function

I'm playing around to use a user-defined-function in SQlite. Ok, for this, I've to attach it

http://stackoverflow.com/questions/6663124/how-to-load-extensions-into-sqlite/8322827#8322827

where is the best place in mechDB to execute

SELECT load_extension('libsqlite-func.so', 'sqlite3_extension_init')

or is there a mechDB-event after connect to call a JNI function containing the connected database ?

java:

public native void registerFunction(database);

c (untested):

#include <jni.h>
#include <sqlite3.h>
#include <stdlib.h>
...
...
void
Java_com_test_MyClass_registerFunction(sqlite3 *db)
{
    sqlite3_create_function(db, "myFunction", 1, SQLITE_UTF8, NULL, &myFunction, NULL, NULL);
}

[MECHDB] add support for custom urls

Would it be possible provide a way for custom urls to be generated in the contract, then have abstract methods in the content provider to handle them.

e.g. if I have a table with key-value pairs called map it would be helpful to have in the contract a method to produce urls in the form: content://authority/map/{key} and not just content://authority/map/{id}

view on view

I try to create a view based on a view, but without success

create table tab1 (
    _id integer primary key autoincrement,
    name integer            
);      
create view view1 as 
    select _id as _id, name as name  
        from tab1;
create view view2 as 
    select _id as _id, name as name  
        from view1;

I would be very nice and extreme helpful to enable this !

[MECHDB] Refactor provider actions and migration code gen

Provider action and migration class stubs are generated with the intention that the user can override their abstract counterparts, but it would be better to have a factory like facade (or instance provider so the user can override each class at will, example:-

public abstract class AbstractRecipeDBMigrationProvider {
public Migration getMigrationV2() {
return new DefaultRecipeDBMigrationV2();
}
}

public class RecipeDBMigrationProvider extends AbstractRecipeDBMigrationProvider {
// TODO user may override and provide their own implementation for each migration
}

The same kind of pattern could be employed for provider actions:-

public abstract class AbstractRecipeDBActionsProvider {
public getRecipesActions() { ... }
public getRecipesByIdActions(){ ... }
}

[MECHNET] Improve generated API

The current generated API uses the request/reply pattern which is ok.

Going forward some improvements might be:

  • Generate base abstract types for clients, request and result classes
  • Improve transformers implementation, at the moment it feels a bit clunky and uses a bit of reflection for creating types
  • push any common code into mechanoid library base classes

Eclipse should ensure mechanoid library is compatible with generated source

The mechanoid plugin relies on the mechanoid runtime library as its base library for the generated code, its possible that modifications can be made to the generated code that requires an updated mechanoid library.

Some kind of integrity check (crc?) needs to take place to ensure the mechanoid library in the users classpath is the one that is expected.

Since the mechanoid library is built and shipped as a plugin resource its possible to compare the resource to the one in the users libs folder.

notifications between sqlite-table and sqlite-view

I populate a SQLite list with mechDB

Cursor cursor = getApplicationContext().getContentResolver().query(Customer.CONTENT_URI, null, null, null, null);
adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, cursor, projection, to, 0); list.setAdapter(adapter);

on onItemClick I do a delete like

CustomerRecord record = CustomerRecord.get(id); 
record.delete(true); 

as I understand the documentation
"ActiveRecord makes use of the Content Provider notification system, by default, ActiveRecord’s will issue change notifications"

As I understand, the delete should automatic reflect on ListView, but nothing happen. What do I wrong ?

Allow default values for mechnet entities and params

Mechnet entities should have the option to specify a default value, for example:-

entity Recipe {
title:String = "Lorem Ipsum"
}

This way we can avoid query params in service methods for params that are fixed values ie:-

get getRecipe "?method=getRecipe" {
}

would become:

get getRecipe {
params method:String="getRecipe"
}

RuntimeException in ActiveRecord constructor

There is an extra dirty flag in the array.

03-20 11:02:05.219: E/AndroidRuntime(2708): Caused by: java.lang.RuntimeException: bad array lengths
03-20 11:02:05.219: E/AndroidRuntime(2708): at android.os.Parcel.readBooleanArray(Parcel.java:614)
03-20 11:02:05.219: E/AndroidRuntime(2708): at com.justeat.app.data.BasketsRecord.(Unknown Source)

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.