Search in sources :

Example 66 with Project

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

the class RoleMultiSelector method getAvailableValues.

@Override
protected String[] getAvailableValues() {
    try {
        Object bean = getBean();
        Project project = ((RoleSet) bean).getProject();
        List<String> roleList = project.getRolesWithGroups();
        return roleList.toArray(new String[roleList.size()]);
    } catch (Exception e) {
        return Strings2.EMPTY;
    }
}
Also used : Project(com.developmentontheedge.be5.metadata.model.Project) RoleSet(com.developmentontheedge.be5.metadata.model.RoleSet)

Example 67 with Project

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

the class VariableSelector method getAsText.

@Override
public String getAsText() {
    String name = super.getAsText();
    if (name.isEmpty())
        return "(none)";
    Project project = ((BeModelElement) getBean()).getProject();
    String value = project.getVariableValue(name);
    return name + " (" + value + ")";
}
Also used : Project(com.developmentontheedge.be5.metadata.model.Project) BeModelElement(com.developmentontheedge.be5.metadata.model.base.BeModelElement)

Example 68 with Project

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

the class ProjectGenerator method generate.

private void generate(final ISaveProject saveProject) throws Exception {
    final Project project = new Project(parameters.getProjectName());
    setRoles(project);
    setLanguages(project);
    addModules(project);
    ModuleUtils.addModuleScripts(project);
    addIncludes(project);
    addFeatures(project);
    addFtlScripts(project);
    if (parameters.shouldCreateLoginAndLogoutOperations())
        createLoginAndLogoutOperations(project);
    saveProject.save(project);
    copyTemplateFiles();
    correctTemplateFiles();
}
Also used : Project(com.developmentontheedge.be5.metadata.model.Project)

Example 69 with Project

use of com.developmentontheedge.be5.metadata.model.Project 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 70 with Project

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

the class ProjectGenerator method addFtlScripts.

private void addFtlScripts(final Project project) {
    final FreemarkerCatalog scripts = project.getApplication().getFreemarkerScripts();
    final FreemarkerScript securityScript = new FreemarkerScript("security", scripts);
    securityScript.setSource("INSERT INTO users (user_name, user_pass) VALUES( '$LOGIN', '$PASSWORD' );\nINSERT INTO user_roles VALUES( '$LOGIN', '$ROLE' );\n".replace("$LOGIN", parameters.getTestUserLogin()).replace("$PASSWORD", parameters.getTestUserPassword()).replace("$ROLE", parameters.getTestUserRole()));
    DataElementUtils.saveQuiet(securityScript);
    final FreemarkerScript dictionariesScript = new FreemarkerScript("dictionaries", scripts);
    final FreemarkerScript attributesScript = new FreemarkerScript("attributes", scripts);
    dictionariesScript.setSource("");
    attributesScript.setSource("");
    DataElementUtils.saveQuiet(dictionariesScript);
    DataElementUtils.saveQuiet(attributesScript);
}
Also used : FreemarkerCatalog(com.developmentontheedge.be5.metadata.model.FreemarkerCatalog) FreemarkerScript(com.developmentontheedge.be5.metadata.model.FreemarkerScript)

Aggregations

Project (com.developmentontheedge.be5.metadata.model.Project)40 Module (com.developmentontheedge.be5.metadata.model.Module)19 Test (org.junit.Test)19 Entity (com.developmentontheedge.be5.metadata.model.Entity)14 Path (java.nio.file.Path)13 Query (com.developmentontheedge.be5.metadata.model.Query)12 LoadContext (com.developmentontheedge.be5.metadata.serialization.LoadContext)7 ArrayList (java.util.ArrayList)7 ProjectLoadException (com.developmentontheedge.be5.metadata.exception.ProjectLoadException)6 FreemarkerScript (com.developmentontheedge.be5.metadata.model.FreemarkerScript)5 URL (java.net.URL)5 Map (java.util.Map)5 ReadException (com.developmentontheedge.be5.metadata.exception.ReadException)4 BeConnectionProfile (com.developmentontheedge.be5.metadata.model.BeConnectionProfile)4 Operation (com.developmentontheedge.be5.metadata.model.Operation)4 IOException (java.io.IOException)4 MojoFailureException (org.apache.maven.plugin.MojoFailureException)4 WriteException (com.developmentontheedge.be5.metadata.exception.WriteException)3 FreemarkerCatalog (com.developmentontheedge.be5.metadata.model.FreemarkerCatalog)3 Localizations (com.developmentontheedge.be5.metadata.model.Localizations)3