ActionSchemaArray entityActions = null;
if (resource.getCollection() != null)
{
resourceSchemaClass = CollectionSchema.class;
CollectionSchema collection = resource.getCollection();
String keyName = collection.getIdentifier().getName();
// In case of collection with a simple key, return the one specified by "type" in
// the "identifier". Otherwise, get both "type" and "params", and return
// ComplexKeyResource parameterized by those two.
if (collection.getIdentifier().getParams() == null)
{
keyClass = getJavaBindingType(collection.getIdentifier().getType(), facadeClass).valueClass;
JClass declaredClass = getClassRefForSchema(RestSpecCodec.textToSchema(collection.getIdentifier().getType(), getSchemaResolver()), facadeClass);
if(!declaredClass.equals(keyClass))
{
keyTyperefClass = declaredClass;
}
}
else
{
keyKeyClass = getJavaBindingType(collection.getIdentifier().getType(), facadeClass).valueClass;
keyParamsClass = getJavaBindingType(collection.getIdentifier().getParams(), facadeClass).valueClass;
keyClass = getCodeModel().ref(ComplexResourceKey.class).narrow(keyKeyClass, keyParamsClass);
}
pathKeyTypes.put(keyName, keyClass);
supportsList = collection.getSupports();
restMethods = collection.getMethods();
finders = collection.getFinders();
subresources = collection.getEntity().getSubresources();
resourceActions = collection.getActions();
entityActions = collection.getEntity().getActions();
}
else if (resource.getAssociation() != null)
{
resourceSchemaClass = AssociationSchema.class;
AssociationSchema association = resource.getAssociation();