Package com.linkedin.restli.restspec

Examples of com.linkedin.restli.restspec.RestMethodSchemaArray


    JClass keyKeyClass = null;
    JClass keyParamsClass = null;
    Class<?> resourceSchemaClass;
    Map<String, AssocKeyTypeInfo> assocKeyTypeInfos = Collections.emptyMap();
    StringArray supportsList=null;
    RestMethodSchemaArray restMethods = null;
    FinderSchemaArray finders = null;
    ResourceSchemaArray subresources = null;
    ActionSchemaArray resourceActions = null;
    ActionSchemaArray entityActions = null;
View Full Code Here


    return parameterSchemaArray;
  }

  private RestMethodSchemaArray createRestMethods(final ResourceModel resourceModel)
  {
    RestMethodSchemaArray restMethods = new RestMethodSchemaArray();

    ResourceMethod[] crudMethods =
            {
                    ResourceMethod.CREATE,
                    ResourceMethod.GET,
                    ResourceMethod.UPDATE,
                    ResourceMethod.PARTIAL_UPDATE,
                    ResourceMethod.DELETE,
                    ResourceMethod.BATCH_CREATE,
                    ResourceMethod.BATCH_GET,
                    ResourceMethod.BATCH_UPDATE,
                    ResourceMethod.BATCH_PARTIAL_UPDATE,
                    ResourceMethod.BATCH_DELETE,
                    ResourceMethod.GET_ALL
            };

    for (ResourceMethod method : crudMethods)
    {
      ResourceMethodDescriptor descriptor = resourceModel.findMethod(method);
      if (descriptor == null)
      {
        continue;
      }

      RestMethodSchema restMethod = new RestMethodSchema();

      restMethod.setMethod(method.toString());

      String doc = _docsProvider.getMethodDoc(descriptor.getMethod());
      if (doc != null)
      {
        restMethod.setDoc(doc);
      }

      ParameterSchemaArray parameters = createParameters(descriptor);
      if (parameters.size() > 0)
      {
        restMethod.setParameters(parameters);
      }

      final DataMap customAnnotation = descriptor.getCustomAnnotationData();


      String deprecatedDoc = _docsProvider.getMethodDeprecatedTag(descriptor.getMethod());
      if(deprecatedDoc != null)
      {
        customAnnotation.put(DEPRECATED_ANNOTATION_NAME, deprecateDocToAnnotationMap(deprecatedDoc));
      }

      if (!customAnnotation.isEmpty())
      {
        restMethod.setAnnotations(new CustomAnnotationContentSchemaMap(customAnnotation));
      }

      restMethods.add(restMethod);
    }

    return restMethods;
  }
View Full Code Here

    collectionSchema.setSupports(supportsArray);
  }

  private void appendMethodsToCollectionSchema(CollectionSchema collectionSchema, ResourceModel resourceModel)
  {
    RestMethodSchemaArray restMethods = createRestMethods(resourceModel);
    if (restMethods.size() > 0)
    {
      collectionSchema.setMethods(restMethods);
    }
  }
View Full Code Here

    simpleSchema.setSupports(supportsArray);
  }

  private void appendMethodsToSimpleSchema(SimpleSchema simpleSchema, ResourceModel resourceModel)
  {
    RestMethodSchemaArray restMethods = createRestMethods(resourceModel);
    if (restMethods.size() > 0)
    {
      simpleSchema.setMethods(restMethods);
    }
  }
View Full Code Here

    return RestLiApiBuilder.buildResourceModels(classes);
  }

  private static RestMethodSchema findRestMethod(ResourceSchema resourceSchema, ResourceMethod method)
  {
    RestMethodSchemaArray methods = null;
    RestMethodSchema methodResult = null;

    final CollectionSchema collectionSchema = resourceSchema.getCollection();
    if (collectionSchema != null)
    {
View Full Code Here

    if(resourceSchema.hasCollection())
    {
      CollectionSchema collection = resourceSchema.getCollection();
      _type = ResourceType.COLLECTION;
      _supports = collection.getSupports();
      _methods = collection.hasMethods() ? collection.getMethods() : new RestMethodSchemaArray(0);
      _finders = collection.hasFinders() ? collection.getFinders() : new FinderSchemaArray(0);
      _actions = collection.hasActions() ? collection.getActions() : new ActionSchemaArray(0);
      _entity = collection.getEntity();

    }
    else if(resourceSchema.hasAssociation())
    {
      _type = ResourceType.ASSOCIATION;
      AssociationSchema association = resourceSchema.getAssociation();
      _supports = association.getSupports();
      _methods = association.hasMethods() ? association.getMethods() : new RestMethodSchemaArray(0);
      _finders = association.hasFinders() ? association.getFinders() : new FinderSchemaArray(0);
      _actions = association.hasActions() ? association.getActions() : new ActionSchemaArray(0);
      _entity = association.getEntity();

    }
    else if(resourceSchema.hasSimple())
    {
      _type = ResourceType.SIMPLE;
      SimpleSchema simple = resourceSchema.getSimple();
      _supports = simple.getSupports();
      _methods = simple.hasMethods() ? simple.getMethods() : new RestMethodSchemaArray(0);
      _finders = new FinderSchemaArray(0);
      _actions = new ActionSchemaArray(0);
      _entity = simple.getEntity();
    }
    else if(resourceSchema.hasActionsSet())
    {
      _type = ResourceType.ACTION_SET;
      ActionsSetSchema actionSet = resourceSchema.getActionsSet();
      _supports = new StringArray(0);
      _methods = new RestMethodSchemaArray(0);
      _finders = new FinderSchemaArray(0);;
      _actions = actionSet.hasActions() ? actionSet.getActions() : new ActionSchemaArray(0);
      _entity = null;
    }
    else
View Full Code Here

TOP

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

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.