/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param <E> the element type * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static <E> List<E> sum(final List<? extends E> list1, final List<? extends E> list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns an ordered list of invokers for the given pointcut. Note that * a new and stable list is returned to.. do whatever you want with it. */ private List<BaseInvoker> getInvokersForPointcut(Pointcut thePointcut) { List<BaseInvoker> invokers; boolean haveAnonymousInvokers; synchronized (myRegistryMutex) { List<BaseInvoker> globalInvokers = myInvokers.get(thePointcut); List<BaseInvoker> anonymousInvokers = myAnonymousInvokers.get(thePointcut); invokers = ListUtils.union(anonymousInvokers, globalInvokers); haveAnonymousInvokers = anonymousInvokers.isEmpty() == false; } if (haveAnonymousInvokers) { invokers.sort(Comparator.naturalOrder()); } return invokers; }
List<RiskLevelRule> allRules = ListUtils.union(triageConfig.getRiskLevelRules(), newRules); triageConfig.setRiskLevelRules(allRules);
/** * @param activeSuites the suite names that are active * @param parallelSuites the suite names to be executed in parallel * @param sequentialSuites the suite names to be executed in sequential manner * @return */ private static List<String> getDefaultRunModeTestSuites(final List<String> activeSuites, final List<String> parallelSuites, final List<String> sequentialSuites) { return removeAll(new ArrayList<>(activeSuites), union(parallelSuites, sequentialSuites)); }
@Override public List<K> items() { if (frame != null) { return ListUtils.union(super.items(), Collections.singletonList(frame)); } else { return super.items(); } }
/** * Displays an informative message in case there is at least one test suite left for default run mode. * * @param unspecifiedTestSuiteRunMode the default run mode for suites that don't explicitly mention a run mode. * @param activeSuites the suite names that are active * @param sequentialSuites the suite names to be executed in sequential manner * @param parallelSuites the suite names to be executed in parallel */ private static void addInformativeNoteForUnspecifiedRules(final TestCaseRunMode unspecifiedTestSuiteRunMode, final List<String> activeSuites, final List<String> sequentialSuites, final List<String> parallelSuites) { List<String> union = union(sequentialSuites, parallelSuites); if (!union.containsAll(activeSuites)) { List<String> copy = new ArrayList<>(activeSuites); copy.removeAll(union); log.info(format(MESSAGE_TEST_SUITES_WITH_UNSPECIFIED_MAPPING, getListForPrint(copy), unspecifiedTestSuiteRunMode.name())); } }
private List<ConfigurationEntry> getEntriesToDelete(String mtaId, CloudTarget newTarget, CloudTarget oldTarget, List<ConfigurationEntry> publishedEntries) { List<ConfigurationEntry> entriesWithNewTargetFormat = getEntriesToDelete(mtaId, newTarget, publishedEntries); /** * TODO: The following line of code should be removed when compatibility with versions lower than 1.18.2 is not required. In these * versions, the configuration entries were stored with the space ID of the provider as a value for their target element. This was * identified as an issue, since restricted users could not see configuration entries for spaces, in which they had no roles * assigned. The following line ensures that entries published by old deploy service versions, are detected properly as discontinued * during redeploy (update) of the MTA that provided them. */ List<ConfigurationEntry> entriesWithOldTargetFormat = getEntriesToDelete(mtaId, oldTarget, publishedEntries); return ListUtils.union(entriesWithNewTargetFormat, entriesWithOldTargetFormat); }
private List<ConfigurationEntry> getEntriesToDelete(String mtaId, CloudTarget newTarget, CloudTarget oldTarget, List<ConfigurationEntry> publishedEntries) { List<ConfigurationEntry> entriesWithNewTargetFormat = getEntriesToDelete(mtaId, newTarget, publishedEntries); /** * TODO: The following line of code should be removed when compatibility with versions lower than 1.18.2 is not required. In these * versions, the configuration entries were stored with the space ID of the provider as a value for their target element. This was * identified as an issue, since restricted users could not see configuration entries for spaces, in which they had no roles * assigned. The following line ensures that entries published by old deploy service versions, are detected properly as discontinued * during redeploy (update) of the MTA that provided them. */ List<ConfigurationEntry> entriesWithOldTargetFormat = getEntriesToDelete(mtaId, oldTarget, publishedEntries); return ListUtils.union(entriesWithNewTargetFormat, entriesWithOldTargetFormat); }
private Task compileTask(String taskName, Map<String, Object> taskRawData, String defaultSuccess, Map<String, String> imports, String defaultFailure) { if (MapUtils.isEmpty(taskRawData)) { throw new RuntimeException("Task: " + taskName + " has no data"); } Map<String, Serializable> preTaskData = new HashMap<>(); Map<String, Serializable> postTaskData = new HashMap<>(); transformersHandler.validateKeyWords(taskName, taskRawData, ListUtils.union(preTaskTransformers, postTaskTransformers), TaskAdditionalKeyWords, null); try { preTaskData.putAll(transformersHandler.runTransformers(taskRawData, preTaskTransformers)); postTaskData.putAll(transformersHandler.runTransformers(taskRawData, postTaskTransformers)); } catch (Exception ex){ throw new RuntimeException("For task: " + taskName + " syntax is illegal.\n" + ex.getMessage(), ex); } List<Input> inputs = (List<Input>)preTaskData.get(DO_KEY); @SuppressWarnings("unchecked") Map<String, Object> doRawData = (Map<String, Object>) taskRawData.get(DO_KEY); if (MapUtils.isEmpty(doRawData)) { throw new RuntimeException("Task: \'" + taskName + "\' has no reference information"); } String refString = doRawData.keySet().iterator().next(); String refId = resolveRefId(refString, imports); @SuppressWarnings("unchecked") Map<String, String> navigationStrings = (Map<String, String>) postTaskData.get(NAVIGATION_KEY); //default navigation if (MapUtils.isEmpty(navigationStrings)) { navigationStrings = new HashMap<>(); navigationStrings.put(SUCCESS_RESULT, defaultSuccess); navigationStrings.put(FAILURE_RESULT, defaultFailure); } return new Task(taskName, preTaskData, postTaskData, inputs, navigationStrings, refId); }
executableConstraintGroups.add(ListUtils.union(flowAdditionalKeywords, operationAdditionalKeywords));
executableConstraintGroups.add(ListUtils.union(flowAdditionalKeywords, operationAdditionalKeywords));
public AddSTKRolesToRelevantAppsTask() { super("Add STK roles to apps", "Re-add roles to relevant apps so STK users can use them"); eePermissionMapping = Arrays.asList( new PermissionMapping("/modules/dam-app/apps/assets/permissions/roles", "demo-project-base", "demo-project-base"), new PermissionMapping("/modules/pages/apps/pages/subApps/browser/actions/activate/availability/access/roles", "demo-publisher", "demo-project-publisher"), new PermissionMapping("/modules/categorization/apps/categories/permissions/roles", "demo-project-base", "demo-project-base") ); cePermissionMapping = ListUtils.union(Arrays.asList( new PermissionMapping("/modules/pages/apps/pages/subApps/browser/actions/activateRecursive/availability/access/roles", "demo-publisher", "demo-project-publisher"), new PermissionMapping("/modules/pages/apps/pages/subApps/browser/actions/deactivate/availability/access/roles", "demo-publisher", "demo-project-publisher"), new PermissionMapping("/modules/pages/apps/pages/subApps/browser/actions/activateDeletion/availability/access/roles", "demo-publisher", "demo-project-publisher")), eePermissionMapping ); }
private ValueWithTimestamp getValue(Subject subject) throws IncomputableFieldException { List<TimedValue> dividendValues = getLatestTimedValuesForSubjectAndAttributes(subject, dividendAttributes); List<TimedValue> divisorValues = getLatestTimedValuesForSubjectAndAttributes(subject, Collections.singletonList(divisorAttribute)); Double dividend = sumTimedValues(dividendValues); Double divisor = sumTimedValues(divisorValues); LocalDateTime latestTimeStamp = getMostRecentTimestampForTimedValues(ListUtils.union(dividendValues, divisorValues)); if (0 == divisor) { throw new IncomputableFieldException("Cannot divide by zero"); } return new ValueWithTimestamp(dividend/divisor, latestTimeStamp); }
@TaskAction public void perform() { final Map<String, String> environmentValues = environmentConfigurationUtils.parseEnvironmentValues(environmentConfig.getOrNull()); final String bundleDirectory = outputBundle.getAsFile().get().getParentFile().getPath(); final List<File> bundleFiles = union( collectFiles(bundleDirectory, BUNDLE_EXTENSION), filterBundleFiles(dependencyBundles.getAsFileTree().getFiles()) ); final FullBundleCreator fullBundleCreator = getInstance(FullBundleCreator.class); fullBundleCreator.createFullBundle( environmentValues, bundleFiles, bundleDirectory, outputBundle.getAsFile().get().getName() ); } }
private List<ConfigurationEntry> getEntriesToDelete(String mtaId, String mtaVersion, CloudTarget newTarget, CloudTarget oldTarget, List<String> providedDependencyNames, List<ConfigurationEntry> publishedEntries) { List<ConfigurationEntry> entriesWithNewTargetFormat = getEntries(mtaId, mtaVersion, newTarget); /** * TODO: The following line of code should be removed when compatibility with versions lower than 1.18.2 is not required. In these * versions, the configuration entries were stored with the space ID of the provider as a value for their target element. This was * identified as an issue, since restricted users could not see configuration entries for spaces, in which they had no roles * assigned. The following line ensures that entries published by old deploy service versions, are detected properly as discontinued * during redeploy (update) of the MTA that provided them. */ List<ConfigurationEntry> entriesWithOldTargetFormat = getEntries(mtaId, mtaVersion, oldTarget); List<ConfigurationEntry> allEntriesForCurrentMta = ListUtils.union(entriesWithNewTargetFormat, entriesWithOldTargetFormat); List<ConfigurationEntry> entriesForCurrentModule = getConfigurationEntriesWithProviderIds(allEntriesForCurrentMta, getProviderIds(mtaId, providedDependencyNames)); return getEntriesNotUpdatedByThisProcess(entriesForCurrentModule, publishedEntries); }
private List<ConfigurationEntry> getEntriesToDelete(String mtaId, String mtaVersion, CloudTarget newTarget, CloudTarget oldTarget, List<String> providedDependencyNames, List<ConfigurationEntry> publishedEntries) { List<ConfigurationEntry> entriesWithNewTargetFormat = getEntries(mtaId, mtaVersion, newTarget); /** * TODO: The following line of code should be removed when compatibility with versions lower than 1.18.2 is not required. In these * versions, the configuration entries were stored with the space ID of the provider as a value for their target element. This was * identified as an issue, since restricted users could not see configuration entries for spaces, in which they had no roles * assigned. The following line ensures that entries published by old deploy service versions, are detected properly as discontinued * during redeploy (update) of the MTA that provided them. */ List<ConfigurationEntry> entriesWithOldTargetFormat = getEntries(mtaId, mtaVersion, oldTarget); List<ConfigurationEntry> allEntriesForCurrentMta = ListUtils.union(entriesWithNewTargetFormat, entriesWithOldTargetFormat); List<ConfigurationEntry> entriesForCurrentModule = getConfigurationEntriesWithProviderIds(allEntriesForCurrentMta, getProviderIds(mtaId, providedDependencyNames)); return getEntriesNotUpdatedByThisProcess(entriesForCurrentModule, publishedEntries); }
@Override protected StepPhase executeStep(ExecutionWrapper execution) throws Exception { getStepLogger().debug(Messages.COMPUTING_NEXT_MODULES_FOR_PARALLEL_ITERATION); List<ModuleToDeploy> allModulesToDeploy = StepsUtil.getModulesToDeploy(execution.getContext()); List<ModuleToDeploy> completedApplications = StepsUtil.getIteratedModulesInParallel(execution.getContext()); List<String> completedModuleNames = completedApplications.stream() .map(ModuleToDeploy::getName) .collect(Collectors.toList()); CloudControllerClient client = execution.getControllerClient(); // Set next iteration data List<ModuleToDeploy> modulesForNextIteration = computeApplicationsForNextIteration(client, allModulesToDeploy, completedModuleNames); StepsUtil.setModulesToIterateInParallel(execution.getContext(), modulesForNextIteration); // Mark next iteration data as computed StepsUtil.setIteratedModulesInParallel(execution.getContext(), ListUtils.union(completedApplications, modulesForNextIteration)); getStepLogger().debug(Messages.COMPUTED_NEXT_MODULES_FOR_PARALLEL_ITERATION, secureSerializer.toJson(modulesForNextIteration)); return StepPhase.DONE; }
@Override protected StepPhase executeStep(ExecutionWrapper execution) throws Exception { getStepLogger().debug(Messages.COMPUTING_NEXT_MODULES_FOR_PARALLEL_ITERATION); List<ModuleToDeploy> allModulesToDeploy = StepsUtil.getModulesToDeploy(execution.getContext()); List<ModuleToDeploy> completedApplications = StepsUtil.getIteratedModulesInParallel(execution.getContext()); List<String> completedModuleNames = completedApplications.stream() .map(ModuleToDeploy::getName) .collect(Collectors.toList()); CloudControllerClient client = execution.getControllerClient(); // Set next iteration data List<ModuleToDeploy> modulesForNextIteration = computeApplicationsForNextIteration(client, allModulesToDeploy, completedModuleNames); StepsUtil.setModulesToIterateInParallel(execution.getContext(), modulesForNextIteration); // Mark next iteration data as computed StepsUtil.setIteratedModulesInParallel(execution.getContext(), ListUtils.union(completedApplications, modulesForNextIteration)); getStepLogger().debug(Messages.COMPUTED_NEXT_MODULES_FOR_PARALLEL_ITERATION, secureSerializer.toJson(modulesForNextIteration)); return StepPhase.DONE; }
flowableFacade); List<ConfigurationEntry> deletedEntries = StepsUtil.getDeletedEntriesFromAllProcesses(execution.getContext(), flowableFacade); List<ConfigurationEntry> updatedEntries = ListUtils.union(publishedEntries, deletedEntries);
flowableFacade); List<ConfigurationEntry> deletedEntries = StepsUtil.getDeletedEntriesFromAllProcesses(execution.getContext(), flowableFacade); List<ConfigurationEntry> updatedEntries = ListUtils.union(publishedEntries, deletedEntries);