Package com.linkedin.restli.restspec

Examples of com.linkedin.restli.restspec.EntitySchema


          findModelsAction(actionSchema, foundTypes, typeOrder);
        }
      }
      if (collection.hasEntity())
      {
        EntitySchema entity = collection.getEntity();
        findModelsEntity(entity, foundTypes, typeOrder);
      }
    }
  }
View Full Code Here


          findModelsAction(actionSchema, foundTypes, typeOrder);
        }
      }
      if (association.hasEntity())
      {
        EntitySchema entitySchema = association.getEntity();
        findModelsEntity(entitySchema, foundTypes, typeOrder);
      }
    }
  }
View Full Code Here

          findModelsAction(actionSchema, foundTypes, typeOrder);
        }
      }
      if (simple.hasEntity())
      {
        EntitySchema entity = simple.getEntity();
        findModelsEntity(entity, foundTypes, typeOrder);
      }
    }
  }
View Full Code Here

  }

  private void appendEntityToCollectionSchema(final CollectionSchema collectionSchema,
                                              final ResourceModel resourceModel)
  {
    EntitySchema entityNode = buildEntitySchema(resourceModel);

    collectionSchema.setEntity(entityNode);
  }
View Full Code Here

  }

  private void appendEntityToSimpleSchema(final SimpleSchema simpleSchema,
                                          final ResourceModel resourceModel)
  {
    EntitySchema entityNode = buildEntitySchema(resourceModel);

    simpleSchema.setEntity(entityNode);
  }
View Full Code Here

    simpleSchema.setEntity(entityNode);
  }

  private EntitySchema buildEntitySchema(ResourceModel resourceModel)
  {
    EntitySchema entityNode = new EntitySchema();
    entityNode.setPath(buildPathForEntity(resourceModel));

    if (resourceModel.getResourceLevel() == ResourceLevel.COLLECTION)
    {
      ActionSchemaArray actions = createActions(resourceModel, ResourceLevel.ENTITY);
      if (actions.size() > 0)
      {
        entityNode.setActions(actions);
      }
    }

    // subresources
    ResourceSchemaArray subresources = new ResourceSchemaArray();
    for (ResourceModel subResourceModel : resourceModel.getSubResources())
    {
      ResourceSchema subresource = new ResourceSchema();

      switch (subResourceModel.getResourceType())
      {
        case COLLECTION:
        case ASSOCIATION:
          appendCollection(subresource, subResourceModel);
          break;
        case SIMPLE:
          appendSimple(subresource, subResourceModel);
          break;
        default:
          break;
      }

      final DataMap customAnnotation = subResourceModel.getCustomAnnotationData();
      if (!customAnnotation.isEmpty())
      {
        subresource.setAnnotations(new CustomAnnotationContentSchemaMap(customAnnotation));
      }

      subresources.add(subresource);
    }

    if (subresources.size() > 0)
    {
      Collections.sort(subresources, new Comparator<ResourceSchema>()
      {
        @Override
        public int compare(ResourceSchema resourceSchema, ResourceSchema resourceSchema2)
        {
          return resourceSchema.getName().compareTo(resourceSchema2.getName());
        }
      });
      entityNode.setSubresources(subresources);
    }
    return entityNode;
  }
View Full Code Here

    ActionSchema actionSchema;

    final CollectionSchema collectionSchema = resourceSchema.getCollection();
    if (collectionSchema != null)
    {
      final EntitySchema entity = collectionSchema.getEntity();
      if (entity != null)
      {
        actionSchema = findActionInEntity(entity, actionName);
        if (actionSchema != null)
        {
          return actionSchema;
        }
      }
    }

    final AssociationSchema associationSchema = resourceSchema.getAssociation();
    if (associationSchema != null)
    {
      final EntitySchema entity = associationSchema.getEntity();
      if (entity != null)
      {
        actionSchema = findActionInEntity(entity, actionName);
        if (actionSchema != null)
        {
View Full Code Here

TOP

Related Classes of com.linkedin.restli.restspec.EntitySchema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.