Search in sources :

Example 6 with SimpleSchema

use of com.linkedin.restli.restspec.SimpleSchema 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());
        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());
        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

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