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

org.octopusden.octopus.vcsfacade.document.RefDocument.kt Maven / Gradle / Ivy

The newest version!
package org.octopusden.octopus.vcsfacade.document

import org.octopusden.octopus.vcsfacade.client.common.dto.RefType
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.data.elasticsearch.annotations.Document
import org.springframework.data.elasticsearch.annotations.Field
import org.springframework.data.elasticsearch.annotations.FieldType
import org.springframework.data.elasticsearch.annotations.Setting

@Document(indexName = "#{ 'vcs-facade-refs-' + @opensearchIndexSuffix }")
@Setting(settingPath = "opensearch-index-settings.json")
@ConditionalOnProperty(
    prefix = "vcs-facade.opensearch", name = ["enabled"], havingValue = "true", matchIfMissing = true
)
class RefDocument(
    @Field(type = FieldType.Object) val repository: RepositoryDocument,
    @Field(type = FieldType.Keyword) val type: RefType,
    @Field(type = FieldType.Text, analyzer = "classic") val name: String,
    @Field(type = FieldType.Keyword) val hash: String,
    @Field(type = FieldType.Keyword) val link: String
) : BaseDocument(id(repository.id, type, name)) {
    val commitId = id(repository.id, hash)

    override fun toString() =
        "RefDocument(id=$id, repository=$repository, type=$type, name=$name, hash=$hash, link=$link)"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy