public string GetParameterId(IActionFacade actionFacade, IActionParameterFacade parameterFacade) { IActionParameterSpec parameter = parameterFacade.WrappedSpec(); IActionSpec action = actionFacade.WrappedSpec(); return(action.OnSpec.ShortName + Sep + action.Id + Sep + NameUtils.CapitalizeName(parameter.Id)); }
public string GetFindMenuId(IObjectFacade objectFacade, IActionFacade actionFacade, string propertyName) { IActionSpec action = actionFacade == null ? null : actionFacade.WrappedSpec(); string contextActionName = action == null ? "" : Sep + action.Id; return(GetObjectId(objectFacade) + contextActionName + Sep + NameUtils.CapitalizeName(propertyName) + Sep + IdConstants.FindMenuName); }
public NamedFacetInferred(string value, ISpecification holder) : base(value, holder) { ShortName = TypeNameUtils.GetShortName(value); CapitalizedName = NameUtils.CapitalizeName(ShortName); SimpleName = NameUtils.SimpleName(ShortName); NaturalName = NameUtils.NaturalName(ShortName); }
internal static string GetActionId(ActionContext targetActionContext, ActionContext actionContext, string propertyName) { string contextActionName = actionContext.Action == null ? "" : actionContext.Action.Id + sep; string contextNakedObjectId = actionContext.Target == null || actionContext.Target == targetActionContext.Target ? "" : GetObjectId(actionContext.Target) + sep; string propertyId = string.IsNullOrEmpty(propertyName) ? "" : NameUtils.CapitalizeName(propertyName) + sep; return(contextNakedObjectId + contextActionName + propertyId + GetObjectId(targetActionContext.Target) + sep + targetActionContext.Action.Id); }
public override void Process(IReflector reflector, MethodInfo actionMethod, IMethodRemover methodRemover, ISpecificationBuilder action) { string capitalizedName = NameUtils.CapitalizeName(actionMethod.Name); Type type = actionMethod.DeclaringType; var facets = new List <IFacet>(); ITypeSpecBuilder onType = reflector.LoadSpecification(type); var returnSpec = reflector.LoadSpecification <IObjectSpecBuilder>(actionMethod.ReturnType); IObjectSpecImmutable elementSpec = null; bool isQueryable = IsQueryOnly(actionMethod) || CollectionUtils.IsQueryable(actionMethod.ReturnType); if (returnSpec != null && returnSpec.IsCollection) { Type elementType = CollectionUtils.ElementType(actionMethod.ReturnType); elementSpec = reflector.LoadSpecification <IObjectSpecImmutable>(elementType); } RemoveMethod(methodRemover, actionMethod); facets.Add(new ActionInvocationFacetViaMethod(actionMethod, onType, returnSpec, elementSpec, action, isQueryable)); MethodType methodType = actionMethod.IsStatic ? MethodType.Class : MethodType.Object; Type[] paramTypes = actionMethod.GetParameters().Select(p => p.ParameterType).ToArray(); FindAndRemoveValidMethod(reflector, facets, methodRemover, type, methodType, capitalizedName, paramTypes, action); DefaultNamedFacet(facets, actionMethod.Name, action); // must be called after the checkForXxxPrefix methods AddHideForSessionFacetNone(facets, action); AddDisableForSessionFacetNone(facets, action); FindDefaultHideMethod(reflector, facets, methodRemover, type, methodType, "ActionDefault", action); FindAndRemoveHideMethod(reflector, facets, methodRemover, type, methodType, capitalizedName, action); FindDefaultDisableMethod(reflector, facets, methodRemover, type, methodType, "ActionDefault", action); FindAndRemoveDisableMethod(reflector, facets, methodRemover, type, methodType, capitalizedName, action); var actionSpecImmutable = action as IActionSpecImmutable; if (actionSpecImmutable != null) { // Process the action's parameters names, descriptions and optional // an alternative design would be to have another facet factory processing just ActionParameter, and have it remove these // supporting methods. However, the FacetFactory API doesn't allow for methods of the class to be removed while processing // action parameters, only while processing Methods (ie actions) IActionParameterSpecImmutable[] actionParameters = actionSpecImmutable.Parameters; string[] paramNames = actionMethod.GetParameters().Select(p => p.Name).ToArray(); FindAndRemoveParametersAutoCompleteMethod(reflector, methodRemover, type, capitalizedName, paramTypes, actionParameters); FindAndRemoveParametersChoicesMethod(reflector, methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters); FindAndRemoveParametersDefaultsMethod(reflector, methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters); FindAndRemoveParametersValidateMethod(reflector, methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters); } FacetUtils.AddFacets(facets); }
public string GetActionId(string propertyName, IActionFacade actionContextActionFacade, IObjectFacade actionObjectFacade, IObjectFacade targetObjectFacade, IActionFacade targetActionFacade) { IActionSpec actionContextAction = actionContextActionFacade == null ? null : actionContextActionFacade.WrappedSpec(); INakedObjectAdapter actionContextTarget = actionObjectFacade == null ? null : actionObjectFacade.WrappedAdapter(); IActionSpec targetActionContextAction = targetActionFacade == null ? null : targetActionFacade.WrappedSpec(); INakedObjectAdapter targetActionContextTarget = targetObjectFacade == null ? null : targetObjectFacade.WrappedAdapter(); string contextActionName = actionContextAction == null ? "" : actionContextAction.Id + Sep; string contextNakedObjectId = actionContextTarget == null || actionContextTarget == targetActionContextTarget ? "" : GetObjectId(actionObjectFacade) + Sep; string propertyId = string.IsNullOrEmpty(propertyName) ? "" : NameUtils.CapitalizeName(propertyName) + Sep; return(contextNakedObjectId + contextActionName + propertyId + GetObjectId(targetObjectFacade) + Sep + targetActionContextAction.Id); }
public static string GetParameterId(IActionSpec action, IActionParameterSpec parameter) { return(action.OnSpec.ShortName + sep + action.Id + sep + NameUtils.CapitalizeName(parameter.Id)); }
public static string GetFindMenuId(INakedObject nakedObject, IActionSpec action, string propertyName) { string contextActionName = action == null ? "" : sep + action.Id; return(GetObjectId(nakedObject) + contextActionName + sep + NameUtils.CapitalizeName(propertyName) + sep + FindMenuName); }