public DataModel getProcesses () {
if (processesAsModel == null
|| processSorter != null && processSorter.isModified()) {
logger.debug ("Retrieving process list");
processSorter.clearModified();
ProcessDirectory pd = null;
try {
pd = wsc.getWorkflowService().processDirectory();
SortCriterion sortCriterion = null;
SortCriterion lastSortCriterion = null;
for (Iterator i = processSorter.getSortCriteria().iterator();
i.hasNext();) {
BeanSorter.SortCriterion bsc
= (BeanSorter.SortCriterion)i.next();
SortCriterion sc = null;
if (bsc.isAscending()) {
sc = new AscendingOrder(bsc.getProperty());
} else {
sc = new DescendingOrder(bsc.getProperty());
}
if (sortCriterion == null) {
sortCriterion = sc;
}
if (lastSortCriterion != null) {
lastSortCriterion.setSubCriterion(sc);
}
lastSortCriterion = sc;
}
FilterCriterion processFilter = null;
if (nameFilter.length() > 0) {
processFilter = new PropertyEquality("name", nameFilter);
}
if (managerNameFilter.length() > 0) {
FilterCriterion fc = new PropertyEquality
("managerName", managerNameFilter);
if (processFilter == null) {
processFilter = fc;
} else {
processFilter = new AndOperation(processFilter, fc);
}
}
if (processKeyFilter.length() > 0) {
FilterCriterion fc
= new PropertyEquality ("key", processKeyFilter);
if (processFilter == null) {
processFilter = fc;
} else {
processFilter = new AndOperation(processFilter, fc);
}
}
if (contextVariable.length() > 0) {
FilterCriterion fc
= new ContextVariableEquality
(contextVariable, contextValue);
if (processFilter == null) {
processFilter = fc;
} else {
processFilter = new AndOperation(processFilter, fc);
}
}
FacesContext fc = FacesContext.getCurrentInstance();
PortletEnvironment portletEnv = (PortletEnvironment)
fc.getApplication().getVariableResolver().resolveVariable
(fc, "processPortletEnv");
Integer chunk = (Integer)
portletEnv.getPreferencesAsIntegers().get("displayedRows");
processesAsModel = new PaginatedDataModel
(pd.processes(processFilter, sortCriterion),
chunk.intValue());
} catch (RemoteException e) {
JSFUtil.addMessage(FacesMessage.SEVERITY_ERROR, L10N_MSGS,
"resourceCurrentlyUnavailable", null, e);
} finally {