String objIdStr = (String) sessionContainer.getAttribute("SUBJECT_ID");
Integer objId = null;
if (objIdStr != null) objId = new Integer (objIdStr);
response.setAttribute("SUBJECT_ID",objIdStr);
PaginatorIFace paginator = new GenericPaginator();
IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
List objectsList = null;
if (initialPath != null && !initialPath.trim().equals("")) {
objectsList = objDAO.loadAllBIObjectsFromInitialPath(initialPath, currentFieldOrder+ " " + currentTypOrder);
} else {
objectsList = objDAO.loadAllBIObjects(currentFieldOrder + " " + currentTypOrder);
}
String checked = (String)request.getAttribute("checked");
if (checked == null )
checked = (String)request.getAttribute("optChecked");
if(checked==null){
checked = "true";
}
request.delAttribute("optChecked");
request.setAttribute("optChecked", checked);
response.setAttribute("optChecked", (String)request.getAttribute("optChecked"));
if(checked.equals("true")){
//if the request is to show only checked objects (it is settled by default when page is loaded at the first time
for (Iterator it = objectsList.iterator(); it.hasNext(); ) {
BIObject obj = (BIObject) it.next();
if (objId != null && obj.getId().equals(objId)) continue;
//boolean bool = isCheckedObject(obj.getId().toString());
if(isCheckedObject(obj.getId().toString())){
SourceBean rowSB = null;
/*if (SpagoBIConstants.ADMIN_ACTOR.equalsIgnoreCase(actor)) {
rowSB = makeAdminListRow(obj);
} else if (SpagoBIConstants.DEV_ACTOR.equalsIgnoreCase(actor)) {
rowSB = makeDevListRow(obj);
}
*/
if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
rowSB = makeAdminListRow(obj);
} else if (!profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN) &&
profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_DEV)) {
rowSB = makeDevListRow(obj);
}
if (rowSB != null) paginator.addRow(rowSB);
}
}
}
//else if it is false, show all objects
else if (checked.equals("false")){
for (Iterator it = objectsList.iterator(); it.hasNext(); ) {
BIObject obj = (BIObject) it.next();
if (objId != null && obj.getId().equals(objId)) continue;
//boolean bool = isCheckedObject(obj.getId().toString());
SourceBean rowSB = null;
/*
if (SpagoBIConstants.ADMIN_ACTOR.equalsIgnoreCase(actor)) {
rowSB = makeAdminListRow(obj);
} else if (SpagoBIConstants.DEV_ACTOR.equalsIgnoreCase(actor)) {
rowSB = makeDevListRow(obj);
}
*/
if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)) {
rowSB = makeAdminListRow(obj);
} else if (!profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN) &&
profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_DEV)) {
rowSB = makeDevListRow(obj);
}
if (rowSB != null) paginator.addRow(rowSB);
}
}
ListIFace list = new GenericList();
list.setPaginator(paginator);