<commit_before>package net.nemerosa.ontrack.extension.general;

import com.fasterxml.jackson.databind.JsonNode;
import net.nemerosa.ontrack.extension.support.AbstractPropertyType;
import net.nemerosa.ontrack.model.form.Form;
import net.nemerosa.ontrack.model.form.Text;
import net.nemerosa.ontrack.model.security.BuildCreate;
import net.nemerosa.ontrack.model.security.SecurityService;
import net.nemerosa.ontrack.model.structure.ProjectEntity;
import net.nemerosa.ontrack.model.structure.ProjectEntityType;

import java.util.EnumSet;
import java.util.Set;

public class ReleasePropertyType extends AbstractPropertyType<ReleaseProperty> {

    @Override
    public String getName() {
        return "Release";
    }

    @Override
    public String getDescription() {
        return "Release indicator on the build.";
    }

    @Override
    public Set<ProjectEntityType> getSupportedEntityTypes() {
        return EnumSet.of(ProjectEntityType.BUILD);
    }

    @Override
    public boolean canEdit(ProjectEntity entity, SecurityService securityService) {
        return securityService.isProjectFunctionGranted(entity, BuildCreate.class);
    }

    @Override
    public boolean canView(ProjectEntity entity, SecurityService securityService) {
        return true;
    }

    @Override
    public Form getEditionForm(ReleaseProperty value) {
        return Form.create()
                .with(
                        Text.of("name")
                                .label("Release name")
                                .length(20)
                );
    }

    @Override
    public ReleaseProperty fromClient(JsonNode node) {
        return fromStorage(node);
    }

    @Override
    public ReleaseProperty fromStorage(JsonNode node) {
        return new ReleaseProperty(
                node.path("name").asText()
        );
    }

    @Override
    public String getSearchKey(ReleaseProperty value) {
        return value.getName();
    }
}<commit_msg>#71 Missing value for the edition<commit_after>package net.nemerosa.ontrack.extension.general;

import com.fasterxml.jackson.databind.JsonNode;
import net.nemerosa.ontrack.extension.support.AbstractPropertyType;
import net.nemerosa.ontrack.model.form.Form;
import net.nemerosa.ontrack.model.form.Text;
import net.nemerosa.ontrack.model.security.BuildCreate;
import net.nemerosa.ontrack.model.security.SecurityService;
import net.nemerosa.ontrack.model.structure.ProjectEntity;
import net.nemerosa.ontrack.model.structure.ProjectEntityType;

import java.util.EnumSet;
import java.util.Set;

public class ReleasePropertyType extends AbstractPropertyType<ReleaseProperty> {

    @Override
    public String getName() {
        return "Release";
    }

    @Override
    public String getDescription() {
        return "Release indicator on the build.";
    }

    @Override
    public Set<ProjectEntityType> getSupportedEntityTypes() {
        return EnumSet.of(ProjectEntityType.BUILD);
    }

    @Override
    public boolean canEdit(ProjectEntity entity, SecurityService securityService) {
        return securityService.isProjectFunctionGranted(entity, BuildCreate.class);
    }

    @Override
    public boolean canView(ProjectEntity entity, SecurityService securityService) {
        return true;
    }

    @Override
    public Form getEditionForm(ReleaseProperty value) {
        return Form.create()
                .with(
                        Text.of("name")
                                .label("Release name")
                                .length(20)
                                .value(value != null ? value.getName() : null)
                );
    }

    @Override
    public ReleaseProperty fromClient(JsonNode node) {
        return fromStorage(node);
    }

    @Override
    public ReleaseProperty fromStorage(JsonNode node) {
        return new ReleaseProperty(
                node.path("name").asText()
        );
    }

    @Override
    public String getSearchKey(ReleaseProperty value) {
        return value.getName();
    }
}
{'fraction_non_alphanumeric': 0.08783279422741976, 'fraction_numerical': 0.001492908683752177, 'mean_word_length': 2.6982520699172032, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6208253', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1040, 'n_words': 215}