public CustomFieldSearcher getCurrentSearcher() { return getCustomField().getCustomFieldSearcher(); }
public StatisticsMapper getStatsMapper(String statsMapperKey) { StatisticsMapper systemMapper = getSystemMapper(statsMapperKey); if (systemMapper != null) return systemMapper; CustomField customField = customFieldManager.getCustomFieldObject(statsMapperKey); if (customField == null) throw new RuntimeException("No custom field with id "+statsMapperKey); if (customField.getCustomFieldSearcher() instanceof CustomFieldStattable) { final CustomFieldStattable customFieldStattable = (CustomFieldStattable) customField.getCustomFieldSearcher(); return customFieldStattable.getStatisticsMapper(customField); } else { return null; } }
/** * Get the {@link com.atlassian.jira.issue.statistics.StatisticsMapper} associated with passed key * * @param statsMapperKey The key for the statsmapper. Usually a customfield id, or one of the constants in this * class * @return The StatisticsMapper associated with the passed in key. */ public StatisticsMapper getStatsMapper(String statsMapperKey) { final StatisticsMapper systemMapper = getSystemMapper(statsMapperKey); if (systemMapper != null) { return systemMapper; } final CustomField customField = customFieldManager.getCustomFieldObject(statsMapperKey); if (customField == null) { throw new RuntimeException("No custom field with id " + statsMapperKey); } if (customField.getCustomFieldSearcher() instanceof CustomFieldStattable) { final CustomFieldStattable customFieldStattable = (CustomFieldStattable) customField.getCustomFieldSearcher(); return customFieldStattable.getStatisticsMapper(customField); } else { return null; } }
String getStatisticsTypeI18nName(final I18nHelper i18nBean, final String statisticType) { //check if it's a custom field and look up the custom field name if that's the case if (statisticType.startsWith(FieldManager.CUSTOM_FIELD_PREFIX)) { final CustomField customField = customFieldManager.getCustomFieldObject(statisticType); if (customField == null) { throw new RuntimeException("No custom field with id '" + statisticType + "'"); } if (customField.getCustomFieldSearcher() instanceof CustomFieldStattable) { return customField.getName(); } else { return null; } } else { return i18nBean.getText("gadget.filterstats.field.statistictype." + statisticType.toLowerCase()); } }
public Map getValues(Map params) { Map allValues = new ListOrderedMap(); allValues.putAll(systemValues); final List<CustomField> customFieldObjects = customFieldManager.getCustomFieldObjects(); for (final CustomField customField : customFieldObjects) { if (customField.getCustomFieldSearcher() instanceof CustomFieldStattable) { allValues.put(customField.getId(), customField.getName()); } } return allValues; }
String getStatisticsTypeI18nName(final I18nHelper i18nBean, final String statisticType) { //check if it's a custom field and look up the custom field name if that's the case if (statisticType.startsWith(FieldManager.CUSTOM_FIELD_PREFIX)) { final CustomField customField = customFieldManager.getCustomFieldObject(statisticType); if (customField == null) { throw new RuntimeException("No custom field with id '" + statisticType + "'"); } if (customField.getCustomFieldSearcher() instanceof CustomFieldStattable) { return customField.getName(); } else { return null; } } else { return i18nBean.getText("gadget.filterstats.field.statistictype." + statisticType.toLowerCase()); } }
@Override public String transformFromCustomField(final String fieldType, final Object input, final String url) { if (input == null) { return i18nBean.getText("common.words.none"); } else { final CustomField customFieldObject = customFieldManager.getCustomFieldObject(fieldType); return customFieldObject.getCustomFieldSearcher().getDescriptor().getStatHtml(customFieldObject, input, null).trim(); } } }
public Map getValues(Map params) { Map allValues = new ListOrderedMap(); allValues.putAll(getValueClassHolderSystemValues()); final List<CustomField> customFieldObjects = customFieldManager.getCustomFieldObjects(); for (final CustomField customField : customFieldObjects) { if (customField.getCustomFieldSearcher() instanceof CustomFieldStattable) { allValues.put(customField.getId(), getValueClassHolderForCF(customField)); } } return allValues; }
private Map<String, String> getValues() { final I18nHelper i18n = authenticationContext.getI18nHelper(); final Map<String, String> allValues = new LinkedHashMap<String, String>(); for (Map.Entry entry : statisticTypesProvider.getSystemStatisticTypes().entrySet()) { allValues.put((String) entry.getKey(), i18n.getText((String) entry.getValue())); } final List<CustomField> customFieldObjects = customFieldManager.getCustomFieldObjects(); for (CustomField customField : customFieldObjects) { if (hasCustomFieldAccess(customField) && (customField.getCustomFieldSearcher() instanceof CustomFieldStattable)) { allValues.put(customField.getId(), i18n.getText(customField.getName())); } } return allValues; }
for (CustomField customField : allCustomFields) final CustomFieldSearcher searcher = customField.getCustomFieldSearcher(); if (searcher == null)
CustomFieldSearcher cfSearcher = field.getCustomFieldSearcher(); String searcherKey = ""; if(null != cfSearcher)
List<ClauseQueryFactory> getAllCustomFieldFactories(final QueryCreationContext queryCreationContext) { final List<ClauseQueryFactory> factories = new ArrayList<ClauseQueryFactory>(); final List<CustomField> allCustomFields = customFieldManager.getCustomFieldObjects(); for (CustomField customField : allCustomFields) { final CustomFieldSearcher searcher = customField.getCustomFieldSearcher(); if (searcher == null) { continue; } final CustomFieldSearcherClauseHandler fieldSearcherClauseHandler = searcher.getCustomFieldSearcherClauseHandler(); if (fieldSearcherClauseHandler == null || !(fieldSearcherClauseHandler instanceof AllTextCustomFieldSearcherClauseHandler)) { continue; } if (!fieldSearcherClauseHandler.getSupportedOperators().contains(Operator.LIKE)) { continue; } final Collection<ClauseHandler> handlers = getHandlersForClauseName(queryCreationContext, customField.getClauseNames().getPrimaryName()); for (ClauseHandler handler : handlers) { factories.add(handler.getFactory()); } } return factories; }
public void doValidation(String key, Map<String,String> parameters, JiraServiceContext jiraServiceContext) { //JRA-13808: Need to check whether or not the user CF has a searcher set. String customFieldOption = parameters.get(getType()); if (StringUtils.isEmpty(customFieldOption)) { String localisedMessage = jiraServiceContext.getI18nBean().getText("admin.permissions.errors.please.select.user.customfield"); jiraServiceContext.getErrorCollection().addErrorMessage(localisedMessage); } else { // passed in parameters names a Custom Field - lets investigate. CustomField customField = customFieldManager.getCustomFieldObject(customFieldOption); if (customField != null && customField.getCustomFieldSearcher() == null) { // In order to use a Custom Field it must be indexed in Lucene Index. Currently we only index custom fields if they have a Searcher. // Message: "Custom field '{0}' is not indexed for searching - please add a searcher to this Custom Field." String localisedMessage = jiraServiceContext.getI18nBean().getText("admin.permissions.errors.customfieldnotindexed", customField.getName()); jiraServiceContext.getErrorCollection().addErrorMessage(localisedMessage); } } }
public void doValidation(String key, Map<String,String> parameters, JiraServiceContext jiraServiceContext) { //JRA-13808: Need to check whether or not the group CF has a searcher set. String customFieldOption = parameters.get(getType()); if (StringUtils.isEmpty(customFieldOption)) { String localisedMessage = jiraServiceContext.getI18nBean().getText("admin.permissions.errors.please.select.group.customfield"); jiraServiceContext.getErrorCollection().addErrorMessage(localisedMessage); } else { // passed in parameters names a Custom Field - lets investigate. CustomField customField = customFieldManager.getCustomFieldObject(customFieldOption); if (customField != null && customField.getCustomFieldSearcher() == null) { // In order to use a Custom Field it must be indexed in Lucene Index. Currently we only index custom fields if they have a Searcher. // Message: "Custom field '{0}' is not indexed for searching - please add a searcher to this Custom Field." String localisedMessage = jiraServiceContext.getI18nBean().getText("admin.permissions.errors.customfieldnotindexed", customField.getName()); jiraServiceContext.getErrorCollection().addErrorMessage(localisedMessage); } } }
@Override public StatsMarkup transformFromCustomField(final String fieldType, final Object input, final String url) { final I18nHelper i18n = authenticationContext.getI18nHelper(); if (input != null) { final CustomField customField = customFieldManager.getCustomFieldObject(fieldType); if (customField != null) { final CustomFieldSearcher searcher = customField.getCustomFieldSearcher(); final CustomFieldSearcherModuleDescriptor moduleDescriptor = searcher.getDescriptor(); return new StatsMarkup(moduleDescriptor.getStatHtml(customField, input, url)); } } final String html = makeMarkupForCellWithHtmlSafeText(i18n.getText("common.words.none"), url); return new StatsMarkup(html); }
@RequiresXsrfCheck protected String doExecute() throws Exception { final CustomFieldSearcher oldSearcher = getCustomField().getCustomFieldSearcher(); final CustomFieldSearcher newSearcher; if (ObjectUtils.isValueSelected(searcher)) { newSearcher = customFieldManager.getCustomFieldSearcher(searcher); // if searcher has changed, then we need to push a reindex message if (oldSearcher == null || !oldSearcher.getDescriptor().getCompleteKey().equals(newSearcher.getDescriptor().getCompleteKey())) { reindexMessageManager.pushMessage(getLoggedInUser(), "admin.notifications.task.custom.fields"); } } else { newSearcher = null; } customFieldManager.updateCustomField(getId(), getName(), getDescription(), newSearcher); return getRedirect("ViewCustomFields.jspa"); }
SearchContext combinedSearchContext = SearchRequestUtils.getCombinedSearchContext(searchRequestContext, possibleContext); CustomFieldSearcher searcher = customField.getCustomFieldSearcher(); if (searcher.getSearchRenderer().isShown(user, combinedSearchContext))
SearchContext combinedSearchContext = SearchRequestUtils.getCombinedSearchContext(searchRequestContext, possibleContext); CustomFieldSearcher searcher = customField.getCustomFieldSearcher(); if (searcher.getSearchRenderer().isShown(user, combinedSearchContext))
if (searcher != oldCustomField.getCustomFieldSearcher())
searcherRef = new CustomFieldSearcherLazyRef(customField.getCustomFieldSearcher());