Search in sources :

Example 1 with DefaultPropertyIntrospectorService

use of org.hisp.dhis.schema.DefaultPropertyIntrospectorService in project dhis2-core by dhis2.

the class PluckNodeTransformerTest method setUp.

@BeforeEach
public void setUp() {
    schemaService = new DefaultSchemaService(new DefaultPropertyIntrospectorService(new JacksonPropertyIntrospector()), sessionFactory);
    collectionNode = new CollectionNode("organisationUnits", 2);
    collectionNode.setNamespace("testUrn");
    collectionNode.setProperty(schemaService.getDynamicSchema(CategoryOption.class).getProperty("organisationUnits"));
    ComplexNode complexNode = new ComplexNode("organisationUnit");
    SimpleNode simpleNode = new SimpleNode("id", schemaService.getDynamicSchema(Category.class).getProperty("id"), "abc1");
    complexNode.addChild(simpleNode);
    simpleNode = new SimpleNode("name", schemaService.getDynamicSchema(Category.class).getProperty("id"), "OU 1");
    complexNode.addChild(simpleNode);
    collectionNode.addChild(complexNode);
    complexNode = new ComplexNode("organisationUnit");
    simpleNode = new SimpleNode("id", schemaService.getDynamicSchema(Category.class).getProperty("id"), "abc2");
    complexNode.addChild(simpleNode);
    simpleNode = new SimpleNode("name", schemaService.getDynamicSchema(Category.class).getProperty("id"), "OU 2");
    complexNode.addChild(simpleNode);
    collectionNode.addChild(complexNode);
}
Also used : Category(org.hisp.dhis.category.Category) ComplexNode(org.hisp.dhis.node.types.ComplexNode) DefaultSchemaService(org.hisp.dhis.schema.DefaultSchemaService) CollectionNode(org.hisp.dhis.node.types.CollectionNode) JacksonPropertyIntrospector(org.hisp.dhis.schema.introspection.JacksonPropertyIntrospector) DefaultPropertyIntrospectorService(org.hisp.dhis.schema.DefaultPropertyIntrospectorService) SimpleNode(org.hisp.dhis.node.types.SimpleNode) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with DefaultPropertyIntrospectorService

use of org.hisp.dhis.schema.DefaultPropertyIntrospectorService in project dhis2-core by dhis2.

the class DefaultFieldFilterServiceTest method setUp.

@BeforeEach
public void setUp() {
    final Set<NodeTransformer> nodeTransformers = new HashSet<>();
    nodeTransformers.add(new PluckNodeTransformer());
    final SchemaService schemaService = new DefaultSchemaService(new DefaultPropertyIntrospectorService(new JacksonPropertyIntrospector()), sessionFactory);
    CacheProvider cacheProvider = mock(CacheProvider.class);
    when(cacheProvider.createPropertyTransformerCache()).thenReturn(new NoOpCache<>());
    service = new DefaultFieldFilterService(new DefaultFieldParser(), schemaService, aclService, currentUserService, attributeService, cacheProvider, userGroupService, userService, nodeTransformers);
    service.init();
}
Also used : NodeTransformer(org.hisp.dhis.node.NodeTransformer) PluckNodeTransformer(org.hisp.dhis.node.transformers.PluckNodeTransformer) DefaultSchemaService(org.hisp.dhis.schema.DefaultSchemaService) SchemaService(org.hisp.dhis.schema.SchemaService) PluckNodeTransformer(org.hisp.dhis.node.transformers.PluckNodeTransformer) DefaultSchemaService(org.hisp.dhis.schema.DefaultSchemaService) CacheProvider(org.hisp.dhis.cache.CacheProvider) JacksonPropertyIntrospector(org.hisp.dhis.schema.introspection.JacksonPropertyIntrospector) HashSet(java.util.HashSet) DefaultPropertyIntrospectorService(org.hisp.dhis.schema.DefaultPropertyIntrospectorService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DefaultPropertyIntrospectorService (org.hisp.dhis.schema.DefaultPropertyIntrospectorService)2 DefaultSchemaService (org.hisp.dhis.schema.DefaultSchemaService)2 JacksonPropertyIntrospector (org.hisp.dhis.schema.introspection.JacksonPropertyIntrospector)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 HashSet (java.util.HashSet)1 CacheProvider (org.hisp.dhis.cache.CacheProvider)1 Category (org.hisp.dhis.category.Category)1 NodeTransformer (org.hisp.dhis.node.NodeTransformer)1 PluckNodeTransformer (org.hisp.dhis.node.transformers.PluckNodeTransformer)1 CollectionNode (org.hisp.dhis.node.types.CollectionNode)1 ComplexNode (org.hisp.dhis.node.types.ComplexNode)1 SimpleNode (org.hisp.dhis.node.types.SimpleNode)1 SchemaService (org.hisp.dhis.schema.SchemaService)1