Search in sources :

Example 1 with Schemas

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

the class SchemaController method getSchemas.

@RequestMapping
@ResponseBody
public RootNode getSchemas() {
    List<String> fields = Lists.newArrayList(contextService.getParameterValues("fields"));
    if (fields.isEmpty()) {
        fields.add("*");
    }
    Schemas schemas = new Schemas(schemaService.getSortedSchemas());
    linkService.generateSchemaLinks(schemas.getSchemas());
    RootNode rootNode = NodeUtils.createRootNode("schemas");
    CollectionNode collectionNode = fieldFilterService.filter(Schema.class, schemas.getSchemas(), fields);
    collectionNode.setWrapping(false);
    rootNode.addChild(collectionNode);
    return rootNode;
}
Also used : RootNode(org.hisp.dhis.node.types.RootNode) Schemas(org.hisp.dhis.schema.Schemas) CollectionNode(org.hisp.dhis.node.types.CollectionNode) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

CollectionNode (org.hisp.dhis.node.types.CollectionNode)1 RootNode (org.hisp.dhis.node.types.RootNode)1 Schemas (org.hisp.dhis.schema.Schemas)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1