public Collection<T> asCollection() { return asList(); }
public CompositeJiraHomePathLocator(final JiraHomePathLocator... locators) { this.locators = CollectionBuilder.newBuilder(locators).asList(); }
public EvaluateAllPredicate(Predicate<T> first, Predicate<T>... predicates) { this.predicates = CollectionBuilder.newBuilder(first).addAll(Arrays.<Predicate<T>>asList(predicates)).asList(); }
@Override public Map<String, ?> getDescriptorParams(Map<String, Object> conditionParams) { return extractMultipleParams(conditionParams, CollectionBuilder.newBuilder("permissionKey", "vars.key", "nullallowed").asList()); } }
@Override protected List<DownloadStrategy> getDownloadStrategies() { // Do not cache managed Components here, because Servlets live forever, and we would end up holding onto stale objects. return newBuilder(ComponentAccessor.getComponentOfType(DownloadStrategy.class)).asList(); } }
public List<String> getIndexedValues(final Long rawValue) { notNull("rawValue", rawValue); if (componentResolver.idExists(rawValue)) { return CollectionBuilder.newBuilder(rawValue.toString()).asList(); } else { return componentResolver.getIdsFromName(rawValue.toString()); } }
static List<FieldIndexer> indexers(final Class<? extends FieldIndexer>... indexers) { final CollectionBuilder<FieldIndexer> builder = CollectionBuilder.newBuilder(); for (final Class<? extends FieldIndexer> clazz : indexers) { builder.add(loadComponent(clazz)); } return builder.asList(); }
public List<String> getIndexedValues(final Long rawValue) { notNull("rawValue", rawValue); final Project project = nameResolver.get(rawValue); if (project == null) { return nameResolver.getIdsFromName(rawValue.toString()); } return CollectionBuilder.newBuilder(project.getId().toString()).asList(); }
private Collection<String> getValidGroups(Collection<String> rawGroups) { final CollectionBuilder<String> builder = CollectionBuilder.newBuilder(); for (String rawGroup : rawGroups) { try { Group group = groupConverter.getGroup(rawGroup); if (group != null) { builder.add(rawGroup); } } catch (FieldValidationException e) { // Ignore group doesn't exist. } } return builder.asList(); }
void addErrors( final Set<Plugin> outdatedPlugins) { final String description = "Plugins found that are not compatible with JIRA v" + buildUtilsInfo.getVersion() + ". " + "The following plugins need to be either removed or updated in order for JIRA to start successfully:"; final StringBuilder pluginNames = new StringBuilder(); for (Plugin outdatedPlugin : outdatedPlugins) { pluginNames.append(pluginsToCheck.get(outdatedPlugin.getKey()).getErrorMessage(outdatedPlugin)).append("\n"); } final String cacMessage = "Please visit " + PAC_LINK + " to download the latest versions of these plugins."; final List<String> messages = CollectionBuilder.newBuilder("", description, "", pluginNames.toString().trim(), "", cacMessage, "").asList(); startupLog.printMessage(messages, Level.ERROR); final Event event = new Event(EventType.get("outdated-plugins-installed"), description + "<p/>" + TextUtils.plainTextToHtml(pluginNames.toString()) + "<p/>" + TextUtils.plainTextToHtml(cacMessage), EventLevel.get(EventLevel.ERROR)); final JohnsonEventContainer eventCont = johnsonProvider.getContainer(); eventCont.addEvent(event); }
public VersionCustomFieldClauseQueryFactory(final String documentConstant, VersionResolver versionResolver, JqlOperandResolver operandResolver) { final VersionIndexInfoResolver versionIndexInfoResolver = new VersionIndexInfoResolver(versionResolver); // need to create a version-specific relational query factory that uses a predicate which filters out versions of other projects final VersionSpecificRelationalOperatorQueryFactory relationQueryFactory = new VersionSpecificRelationalOperatorQueryFactory(VersionComparator.COMPARATOR, versionResolver, versionIndexInfoResolver); final List<OperatorSpecificQueryFactory> operatorFactories = CollectionBuilder.<OperatorSpecificQueryFactory>newBuilder( new EqualityQueryFactory<Version>(versionIndexInfoResolver), relationQueryFactory ).asList(); delegateClauseQueryFactory = new GenericClauseQueryFactory(documentConstant, operatorFactories, operandResolver); }
List<ClauseContextFactory> getFactories(final ApplicationUser searcher) { final CollectionBuilder<ClauseContextFactory> factoryCollectionBuilder = CollectionBuilder.newBuilder(); factoryCollectionBuilder.addAll(getAllSystemFieldFactories(searcher)); factoryCollectionBuilder.addAll(getAllCustomFieldFactories(searcher)); return factoryCollectionBuilder.asList(); }
List<ClauseQueryFactory> getFactories(final QueryCreationContext queryCreationContext) { final CollectionBuilder<ClauseQueryFactory> factoryCollectionBuilder = CollectionBuilder.newBuilder(); factoryCollectionBuilder.addAll(getAllSystemFieldFactories(queryCreationContext)); factoryCollectionBuilder.addAll(getAllCustomFieldFactories(queryCreationContext)); return factoryCollectionBuilder.asList(); }
public FixForVersionClauseQueryFactory(VersionResolver versionResolver, JqlOperandResolver operandResolver) { final VersionIndexInfoResolver versionIndexInfoResolver = new VersionIndexInfoResolver(versionResolver); // need to create a version-specific relational query factory that uses a predicate which filters out versions of other projects final VersionSpecificRelationalOperatorQueryFactory relationQueryFactory = new VersionSpecificRelationalOperatorQueryFactory(VersionComparator.COMPARATOR, versionResolver, versionIndexInfoResolver); final List<OperatorSpecificQueryFactory> operatorFactories = CollectionBuilder.<OperatorSpecificQueryFactory>newBuilder( new EqualityWithSpecifiedEmptyValueQueryFactory<Version>(versionIndexInfoResolver, BaseFieldIndexer.NO_VALUE_INDEX_VALUE), relationQueryFactory ).asList(); delegateClauseQueryFactory = new GenericClauseQueryFactory(SystemSearchConstants.forFixForVersion().getIndexField(), operatorFactories, operandResolver); }
public AffectedVersionClauseQueryFactory(VersionResolver versionResolver, JqlOperandResolver operandResolver) { final VersionIndexInfoResolver versionIndexInfoResolver = new VersionIndexInfoResolver(versionResolver); // need to create a version-specific relational query factory that uses a predicate which filters out versions of other projects final VersionSpecificRelationalOperatorQueryFactory relationQueryFactory = new VersionSpecificRelationalOperatorQueryFactory(VersionComparator.COMPARATOR, versionResolver, versionIndexInfoResolver); final List<OperatorSpecificQueryFactory> operatorFactories = CollectionBuilder.<OperatorSpecificQueryFactory>newBuilder( new EqualityWithSpecifiedEmptyValueQueryFactory<Version>(versionIndexInfoResolver, BaseFieldIndexer.NO_VALUE_INDEX_VALUE), relationQueryFactory ).asList(); delegateClauseQueryFactory = new GenericClauseQueryFactory(SystemSearchConstants.forAffectedVersion().getIndexField(), operatorFactories, operandResolver); }
List<ClauseContextFactory> getAllSystemFieldFactories(final ApplicationUser searcher) { final List<String> systemFieldClauseNames = CollectionBuilder.newBuilder( SystemSearchConstants.forComments().getJqlClauseNames().getPrimaryName(), SystemSearchConstants.forDescription().getJqlClauseNames().getPrimaryName(), SystemSearchConstants.forEnvironment().getJqlClauseNames().getPrimaryName(), SystemSearchConstants.forSummary().getJqlClauseNames().getPrimaryName() ).asList(); final List<ClauseContextFactory> factories = Lists.newArrayListWithCapacity(systemFieldClauseNames.size()); for (String clauseName : systemFieldClauseNames) { final Collection<ClauseHandler> handlers = searchHandlerManager.getClauseHandler(searcher, clauseName); for (ClauseHandler handler : handlers) { factories.add(handler.getClauseContextFactory()); } } return factories; }
List<ClauseQueryFactory> getAllSystemFieldFactories(final QueryCreationContext queryCreationContext) { final List<String> systemFieldClauseNames = CollectionBuilder.newBuilder( SystemSearchConstants.forComments().getJqlClauseNames().getPrimaryName(), SystemSearchConstants.forDescription().getJqlClauseNames().getPrimaryName(), SystemSearchConstants.forEnvironment().getJqlClauseNames().getPrimaryName(), SystemSearchConstants.forSummary().getJqlClauseNames().getPrimaryName(), SystemSearchConstants.forWorklogComment().getJqlClauseNames().getPrimaryName() ).asList(); final List<ClauseQueryFactory> factories = Lists.newArrayListWithCapacity(systemFieldClauseNames.size()); for (String clauseName : systemFieldClauseNames) { final Collection<ClauseHandler> handlers = getHandlersForClauseName(queryCreationContext, clauseName); for (ClauseHandler handler : handlers) { factories.add(handler.getFactory()); } } return factories; }
public List<TextOption> getTimeTrackingFormats() { try { final BigDecimal hoursPerDay = new BigDecimal(getHoursPerDay()); final BigDecimal daysPerWeek = new BigDecimal(getDaysPerWeek()); final I18nHelper i18nBean = authenticationContext.getI18nHelper(); final String durationPretty = new JiraDurationUtils.PrettyDurationFormatter(hoursPerDay, daysPerWeek, i18nBean).format(SAMPLE_DURATION); final String durationDays = new JiraDurationUtils.DaysDurationFormatter(hoursPerDay, i18nBean).format(SAMPLE_DURATION); final String durationHours = new JiraDurationUtils.HoursDurationFormatter(i18nBean).format(SAMPLE_DURATION); return CollectionBuilder.newBuilder( new TextOption(JiraDurationUtils.FORMAT_PRETTY, getText(JiraDurationUtils.PrettyDurationFormatter.KEY_FORMAT_PRETTY, durationPretty)), new TextOption(JiraDurationUtils.FORMAT_DAYS, getText(JiraDurationUtils.DaysDurationFormatter.KEY_FORMAT_DAYS, durationDays)), new TextOption(JiraDurationUtils.FORMAT_HOURS, getText(JiraDurationUtils.HoursDurationFormatter.KEY_FORMAT_HOURS, durationHours))).asList(); } catch (NumberFormatException ignored) { } catch (ArithmeticException ignored) { } // can be caused by invalid input. It will be caught above in validation return Collections.emptyList(); }
public void updateGadgetPosition(final Long gadgetId, final int row, final int column, final Long dashboardId) { notNull("gadgetId", gadgetId); notNull("dashboardId", dashboardId); final int rowsUpdated = delegator.bulkUpdateByPrimaryKey(TABLE, MapBuilder.<String, Object>newBuilder() .add(Columns.ROW, row) .add(Columns.COLUMN, column) .add(Columns.PORTALPAGE, dashboardId) .toMap(), CollectionBuilder.newBuilder(gadgetId).asList()); if (rowsUpdated != 1) { throw new DataAccessException("Gadget position for gadget with id '" + gadgetId + "' not updated correctly."); } }
/** * This is the first time the searcher knows what its ID and names are * * @param field the Custom Field for this searcher */ public void init(CustomField field) { final VersionCustomFieldIndexer indexer = new VersionCustomFieldIndexer(fieldVisibilityManager, field); this.searcherInformation = new CustomFieldSearcherInformation(field.getId(), field.getNameKey(), Collections.<FieldIndexer>singletonList(indexer), new AtomicReference<CustomField>(field)); this.searchRenderer = new VersionPickerCustomFieldRenderer(field, projectManager, versionManager, fieldVisibilityManager, velocityRequestContextFactory, applicationProperties, templatingEngine, permissionManager, searcherInformation.getNameKey()); this.searchInputTransformer = new VersionPickerCustomFieldSearchInputTransformer(field, operandResolver, fieldFlagOperandRegistry, versionResolver, customFieldInputHelper); this.customFieldSearcherClauseHandler = new SimpleCustomFieldContextValueGeneratingClauseHandler( new VersionCustomFieldValidator(versionResolver, operandResolver, permissionManager, versionManager, beanFactory), new VersionCustomFieldClauseQueryFactory(field.getId(), versionResolver, operandResolver), new IntersectingClauseContextFactory(contextSetUtil, CollectionBuilder.newBuilder( new CustomFieldClauseContextFactory(field, clauseContextUtil, ContextSetUtil.getInstance()), versionClauseContextFactory).asList()), new VersionClauseValuesGenerator(versionManager, permissionManager, beanFactory), OperatorClasses.EQUALITY_AND_RELATIONAL_WITH_EMPTY, JiraDataTypes.VERSION); }