All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.almworks.jira.structure.api.column.ColumnContextKeys Maven / Gradle / Ivy

There is a newer version: 17.25.3
Show newest version
package com.almworks.jira.structure.api.column;

import com.atlassian.annotations.ExperimentalApi;
import com.google.common.collect.ImmutableSet;

import java.util.Set;

/**
 * 

This class contains keys for the {@link AttributeContext#getObject(Object)} method that can be used to retrieve * various objects needed to perform advanced tasks. For example, you can retrieve Apache POI model instanced to * do low-level manipulations in your column's Excel export renderer.

* *

The values are provided by Structure, and you cannot overwrite them, as the keys are read-only.

* * @see AttributeContext * @see ColumnRequestContext * @see ColumnRenderContext */ @ExperimentalApi public final class ColumnContextKeys { /** * Keys for the issue data requests. */ public static enum IssueData { /** * All data field specifications for the current issue data request. * Value type is {@code java.util.List}. Read-only. */ FIELD_SPECS } /** * Keys for the attribute data requests. * */ public enum AttributeData { /** * The {@link com.almworks.jira.structure.api2g.forest.ItemForest forest} * in which the current attribute value is being loaded. * Value type is {@code com.almworks.jira.structure.api2g.forest.ItemForest}. Read-only. * */ ITEM_FOREST } /** * Keys for all export requests. */ public static enum Export { /** * The complete view specification for the current export request. * Value type is {@link com.almworks.jira.structure.api.view.ViewSpecification}. Read-only. */ VIEW_SPECIFICATION } /** * Keys for Excel export requests. */ public static enum Excel { /** * The current Apache POI Workbook instance. * Value type is {@code org.apache.poi.hssf.usermodel.HSSFWorkbook}. Read-only. */ POI_WORKBOOK, /** * The current Apache POI CreationHelper instance. * Value implements {@code org.apache.poi.ss.usermodel.CreationHelper}. Read-only. */ POI_HELPER, /** * The current Apache POI Sheet instance. * Value implements {@code org.apache.poi.ss.usermodel.Sheet}. Read-only. */ POI_SHEET, /** * The current Apache POI row index. * Value type is {@code java.lang.Integer}. Read-only. */ POI_ROWNUM, /** * The current Apache POI Row instance. * Value implements {@code org.apache.poi.ss.usermodel.Row}. Read-only. */ POI_ROW, /** * The current Apache POI column index. * Value type is {@code java.lang.Integer}. Read-only. */ POI_COLUMN, /** * The current Apache POI Cell instance. * Value implements {@code org.apache.poi.ss.usermodel.Cell}. Read-only. */ POI_CELL } private static final Set READ_ONLY_KEYS = ImmutableSet.of( IssueData.FIELD_SPECS, AttributeData.ITEM_FOREST, Export.VIEW_SPECIFICATION, Excel.POI_WORKBOOK, Excel.POI_HELPER, Excel.POI_SHEET, Excel.POI_ROWNUM, Excel.POI_ROW, Excel.POI_COLUMN, Excel.POI_CELL ); /** * Checks whether the given context key is read-only. A call to {@link AttributeContext#putObject(Object, Object)} with a * read-only key will throw an {@code java.lang.IllegalArgumentException}. * @param key context key * @return {@code true} if {@code key} is read-only. */ public static boolean isReadOnly(Object key) { return READ_ONLY_KEYS.contains(key); } }