Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec-model doesn't populate metadata of declared type #6037

Open
tkobayas opened this issue Jul 31, 2024 · 2 comments
Open

exec-model doesn't populate metadata of declared type #6037

tkobayas opened this issue Jul 31, 2024 · 2 comments
Assignees

Comments

@tkobayas
Copy link
Contributor

For example, if we add this test case to drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/compiler/TypeDeclarationTest.java

    @Test
    public void testTypeDeclarationCustomMetadata() {
        String str = "package org.example.custom; \n" +
                "import " + Date.class.getCanonicalName() + ";\n" +
                "import " + Address.class.getCanonicalName() + ";\n" +
                "\n" +
                "declare Person\n" +
                "    @author( Bob )\n" +
                "    @dateOfCreation( 01-Feb-2009 )\n" +
                "\n" +
                "    name : String @key @maxLength( 30 )\n" +
                "    dateOfBirth : Date\n" +
                "    address : Address\n" +
                "end";

        KieBase kBase = KieBaseUtil.getKieBaseFromKieModuleFromDrl("test", kieBaseTestConfiguration, str);

        FactType person = kBase.getFactType( "org.example.custom", "Person" );

        Map<String, Object> personMetaData = person.getMetaData();
        System.out.println("== Person Meta Data ==");
        System.out.println(personMetaData);

        FactField field = person.getField( "name" );
        Map<String, Object> nameMetaData = field.getMetaData();
        System.out.println("== name Meta Data ==");
        System.out.println(nameMetaData);
    }

non-exec-model

== Person Meta Data ==
{author=Bob, dateOfCreation=01-Feb-2009}
== name Meta Data ==
{key=null, maxLength=30}

exec-model

== Person Meta Data ==
null
== name Meta Data ==
null
@tkobayas tkobayas self-assigned this Jul 31, 2024
@tkobayas
Copy link
Contributor Author

tkobayas commented Aug 1, 2024

Note that the generated class contains the annotation when the annotation is defined as a Java class, which should be the main benefit.

https://kie.zulipchat.com/#narrow/stream/232677-drools/topic/Annotations.20on.20user.20declared.20types.3F/near/455392692

@tkobayas
Copy link
Contributor Author

tkobayas commented Aug 5, 2024

lower priority

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant