@Override public Collection<String> getHeaderNames() { return headers.keySet(); }
public Set<K> keySet() { return m_impl.keySet(); }
/** * @return all keys (lower-cased) from this instance (never returns {@code null}) */ public Set<String> getKeys() { @SuppressWarnings("unchecked") final Set<String> result = new HashSet<String>(this.values.keySet()); return result; }
/** * @return all keys (lower-cased) from this instance (never returns {@code null}) */ public Set<String> getKeys() { @SuppressWarnings("unchecked") final Set<String> result = new HashSet<String>(this.values.keySet()); return result; }
public Set<String> getWorkflowsInUse() { @SuppressWarnings ("unchecked") final Set<WorkflowTransitionKey> workflowTransitionMapKeys = workflowTransitionMap.keySet(); return CollectionUtil.transformSet(workflowTransitionMapKeys, new Function<WorkflowTransitionKey, String>() { public String get(final WorkflowTransitionKey input) { return input.getWorkflowName(); } }); }
public Collection getKeys() { TreeSet keys = new TreeSet(new Comparator() { public int compare(Object o1, Object o2) { if (o1.equals(o2)) { return 0; } if (NUMERIC.equals(o1)) { return 1; } else if (NUMERIC.equals(o2)) { return -1; } else { return collator.compare(o1, o2); } } }); keys.addAll(alphabetBuckets.keySet()); return keys; }
public Map toMap() { Map paramMap = new HashMap(); for (Object key : map.keySet()) { List list = (List) map.get(key); String[] vals = new String[list.size()]; for (int i = 0; i < vals.length; i++) { vals[i] = String.valueOf(list.get(i)); } paramMap.put(key, vals); } return paramMap; } }
private KeyValues createHeaders() { KeyValues res = new KeyValues(); for (@SuppressWarnings("unchecked") final Iterator<String> itKey = (Iterator<String>) this.headers.keySet().iterator(); itKey.hasNext();) { final String key = itKey.next(); for (@SuppressWarnings("unchecked") final Iterator<String> itValue = ((Collection<String>)this.headers.get(key)).iterator(); itValue.hasNext();) { res = res.add(key, itValue.next()); } } return res; } }
private KeyValues createHeaders() { KeyValues res = new KeyValues(); for (@SuppressWarnings("unchecked") final Iterator<String> itKey = (Iterator<String>) this.headers.keySet().iterator(); itKey.hasNext();) { final String key = itKey.next(); for (@SuppressWarnings("unchecked") final Iterator<String> itValue = ((Collection<String>)this.headers.get(key)).iterator(); itValue.hasNext();) { res = res.add(key, itValue.next()); } } return res; } }
public List<WorkflowTransitionKey> getTransitionIdsForWorkflow(final String workflowName) { @SuppressWarnings ("unchecked") final Collection<WorkflowTransitionKey> workflowTransitionMaps = workflowTransitionMap.keySet(); final List<WorkflowTransitionKey> transitionIdsForWorkflow = Lists.newArrayListWithCapacity(workflowTransitionMaps.size()); for (final WorkflowTransitionKey wfTransitionKey : workflowTransitionMaps) { if (wfTransitionKey.getWorkflowName().equals(workflowName)) { transitionIdsForWorkflow.add(wfTransitionKey); } } //Sorting the list by actiondescriptor, to ensure that if there's two lines //for an action descriptor they'll be grouped (see JRA-12017 about how this may happen). Collections.sort(transitionIdsForWorkflow, new Comparator<WorkflowTransitionKey>() { public int compare(final WorkflowTransitionKey o1, final WorkflowTransitionKey o2) { return o1.getActionDescriptorId().compareTo(o2.getActionDescriptorId()); } }); return transitionIdsForWorkflow; }
private ErrorCollection validateNoUsageOfRoleInWorkflows(final ProjectRole projectRole) { ErrorCollection errorCollection = new SimpleErrorCollection(); Set<JiraWorkflow> workflows = getAssociatedWorkflows(projectRole, errorCollection).keySet(); if(!workflows.isEmpty()) { List<String> workflowNames = workflows.stream().map(JiraWorkflow::getDisplayName).collect(Collectors.toList()); String workflowListString = "[" + StringUtils.join(workflowNames, ",") + "]"; errorCollection.addErrorMessage(getText("rest.role.used.in.workflows", workflowListString), ErrorCollection.Reason.CONFLICT); } return errorCollection; }
/** * Copies all the values from one MultiMap to another. * This method is needed because the (undocumented) behaviour of * MultiHashMap.putAll in versions of Commons Collections prior to 3.0 * was to replace the collection in the destination, whereas in 3.0 * it adds the collection from the source as an _element_ of the collection * in the destination. This method makes no assumptions about the implementation * of the MultiMap, and should work with all versions. * * @param destination * @param specific */ public static void copyMultiMap(MultiMap destination, MultiMap specific) { for (Iterator<?> keyIterator = specific.keySet().iterator(); keyIterator.hasNext(); ) { Object key = keyIterator.next(); Collection<?> c = (Collection<?>)specific.get(key); for (Iterator<?> valueIterator = c.iterator(); valueIterator.hasNext(); ) destination.put(key, valueIterator.next() ); } }
/** * Copies all the values from one MultiMap to another. * This method is needed because the (undocumented) behaviour of * MultiHashMap.putAll in versions of Commons Collections prior to 3.0 * was to replace the collection in the destination, whereas in 3.0 * it adds the collection from the source as an _element_ of the collection * in the destination. This method makes no assumptions about the implementation * of the MultiMap, and should work with all versions. * * @param destination * @param specific */ public static void copyMultiMap(MultiMap destination, MultiMap specific) { for (Iterator<?> keyIterator = specific.keySet().iterator(); keyIterator.hasNext(); ) { Object key = keyIterator.next(); Collection<?> c = (Collection<?>)specific.get(key); for (Iterator<?> valueIterator = c.iterator(); valueIterator.hasNext(); ) destination.put(key, valueIterator.next() ); } }
public FieldConfig getOneAndOnlyConfig() { final MultiMap configsByConfig = getConfigsByConfig(); if ((configsByConfig != null) && (configsByConfig.size() == 1)) { return (FieldConfig) configsByConfig.keySet().iterator().next(); } else { if (configsByConfig != null) { log.warn("There is not exactly one config for this scheme (" + getId() + "). Configs are " + configsByConfig + "."); } return null; } }
/** * Retreives all the options for the {@link FieldConfigScheme}. * * @param fieldConfigScheme the config scheme to retrieve the options from. * @return the options for the {@link FieldConfigScheme} in a mutable {@link java.util.List}; never null. */ public List<Option> getOptionsForScheme(final FieldConfigScheme fieldConfigScheme) { List<Option> optionList = new ArrayList<Option>(); final Set<FieldConfig> configSet = fieldConfigScheme.getConfigsByConfig().keySet(); for (FieldConfig fieldConfig : configSet) { final Options options = optionsManager.getOptions(fieldConfig); if (options != null) { for (Object o : options) { final Option option = (Option) o; optionList.add(option); optionList.addAll(option.getChildOptions()); } } } return optionList; }
for (Iterator<?> iter = general.keySet().iterator();iter.hasNext();) { Object key = iter.next();
private void swapRoleInWorkflows(final ProjectRole role, final ProjectRole swapRole) { ErrorCollection errorCollection = new SimpleErrorCollection(); MultiMap associatedWorkflows = getAssociatedWorkflows(role, errorCollection); String moduleKey = "com.atlassian.jira.plugin.system.workflow:isuserinprojectrole-condition"; String className = "com.atlassian.jira.workflow.condition.InProjectRoleCondition"; for (Object o : associatedWorkflows.keySet()) { if(!(associatedWorkflows.get(o) instanceof Collection)) { throw new IllegalStateException("Associated workflows returned an unexpected map"); } for (ActionDescriptor actionDescriptor: (Collection<ActionDescriptor>)associatedWorkflows.get(o)) { JiraWorkflow jiraWorkflow = (JiraWorkflow) o; //JiraWorkflow clone = workflowManager.getWorkflowClone(jiraWorkflow.getName()); workflowManager.replaceConditionInTransition( actionDescriptor, ImmutableMap.of("jira.projectrole.id", role.getId().toString(), "class.name", className), ImmutableMap.of("jira.projectrole.id", swapRole.getId().toString())); workflowManager.saveWorkflowWithoutAudit(jiraWorkflow); } } }
private Either<String, Void> createDocumentsForNotUsedMaterials(final Entity order) { List<Entity> productionCountingQuantities = getUniqueProductionCountingQuantitiesForOrder(order); MultiMap groupedProductionCountingQuantities = groupProductionCountingQuantitiesByField(productionCountingQuantities, ProductionCountingQuantityFieldsPFTD.COMPONENTS_LOCATION); for (Object inLocation : groupedProductionCountingQuantities.keySet()) { if (inLocation != null) { List<Entity> list = new ArrayList<Entity>(); list.addAll((Collection<Entity>) groupedProductionCountingQuantities.get(inLocation)); MultiMap groupedByOutputLocation = groupProductionCountingQuantitiesByField(list, ProductionCountingQuantityFieldsPFTD.COMPONENTS_OUTPUT_LOCATION); for (Object outLocation : groupedByOutputLocation.keySet()) { if (outLocation != null) { Either<String, Void> isValid = createTransferDocumentsForUnusedMaterials((Entity) outLocation, (Entity) inLocation, getProductsAndQuantitiesMap(groupedByOutputLocation, order), order); if (isValid.isLeft()) { return isValid; } } } } } return Either.right(null); }
/** * Removes all occurrences of the given header in this stub response (using a case insensitive search) * and sets its single value. * @param name header name * @param value header value */ @SuppressWarnings("unchecked") void setHeaderCaseInsensitive(final String name, final String value) { final MultiMap result = new MultiValueMap(); for (final Object o: this.headers.keySet()) { final String key = (String) o; //fucking non-generics MultiMap if (!name.equalsIgnoreCase(key)) { //copy all other headers to the result multimap for(final String s: (Collection<String>)this.headers.get(o)) { result.put(o, s); } } } this.headers.clear(); this.headers.putAll(result); this.addHeader(name, value); }
/** * Removes all occurrences of the given header in this stub response (using a case insensitive search) * and sets its single value. * @param name header name * @param value header value */ @SuppressWarnings("unchecked") void setHeaderCaseInsensitive(final String name, final String value) { final MultiMap result = new MultiValueMap(); for (final Object o: this.headers.keySet()) { final String key = (String) o; //fucking non-generics MultiMap if (!name.equalsIgnoreCase(key)) { //copy all other headers to the result multimap for(final String s: (Collection<String>)this.headers.get(o)) { result.put(o, s); } } } this.headers.clear(); this.headers.putAll(result); this.addHeader(name, value); }