بنقرة واحدة
jmix-create-enum
Create a Jmix enum for entity attributes with stable database ids and localization.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Create a Jmix enum for entity attributes with stable database ids and localization.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | jmix-create-enum |
| description | Create a Jmix enum for entity attributes with stable database ids and localization. |
Use this skill when an entity attribute has a fixed set of values.
entity package.io.jmix.core.metamodel.datatype.EnumClass<T>.fromId() method annotated with @Nullable.jmix-add-i18n-keys for the <package>/<EnumClass>.<CONSTANT> key shape (e.g. com.company.app.entity/TransactionType.INCOME), NOT an all-dots FQCN.CONSTANT form.import io.jmix.core.metamodel.datatype.EnumClass;
import org.springframework.lang.Nullable;
public enum TransactionType implements EnumClass<String> {
INCOME("INCOME"),
OUTCOME("OUTCOME");
private final String id;
TransactionType(String id) {
this.id = id;
}
@Override
public String getId() {
return id;
}
@Nullable
public static TransactionType fromId(String id) {
for (TransactionType value : TransactionType.values()) {
if (value.getId().equals(id)) {
return value;
}
}
return null;
}
}
@Column(name = "TYPE", nullable = false, length = 50)
private String type;
public TransactionType getType() {
return type == null ? null : TransactionType.fromId(type);
}
public void setType(TransactionType type) {
this.type = type == null ? null : type.getId();
}
Keep one consistent id type across EnumClass<T>, getId()/fromId(), the entity field, and the Liquibase column (e.g. all String/VARCHAR). A mismatch compiles cleanly but silently corrupts load/save. Each literal id must be a hardcoded stable value, never a display label or ordinal()/name().
When binding an enum attribute in a view, use <comboBox> (its Range is an enumeration) — not entityComboBox, which is for entity associations.
io.jmix.core.EnumClass.EnumClass without a type parameter.ordinal() or enum .name() persistence.Open a Jmix entity detail view from a button/action and refresh related data after save.
Add Jmix entity lifecycle event listeners to perform additional actions with saved or loaded entities.
Add complete Jmix message keys for entities, enums, views, actions, and validation text.
Configure or audit Jmix fetch plans in XML views, fragments, DataManager loads, repositories, and entity events when loading references, avoiding N+1 queries, fixing unfetched attribute errors, or tuning data loading.
Add inline editable parent-child composition UI to a Jmix detail view, when a parent entity owns child records edited via a property-bound collection container (no query loader).
Create a Jmix Flow UI detail view with XML descriptor, save-close action, messages, and policies.