@Override public Collection<KaleoTaskAssignment> calculateTaskAssignments( KaleoTaskAssignment kaleoTaskAssignment, ExecutionContext executionContext) throws PortalException { KaleoInstanceToken kaleoInstanceToken = executionContext.getKaleoInstanceToken(); Group group = null; long groupId = kaleoInstanceToken.getGroupId(); if (groupId != WorkflowConstants.DEFAULT_GROUP_ID) { group = _groupLocalService.getGroup(groupId); if (group.isLayout()) { group = _groupLocalService.getGroup(group.getParentGroupId()); } } List<KaleoTaskAssignment> calculatedKaleoTaskAssignments = new ArrayList<>(); if (isValidAssignment(kaleoTaskAssignment, group)) { calculatedKaleoTaskAssignments.add(kaleoTaskAssignment); } return calculatedKaleoTaskAssignments; }
public static Tuple getElements(String xml, String className, int inactiveGroupsCount) { List<Element> resultRows = new ArrayList<>(); int totalRows = 0; try { xml = XMLUtil.stripInvalidChars(xml); Document document = SAXReaderUtil.read(xml); Element rootElement = document.getRootElement(); List<Element> elements = rootElement.elements("entry"); totalRows = GetterUtil.getInteger( rootElement.elementText( OpenSearchUtil.getQName("totalResults", OpenSearchUtil.OS_NAMESPACE))); for (Element element : elements) { try { long entryScopeGroupId = GetterUtil.getLong( element.elementText( OpenSearchUtil.getQName("scopeGroupId", OpenSearchUtil.LIFERAY_NAMESPACE))); if ((entryScopeGroupId != 0) && (inactiveGroupsCount > 0)) { Group entryGroup = GroupServiceUtil.getGroup(entryScopeGroupId); if (entryGroup.isLayout()) { entryGroup = GroupLocalServiceUtil.getGroup(entryGroup.getParentGroupId()); } if (!entryGroup.isActive()) { totalRows--; continue; } } resultRows.add(element); } catch (Exception e) { _log.error("Unable to retrieve individual search result for " + className, e); totalRows--; } } } catch (Exception e) { _log.error("Unable to display content for " + className, e); } return new Tuple(resultRows, totalRows); }
private List<Group> _filterLayoutGroups(List<Group> groups, Boolean privateLayout) throws Exception { List<Group> filteredGroups = new ArrayList(); if (privateLayout == null) { return groups; } for (Group group : groups) { if (!group.isLayout()) { continue; } Layout layout = LayoutLocalServiceUtil.getLayout(group.getClassPK()); if (layout.isPrivateLayout() == privateLayout) { filteredGroups.add(group); } } return filteredGroups; }