Package com.linkedin.restli.restspec

Examples of com.linkedin.restli.restspec.ActionSchema


        FinderSchema finderMethodSchema = (FinderSchema)methodSchema;
        capture = generator.finder(finderMethodSchema.getName());
      }
      else if (methodSchema instanceof ActionSchema)
      {
        ActionSchema actionMethodSchema = (ActionSchema)methodSchema;
        final ResourceLevel resourceLevel = (visitor.getCollectionActions().contains(methodSchema) ?
                                             ResourceLevel.COLLECTION :
                                             ResourceLevel.ENTITY);
        capture = generator.action(actionMethodSchema.getName(), resourceLevel);
      }
      else
      {
        capture = null;
      }
View Full Code Here


        if (resourceMethodDescriptor.getActionResourceLevel() != resourceLevel)
        {
          continue;
        }

        ActionSchema action = new ActionSchema();

        action.setName(resourceMethodDescriptor.getActionName());

        //We have to construct the method doc for the action which includes the action return type
        final String methodDoc = _docsProvider.getMethodDoc(resourceMethodDescriptor.getMethod());
        if (methodDoc != null)
        {
          final StringBuilder methodDocBuilder = new StringBuilder(methodDoc.trim());
          if (methodDocBuilder.length() > 0)
          {
            final String returnDoc = sanitizeDoc(_docsProvider.getReturnDoc(resourceMethodDescriptor.getMethod()));
            if (returnDoc != null && !returnDoc.isEmpty())
            {
              methodDocBuilder.append("\n");
              methodDocBuilder.append("Service Returns: ");
              //Capitalize the first character
              methodDocBuilder.append(returnDoc.substring(0, 1).toUpperCase());
              methodDocBuilder.append(returnDoc.substring(1));
            }
          }
          action.setDoc(methodDocBuilder.toString());
        }

        ParameterSchemaArray parameters = createParameters(resourceMethodDescriptor);
        if (parameters.size() > 0)
        {
          action.setParameters(parameters);
        }

        Class<?> returnType = resourceMethodDescriptor.getActionReturnType();
        if (returnType != Void.TYPE)
        {
          String returnTypeString =
              buildDataSchemaType(returnType,
                                  resourceMethodDescriptor.getActionReturnRecordDataSchema().getField(ActionResponse.VALUE_NAME).getType());
          action.setReturns(returnTypeString);
        }

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

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

        actionsArray.add(action);
      }
    }
View Full Code Here

    return null;
  }

  private static ActionSchema findEntityAction(ResourceSchema resourceSchema, String actionName)
  {
    ActionSchema actionSchema;

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

        buildResourceMethodDescriptorForFinder(name));
  }

  public ExampleRequestResponse action(String name, ResourceLevel resourceLevel)
  {
    ActionSchema actionSchema;
    switch(resourceLevel)
    {
      case COLLECTION:
        actionSchema = _resourceSchema.getAction(name);
        break;
View Full Code Here

TOP

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

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.