List of usage examples for java.util Set retainAll
boolean retainAll(Collection<?> c);
From source file:org.opengrok.suggest.SuggesterProjectData.java
private void initFields(final Set<String> fields) throws IOException { try (IndexReader indexReader = DirectoryReader.open(indexDir)) { Collection<String> indexedFields = MultiFields.getIndexedFields(indexReader); if (fields == null) { this.fields = new HashSet<>(indexedFields); } else if (!indexedFields.containsAll(fields)) { Set<String> copy = new HashSet<>(fields); copy.removeAll(indexedFields); logger.log(Level.WARNING, "Fields {0} will be ignored because they were not found in index directory {1}", new Object[] { copy, indexDir }); copy = new HashSet<>(fields); copy.retainAll(indexedFields); this.fields = copy; } else {// w w w .j av a2 s . c o m this.fields = new HashSet<>(fields); } } }
From source file:edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.visitors.FDsAndEquivClassesVisitor.java
/*** * Propagated equivalent classes from the child to the current operator, based * on the used variables of the current operator. * /*from ww w .j a va2s . com*/ * @param op * , the current operator * @param ctx * , the optimization context which keeps track of all equivalent classes. * @param usedVariables * , used variables. * @throws AlgebricksException */ private void propagateFDsAndEquivClassesForUsedVars(ILogicalOperator op, IOptimizationContext ctx, List<LogicalVariable> usedVariables) throws AlgebricksException { ILogicalOperator op2 = op.getInputs().get(0).getValue(); Map<LogicalVariable, EquivalenceClass> eqClasses = getOrCreateEqClasses(op, ctx); List<FunctionalDependency> fds = new ArrayList<FunctionalDependency>(); ctx.putFDList(op, fds); Map<LogicalVariable, EquivalenceClass> chldClasses = getOrComputeEqClasses(op2, ctx); // Propagate equivalent classes that contain the used variables. for (LogicalVariable v : usedVariables) { EquivalenceClass ec = eqClasses.get(v); if (ec == null) { EquivalenceClass oc = chldClasses.get(v); if (oc == null) { continue; } List<LogicalVariable> m = new LinkedList<LogicalVariable>(); for (LogicalVariable v2 : oc.getMembers()) { if (usedVariables.contains(v2)) { m.add(v2); } } EquivalenceClass nc; if (oc.representativeIsConst()) { nc = new EquivalenceClass(m, oc.getConstRepresentative()); } else if (m.contains(oc.getVariableRepresentative())) { nc = new EquivalenceClass(m, oc.getVariableRepresentative()); } else { nc = new EquivalenceClass(m, v); } for (LogicalVariable v3 : m) { eqClasses.put(v3, nc); } } } // Propagates equivalent classes that contain expressions that use the used variables. // Note that for the case variable $v is not in the used variables but it is // equivalent to field-access($t, i) and $t is a used variable, the equivalent // class should still be propagated (kept). Set<LogicalVariable> usedVarSet = new HashSet<LogicalVariable>(usedVariables); for (Entry<LogicalVariable, EquivalenceClass> entry : chldClasses.entrySet()) { EquivalenceClass ec = entry.getValue(); for (ILogicalExpression expr : ec.getExpressionMembers()) { Set<LogicalVariable> exprUsedVars = new HashSet<LogicalVariable>(); expr.getUsedVariables(exprUsedVars); exprUsedVars.retainAll(usedVarSet); // Check if the expression member uses a used variable. if (!exprUsedVars.isEmpty()) { for (LogicalVariable v : ec.getMembers()) { eqClasses.put(v, ec); // If variable members contain a used variable, the representative // variable should be a used variable. if (usedVarSet.contains(v)) { ec.setVariableRepresentative(v); } } } } } List<FunctionalDependency> chldFds = getOrComputeFDs(op2, ctx); for (FunctionalDependency fd : chldFds) { if (!usedVariables.containsAll(fd.getHead())) { continue; } List<LogicalVariable> tl = new LinkedList<LogicalVariable>(); for (LogicalVariable v : fd.getTail()) { if (usedVariables.contains(v)) { tl.add(v); } } if (!tl.isEmpty()) { FunctionalDependency newFd = new FunctionalDependency(fd.getHead(), tl); fds.add(newFd); } } }
From source file:org.apache.lens.cube.parse.join.AutoJoinContext.java
private void pruneEmptyPaths(Map<Aliased<Dimension>, List<JoinPath>> allPaths) throws LensException { Iterator<Map.Entry<Aliased<Dimension>, List<JoinPath>>> iter = allPaths.entrySet().iterator(); Set<Dimension> noPathDims = new HashSet<>(); while (iter.hasNext()) { Map.Entry<Aliased<Dimension>, List<JoinPath>> entry = iter.next(); if (entry.getValue().isEmpty()) { noPathDims.add(entry.getKey().getObject()); iter.remove();//from w ww .j av a2 s .c om } } noPathDims.retainAll(requiredDimensions); if (!noPathDims.isEmpty()) { throw new LensException(LensCubeErrorCode.NO_JOIN_PATH.getLensErrorInfo(), autoJoinTarget.getName(), noPathDims.toString()); } }
From source file:org.b3mn.poem.handler.SortFilterHandler.java
@SuppressWarnings("unchecked") @Override//from w w w . j a v a 2 s . c o m public void doGet(HttpServletRequest request, HttpServletResponse response, Identity subject, Identity object) throws Exception { String sortName = request.getParameter("sort"); String defaultSort = "lastchange"; if (sortName == null) { sortName = defaultSort; // set default filter } sortName = sortName.toLowerCase(); Method sortMethod = getDispatcher().getSortMethod(sortName); if (sortMethod == null) { sortName = defaultSort; // set default filter sortMethod = getDispatcher().getSortMethod(sortName); } Object[] arg = { subject }; // Use the LinkedHashSet implementation to remain the order of the entries Set<String> orderedUris = new LinkedHashSet<String>((List<String>) sortMethod.invoke(null, arg)); // Iterate over http parameters Enumeration<String> e = request.getParameterNames(); while (e.hasMoreElements()) { String filterName = (String) e.nextElement(); String params = request.getParameter(filterName); // Ignore Filters without parameters if (!filterName.equals("sort") && (params != null) && (params.length() > 0)) { Method filterMethod = getDispatcher().getFilterMethod(filterName.toLowerCase()); // If the filter method exists if (filterMethod != null) { Object[] args = { subject, params }; // Invoke the filter method an add the filtered ids to the result set orderedUris.retainAll((Collection<String>) filterMethod.invoke(null, args)); } } } JSONArray jsonArray = new JSONArray(orderedUris); // Transform List to json jsonArray.write(response.getWriter()); // Write json to http response response.setStatus(200); }
From source file:org.apache.kylin.cube.CubeInstance.java
public Set<Long> getCuboidsByMode(CuboidModeEnum cuboidMode) { if (cuboidMode == null || cuboidMode == CURRENT) { return getCuboidScheduler().getAllCuboidIds(); }//ww w . j a v a2 s .c om Set<Long> cuboidsRecommend = getCuboidsRecommend(); if (cuboidsRecommend == null || cuboidMode == RECOMMEND) { return cuboidsRecommend; } Set<Long> currentCuboids = getCuboidScheduler().getAllCuboidIds(); switch (cuboidMode) { case RECOMMEND_EXISTING: cuboidsRecommend.retainAll(currentCuboids); return cuboidsRecommend; case RECOMMEND_MISSING: cuboidsRecommend.removeAll(currentCuboids); return cuboidsRecommend; case RECOMMEND_MISSING_WITH_BASE: cuboidsRecommend.removeAll(currentCuboids); cuboidsRecommend.add(getCuboidScheduler().getBaseCuboidId()); return cuboidsRecommend; default: return null; } }
From source file:org.slc.sli.api.resources.generic.service.DefaultResourceService.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override// w ww. ja v a2 s . co m @MigrateResponse public ServiceResponse getEntities(final Resource base, final String id, final Resource resource, final URI requestURI) { final EntityDefinition definition = resourceHelper.getEntityDefinition(resource); if (isAssociation(base)) { final String key = "_id"; return getAssociatedEntities(base, base, id, resource, key, requestURI); } try { final String associationKey = getConnectionKey(base, resource); List<EntityBody> entityBodyList = new ArrayList<EntityBody>(); // DS-1046 - initialize in case we don't fill this in List<String> valueList = Arrays.asList(id.split(",")); final ApiQuery apiQuery = resourceServiceHelper.getApiQuery(definition, requestURI); addGranularAccessCriteria(definition, apiQuery); //Mongo blows up if we have multiple $in or equal criteria for the same key. //To avoid that case, if we do have duplicate keys, set the value for that //criteria to the intersection of the two critiera values boolean skipIn = false; for (NeutralCriteria crit : apiQuery.getCriteria()) { if (crit.getKey().equals(associationKey) && (crit.getOperator().equals(NeutralCriteria.CRITERIA_IN) || crit.getOperator().equals(NeutralCriteria.OPERATOR_EQUAL))) { skipIn = true; Set valueSet = new HashSet(); if (crit.getValue() instanceof Collection) { valueSet.addAll((Collection) crit.getValue()); } else { valueSet.add(crit.getValue()); } valueSet.retainAll(valueList); crit.setValue(valueSet); } } if (!skipIn) { apiQuery.addCriteria(new NeutralCriteria(associationKey, "in", valueList)); } // if we are doing only a count, don't execute the query that returns the body list // DS-1046 if (!apiQuery.isCountOnly()) { entityBodyList = (List<EntityBody>) getEntityBodies(apiQuery, definition, definition.getResourceName()); } long count = getEntityCount(definition, apiQuery); return new ServiceResponse(adapter.migrate(entityBodyList, definition.getResourceName(), GET), count); } catch (NoGranularAccessDatesException e) { List<EntityBody> entityBodyList = Collections.emptyList(); return new ServiceResponse(entityBodyList, 0); } }
From source file:eu.ggnet.dwoss.receipt.unit.UnitView.java
/** * Updates the Product and the Description from the Model; */// w ww .j a v a 2 s.c o m void updateProduct() { Set<UniqueUnit.Equipment> equipment = UniqueUnit.Equipment.getEquipments(); if (model.getProduct() != null) equipment.retainAll(UniqueUnit.Equipment.getEquipments(model.getProduct().getGroup())); if (unit != null) equipment.addAll(unit.getEquipments()); equipmentModel.setFiltered(equipment); detailArea.setText(model.getProductSpecDescription()); }
From source file:com.aurel.track.admin.customize.category.filter.execute.loadItems.LoadTreeFilterItems.java
/** * Prepares the custom filter workItemBeans * @param filterUpperTO filter's upper part * @param qNode filter's tree part/* ww w . j a va2s. c om*/ * @param personID * @param locale * @param withCustomAttributes whether the custom attributes should be loaded * @param projectID * @param entityFlag * @param startDate only items with start date after (if startDate specified) * @param endDate only items with end date before (if endDate specified) * @param attributeValueBeanList output parameter * @return * @throws TooManyItemsToLoadException */ private static List<TWorkItemBean> prepareTreeFilterItems(FilterUpperTO filterUpperTO, QNode qNode, RACIBean raciBean, TPersonBean personBean, Locale locale, boolean editFlagNeeded, Date startDate, Date endDate, boolean withCustomAttributes, List<TAttributeValueBean> attributeValueBeanList, boolean withWatchers, List<TNotifyBean> watcherList, boolean withMyExpenses, List<TComputedValuesBean> myExpenseList, boolean withTotalExpenses, List<TComputedValuesBean> totalExpenseList, boolean withBudgetPlan, List<TComputedValuesBean> budgetAndPlanList, boolean withRemainingPlan, List<TActualEstimatedBudgetBean> remainingPlanList, boolean withAttachment, List<TAttachmentBean> attachmentList, boolean withLinks, List<TWorkItemLinkBean> itemLinkList, boolean withParents, Set<Integer> parentIDs) throws TooManyItemsToLoadException { Date start = null; int count = 0; if (LOGGER.isDebugEnabled()) { start = new Date(); } Set<Integer> pseudoFieldsInTree = new HashSet<Integer>(); ExecuteMatcherBL.gatherPseudoFieldsInTree(qNode, pseudoFieldsInTree); //the pseudo fields should be loaded if either has to be rendered or the filter contains the corresponding pseudo field expression withWatchers = withWatchers || pseudoFieldsInTree.contains(TReportLayoutBean.PSEUDO_COLUMNS.CONSULTANT_LIST) || pseudoFieldsInTree.contains(TReportLayoutBean.PSEUDO_COLUMNS.INFORMANT_LIST); boolean filterByMyExpenseTime = pseudoFieldsInTree .contains(TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_TIME); withMyExpenses = withMyExpenses || filterByMyExpenseTime || pseudoFieldsInTree.contains(TReportLayoutBean.PSEUDO_COLUMNS.MY_EXPENSE_COST); boolean filterByTotalExpenseTime = pseudoFieldsInTree .contains(TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_TIME); withTotalExpenses = withTotalExpenses || filterByTotalExpenseTime || pseudoFieldsInTree.contains(TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_EXPENSE_COST); boolean filterByBudgetPlanTime = pseudoFieldsInTree .contains(TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_TIME) || pseudoFieldsInTree.contains(TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_TIME); withBudgetPlan = withBudgetPlan || filterByBudgetPlanTime || pseudoFieldsInTree.contains(TReportLayoutBean.PSEUDO_COLUMNS.TOTAL_PLANNED_COST) || pseudoFieldsInTree.contains(TReportLayoutBean.PSEUDO_COLUMNS.BUDGET_COST); boolean filterByRemainingTime = pseudoFieldsInTree .contains(TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_TIME); withRemainingPlan = withRemainingPlan || filterByRemainingTime || pseudoFieldsInTree.contains(TReportLayoutBean.PSEUDO_COLUMNS.REMAINING_PLANNED_COST); Integer personID = personBean.getObjectID(); Boolean projectRoleItemsAboveLimit = personBean.getProjectRoleItemsAboveLimit(); Boolean raciRoleItemsAboveLimit = personBean.getRaciRoleItemsAboveLimit(); if (projectRoleItemsAboveLimit == null) { projectRoleItemsAboveLimit = Boolean.TRUE; } if (raciRoleItemsAboveLimit == null) { raciRoleItemsAboveLimit = Boolean.TRUE; } int maxItems = GeneralSettings.getMaxItems(); boolean myItems = raciBean != null; if (filterUpperTO.getMatcherContext() == null) { MatcherContext matcherContext = new MatcherContext(); matcherContext.setLoggedInUser(personID); matcherContext.setLastLoggedDate(personBean.getLastButOneLogin()); matcherContext.setLocale(locale); filterUpperTO.setMatcherContext(matcherContext); matcherContext.setIncludeResponsiblesThroughGroup(filterUpperTO.isIncludeResponsiblesThroughGroup()); matcherContext.setReleaseTypeSelector(filterUpperTO.getReleaseTypeSelector()); filterUpperTO.cleanParameters(); } if (filterByMyExpenseTime || filterByTotalExpenseTime || filterByBudgetPlanTime || filterByRemainingTime) { filterUpperTO.getMatcherContext().setProjectAccountingMap(ProjectBL.getAccountingAttributesMap( GeneralUtils.createIntegerListFromIntegerArr(filterUpperTO.getSelectedProjects()))); } Integer[] selectedProjectsOriginal = filterUpperTO.getSelectedProjects(); if (selectedProjectsOriginal == null || selectedProjectsOriginal.length == 0) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("No Project(s) selected in filter"); } return new LinkedList<TWorkItemBean>(); } /** * All items will be gathered in this list */ List<TWorkItemBean> workItemBeanList = new LinkedList<TWorkItemBean>(); Set<Integer> foundWorkItemsIDs = new HashSet<Integer>(); /** * Separate the projects with roles from projects with RACI items */ List<Integer> meAndSubstitutedAndGroups = AccessBeans.getMeAndSubstitutedAndGroups(personID); //all selected projects and their descendants //List<Integer> selectedProjectIDs = GeneralUtils.createIntegerListFromIntegerArr(selectedAndDescendantProjects); if (LOGGER.isDebugEnabled() && selectedProjectsOriginal != null) { LOGGER.debug("Project(s) selected in filter: " + LookupContainer.getNotLocalizedLabelBeanListLabels( SystemFields.INTEGER_PROJECT, GeneralUtils.createSetFromIntegerArr(selectedProjectsOriginal))); } //get also the ancestor projects for getting the role based rights Integer[] ancestorProjects = ProjectBL.getAncestorProjects(selectedProjectsOriginal); int[] readAnyRights = new int[] { AccessFlagIndexes.READANYTASK, AccessFlagIndexes.PROJECTADMIN }; Map<Integer, Set<Integer>> projectToIssueTypesWithReadRight = AccessBeans .getProjectsToIssueTypesWithRoleForPerson(meAndSubstitutedAndGroups, ancestorProjects, readAnyRights); Map<Integer, Set<Integer>> projectToIssueTypesWithEditRight = null; if (editFlagNeeded) { int[] editRights = new int[] { AccessFlagIndexes.MODIFYANYTASK, AccessFlagIndexes.PROJECTADMIN }; projectToIssueTypesWithEditRight = AccessBeans.getProjectsToIssueTypesWithRoleForPerson( meAndSubstitutedAndGroups, ancestorProjects, editRights); } //gets the selected item types for getting the role based right eventually restricted by item types Integer[] selectedItemTypesOriginal = filterUpperTO.getSelectedIssueTypes(); if (selectedItemTypesOriginal == null || selectedItemTypesOriginal.length == 0) { List<TListTypeBean> selectableItemTypes = IssueTypeBL.loadAllSelectable(); selectedItemTypesOriginal = GeneralUtils.createIntegerArrFromCollection( GeneralUtils.createIntegerListFromBeanList(selectableItemTypes)); if (LOGGER.isDebugEnabled()) { LOGGER.debug( "No explicit item types selected. Number of non document item types included implicitly " + selectableItemTypes.size()); } } Set<Integer> selectedItemTypesSet = new HashSet<Integer>(); if (selectedItemTypesOriginal != null) { selectedItemTypesSet = GeneralUtils.createSetFromIntegerArr(selectedItemTypesOriginal); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Item type(s) selected in filter: " + LookupContainer.getLocalizedLabelBeanListLabels( SystemFields.INTEGER_ISSUETYPE, selectedItemTypesSet, locale)); } } List<TProjectBean> selectedAndDescendantProjectBeans = ProjectBL .loadByProjectIDs(GeneralUtils.createListFromIntArr(selectedProjectsOriginal)); Map<Integer, Integer> childToParentProjectMap = ProjectBL .getChildToParentMap(selectedAndDescendantProjectBeans, null); Set<Integer> raciProjectIDs = new HashSet<Integer>(); Date projectRoles; if (LOGGER.isDebugEnabled() && start != null) { projectRoles = new Date(); LOGGER.debug("Getting project roles lasted " + new Long(projectRoles.getTime() - start.getTime()).toString() + " ms"); } Map<Integer, TWorkItemBean> notEditableMap = null; if (editFlagNeeded) { notEditableMap = new HashMap<Integer, TWorkItemBean>(); } /** * Get the issues for projects with role grouped by same item types */ Map<Set<Integer>, Set<Integer>> itemTypesToProjectsMap = getItemTypesToProjectsMap(selectedProjectsOriginal, selectedItemTypesSet, projectToIssueTypesWithReadRight, childToParentProjectMap, raciProjectIDs); for (Map.Entry<Set<Integer>, Set<Integer>> entry : itemTypesToProjectsMap.entrySet()) { Set<Integer> itemTypes = entry.getKey(); Set<Integer> projectIDs = entry.getValue(); boolean itemTypeRestrictions = !itemTypes.contains(null); filterUpperTO.setSelectedProjects(GeneralUtils.createIntegerArrFromCollection(projectIDs)); Integer[] itemTypesArr = null; if (itemTypeRestrictions) { itemTypesArr = GeneralUtils.createIntegerArrFromCollection(itemTypes); } else { itemTypesArr = selectedItemTypesOriginal; } filterUpperTO.setSelectedIssueTypes(itemTypesArr); if (projectRoleItemsAboveLimit.booleanValue()) { int projectRoleCount = LoadTreeFilterItemCounts.getItemCount(personID, filterUpperTO, raciBean); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Number of items found in projects " + LookupContainer .getNotLocalizedLabelBeanListLabels(SystemFields.INTEGER_PROJECT, projectIDs) + " and item types " + LookupContainer.getLocalizedLabelBeanListLabels(SystemFields.INTEGER_ISSUETYPE, GeneralUtils.createSetFromIntegerArr(itemTypesArr), locale) + ": " + projectRoleCount); } count += projectRoleCount; if (count > maxItems) { throw new TooManyItemsToLoadException("Too many items to load " + count, count); } } List<TWorkItemBean> projectRoleBeansList = getItems(personID, filterUpperTO, raciBean, withCustomAttributes, attributeValueBeanList, withWatchers, watcherList, withMyExpenses, myExpenseList, withTotalExpenses, totalExpenseList, withBudgetPlan, budgetAndPlanList, withRemainingPlan, remainingPlanList, withAttachment, attachmentList, withLinks, itemLinkList, withParents, parentIDs, foundWorkItemsIDs, locale, startDate, endDate, qNode); if (projectRoleBeansList != null) { if (LOGGER.isDebugEnabled()) { String itemTypeString = null; if (itemTypeRestrictions) { StringBuilder stringBuilder = new StringBuilder("item type(s) "); stringBuilder.append(LookupContainer.getLocalizedLabelBeanListLabels( SystemFields.INTEGER_ISSUETYPE, itemTypes, locale)); itemTypeString = stringBuilder.toString(); } else { itemTypeString = "no item type restrictions "; } LOGGER.debug("Number of items from project(s) " + LookupContainer.getNotLocalizedLabelBeanListLabels(SystemFields.PROJECT, projectIDs) + " and " + itemTypeString + ": " + projectRoleBeansList.size()); } for (TWorkItemBean workItemBean : projectRoleBeansList) { Integer itemID = workItemBean.getObjectID(); foundWorkItemsIDs.add(itemID); if (editFlagNeeded) { Integer itemProjectID = workItemBean.getProjectID(); Integer itemTypeID = workItemBean.getListTypeID(); if (AccessBeans.hasExplicitRight(personID, itemID, itemProjectID, itemTypeID, projectToIssueTypesWithEditRight, childToParentProjectMap, "edit")) { workItemBean.setEditable(true); } else { //mark as not editable, but may be set to editable in a later RACI phase notEditableMap.put(itemID, workItemBean); //this is readable but not editable. Force loading the same item as from RACI project to possibly set later as editable raciProjectIDs.add(itemProjectID); } } } workItemBeanList.addAll(projectRoleBeansList); } } filterUpperTO.setSelectedProjects(selectedProjectsOriginal); filterUpperTO.setSelectedIssueTypes(selectedItemTypesOriginal); //the projects not completely covered in projects with roles: get the RACI items if (!raciProjectIDs.isEmpty()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("RACI projects selected in filter: " + LookupContainer .getNotLocalizedLabelBeanListLabels(SystemFields.INTEGER_PROJECT, raciProjectIDs)); } List<Integer> meAndSubstitutedIDs = AccessBeans.getMeAndSubstituted(personBean); Integer[] selectedResponsibles = filterUpperTO.getSelectedResponsibles(); Integer[] selectedManagers = filterUpperTO.getSelectedManagers(); Integer[] selectedAuthors = filterUpperTO.getSelectedOriginators(); boolean reponsiblesInFilter = selectedResponsibles != null && selectedResponsibles.length > 0; boolean managersInFilter = selectedManagers != null && selectedManagers.length > 0; boolean authorsInFilter = selectedAuthors != null && selectedAuthors.length > 0; filterUpperTO.setSelectedProjects(GeneralUtils.createIntegerArrFromCollection(raciProjectIDs)); filterUpperTO.setSelectedIssueTypes(selectedItemTypesOriginal); Map<Integer, List<Integer>> reciprocGroups = AccessBeans.getRaciprocGroupsMap(meAndSubstitutedIDs); List<Integer> reciprocOriginatorGroups = reciprocGroups.get(SystemFields.INTEGER_ORIGINATOR); List<Integer> reciprocManagerGroups = reciprocGroups.get(SystemFields.INTEGER_MANAGER); List<Integer> reciprocResponsibleGroups = reciprocGroups.get(SystemFields.INTEGER_RESPONSIBLE); List<Integer> allGroupsForPerson = reciprocGroups.get(AccessBeans.ALL_PERSONGROUPS); if (!myItems) { //configure the RACIBean with own and reciproc persons only if not MY_ITEMS because MY_ITEMS refers only to me (no reciproc persons) raciBean = new RACIBean(); /** * prepare my author items */ Set<Integer> authorSet = new HashSet<Integer>(); authorSet.addAll(meAndSubstitutedIDs); if (reciprocOriginatorGroups != null) { List<TPersonBean> originatorsInReciprocGroups = PersonBL .getIndirectPersons(reciprocOriginatorGroups, false, null); List<Integer> reciprocOriginators = GeneralUtils .createIntegerListFromBeanList(originatorsInReciprocGroups); authorSet.addAll(reciprocOriginators); } raciBean.setAuthors(authorSet); /** * prepare my responsible items */ Set<Integer> responsibleSet = new HashSet<Integer>(); responsibleSet.addAll(meAndSubstitutedIDs); if (reciprocResponsibleGroups != null) { List<TPersonBean> responsiblesInReciprocGroups = PersonBL .getIndirectPersons(reciprocResponsibleGroups, false, null); List<Integer> reciprocResponsibles = GeneralUtils .createIntegerListFromBeanList(responsiblesInReciprocGroups); responsibleSet.addAll(reciprocResponsibles); } if (allGroupsForPerson != null) { responsibleSet.addAll(allGroupsForPerson); } raciBean.setResponsibles(responsibleSet); /** * prepare my manager items */ Set<Integer> managerSet = new HashSet<Integer>(); managerSet.addAll(meAndSubstitutedIDs); if (reciprocManagerGroups != null) { List<TPersonBean> managersInReciprocGroups = PersonBL.getIndirectPersons(reciprocManagerGroups, false, null); List<Integer> reciprocManagers = GeneralUtils .createIntegerListFromBeanList(managersInReciprocGroups); managerSet.addAll(reciprocManagers); } raciBean.setManagers(managerSet); } if (reponsiblesInFilter && managersInFilter && authorsInFilter) { //if a RACI role (author or responsible or manager) is set in filter then this RACI role will be excluded from raciBean (see TreeFilterCriteria Torque limitation) //but if all three are set in filter then we loose the RACI filter (no RACI criterion is set at all) so possibly we would get item results the user has not right to see //so in this case no common RACI search is executed (only the one by one for author and responsible and manager, see later) LOGGER.debug( "All the authors, responsibles and managers are set in filter. No RACI projects are searched"); } else { /** * get the author, responsible and manager items */ LOGGER.debug("Getting my RACI items..."); if (raciRoleItemsAboveLimit.booleanValue()) { int raciRoleCount = LoadTreeFilterItemCounts.getItemCount(personID, filterUpperTO, raciBean); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Items found as manager/responsible/author " + raciRoleCount); } count += raciRoleCount; if (count > maxItems) { throw new TooManyItemsToLoadException("Too many items to load " + count, count); } } List<TWorkItemBean> respManAuthItems = getItems(personID, filterUpperTO, raciBean, withCustomAttributes, attributeValueBeanList, withWatchers, watcherList, withMyExpenses, myExpenseList, withTotalExpenses, totalExpenseList, withBudgetPlan, budgetAndPlanList, withRemainingPlan, remainingPlanList, withAttachment, attachmentList, withLinks, itemLinkList, withParents, parentIDs, foundWorkItemsIDs, locale, startDate, endDate, qNode); if (respManAuthItems != null) { workItemBeanList.addAll( filterItemList(respManAuthItems, foundWorkItemsIDs, editFlagNeeded, notEditableMap)); } } if (reponsiblesInFilter) { Set<Integer> selectedResponsiblesSet = GeneralUtils.createSetFromIntegerArr(selectedResponsibles); Set<Integer> raciResponsibles = raciBean.getResponsibles(); raciResponsibles.retainAll(selectedResponsiblesSet); if (!raciResponsibles.isEmpty()) { LOGGER.debug("Getting my responsible items..."); filterUpperTO.setSelectedResponsibles(GeneralUtils.createIntegerArrFromSet(raciResponsibles)); if (raciRoleItemsAboveLimit.booleanValue()) { int raciRoleCount = LoadTreeFilterItemCounts.getItemCount(personID, filterUpperTO, null); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Items found as responsible " + raciRoleCount); } count += raciRoleCount; if (count > maxItems) { throw new TooManyItemsToLoadException("Too many items to load " + count, count); } } List<TWorkItemBean> responsibleItems = getItems(personID, filterUpperTO, null, withCustomAttributes, attributeValueBeanList, withWatchers, watcherList, withMyExpenses, myExpenseList, withTotalExpenses, totalExpenseList, withBudgetPlan, budgetAndPlanList, withRemainingPlan, remainingPlanList, withAttachment, attachmentList, withLinks, itemLinkList, withParents, parentIDs, foundWorkItemsIDs, locale, startDate, endDate, qNode); if (responsibleItems != null) { workItemBeanList.addAll(filterItemList(responsibleItems, foundWorkItemsIDs, editFlagNeeded, notEditableMap)); } filterUpperTO.setSelectedResponsibles(selectedResponsibles); } } if (managersInFilter) { Set<Integer> selectedManagersSet = GeneralUtils.createSetFromIntegerArr(selectedManagers); Set<Integer> raciManagers = raciBean.getManagers(); raciManagers.retainAll(selectedManagersSet); if (!raciManagers.isEmpty()) { LOGGER.debug("Getting my manager items..."); filterUpperTO.setSelectedManagers(GeneralUtils.createIntegerArrFromSet(raciManagers)); if (raciRoleItemsAboveLimit.booleanValue()) { int raciRoleCount = LoadTreeFilterItemCounts.getItemCount(personID, filterUpperTO, null); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Items found as manager " + raciRoleCount); } count += raciRoleCount; if (count > maxItems) { throw new TooManyItemsToLoadException("Too many items to load " + count, count); } } List<TWorkItemBean> managerItems = getItems(personID, filterUpperTO, null, withCustomAttributes, attributeValueBeanList, withWatchers, watcherList, withMyExpenses, myExpenseList, withTotalExpenses, totalExpenseList, withBudgetPlan, budgetAndPlanList, withRemainingPlan, remainingPlanList, withAttachment, attachmentList, withLinks, itemLinkList, withParents, parentIDs, foundWorkItemsIDs, locale, startDate, endDate, qNode); if (managerItems != null) { workItemBeanList.addAll( filterItemList(managerItems, foundWorkItemsIDs, editFlagNeeded, notEditableMap)); } filterUpperTO.setSelectedManagers(selectedManagers); } } if (authorsInFilter) { Set<Integer> selectedAuthorsSet = GeneralUtils.createSetFromIntegerArr(selectedAuthors); Set<Integer> raciAuthors = raciBean.getAuthors(); raciAuthors.retainAll(selectedAuthorsSet); if (!raciAuthors.isEmpty()) { LOGGER.debug("Getting my author items..."); filterUpperTO.setSelectedOriginators(GeneralUtils.createIntegerArrFromSet(raciAuthors)); if (raciRoleItemsAboveLimit.booleanValue()) { int raciRoleCount = LoadTreeFilterItemCounts.getItemCount(personID, filterUpperTO, null); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Items found as author " + raciRoleCount); } count += raciRoleCount; if (count > maxItems) { throw new TooManyItemsToLoadException("Too many items to load " + count, count); } } List<TWorkItemBean> authorItems = getItems(personID, filterUpperTO, null, withCustomAttributes, attributeValueBeanList, withWatchers, watcherList, withMyExpenses, myExpenseList, withTotalExpenses, totalExpenseList, withBudgetPlan, budgetAndPlanList, withRemainingPlan, remainingPlanList, withAttachment, attachmentList, withLinks, itemLinkList, withParents, parentIDs, foundWorkItemsIDs, locale, startDate, endDate, qNode); if (authorItems != null) { workItemBeanList.addAll( filterItemList(authorItems, foundWorkItemsIDs, editFlagNeeded, notEditableMap)); } filterUpperTO.setSelectedOriginators(selectedAuthors); } } /** * my watcher items */ //save temporarily to set it back after filter is executed for watchers Integer[] selectedWatchersOriginal = filterUpperTO.getSelectedConsultantsInformants(); Integer watcherSelectorOriginal = filterUpperTO.getWatcherSelector(); Set<Integer> watcherSet = new HashSet<Integer>(); if (myItems) { watcherSet.add(personID); } else { watcherSet.addAll(meAndSubstitutedAndGroups); } if (selectedWatchersOriginal != null && selectedWatchersOriginal.length > 0) { //if originator field has selection than retain only the selections related to me as author watcherSet.retainAll(GeneralUtils.createSetFromIntegerArr(selectedWatchersOriginal)); } else { filterUpperTO.setWatcherSelector(FilterUpperTO.CONSINF_SELECTOR.CONSULTANT_OR_INFORMANT); } if (!watcherSet.isEmpty()) { filterUpperTO .setSelectedConsultantsInformants(GeneralUtils.createIntegerArrFromCollection(watcherSet)); if (raciRoleItemsAboveLimit.booleanValue()) { int raciRoleCount = LoadTreeFilterItemCounts.getItemCount(personID, filterUpperTO, null); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Items found as watchers " + raciRoleCount); } count += raciRoleCount; if (count > maxItems) { throw new TooManyItemsToLoadException("Too many items to load " + count, count); } } List<TWorkItemBean> watcherItems = getItems(personID, filterUpperTO, null, withCustomAttributes, attributeValueBeanList, withWatchers, watcherList, withMyExpenses, myExpenseList, withTotalExpenses, totalExpenseList, withBudgetPlan, budgetAndPlanList, withRemainingPlan, remainingPlanList, withAttachment, attachmentList, withLinks, itemLinkList, withParents, parentIDs, foundWorkItemsIDs, locale, startDate, endDate, qNode); //set both watchers and selector back to original value for the next filter execution filterUpperTO.setSelectedConsultantsInformants(selectedWatchersOriginal); filterUpperTO.setWatcherSelector(watcherSelectorOriginal); //helper for setting the consulted items as editable List<Integer> watcherItemIDs = new LinkedList<Integer>(); if (watcherItems != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Total number of watcher items: " + watcherItems.size()); } for (Iterator<TWorkItemBean> iterator = watcherItems.iterator(); iterator.hasNext();) { TWorkItemBean workItemBean = iterator.next(); Integer workItemID = workItemBean.getObjectID(); if (foundWorkItemsIDs.contains(workItemID)) { iterator.remove(); if (editFlagNeeded) { TWorkItemBean includedWorkItemBean = notEditableMap.get(workItemID); if (includedWorkItemBean != null) { watcherItemIDs.add(workItemID); } } } else { foundWorkItemsIDs.add(workItemID); if (editFlagNeeded) { notEditableMap.put(workItemID, workItemBean); watcherItemIDs.add(workItemID); } } } if (!watcherItems.isEmpty()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Number of watcher only items: " + watcherItems.size()); } workItemBeanList.addAll(watcherItems); } } if (editFlagNeeded) { List<TNotifyBean> notifyBeanList = ConsInfBL.loadWatcherByItems(watcherItemIDs, RaciRole.CONSULTANT); if (notifyBeanList != null) { for (TNotifyBean notifyBean : notifyBeanList) { Integer itemID = notifyBean.getWorkItem(); TWorkItemBean workItemBean = notEditableMap.get(itemID); if (workItemBean != null) { workItemBean.setEditable(true); notEditableMap.remove(itemID); } } } } } /** * on behalf of items */ if (!myItems) { List<Integer> onBefalfUserPickerFiels = FieldBL.getOnBehalfOfUserPickerFieldIDs(); if (onBefalfUserPickerFiels != null && !onBefalfUserPickerFiels.isEmpty()) { Map<Integer, Integer[]> selectedCustomSelectsOriginal = filterUpperTO .getSelectedCustomSelects(); if (selectedCustomSelectsOriginal == null) { selectedCustomSelectsOriginal = new HashMap<Integer, Integer[]>(); filterUpperTO.setSelectedCustomSelects(selectedCustomSelectsOriginal); } Map<Integer, Integer> customSelectSimpleFieldsMap = filterUpperTO.getCustomSelectSimpleFields(); if (customSelectSimpleFieldsMap == null) { customSelectSimpleFieldsMap = new HashMap<Integer, Integer>(); filterUpperTO.setCustomSelectSimpleFields(customSelectSimpleFieldsMap); } for (Integer fieldID : onBefalfUserPickerFiels) { //get the filter result for each on behalf of user picker one by one Set<Integer> onBehalfSet = new HashSet<Integer>(); onBehalfSet.addAll(meAndSubstitutedIDs); //save temporarily to set it back after filter is executed for on behalf of persons Integer[] selectedOnBehalfUserPickerOriginal = selectedCustomSelectsOriginal.get(fieldID); if (selectedOnBehalfUserPickerOriginal != null && selectedOnBehalfUserPickerOriginal.length > 0) { //if on behalf of field has selection than retain only the selections related to me as author onBehalfSet.retainAll( GeneralUtils.createSetFromIntegerArr(selectedOnBehalfUserPickerOriginal)); } if (!onBehalfSet.isEmpty()) { selectedCustomSelectsOriginal.put(fieldID, GeneralUtils.createIntegerArrFromCollection(onBehalfSet)); IFieldTypeRT fieldTypeRT = FieldTypeManager.getFieldTypeRT(fieldID); customSelectSimpleFieldsMap.put(fieldID, fieldTypeRT.getSystemOptionType()); if (raciRoleItemsAboveLimit.booleanValue()) { int raciRoleCount = LoadTreeFilterItemCounts.getItemCount(personID, filterUpperTO, null); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Items found as on behalf " + raciRoleCount); } count += raciRoleCount; if (count > maxItems) { throw new TooManyItemsToLoadException("Too many items to load " + count, count); } } List<TWorkItemBean> onBehalfItems = getItems(personID, filterUpperTO, null, withCustomAttributes, attributeValueBeanList, withWatchers, watcherList, withMyExpenses, myExpenseList, withTotalExpenses, totalExpenseList, withBudgetPlan, budgetAndPlanList, withRemainingPlan, remainingPlanList, withAttachment, attachmentList, withLinks, itemLinkList, withParents, parentIDs, foundWorkItemsIDs, locale, startDate, endDate, qNode); if (onBehalfItems != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Total number of on behalf items for field " + fieldID + " is " + onBehalfItems.size()); } for (Iterator<TWorkItemBean> iterator = onBehalfItems.iterator(); iterator .hasNext();) { TWorkItemBean workItemBean = iterator.next(); Integer workItemID = workItemBean.getObjectID(); if (foundWorkItemsIDs.contains(workItemID)) { iterator.remove(); if (editFlagNeeded) { TWorkItemBean includedWorkItemBean = notEditableMap.get(workItemID); if (includedWorkItemBean != null) { includedWorkItemBean.setEditable(true); notEditableMap.remove(workItemID); } } } else { foundWorkItemsIDs.add(workItemID); if (editFlagNeeded) { workItemBean.setEditable(true); } } } if (!onBehalfItems.isEmpty()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Number of on behalf only items for field " + fieldID + " is " + onBehalfItems.size()); } workItemBeanList.addAll(onBehalfItems); } } //set it back to original value for the next filter execution selectedCustomSelectsOriginal.put(fieldID, selectedOnBehalfUserPickerOriginal); } } } } } if (!workItemBeanList.isEmpty()) { String keyword = filterUpperTO.getKeyword(); if (keyword != null && keyword.length() > 0) { //if keyword specified restrict the results try { int[] luceneWorkItems = LuceneSearcher.searchWorkItems(keyword, false, locale, null); if (luceneWorkItems == null || luceneWorkItems.length == 0) { //not a single match found, clear the results got from the database LOGGER.debug("No match found for the keyword " + keyword + " using the lucene search."); workItemBeanList.clear(); } else { //some match is found: combine it with the results from database search Set<Integer> workItemIDsSet = GeneralUtils.createSetFromIntArr(luceneWorkItems); for (Iterator<TWorkItemBean> iterator = workItemBeanList.iterator(); iterator.hasNext();) { TWorkItemBean workItemBean = iterator.next(); if (!workItemIDsSet.contains(workItemBean.getObjectID())) { //report bean does not matches the keyword iterator.remove(); } } } } catch (BooleanQuery.TooManyClauses e) { //do nothing because no ErrorData list available } catch (ParseException e) { LOGGER.warn("Parsing the keyword expression failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } //gets the linked items if selected int[] linkedWorkItemIDs = LoadItemLinksUtil.getLinkedWorkItemIDs(filterUpperTO.getLinkTypeFilterSuperset(), filterUpperTO.getArchived(), filterUpperTO.getDeleted(), filterUpperTO.getItemTypeIDsForLinkType(), workItemBeanList); //If selected view in item navigator is Gant view, we need to add all linked work items if (personBean.getLastSelectedView() != null) { if (personBean.getLastSelectedView().equals(IssueListViewDescriptor.GANTT)) { int[] msProjectLinkedWorkItems = LoadItemLinksUtil.getMsProjectLinkedWorkItemIDs( filterUpperTO.getArchived(), filterUpperTO.getDeleted(), workItemBeanList); Set<Integer> msProjectLinkedWorkItemsSet = GeneralUtils .createSetFromIntArr(msProjectLinkedWorkItems); Set<Integer> linkedWorkItemIDsSet = GeneralUtils.createSetFromIntArr(linkedWorkItemIDs); //combining two set msProjectLinkedWorkItemsSet.addAll(linkedWorkItemIDsSet); linkedWorkItemIDs = GeneralUtils.createIntArrFromIntegerCollection(msProjectLinkedWorkItemsSet); } } if (linkedWorkItemIDs != null && linkedWorkItemIDs.length > 0) { Integer archived = filterUpperTO.getArchived(); if (archived == null) { //should never happen (either both or none has value) archived = Integer.valueOf(FilterUpperTO.ARCHIVED_FILTER.EXCLUDE_ARCHIVED); } Integer deleted = filterUpperTO.getDeleted(); if (deleted == null) { //should never happen (either both or none has value) deleted = Integer.valueOf(FilterUpperTO.DELETED_FILTER.EXCLUDE_DELETED); } boolean includeArchivedDeleted = archived.intValue() != FilterUpperTO.ARCHIVED_FILTER.EXCLUDE_ARCHIVED || deleted.intValue() != FilterUpperTO.DELETED_FILTER.EXCLUDE_DELETED; List<TWorkItemBean> linkedWorkItemBeans = LoadItemIDListItems.getItems(personID, linkedWorkItemIDs, includeArchivedDeleted, editFlagNeeded, withCustomAttributes, attributeValueBeanList, withWatchers, watcherList, withMyExpenses, myExpenseList, withTotalExpenses, totalExpenseList, withBudgetPlan, budgetAndPlanList, withRemainingPlan, remainingPlanList, withAttachment, attachmentList, withLinks, itemLinkList, withParents, parentIDs); workItemBeanList.addAll(linkedWorkItemBeans); } Integer archived = filterUpperTO.getArchived(); Integer deleted = filterUpperTO.getDeleted(); boolean archivedOrDeletedIncluded = (archived != null && archived.intValue() != ARCHIVED_FILTER.EXCLUDE_ARCHIVED) || (deleted != null && deleted.intValue() != DELETED_FILTER.EXCLUDE_DELETED); if (archivedOrDeletedIncluded) { //if archived or deleted is included only the project admin might see them Map<Integer, Set<Integer>> projectToIssueTypesWithAdminRight = AccessBeans .getProjectsToIssueTypesWithRoleForPerson(meAndSubstitutedAndGroups, ancestorProjects, new int[] { AccessFlagIndexes.PROJECTADMIN }); for (Iterator<TWorkItemBean> iterator = workItemBeanList.iterator(); iterator.hasNext();) { TWorkItemBean workItemBean = iterator.next(); Integer itemID = workItemBean.getObjectID(); Integer itemProjectID = workItemBean.getProjectID(); Integer itemTypeID = workItemBean.getListTypeID(); boolean archivedOrDeleted = workItemBean.isArchivedOrDeleted(); if (archivedOrDeleted && !AccessBeans.hasExplicitRight(personID, itemID, itemProjectID, itemTypeID, projectToIssueTypesWithAdminRight, childToParentProjectMap, "project admin")) { /** * Exclude the deleted and archived workItems if the person is not project admin for the workItem * a person selects more projects but is project admin only in some of them: all archived/deleted workItems * in the projects where the person is not project admin should be filtered out */ iterator.remove(); } } } if (LOGGER.isDebugEnabled() && start != null) { Date end = new Date(); LOGGER.debug("Loading all filter items (" + workItemBeanList.size() + ") lasted " + new Long(end.getTime() - start.getTime()).toString() + " ms"); } return workItemBeanList; }
From source file:com.sun.identity.saml2.plugins.SAML2IDPProxyFRImpl.java
private String selectIDPBasedOnLOA(List<String> idpList, String realm, AuthnRequest authnRequest) { String classMethod = "selectIdPBasedOnLOA"; EntityDescriptorElement idpDesc = null; Set authnRequestContextSet = null; String idps = ""; try {// w w w.j a v a 2 s . co m RequestedAuthnContext requestedAuthnContext = authnRequest.getRequestedAuthnContext(); if (requestedAuthnContext == null) { //Handle the special case when the original request did not contain any Requested AuthnContext: //In this case we just simply return all the IdPs as each one should support a default AuthnContext. return StringUtils.join(idpList, " "); } List listOfAuthnContexts = requestedAuthnContext.getAuthnContextClassRef(); debugMessage(classMethod, "listofAuthnContexts: " + listOfAuthnContexts); try { authnRequestContextSet = new HashSet(listOfAuthnContexts); } catch (Exception ex1) { authnRequestContextSet = new HashSet(); } if ((idpList != null) && (!idpList.isEmpty())) { Iterator idpI = idpList.iterator(); while (idpI.hasNext()) { String idp = (String) idpI.next(); debugMessage(classMethod, "IDP is: " + idp); idpDesc = SAML2Utils.getSAML2MetaManager().getEntityDescriptor(realm, idp); if (idpDesc != null) { ExtensionsType et = idpDesc.getExtensions(); if (et != null) { debugMessage(classMethod, "Extensions found for idp: " + idp); List idpExtensions = et.getAny(); if (idpExtensions != null || !idpExtensions.isEmpty()) { debugMessage(classMethod, "Extensions content found for idp: " + idp); Iterator idpExtensionsI = idpExtensions.iterator(); while (idpExtensionsI.hasNext()) { EntityAttributesElement eael = (EntityAttributesElement) idpExtensionsI.next(); if (eael != null) { debugMessage(classMethod, "Entity Attributes found for idp: " + idp); List attribL = eael.getAttributeOrAssertion(); if (attribL != null || !attribL.isEmpty()) { Iterator attrI = attribL.iterator(); while (attrI.hasNext()) { AttributeElement ae = (AttributeElement) attrI.next(); // TODO: Verify what type of element this is (Attribute or assertion) // For validation purposes List av = ae.getAttributeValue(); if (av != null || !av.isEmpty()) { debugMessage(classMethod, "Attribute Values found for idp: " + idp); Iterator avI = av.iterator(); while (avI.hasNext()) { AttributeValueElement ave = (AttributeValueElement) avI .next(); if (ave != null) { List contentL = ave.getContent(); debugMessage(classMethod, "Attribute Value Elements found for idp: " + idp + "-->" + contentL); if (contentL != null || !contentL.isEmpty()) { Set idpContextSet = trimmedListToSet(contentL); debugMessage(classMethod, "idpContextSet = " + idpContextSet); idpContextSet.retainAll(authnRequestContextSet); if (idpContextSet != null && !idpContextSet.isEmpty()) { idps = idp + " " + idps; debugMessage(classMethod, "Extension Values found for idp " + idp + ": " + idpContextSet); } } } } } } } } } } } else { debugMessage(classMethod, " No extensions found for IdP " + idp); } } else { debugMessage(classMethod, "Configuration for the idp " + idp + " was not found in this system"); } } } } catch (SAML2MetaException me) { debugMessage(classMethod, "SOmething went wrong: " + me); } debugMessage(classMethod, " IDPList returns: " + idps); return idps.trim(); }
From source file:opennlp.tools.fca.BasicLevelMetrics.java
public void cueValidity() { if (attributesExtent == null) this.setUp(); ArrayList<Integer> attrExtent; Set<Integer> intersection; double sum = 0; for (FormalConcept c : cl.conceptList) { sum = 0;//from ww w .j a v a2 s. c om for (Integer i : c.intent) { intersection = new HashSet<Integer>(); intersection.addAll(c.extent); attrExtent = attributesExtent.get(i); intersection.retainAll(attrExtent); sum += (double) intersection.size() * 1. / attrExtent.size(); } c.blCV = Double.isNaN(sum) ? 0 : sum; } }