ProjectFieldConfig.java

package info.textgrid.services.textapi;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Represents the field override configuration for a project.
 * Loaded from a YAML file named after the projectId.
 */
@JsonPropertyOrder({
    "projectId",
    "applyOnlyTo",
    "excludeFrom",
    "fields",
    "annotationCollection",
    "include",
    "exclude"
})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ProjectFieldConfig {

    private String projectId;
    private List<String> applyOnlyTo;
    private List<String> excludeFrom;
    private List<FieldOverride> fields;
    private Map<String, String> annotationCollection;
    private List<Include> include;
    private List<Exclude> exclude;

    /**
     * The project ID this configuration is for.
     */
    public String getProjectId() {
        return projectId;
    }

    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    /**
     * List of slugs (object names) where changes should be applied exclusively.
     * If not empty, changes are ONLY applied to these slugs.
     */
    public List<String> getApplyOnlyTo() {
        return applyOnlyTo;
    }

    public void setApplyOnlyTo(List<String> applyOnlyTo) {
        this.applyOnlyTo = applyOnlyTo;
    }

    /**
     * List of slugs (object names) where changes should NOT be applied.
     */
    public List<String> getExcludeFrom() {
        return excludeFrom;
    }

    public void setExcludeFrom(List<String> excludeFrom) {
        this.excludeFrom = excludeFrom;
    }

    /**
     * List of field overrides to apply.
     */
    public List<FieldOverride> getFields() {
        return fields;
    }

    public void setFields(List<FieldOverride> fields) {
        this.fields = fields;
    }

    /**
     * Annotations collection configuration.
     * Maps context (e.g., "project") to annotations collection URL.
     */
    public Map<String, String> getAnnotationCollection() {
        return annotationCollection;
    }

    public void setAnnotationCollection(Map<String, String> annotationCollection) {
        this.annotationCollection = annotationCollection;
    }

    /**
     * List of inclusion rules.
     * For entries whose ID matches a rule's "from", only the rule's "target" IDs
     * are kept/referenced within their list (collections, manifests or items).
     */
    public List<Include> getInclude() {
        return include;
    }

    public void setInclude(List<Include> include) {
        this.include = include;
    }

    /**
     * List of exclusion rules.
     * Entries whose ID matches a rule's "from" have the rule's "target" IDs
     * removed from their list (collections, manifests or items).
     */
    public List<Exclude> getExclude() {
        return exclude;
    }

    public void setExclude(List<Exclude> exclude) {
        this.exclude = exclude;
    }
}