Package com.linkedin.restli.restspec

Examples of com.linkedin.restli.restspec.IdentifierSchema


  private void findModelsCollection(ResourceSchema resourceSchema, Map<String, NamedDataSchema> foundTypes, List<NamedDataSchema> typeOrder)
  {
    CollectionSchema collection = resourceSchema.getCollection();
    if (collection != null)
    {
      IdentifierSchema identifier = collection.getIdentifier();
      findModelsIdentifier(identifier, foundTypes, typeOrder);
      if (collection.hasFinders())
      {
        for (FinderSchema restMethodSchema: collection.getFinders())
        {
View Full Code Here


      @Override
      public void visitCollectionResource(VisitContext visitContext,
                                          CollectionSchema collectionSchema)
      {
        final IdentifierSchema id = collectionSchema.getIdentifier();

        final NamedDataSchema typeSchema = extractSchema(id.getType());
        if (typeSchema != null)
        {
          connectSchemaToResource(visitContext, typeSchema);
        }

        final String params = id.getParams();
        if (params != null)
        {
          final NamedDataSchema paramsSchema = extractSchema(params);
          if (paramsSchema != null)
          {
View Full Code Here

  }

  private void appendIdentifierNode(final CollectionSchema collectionNode,
                                    final ResourceModel collectionResource)
  {
    IdentifierSchema identifierSchema = new IdentifierSchema();
    identifierSchema.setName(collectionResource.getKeyName());
    // If the key is a complex key, set type to the schema type of the key part of the
    // complex key and params to that of the params part of the complex key.
    // Otherwise, just set the type to the key class schema type
    if (collectionResource.getKeyClass().equals(ComplexResourceKey.class))
    {
      identifierSchema.setType(buildDataSchemaType(collectionResource.getKeyKeyClass()));
      identifierSchema.setParams(buildDataSchemaType(collectionResource.getKeyParamsClass()));
    }
    else
    {
      Key key = collectionResource.getPrimaryKey();
      identifierSchema.setType(buildDataSchemaType(key.getType(), key.getDataSchema()));
    }

    collectionNode.setIdentifier(identifierSchema);
  }
View Full Code Here

    if(collection.getEntity().hasActions())
    {
      entityActions = collection.getEntity().getActions();
    }
    String schema = resourceSchema.getSchema();
    IdentifierSchema identifier = collection.getIdentifier();
    if(identifier.getParams() == null) // in this case we have a "simple" collection resource
    {
      DataSchema key = RestSpecCodec.textToSchema(identifier.getType(), _schemaResolver);
      return buildResourceSpec(supports,
                               toTypeSpec(key),
                               null,
                               Collections.<String, Object>emptyMap(),
                               schema,
                               actions,
                               entityActions);
    }
    else // we have a complex collection resource
    {
      DataSchema keyKeyType = RestSpecCodec.textToSchema(identifier.getType(), _schemaResolver);
      DataSchema keyParamsType = RestSpecCodec.textToSchema(identifier.getParams(), _schemaResolver);
      ComplexKeySpec<?, ?> complexKeyType = toComplexKey(keyKeyType, keyParamsType);
      return buildResourceSpec(supports,
                               new TypeSpec<ComplexResourceKey>(ComplexResourceKey.class, null),
                               complexKeyType,
                               Collections.<String, Object>emptyMap(),
View Full Code Here

TOP

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

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.