Class MetadataFieldType

    • Constructor Detail

      • MetadataFieldType

        public MetadataFieldType()
    • Method Detail

      • getName

        public abstract String getName()
      • renderView

        public String renderView​(com.atlassian.confluence.core.ContentEntityObject ceo)
      • renderData

        public abstract String renderData​(DataObject value,
                                          com.atlassian.confluence.core.ContentEntityObject contentEntityObject)
      • renderHistoryView

        public String renderHistoryView​(DataObject value,
                                        com.atlassian.confluence.core.ContentEntityObject contentEntityObject)
        Parameters:
        value - a metadata value
        contentEntityObject - the content the metadata value belongs to
        Returns:
        the representation which shall be displayed in a history entry for the given value on the given content
      • renderDraftView

        public String renderDraftView​(Map parameterValues,
                                      com.atlassian.confluence.core.ContentEntityObject contentEntityObject)
      • renderEdit

        public abstract String renderEdit​(com.atlassian.confluence.core.ContentEntityObject abstractPage)
        This method returns a form for editing metadata fields
        Parameters:
        abstractPage -
        Returns:
      • renderEdit

        public abstract String renderEdit​(DataObject dataObject)
        This method returns a form for editing metadata fields
        Parameters:
        dataObject -
        Returns:
      • renderAdmin

        public String renderAdmin()
      • getLuceneQuery

        public String getLuceneQuery​(DataObject dataObject)
        this method will be used on searching a field. the basic fieldtype handles this for most text related cases. If you want a special search than implement it in the specific fieldtpye
        Parameters:
        dataObject -
        Returns:
      • getSearchIndexValue

        public abstract Collection<String> getSearchIndexValue​(com.atlassian.confluence.core.ContentEntityObject ceo)
        this method is used to get the searchindex values for a metadatafield. the metadatafielddata will be extracted from the given content entity object.
        Parameters:
        ceo -
        Returns:
      • getSearchIndexValue

        public abstract Collection<String> getSearchIndexValue​(DataObject dataObject)
        this method returns a list of index values which describe the given data object.
        Parameters:
        dataObject -
        Returns:
      • isCompatible

        public boolean isCompatible​(MetadataFieldType otherFieldType)

        Test whether this metadata field type is compatible with another field type. Two field types should be considered compatible when fields with these types can have the same type of values. For simple types a test for an equal class and name should be enough, for more complex types like one which defines selectable predefined values this method should also check whether the other type declares the same predefined values. The default implementation uses Object.equals(Object).

        Compatibility plays an important role when deciding whether metadata values can be copied or moved along with the page, they were added to, to another space. In this scenario only metadata values can be copied or moved if the target space has a compatible metadata set. Two sets are considered compatible if they have the same key and only compatible fields. Fields are compatible if they have the same key, title, description, required and hidden flag and a compatible field type.

        Parameters:
        otherFieldType - the other field type to test against
        Returns:
        true if this field type is compatible with the other field type
      • createDataObject

        public abstract DataObject createDataObject​(Map parameterValues)
      • loadDataObject

        public abstract DataObject loadDataObject​(com.atlassian.confluence.core.ContentEntityObject abstractPage)
      • saveDataObject

        public abstract void saveDataObject​(com.atlassian.confluence.core.ContentEntityObject abstractPage,
                                            DataObject data)
      • removeDataObject

        public abstract void removeDataObject​(com.atlassian.confluence.core.ContentEntityObject abstractPage)
      • setMetadataField

        public void setMetadataField​(MetadataField metadataField)
      • getCqlUiSupport

        public com.atlassian.querylang.fields.UISupport getCqlUiSupport()
        Define an alternate UI support dor the fieldtype. this will be used in the cql field autocomplete dialogs.
        Returns:
      • getCqlSearchFieldHandler

        public com.atlassian.querylang.fields.FieldHandler getCqlSearchFieldHandler​(MetadataSchemaField schemaField)
        Define a Searchfieldhandler which will be used during a cql search for the fieldtype
        Returns:
        A Fieldhandler that is able to handle the cql search request to the index
      • onSaveMetadataField

        public boolean onSaveMetadataField​(Map parameters)
      • onRemoveMetadataField

        public void onRemoveMetadataField()
      • onSaveContentMetadataValue

        public void onSaveContentMetadataValue​(com.atlassian.confluence.core.ContentEntityObject ceo,
                                               DataObject oldValue,
                                               DataObject newValue)
      • onRemoveContentMetadataValue

        public void onRemoveContentMetadataValue​(com.atlassian.confluence.core.ContentEntityObject ceo,
                                                 DataObject oldValue)