Hello
I’m using Jmix 2.5.1
I have an enum as a property of a Sign class:
import io.jmix.core.metamodel.annotation.JmixEntity;
import io.jmix.core.metamodel.annotation.Store;
import io.jmix.data.DdlGeneration;
import jakarta.persistence.*;
import py.com.itti.secure.certificates.backoffice.utils.SignMethods;
import java.util.Date;
@DdlGeneration(value = DdlGeneration.DbScriptGenerationMode.DISABLED)
@JmixEntity
@Store(name = "certificates")
@Table(name = "sign")
@Entity
public class Sign {
@Column(name = "pk", nullable = false)
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer pk;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "created_at", nullable = false)
private Date createdAt;
@Column(name = "METHOD")
private String method; //enum in the jmix studio entity design
}
Enum for the “method” attribute:
import io.jmix.core.metamodel.datatype.EnumClass;
import lombok.Getter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.lang.NonNull;
@Getter
public enum SignMethods implements EnumClass<String> {
PIN("PIN", "Pin"),
SELFIE("SELFIE", "Selfie");
private final String id;
private final String label;
SignMethods(String id, String label) {
this.id = id;
this.label = label;
}
@Override
@NonNull
public String getId() {
return id;
}
public static SignMethods fromId(String id) {
for (SignMethods status : SignMethods.values()) {
if (status.getId().equals(id)) {
return status;
}
}
return null;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.toString();
}
}
Where the attribute method is an enum, according to Jmix design, as a data type.
The thing is that it is recognized as an enum — in the filter it appears as a dropdown, but there (and in the datagrid display, in the detail page, and when exporting to a file using Grid Export Action), the value shown is SignMethods.PIN and not just PIN.
Is that normal? Is it not possible to only show the value (like PIN), and not the full enum representation (like SignMethods.PIN)?
Looking forward to your comments. Thank you very much!