Search in sources :

Example 11 with CollectionSchema

use of com.linkedin.restli.restspec.CollectionSchema in project rest.li by linkedin.

the class ResourceSchemaCollection method processResourceSchema.

private static void processResourceSchema(ResourceSchemaVisitior visitor, List<ResourceSchema> hierarchy, ResourceSchema resourceSchema) {
    hierarchy.add(resourceSchema);
    final ResourceSchemaVisitior.VisitContext context = buildContext(hierarchy);
    visitor.visitResourceSchema(context, resourceSchema);
    if (resourceSchema.hasCollection()) {
        final CollectionSchema collectionSchema = resourceSchema.getCollection();
        visitor.visitCollectionResource(context, collectionSchema);
        processRestMethods(visitor, context, collectionSchema, collectionSchema.getMethods());
        processFinders(visitor, context, collectionSchema, collectionSchema.getFinders());
        processBatchFinders(visitor, context, collectionSchema, collectionSchema.getBatchFinders());
        processActions(visitor, context, collectionSchema, collectionSchema.getActions());
        processEntitySchema(visitor, context, collectionSchema.getEntity());
    } else if (resourceSchema.hasAssociation()) {
        final AssociationSchema associationSchema = resourceSchema.getAssociation();
        visitor.visitAssociationResource(context, associationSchema);
        processRestMethods(visitor, context, associationSchema, associationSchema.getMethods());
        processFinders(visitor, context, associationSchema, associationSchema.getFinders());
        processBatchFinders(visitor, context, associationSchema, associationSchema.getBatchFinders());
        processActions(visitor, context, associationSchema, associationSchema.getActions());
        processEntitySchema(visitor, context, associationSchema.getEntity());
    } else if (resourceSchema.hasSimple()) {
        final SimpleSchema simpleSchema = resourceSchema.getSimple();
        visitor.visitSimpleResource(context, simpleSchema);
        processRestMethods(visitor, context, simpleSchema, simpleSchema.getMethods());
        processActions(visitor, context, simpleSchema, simpleSchema.getActions());
        processEntitySchema(visitor, context, simpleSchema.getEntity());
    } else if (resourceSchema.hasActionsSet()) {
        final ActionsSetSchema actionsSet = resourceSchema.getActionsSet();
        visitor.visitActionSetResource(context, actionsSet);
        processActions(visitor, context, actionsSet, actionsSet.getActions());
    }
    hierarchy.remove(hierarchy.size() - 1);
}
Also used : AssociationSchema(com.linkedin.restli.restspec.AssociationSchema) CollectionSchema(com.linkedin.restli.restspec.CollectionSchema) SimpleSchema(com.linkedin.restli.restspec.SimpleSchema) ActionsSetSchema(com.linkedin.restli.restspec.ActionsSetSchema)

Aggregations

CollectionSchema (com.linkedin.restli.restspec.CollectionSchema)11 AssociationSchema (com.linkedin.restli.restspec.AssociationSchema)9 SimpleSchema (com.linkedin.restli.restspec.SimpleSchema)6 ActionsSetSchema (com.linkedin.restli.restspec.ActionsSetSchema)5 StringArray (com.linkedin.data.template.StringArray)4 ActionSchemaArray (com.linkedin.restli.restspec.ActionSchemaArray)4 FinderSchemaArray (com.linkedin.restli.restspec.FinderSchemaArray)4 RestMethodSchemaArray (com.linkedin.restli.restspec.RestMethodSchemaArray)4 ValidationOptions (com.linkedin.data.schema.validation.ValidationOptions)3 ValidationResult (com.linkedin.data.schema.validation.ValidationResult)3 ResourceMethod (com.linkedin.restli.common.ResourceMethod)3 ActionSchema (com.linkedin.restli.restspec.ActionSchema)3 ResourceSchemaArray (com.linkedin.restli.restspec.ResourceSchemaArray)3 RestMethodSchema (com.linkedin.restli.restspec.RestMethodSchema)3 ArrayList (java.util.ArrayList)3 DataList (com.linkedin.data.DataList)2 DataMap (com.linkedin.data.DataMap)2 RestliRequestOptions (com.linkedin.restli.client.RestliRequestOptions)2 URIParamUtils (com.linkedin.restli.internal.common.URIParamUtils)2 EntitySchema (com.linkedin.restli.restspec.EntitySchema)2