}
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
{
throw new IllegalArgumentException("Invalid resourceSchema, must be one of: " + EnumSet.allOf(ResourceType.class));
}
if(resourceSchema.hasSimple())
{
SimpleSchema simple = resourceSchema.getSimple();
_entityActions = simple.hasActions() ? simple.getActions() : new ActionSchemaArray(0);
}
else if(_entity != null)
{
_entityActions = _entity.hasActions() ? _entity.getActions() : new ActionSchemaArray(0);
}