/** * Returns all navigable fields (including Custom Fields) minus the unavailable fields. * * @return All navigable fields (including Custom Fields) minus the unavailable fields. */ @SuppressWarnings ("unchecked") private Set<NavigableField> getAvailableNavigableFields() { return getAvailableFields(navigableFields); }
@Override public Set<NavigableField> getNavigableFields() { return Collections.unmodifiableSet(getAvailableNavigableFields()); }
@Override public Set<NavigableField> getAvailableNavigableFieldsWithScope(final ApplicationUser user) throws FieldException { return getAvailableNavigableFieldsWithScope(user, Collections.<Long>emptyList(), Collections.<String>emptyList()); }
try final Set<FieldLayout> uniqueSchemes = getUniqueSchemes(Collections.<Long>emptyList(), Collections.<String>emptyList(), remoteUser); final Set<String> browsableProjects = getBrowsableProjectKeys(remoteUser); final Set<NavigableField> allAvailableFields = getAvailableNavigableFields(); if (!isFieldHidden(uniqueSchemes, field)) if (isCustomField(field)) final CustomField customField = getCustomField(field.getId()); if (userHasPermissionToCustomFieldProjects(customField, browsableProjects))
final Set<FieldLayout> schemes = getUniqueSchemes(projectIds, issueTypes, remoteUser); allAvailableFields.removeAll(getUnavailableFields()); availableFields.addAll(getAvailableFields(allAvailableFields, schemes)); availableFields.addAll(getAvailableCustomFieldsWithScope(remoteUser, projectIds, issueTypes));
/** * Returns a set of {@link Field}s that are NOT hidden in AT LEAST ONE project in the system. * <p/> * NOTE: This method is used in the Admin interface, as admins should be able to configure the default ColumnLayouts * irrespective of their permissions. They should be able to see all fields that are not hidden in at least one * FieldLayout in the system * * @throws FieldException if cannot retrieve the projects the user can see, or if cannot retrieve the field layouts * for the viewable projects */ @Override public Set<NavigableField> getAllAvailableNavigableFields() throws FieldException { try { // Include custom fields (irrespective of scope) and exclude fields that should not be available (e.g. timetracking if it is turned off) final Set<NavigableField> allAvailableFields = getAvailableNavigableFields(); // Retrieve all unique FieldLayouts in the system final Set<FieldLayout> uniqueSchemes = getAllFieldLayouts(); // Go through the list of available fields and see of the field is NOT hidden in at least one scheme return getAvailableFields(allAvailableFields, uniqueSchemes); } catch (DataAccessException e) { final String message = "Error retrieving field layout."; LOG.error(message, e); throw new FieldException(message, e); } }
return findVisibleFieldLayouts(getBrowsableProjectObjects(remoteUser), getAllIssueTypes()); return findVisibleFieldLayouts(getBrowsableProjectObjects(remoteUser), issueTypes); return findVisibleFieldLayouts(ComponentAccessor.getProjectManager().convertToProjectObjects(projectIds), getAllIssueTypes()); return findVisibleFieldLayouts(ComponentAccessor.getProjectManager().convertToProjectObjects(projectIds), issueTypes);
throws FieldException final CustomFieldManager customFieldManager = getCustomFieldManager(); try final Set<FieldLayout> schemes = getUniqueSchemes(projectIds, issueTypes, remoteUser); return getAvailableFields(existingCustomFields, schemes);
private Set<FieldLayout> getAllFieldLayouts() { // Retrieve the list of all projects return findVisibleFieldLayouts(ComponentAccessor.getProjectManager().getProjectObjects(), getAllIssueTypes()); }
@Override public Set<OrderableField> getOrderableFields() { return Collections.unmodifiableSet(getAvailableOrderableFields()); }
public DefaultFieldManager() { this.fields = buildSystemFieldMap(); // Special case: ProjectSystemField is not orderable, even though it implements OrderableField this.orderableFields = ImmutableSet.copyOf(filter(filter(fields.values(), ORDERABLE), OrderableField.class)); this.navigableFields = ImmutableSet.copyOf(filter(fields.values(), NavigableField.class)); this.searchableFields = ImmutableSet.copyOf(filter(fields.values(), SearchableField.class)); }
@Override public Set<CustomField> getAvailableCustomFields(final ApplicationUser remoteUser, final Issue issue) throws FieldException { final Project project = issue.getProjectObject(); // TODO: Do we really want to do this null check? It was just copied from the old GenericValue version of this method. final List<Long> projectList = (project == null) ? Collections.<Long>emptyList() : CollectionBuilder.list(project.getId()); return getAvailableCustomFieldsWithScope(remoteUser, projectList, CollectionBuilder.list(issue.getIssueTypeId())); }
@Override public Set<NavigableField> getAvailableNavigableFieldsWithScope(final ApplicationUser remoteUser, final QueryContext queryContext) throws FieldException { final Set<NavigableField> allFields = new LinkedHashSet<NavigableField>(); for (final QueryContext.ProjectIssueTypeContexts context : queryContext.getProjectIssueTypeContexts()) { final Set<NavigableField> availableFields = getAvailableNavigableFieldsWithScope(remoteUser, context.getProjectIdInList(), context.getIssueTypeIds()); // Union all the visible fields for each project/issue type context allFields.addAll(availableFields); } return allFields; }
/** * Returns all Orderable fields (including Custom Fields) minus the unavailable fields. * * @return All Orderable fields (including Custom Fields) minus the unavailable fields. */ @SuppressWarnings ("unchecked") private Set<OrderableField> getAvailableOrderableFields() { return getAvailableFields(orderableFields); }