Correct configuration of tokenList component

I’m trying to get the TokenList component to work, it’s supposed to be correctly configured but when I try to use it it just doesn’t work and doesn’t flag an error either.

I’ve got the following:

Fiscal responsability entity

@NamePattern(value = "%s|description")
@Table(name = "HET_FISCAL_RESPONSIBILITY", indexes = [
    Index(name = "IDX_HET_FISCAL_RESPONSIBILITY_01", columnList = "DESCRIPTION")
], uniqueConstraints = [
    UniqueConstraint(name = "IDX_HET_FISCAL_RESPONSIBILITY_UNQ", columnNames = ["IDENTIFICATION"])
])
@Entity(name = "het_FiscalResponsibility")
class FiscalResponsibility : BasicField() {

    companion object {
        private const val serialVersionUID = -1225558278840943983L
    }
}

Relational entity (detail)

@NamePattern(value = "%s|fiscalResponsability")
@Table(name = "HET_INTERNATIONAL_FSCL_RSPNSBLTY", uniqueConstraints = [
    UniqueConstraint(name = "IDX_HET_INTERNATIONAL_FISCAL_RESPONSABILITY_UNQ", columnNames = ["INTERNATIONAL_MARKETER_ID", "FISCAL_RESPONSABILITY_ID"])
])
@Entity(name = "het_InternationalFiscalResponsability")
class InternationalFiscalResponsability : Identificador() {

    @OnDeleteInverse(DeletePolicy.CASCADE)
    @Lookup(type = LookupType.DROPDOWN, actions = [])
    @NotNull
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "INTERNATIONAL_MARKETER_ID")
    var internationalMarketer: InternationalMarketer? = null

    @Lookup(type = LookupType.DROPDOWN, actions = [])
    @OnDeleteInverse(DeletePolicy.DENY)
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "FISCAL_RESPONSABILITY_ID")
    var fiscalResponsability: FiscalResponsibility? = null

    companion object {
        private const val serialVersionUID = 5799073036678630010L
    }
}

Master Entity

@NamePattern(value = "%s|businessName")
@Table(name = "HET_INTERNATIONAL_MRKTR", uniqueConstraints = [
    UniqueConstraint(name = "IDX_HET_INTERNATIONAL_MARKETER_UNQ", columnNames = ["IDENTIFICATION"])
])
@Entity(name = "het_InternationalMarketer")
@Listeners("het_InternationalMarketerListener")
class InternationalMarketer : Identificador() {

    @NotNull
    @Column(name = "IDENTIFICATION", nullable = false, length = 20)
    var identification: String? = null

    @Lookup(type = LookupType.DROPDOWN, actions = ["lookup", "open"])
    @NotNull
    @OnDeleteInverse(DeletePolicy.DENY)
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "IDENTIFICATION_TYPE_ID")
    var identificationType: IdentificationType? = null

    @NotNull
    @Column(name = "BUSINESS_NAME", nullable = false, length = 120)
    var businessName: String? = null

    @NotNull
    @Column(name = "PERSON_TYPE", nullable = false)
    private var personType: Int? = null

    @Lookup(type = LookupType.DROPDOWN, actions = ["lookup", "open"])
    @NotNull
    @OnDeleteInverse(DeletePolicy.DENY)
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "CURRENCY_ID")
    var currency: Currency? = null

    @Lookup(type = LookupType.DROPDOWN, actions = ["lookup", "open"])
    @NotNull
    @OnDeleteInverse(DeletePolicy.DENY)
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "CIIU_CODE_ID")
    var ciiuCode: CiiuCode? = null

    @Composition
    @OnDeleteInverse(DeletePolicy.CASCADE)
    @OneToMany(mappedBy = "internationalMarketer", cascade = [CascadeType.PERSIST])
    var responsibilities: MutableList<InternationalFiscalResponsability>? = mutableListOf()

    fun getPersonType(): PersonType? = personType?.let { PersonType.fromId(it) }

    fun setPersonType(personType: PersonType?) {
        this.personType = personType?.id
    }

    companion object {
        private const val serialVersionUID = 9042427494405307321L
    }
}

in my editor

<data>
        <instance id="internationalMarketerDc"
                  class="com.treze.sw.het.entity.catalogs.generals.InternationalMarketer"
                  view="internationalMarketer-view">
            <loader/>
            <collection id="responsibilitiesDc" property="responsibilities"/>    
        </instance>
</data>
<collection id="fiscalResponsibilityDc" class="com.treze.sw.het.entity.catalogs.taxes.FiscalResponsibility"
                    view="_minimal">
            <loader id="fiscalResponsibilityLc">
                <query>
                    <![CDATA[select e from het_FiscalResponsibility e where e.hidden <> true order by e.description asc]]>
                </query>
            </loader>
        </collection>
<layout expand="optionBox" spacing="true">
                      <form dataContainer="internationalMarketerDc">
                            <column width="740px">
                                <tokenList dataContainer="responsibilitiesDc" property="fiscalResponsability" inline="true">
                                    <lookup optionsContainer="fiscalResponsibilityDc"/>
                                    <clearButton caption="" icon="font-icon:REMOVE"/>
                                </tokenList>
                            </column>
                        </form>
</layout>

All of the above should work, but it doesn’t.
TokenList

I appreciate any help.

Regards,

Nelson F.

The configuration for token list for n-n relationship between A & B.

If being used in A screens.
Datacontainer - Adc
OptionContainer - Bdc (not the relationship table/entity but B)
property - Attribute in A.

It works very well for direct relationship (with no relationship entity).
I have not used it in case of indirect n-n relationship. (but if you are using token list then direct relationship is sufficient as you are not going to input some other data in relationship entity).

If I get your code correctly and tokenlist works for n-n indirecct relationships-
Why datacontainer for token list is responsibilitiesDc It should be internationalMarketerDc

regards

Umesh

Hi,

In your case, the correct tokenList definition looks as follows:

<tokenList dataContainer="internationalMarketerDc" property="responsibilities" ...

Regards,
Gleb