Designer remove Attributes if Entity Implementing Application Interface

Hi,

Cureently I have my Entity which as below

extends BaseUuidEntity implements Versioned, Updatable, Creatable, Attributable

Attributable is application interface which has below function

AttributeType getType();

AttributeType is An Enum of type String

Class which is Implementing this interface if i tried to open designer some strange behavior is happening

Designer will remove AttributeType getType(); from the interface and Will convert the function inside the class to return String instead of the Enum

Thanks

Hi

Thanks for your feedback.
Unfortunately I can’t get what is the issue about.

Could you please provide some details?
First please go to CUBA -> Welcome, copy and attach Product Versions.
Did you make any changes in the designer (added, modified or removed some attributes)? Or just opened and closed designer?

Also it would be very helpful if you attach your entity class contents before and after the changes made by the designer.

Hi @gaslov ,

Thanks for your replay , below is details

CUBA Platform version: 7.1.4
CUBA Studio plugin version: 13.0-191
IntelliJ version: IntelliJ IDEA 2019.1.3 (Ultimate Edition)

This is my class before open designer only opening without any action


@Table(name = "VTOWER_REQUEST_DEFINITION_STATE_ATTRIBUTE")
@Entity(name = "vtower_RequestDefinitionStateAttribute")
public class RequestDefinitionStateAttribute extends BaseUuidEntity implements Versioned, Updatable, Creatable, Attributable {
    private static final long serialVersionUID = -3775717776706158793L;

    @Lookup(type = LookupType.DROPDOWN, actions = {})
    @NotNull
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "REQUEST_DEFINITION_STATE_ID")
    protected RequestDefinitionState requestDefinitionState;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.code.validation.NotNull}")
    @Column(name = "CODE", nullable = false)
    protected String code;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.type.validation.NotNull}")
    @Column(name = "TYPE_", nullable = false)
    protected String type;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.defaultName.validation.NotNull}")
    @Column(name = "DEFAULT_NAME", nullable = false)
    protected String defaultName;

    @Lob
    @Column(name = "REQUIRED_CLAUSE")
    protected String requiredClause;

    @Column(name = "REQUIRED_CLAUSE_ERROR_MESSAGE", length = 4000)
    protected String requiredClauseErrorMessage;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.defaultOrder.validation.NotNull}")
    @Column(name = "DEFAULT_ORDER", nullable = false)
    protected Integer defaultOrder;

    @Lob
    @Column(name = "DEFAULT_DESCRIPTION")
    protected String defaultDescription;

    @Lob
    @Column(name = "DEFAULT_REGEX")
    protected String defaultRegex;

    @Column(name = "DEFAULT_REGEX_ERROR_MESSAGE", length = 4000)
    protected String defaultRegexErrorMessage;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.isSystemAttribute.validation.NotNull}")
    @Column(name = "IS_SYSTEM_ATTRIBUTE", nullable = false)
    protected Boolean isSystemAttribute = false;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.isSubjectAttribute.validation.NotNull}")
    @Column(name = "IS_SUBJECT_ATTRIBUTE", nullable = false)
    protected Boolean isSubjectAttribute = false;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.isPreCalculated.validation.NotNull}")
    @Column(name = "IS_PRE_CALCULATED", nullable = false)
    protected Boolean isPreCalculated = false;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.isPostCalculated.validation.NotNull}")
    @Column(name = "IS_POST_CALCULATED", nullable = false)
    protected Boolean isPostCalculated = false;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.isHidden.validation.NotNull}")
    @Column(name = "IS_HIDDEN", nullable = false)
    protected Boolean isHidden = false;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.canBeHidden.validation.NotNull}")
    @Column(name = "CAN_BE_HIDDEN", nullable = false)
    protected Boolean canBeHidden = false;

    @Temporal(TemporalType.DATE)
    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.startDate.validation.NotNull}")
    @Column(name = "START_DATE", nullable = false)
    protected Date startDate;

    @Temporal(TemporalType.DATE)
    @Column(name = "END_DATE")
    protected Date endDate;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.category.validation.NotNull}")
    @Column(name = "CATEGORY", nullable = false)
    protected String category;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.categoryOrder.validation.NotNull}")
    @Column(name = "CATEGORY_ORDER", nullable = false)
    protected Integer categoryOrder;

    @NotNull(message = "{msg://vtower_RequestDefinitionStateAttribute.isWorkflowNodable.validation.NotNull}")
    @Column(name = "IS_WORKFLOW_NODABLE", nullable = false)
    protected Boolean isWorkflowNodable = false;

    @Composition
    @OneToMany(mappedBy = "requestDefinitionStateAttribute")
    protected List<RequestDefinitionStateAttributeListItem> requestDefinitionStateAttributeListItems;

    @Column(name = "UPDATE_TS")
    protected Date updateTs;

    @Column(name = "UPDATED_BY", length = 50)
    protected String updatedBy;

    @Column(name = "CREATE_TS")
    protected Date createTs;

    @Column(name = "CREATED_BY", length = 50)
    protected String createdBy;

    @Version
    @Column(name = "VERSION", nullable = false)
    protected Integer version;

    public void setType(AttributeType type) {
        this.type = type == null ? null : type.getId();
    }

    public AttributeType getType() {
        return type == null ? null : AttributeType.fromId(type);
    }

    public RequestDefinitionState getRequestDefinitionState() {
        return requestDefinitionState;
    }

    public void setRequestDefinitionState(RequestDefinitionState requestDefinitionState) {
        this.requestDefinitionState = requestDefinitionState;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDefaultName() {
        return defaultName;
    }

    public void setDefaultName(String defaultName) {
        this.defaultName = defaultName;
    }

    public String getRequiredClause() {
        return requiredClause;
    }

    public void setRequiredClause(String requiredClause) {
        this.requiredClause = requiredClause;
    }

    public String getRequiredClauseErrorMessage() {
        return requiredClauseErrorMessage;
    }

    public void setRequiredClauseErrorMessage(String requiredClauseErrorMessage) {
        this.requiredClauseErrorMessage = requiredClauseErrorMessage;
    }

    public Integer getDefaultOrder() {
        return defaultOrder;
    }

    public void setDefaultOrder(Integer defaultOrder) {
        this.defaultOrder = defaultOrder;
    }

    public String getDefaultDescription() {
        return defaultDescription;
    }

    public void setDefaultDescription(String defaultDescription) {
        this.defaultDescription = defaultDescription;
    }

    public String getDefaultRegex() {
        return defaultRegex;
    }

    public void setDefaultRegex(String defaultRegex) {
        this.defaultRegex = defaultRegex;
    }

    public String getDefaultRegexErrorMessage() {
        return defaultRegexErrorMessage;
    }

    public void setDefaultRegexErrorMessage(String defaultRegexErrorMessage) {
        this.defaultRegexErrorMessage = defaultRegexErrorMessage;
    }

    public Boolean getIsSystemAttribute() {
        return isSystemAttribute;
    }

    public void setIsSystemAttribute(Boolean systemAttribute) {
        isSystemAttribute = systemAttribute;
    }

    public Boolean getIsSubjectAttribute() {
        return isSubjectAttribute;
    }

    public void setIsSubjectAttribute(Boolean subjectAttribute) {
        isSubjectAttribute = subjectAttribute;
    }

    public Boolean getIsPreCalculated() {
        return isPreCalculated;
    }

    public void setIsPreCalculated(Boolean preCalculated) {
        isPreCalculated = preCalculated;
    }

    public Boolean getIsPostCalculated() {
        return isPostCalculated;
    }

    public void setIsPostCalculated(Boolean postCalculated) {
        isPostCalculated = postCalculated;
    }

    public Boolean getIsHidden() {
        return isHidden;
    }

    public void setIsHidden(Boolean hidden) {
        isHidden = hidden;
    }

    public Boolean getCanBeHidden() {
        return canBeHidden;
    }

    public void setCanBeHidden(Boolean canBeHidden) {
        this.canBeHidden = canBeHidden;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public Integer getCategoryOrder() {
        return categoryOrder;
    }

    @Override
    public List<AttributeListItemable> getListItems() {
        return null;
    }

    public void setCategoryOrder(Integer categoryOrder) {
        this.categoryOrder = categoryOrder;
    }

    public Boolean getIsWorkflowNodable() {
        return isWorkflowNodable;
    }

    public void setIsWorkflowNodable(Boolean workflowNodable) {
        isWorkflowNodable = workflowNodable;
    }

    public List<RequestDefinitionStateAttributeListItem> getRequestDefinitionStateAttributeListItems() {
        return requestDefinitionStateAttributeListItems;
    }

    public void setRequestDefinitionStateAttributeListItems(List<RequestDefinitionStateAttributeListItem> requestDefinitionStateAttributeListItems) {
        this.requestDefinitionStateAttributeListItems = requestDefinitionStateAttributeListItems;
    }



    @Override
    public Integer getVersion() {
        return version;
    }

    @Override
    public void setVersion(Integer version) {
        this.version = version;
    }

    @Override
    public String getCreatedBy() {
        return createdBy;
    }

    @Override
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @Override
    public Date getCreateTs() {
        return createTs;
    }

    @Override
    public void setCreateTs(Date createTs) {
        this.createTs = createTs;
    }

    @Override
    public String getUpdatedBy() {
        return updatedBy;
    }

    @Override
    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    @Override
    public Date getUpdateTs() {
        return updateTs;
    }

    @Override
    public void setUpdateTs(Date updateTs) {
        this.updateTs = updateTs;
    }

}

interface

public interface Attributable {
    String getCode();
    AttributeType getType();
    String getDefaultName();
    String getRequiredClause();
    String getRequiredClauseErrorMessage();
    Integer getDefaultOrder();
    String getDefaultDescription();
    String getDefaultRegex();
    String getDefaultRegexErrorMessage();
    Boolean getIsSystemAttribute();
    Boolean getIsPreCalculated();
    Boolean getIsPostCalculated();
    Boolean getIsHidden();
    Boolean getCanBeHidden();
    Date getStartDate();
    Date getEndDate();
    String getCategory();
    Integer getCategoryOrder();
    List<AttributeListItemable> getListItems();
}

After Opening Designer

Type of function getType() which is referencing Enum is changed to return String instead
Interface getType() function is removed from the interface automatically

Thanks

Thanks

I’ve reproduced the issue.

There is a bug in Studio.
YouTrack issue created.

If it is acceptable for your project you can use the following workaround:
Rename interface method, so it have name different from the type field getter.
E.g. getAttributeType
Add this method implementation to the entity that just calls the getType

    public AttributeType getType() {
        return type == null ? null : AttributeType.fromId(type);
    }

    @Override
    public AttributeType getAttributeType() {
        return getType();
    }

Or vice versa: rename type field.

1 Like

Hi @gaslov ,

I will try your work around , and i will keep watching issue once it is released ,

Thanks