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);
}
Aggregations