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;
}
}
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 + ")";
}
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();
}
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 );
}
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);
}
Aggregations