Search in sources :

Example 56 with Entity

use of com.developmentontheedge.be5.metadata.model.Entity in project be5 by DevelopmentOnTheEdge.

the class SilentEditOperation method getParameters.

@Override
public Object getParameters(Map<String, Object> presetValues) throws Exception {
    Entity entity = getInfo().getEntity();
    DynamicPropertySet dps = dpsHelper.addDpExcludeAutoIncrement(new DynamicPropertySetSupport(), getInfo().getModel());
    dpsHelper.setValues(dps, database.getEntity(entity.getName()).get(context.records[0]));
    dpsHelper.setOperationParams(dps, context.getOperationParams());
    return dpsHelper.setValues(dps, presetValues);
}
Also used : DynamicPropertySet(com.developmentontheedge.beans.DynamicPropertySet) Entity(com.developmentontheedge.be5.metadata.model.Entity) DynamicPropertySetSupport(com.developmentontheedge.beans.DynamicPropertySetSupport)

Example 57 with Entity

use of com.developmentontheedge.be5.metadata.model.Entity in project be5 by DevelopmentOnTheEdge.

the class ColumnSelector method getTags.

@Override
public String[] getTags() {
    final Entity entity = (Entity) getBean();
    final TableDef tableDefinition = entity.findTableDefinition();
    if (tableDefinition == null)
        return Strings2.EMPTY;
    return tableDefinition.getColumns().names().toArray(String[]::new);
}
Also used : Entity(com.developmentontheedge.be5.metadata.model.Entity) TableDef(com.developmentontheedge.be5.metadata.model.TableDef)

Example 58 with Entity

use of com.developmentontheedge.be5.metadata.model.Entity in project be5 by DevelopmentOnTheEdge.

the class ProjectGenerator method createLoginAndLogoutOperations.

private void createLoginAndLogoutOperations(final Project project) {
    final Entity logoutEntity = new Entity("_logout_", project.getApplication(), EntityType.TABLE);
    logoutEntity.setDisplayName("Logout");
    logoutEntity.setOrder("99");
    logoutEntity.setPrimaryKey("dummy");
    logoutEntity.getIcon().setSource(Icon.SOURCE_BE);
    logoutEntity.getIcon().setName("logout.gif");
    final Query logout = new Query("Logout", logoutEntity);
    logout.setType(QueryType.STATIC);
    logout.getRoles().add('@' + SpecialRoleGroup.ALL_ROLES_EXCEPT_GUEST_GROUP);
    logout.setQuery("logout");
    DataElementUtils.saveQuiet(logout);
    EntitiesFactory.addToModule(logoutEntity, project.getApplication());
    Module beModule = project.getModule(SYSTEM_MODULE);
    Entity usersEntity = new Entity("users", beModule, EntityType.TABLE);
    usersEntity.setOrder("90");
    usersEntity.getIcon().setSource("be:people.gif");
    DataElementUtils.saveQuiet(usersEntity);
    Query loginQuery = new Query("Login", usersEntity);
    loginQuery.setType(QueryType.STATIC);
    loginQuery.setQuery("login");
    loginQuery.getRoles().add("Guest");
    DataElementUtils.saveQuiet(loginQuery);
// Query forgotPassword = new Query("Forgot Password?", usersEntity);
// forgotPassword.getRoles().add( "Guest" );
// forgotPassword.setParametrizingOperationName( "Send password" );
// DataElementUtils.saveQuiet( forgotPassword );
// Operation sendPassword = Operation.createOperation( "Send password", Operation.OPERATION_TYPE_JAVA, usersEntity );
// sendPassword.setCode( SendPassword.class.getName() );
// DataElementUtils.saveQuiet( sendPassword );
}
Also used : Entity(com.developmentontheedge.be5.metadata.model.Entity) Query(com.developmentontheedge.be5.metadata.model.Query) Module(com.developmentontheedge.be5.metadata.model.Module)

Example 59 with Entity

use of com.developmentontheedge.be5.metadata.model.Entity in project be5 by DevelopmentOnTheEdge.

the class ActionHelperTest method getQuery.

private Query getQuery(QueryType type, String queryCode) {
    Entity entity = meta.getEntity("testtable");
    Query query = new Query("ActionHelperTest", entity);
    query.setType(type);
    query.setQuery(queryCode);
    return query;
}
Also used : Entity(com.developmentontheedge.be5.metadata.model.Entity) Query(com.developmentontheedge.be5.metadata.model.Query)

Aggregations

Entity (com.developmentontheedge.be5.metadata.model.Entity)36 Query (com.developmentontheedge.be5.metadata.model.Query)19 Module (com.developmentontheedge.be5.metadata.model.Module)16 Project (com.developmentontheedge.be5.metadata.model.Project)16 Test (org.junit.Test)11 Path (java.nio.file.Path)9 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)8 ColumnDef (com.developmentontheedge.be5.metadata.model.ColumnDef)7 Operation (com.developmentontheedge.be5.metadata.model.Operation)7 TableDef (com.developmentontheedge.be5.metadata.model.TableDef)7 Meta (com.developmentontheedge.be5.api.services.Meta)4 ReadException (com.developmentontheedge.be5.metadata.exception.ReadException)4 BeModelElement (com.developmentontheedge.be5.metadata.model.base.BeModelElement)4 Map (java.util.Map)4 ProjectElementException (com.developmentontheedge.be5.metadata.exception.ProjectElementException)3 DdlElement (com.developmentontheedge.be5.metadata.model.DdlElement)3 Localizations (com.developmentontheedge.be5.metadata.model.Localizations)3 LinkedHashMap (java.util.LinkedHashMap)3 Be5Exception (com.developmentontheedge.be5.api.exceptions.Be5Exception)2