}
private void initialize() {
logger.debug("IN");
try {
ILowFunctionalityDAO functionalityDAO = DAOFactory.getLowFunctionalityDAO();
List functions = functionalityDAO.loadAllLowFunctionalities(false);
if (functions != null && functions.size() > 0) {
logger.debug("Tree already initialized");
} else {
List nodes = _config.getAttributeAsList("TREE_INITIAL_STRUCTURE.NODE");
Iterator it = nodes.iterator();
while (it.hasNext()) {
SourceBean node = (SourceBean) it.next();
String code = (String) node.getAttribute("code");
String name = (String) node.getAttribute("name");
String description = (String) node.getAttribute("description");
String codeType = (String) node.getAttribute("codeType");
String parentPath = (String) node.getAttribute("parentPath");
LowFunctionality functionality = new LowFunctionality();
functionality.setCode(code);
functionality.setName(name);
functionality.setDescription(description);
functionality.setCodType(codeType);
functionality.setPath(parentPath + "/" + code);
if (parentPath != null && !parentPath.trim().equals("")) {
// if it is not the root load the id of the parent path
LowFunctionality parentFunctionality = functionalityDAO.loadLowFunctionalityByPath(parentPath,
false);
functionality.setParentId(parentFunctionality.getId());
} else {
// if it is the root the parent path id is set to null
functionality.setParentId(null);
}
// sets no permissions
functionality.setDevRoles(new Role[0]);
functionality.setExecRoles(new Role[0]);
functionality.setTestRoles(new Role[0]);
functionality.setCreateRoles(new Role[0]);
functionalityDAO.insertLowFunctionality(functionality, null);
}
}
} catch (EMFUserError e) {
logger.error("EMFUserError", e);