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;
}