Class MetadataFieldType
- java.lang.Object
-
- com.communardo.confluence.metadata.MetadataFieldType
-
- All Implemented Interfaces:
Comparable<MetadataFieldType>
public abstract class MetadataFieldType extends Object implements Comparable<MetadataFieldType>
-
-
Constructor Summary
Constructors Constructor Description MetadataFieldType()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intcompareTo(MetadataFieldType b)MetadataFieldTypecopy()abstract DataObjectcreateDataObject(Map parameterValues)com.atlassian.querylang.fields.FieldHandlergetCqlSearchFieldHandler(MetadataSchemaField schemaField)Define a Searchfieldhandler which will be used during a cql search for the fieldtypecom.atlassian.querylang.fields.UISupportgetCqlUiSupport()Define an alternate UI support dor the fieldtype. this will be used in the cql field autocomplete dialogs.StringgetLuceneQuery(DataObject dataObject)this method will be used on searching a field. the basic fieldtype handles this for most text related cases.MetadataFieldgetMetadataField()abstract StringgetName()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.abstract Collection<String>getSearchIndexValue(DataObject dataObject)this method returns a list of index values which describe the given data object.abstract voidimportTypeData(String asString)Deprecated.since 2.2.booleanisCompatible(MetadataFieldType otherFieldType)Test whether this metadata field type is compatible with another field type.abstract DataObjectloadDataObject(com.atlassian.confluence.core.ContentEntityObject abstractPage)voidonRemoveContentMetadataValue(com.atlassian.confluence.core.ContentEntityObject ceo, DataObject oldValue)voidonRemoveMetadataField()voidonSaveContentMetadataValue(com.atlassian.confluence.core.ContentEntityObject ceo, DataObject oldValue, DataObject newValue)booleanonSaveMetadataField(Map parameters)abstract voidremoveDataObject(com.atlassian.confluence.core.ContentEntityObject abstractPage)StringrenderAdmin()abstract StringrenderData(DataObject value, com.atlassian.confluence.core.ContentEntityObject contentEntityObject)StringrenderDraftView(Map parameterValues, com.atlassian.confluence.core.ContentEntityObject contentEntityObject)abstract StringrenderEdit(com.atlassian.confluence.core.ContentEntityObject abstractPage)This method returns a form for editing metadata fieldsabstract StringrenderEdit(DataObject dataObject)This method returns a form for editing metadata fieldsStringrenderHistoryView(DataObject value, com.atlassian.confluence.core.ContentEntityObject contentEntityObject)StringrenderView(com.atlassian.confluence.core.ContentEntityObject ceo)abstract voidsaveDataObject(com.atlassian.confluence.core.ContentEntityObject abstractPage, DataObject data)voidsetMetadataField(MetadataField metadataField)StringtoString()
-
-
-
Method Detail
-
getName
public abstract String getName()
-
copy
public MetadataFieldType copy()
-
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 valuecontentEntityObject- 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)
-
compareTo
public int compareTo(MetadataFieldType b)
- Specified by:
compareToin interfaceComparable<MetadataFieldType>
-
getMetadataField
public MetadataField getMetadataField()
-
setMetadataField
public void setMetadataField(MetadataField metadataField)
-
importTypeData
@Deprecated public abstract void importTypeData(String asString) throws Exception
Deprecated.since 2.2. UseTransferable.importTypeConfiguration(String)instead.- Throws:
Exception
-
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)
-
-