List childs = DAOFactory.getLowFunctionalityDAO()
.loadSubLowFunctionalities(parentPath, false);
if (childs.size() != 0) {
Iterator i = childs.iterator();
while (i.hasNext()) {
LowFunctionality childNode = (LowFunctionality) i.next();
String childPath = childNode.getPath();
// LowFunctionality lowFuncParent =
// DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByPath(parentPath);
LowFunctionality lowFuncChild = DAOFactory
.getLowFunctionalityDAO().loadLowFunctionalityByPath(
childPath, false);
if (lowFuncChild != null) {
// control childs permissions and fathers permissions
// remove from childs those persmissions that are not
// present in the fathers
// control for test Roles
Role[] testChildRoles = lowFuncChild.getTestRoles();
// Role[] testParentRoles = lowFuncParent.getTestRoles();
// ArrayList newTestChildRoles = new ArrayList();
// HashMap rolesToErase = new HashMap();
for (int j = 0; j < testChildRoles.length; j++) {
String rule = testChildRoles[j].getId().toString();
if (!isParentRule(rule, lowFuncParent,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_TEST)) {
ArrayList roles = new ArrayList();
roles.add(0, lowFuncChild.getId());
roles.add(1, testChildRoles[j].getId());
roles.add(
2,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_TEST);
rolesToErase.add(roles);
lowFuncChild = eraseRolesFromFunctionality(
lowFuncChild,
rule,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_TEST);
// rolesToErase.put(lowFuncChild.getId(),testChildRoles[j].getId());
// DAOFactory.getLowFunctionalityDAO().deleteFunctionalityRole(lowFuncChild,testChildRoles[j].getId());
}
}
// control for development roles
Role[] devChildRoles = lowFuncChild.getDevRoles();
// Role[] devParentRoles = lowFuncParent.getDevRoles();
// ArrayList newDevChildRoles = new ArrayList();
for (int j = 0; j < devChildRoles.length; j++) {
String rule = devChildRoles[j].getId().toString();
if (!isParentRule(
rule,
lowFuncParent,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_DEVELOP)) {
ArrayList roles = new ArrayList();
roles.add(0, lowFuncChild.getId());
roles.add(1, devChildRoles[j].getId());
roles.add(
2,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_DEVELOP);
rolesToErase.add(roles);
lowFuncChild = eraseRolesFromFunctionality(
lowFuncChild,
rule,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_DEVELOP);
// rolesToErase.put(lowFuncChild.getId(),devChildRoles[j].getId());
// DAOFactory.getLowFunctionalityDAO().deleteFunctionalityRole(lowFuncChild,devChildRoles[j].getId());
}
}
// control for execution roles
Role[] execChildRoles = lowFuncChild.getExecRoles();
// Role[] execParentRoles = lowFuncParent.getExecRoles();
// ArrayList newExecChildRoles = new ArrayList();
for (int j = 0; j < execChildRoles.length; j++) {
String rule = execChildRoles[j].getId().toString();
if (!isParentRule(
rule,
lowFuncParent,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_EXECUTE)) {
ArrayList roles = new ArrayList();
roles.add(0, lowFuncChild.getId());
roles.add(1, execChildRoles[j].getId());
roles.add(
2,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_EXECUTE);
rolesToErase.add(roles);
lowFuncChild = eraseRolesFromFunctionality(
lowFuncChild,
rule,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_EXECUTE);
// rolesToErase.put(lowFuncChild.getId(),execChildRoles[j].getId());
// DAOFactory.getLowFunctionalityDAO().deleteFunctionalityRole(lowFuncChild,execChildRoles[j].getId());
}
}
// control for development roles
Role[] createChildRoles = lowFuncChild.getCreateRoles();
for (int j = 0; j < createChildRoles.length; j++) {
String rule = createChildRoles[j].getId().toString();
if (!isParentRule(rule, lowFuncParent,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_CREATE)) {
ArrayList roles = new ArrayList();
roles.add(0, lowFuncChild.getId());
roles.add(1, createChildRoles[j].getId());
roles.add(
2,
SpagoBIConstants.PERMISSION_ON_FOLDER_TO_CREATE);
rolesToErase.add(roles);