private Tuple <ActionWrapper, NakedObjectSpecification, NakedObjectActionParameter> GetActionParameterTypeInternal(string typeName, string actionName, string parmName)
        {
            if (string.IsNullOrEmpty(typeName.Trim()) || string.IsNullOrWhiteSpace(actionName.Trim()) || string.IsNullOrWhiteSpace(parmName.Trim()))
            {
                throw new BadRequestNOSException();
            }

            NakedObjectSpecification spec = [email protected]().loadSpecification(typeName);

            if (spec is NoMemberSpecification)
            {
                throw new TypeResourceNotFoundNOSException(typeName);
            }

            ActionWrapper action = spec.GetActionLeafNodes().SingleOrDefault(p => p.getId() == actionName);

            if (action == null)
            {
                throw new ActionResourceNotFoundNOSException(actionName);
            }

            NakedObjectActionParameter parm = action.GetParameters().SingleOrDefault(p => p.getId() == parmName);

            if (parm == null)
            {
                throw new ActionResourceNotFoundNOSException(parmName);
            }

            return(new Tuple <ActionWrapper, NakedObjectSpecification, NakedObjectActionParameter>(action, spec, parm));
        }
        private static Tuple <ActionContext, NakedObjectSpecification> GetActionTypeInternal(string typeName, string actionName)
        {
            if (string.IsNullOrEmpty(typeName.Trim()) || string.IsNullOrWhiteSpace(actionName.Trim()))
            {
                throw new BadRequestNOSException();
            }

            NakedObjectSpecification spec = [email protected]().loadSpecification(typeName);

            if (spec is NoMemberSpecification)
            {
                throw new TypeResourceNotFoundNOSException(typeName);
            }

            ActionWrapper action = spec.GetActionLeafNodes().SingleOrDefault(p => p.getId() == actionName);

            if (action == null)
            {
                throw new ActionResourceNotFoundNOSException(actionName);
            }

            var actionContext = new ActionContext {
                Action = action
            };

            return(new Tuple <ActionContext, NakedObjectSpecification>(actionContext, spec));
        }
Example #3
0
 public IActionFacade[] GetActionLeafNodes()
 {
     return(spec.GetActionLeafNodes().Select(a => new ActionFacade(a, target, FrameworkFacade)).Cast <IActionFacade>().OrderBy(a => a.Id).ToArray());
 }