use of com.linkedin.restli.restspec.RestMethodSchema in project rest.li by linkedin.
the class RestLiHTMLDocumentationRenderer method getDoc.
private String getDoc(Object method, boolean isSimpleResourceMethod) {
String doc = null;
if (method instanceof RestMethodSchema) {
final RestMethodSchema restMethodSchema = (RestMethodSchema) method;
doc = restMethodSchema.getDoc();
if (// if no javadoc is supplied, fallback to generic doc string
doc == null || doc.trim().length() == 0) {
if (isSimpleResourceMethod) {
doc = _restMethodDocsMapForSimpleResource.get(restMethodSchema.getMethod());
} else {
doc = _restMethodDocsMapForCollection.get(restMethodSchema.getMethod());
}
if (doc == null) {
log.warn(String.format("No doc string for REST method %s", doc));
}
}
}
return doc;
}
use of com.linkedin.restli.restspec.RestMethodSchema in project rest.li by linkedin.
the class SnapshotGenerator method findModelsCollection.
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()) {
findModelsFinder(restMethodSchema, foundTypes, typeOrder);
}
}
if (collection.hasMethods()) {
for (RestMethodSchema restMethodSchema : collection.getMethods()) {
findModelsMethod(restMethodSchema, foundTypes, typeOrder);
}
}
if (collection.hasActions()) {
for (ActionSchema actionSchema : collection.getActions()) {
findModelsAction(actionSchema, foundTypes, typeOrder);
}
}
if (collection.hasEntity()) {
EntitySchema entity = collection.getEntity();
findModelsEntity(entity, foundTypes, typeOrder);
}
}
}
use of com.linkedin.restli.restspec.RestMethodSchema in project rest.li by linkedin.
the class ResourceModelEncoder method createRestMethods.
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));
}
if (method == ResourceMethod.GET_ALL && descriptor.isPagingSupported()) {
restMethod.setPagingSupported(true);
}
restMethods.add(restMethod);
}
return restMethods;
}
use of com.linkedin.restli.restspec.RestMethodSchema in project rest.li by linkedin.
the class SnapshotGenerator method findModelsAssocation.
private void findModelsAssocation(ResourceSchema resourceSchema, Map<String, NamedDataSchema> foundTypes, List<NamedDataSchema> typeOrder) {
AssociationSchema association = resourceSchema.getAssociation();
if (association != null) {
for (AssocKeySchema assocKeySchema : association.getAssocKeys()) {
String type = assocKeySchema.getType();
recordType(type, foundTypes, typeOrder);
}
if (association.hasFinders()) {
for (FinderSchema restMethodSchema : association.getFinders()) {
findModelsFinder(restMethodSchema, foundTypes, typeOrder);
}
}
if (association.hasMethods()) {
for (RestMethodSchema restMethodSchema : association.getMethods()) {
findModelsMethod(restMethodSchema, foundTypes, typeOrder);
}
}
if (association.hasActions()) {
for (ActionSchema actionSchema : association.getActions()) {
findModelsAction(actionSchema, foundTypes, typeOrder);
}
}
if (association.hasEntity()) {
EntitySchema entitySchema = association.getEntity();
findModelsEntity(entitySchema, foundTypes, typeOrder);
}
}
}
use of com.linkedin.restli.restspec.RestMethodSchema in project rest.li by linkedin.
the class SnapshotGenerator method findModelsSimple.
private void findModelsSimple(ResourceSchema resourceSchema, Map<String, NamedDataSchema> foundTypes, List<NamedDataSchema> typeOrder) {
SimpleSchema simple = resourceSchema.getSimple();
if (simple != null) {
if (simple.hasMethods()) {
for (RestMethodSchema restMethodSchema : simple.getMethods()) {
findModelsMethod(restMethodSchema, foundTypes, typeOrder);
}
}
if (simple.hasActions()) {
for (ActionSchema actionSchema : simple.getActions()) {
findModelsAction(actionSchema, foundTypes, typeOrder);
}
}
if (simple.hasEntity()) {
EntitySchema entity = simple.getEntity();
findModelsEntity(entity, foundTypes, typeOrder);
}
}
}
Aggregations