Package com.linkedin.restli.restspec

Examples of com.linkedin.restli.restspec.FinderSchemaArray


    compareActions(actual, expected, actions);

    ActionSchemaArray entityActions = resourceSchema.getEntityActions();
    compareActions(actual, expected, entityActions);

    FinderSchemaArray finders = resourceSchema.getFinders();
    for (FinderSchema finder : finders)
    {
      compareParameters(actual.getRequestMetadata(finder.getName()), expected.getRequestMetadata(finder.getName()));
    }
  }
View Full Code Here


  @Test
  public void test() throws IOException
  {
    final String findersFilename = IDLS_DIR + FINDERS_FILE;
    final ResourceSchema findersIdl = _codec.readResourceSchema(new FileInputStream(findersFilename));
    final FinderSchemaArray finders = findersIdl.getCollection().getFinders();

    for (FinderSchema finder : finders)
    {
      if ("searchWithoutMetadata".equals(finder.getName()))
      {
View Full Code Here

    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;

    if (resource.getCollection() != null)
View Full Code Here

      appendKeys(associationSchema, collectionModel);
    }

    appendSupportsNodeToCollectionSchema(collectionSchema, collectionModel);
    appendMethodsToCollectionSchema(collectionSchema, collectionModel);
    FinderSchemaArray finders = createFinders(collectionModel);
    if (finders.size() > 0)
    {
      collectionSchema.setFinders(finders);
    }
    ActionSchemaArray actions = createActions(collectionModel, ResourceLevel.COLLECTION);
    if (actions.size() > 0)
View Full Code Here

    return deprecatedAnnotation;
  }

  private FinderSchemaArray createFinders(final ResourceModel resourceModel)
  {
    FinderSchemaArray findersArray = new FinderSchemaArray();

    List<ResourceMethodDescriptor> resourceMethodDescriptors =
        resourceModel.getResourceMethodDescriptors();
    Collections.sort(resourceMethodDescriptors, new Comparator<ResourceMethodDescriptor>()
    {
      @Override
      public int compare(final ResourceMethodDescriptor o1, final ResourceMethodDescriptor o2)
      {
        if (o1.getFinderName() == null)
        {
          return -1;
        }
        else if (o2.getFinderName() == null)
        {
          return 1;
        }

        return o1.getFinderName().compareTo(o2.getFinderName());
      }
    });

    for (ResourceMethodDescriptor resourceMethodDescriptor : resourceMethodDescriptors)
    {
      if (ResourceMethod.FINDER.equals(resourceMethodDescriptor.getType()))
      {
        FinderSchema finder = new FinderSchema();

        finder.setName(resourceMethodDescriptor.getFinderName());

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

        ParameterSchemaArray parameters = createParameters(resourceMethodDescriptor);
        if (parameters.size() > 0)
        {
          finder.setParameters(parameters);
        }
        StringArray assocKeys = createAssocKeyParameters(resourceMethodDescriptor);
        if (assocKeys.size() > 0)
        {
          finder.setAssocKeys(assocKeys);
        }
        if (resourceMethodDescriptor.getFinderMetadataType() != null)
        {
          Class<?> metadataType = resourceMethodDescriptor.getFinderMetadataType();
          MetadataSchema metadataSchema = new MetadataSchema();
          metadataSchema.setType(buildDataSchemaType(metadataType));
          finder.setMetadata(metadataSchema);
        }

        final DataMap customAnnotation = resourceMethodDescriptor.getCustomAnnotationData();

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

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

        findersArray.add(finder);
      }
    }
    return findersArray;
  }
View Full Code Here

  private static FinderSchema findFinder(ResourceSchema resourceSchema, String finderName)
  {
    final CollectionSchema collectionSchema = resourceSchema.getCollection();
    if (collectionSchema != null)
    {
      final FinderSchemaArray finders = collectionSchema.getFinders();
      if (finders != null)
      {
        for (FinderSchema finderSchema: finders)
        {
          if (finderSchema.getName().equals(finderName))
          {
            return finderSchema;
          }
        }
      }
    }

    final AssociationSchema associationSchema = resourceSchema.getAssociation();
    if (associationSchema != null)
    {
      final FinderSchemaArray finders = associationSchema.getFinders();
      if (finders != null)
      {
        for (FinderSchema finderSchema: finders)
        {
          if (finderSchema.getName().equals(finderName))
View Full Code Here

    {
      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.FinderSchemaArray

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.