protected InlineActionRepresentation(IOidStrategy oidStrategy, AbstractActionRepresentationStrategy strategy)
     : base(oidStrategy, strategy.GetFlags())
 {
     MemberType = MemberTypes.Action;
     Id         = strategy.GetId();
     Links      = strategy.GetLinks();
     Extensions = strategy.GetExtensions();
     SetHeader(strategy.GetTarget());
 }
Exemple #2
0
 protected ActionRepresentation(IOidStrategy oidStrategy, AbstractActionRepresentationStrategy strategy)
     : base(oidStrategy, strategy.GetFlags())
 {
     SelfRelType = strategy.GetSelf();
     Id          = strategy.GetId();
     Parameters  = strategy.GetParameters();
     Links       = strategy.GetLinks();
     Extensions  = strategy.GetExtensions();
     SetHeader(strategy.GetTarget());
 }
        public static InlineActionRepresentation Create(IOidStrategy oidStrategy, HttpRequest req, ActionContextFacade actionContext, RestControlFlags flags)
        {
            var consent = actionContext.Action.IsUsable(actionContext.Target);

            var strategy  = AbstractActionRepresentationStrategy.GetStrategy(true, oidStrategy, req, actionContext, flags);
            var optionals = new List <OptionalProperty>();

            if (consent.IsVetoed)
            {
                optionals.Add(new OptionalProperty(JsonPropertyNames.DisabledReason, consent.Reason));
            }

            if (strategy.ShowParameters())
            {
                optionals.Add(new OptionalProperty(JsonPropertyNames.Parameters, strategy.GetParameters()));
            }

            return(optionals.Any()
                ? CreateWithOptionals <InlineActionRepresentation>(new object[] { oidStrategy, strategy }, optionals)
                : new InlineActionRepresentation(oidStrategy, strategy));
        }
Exemple #4
0
        public static ActionRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, ActionContextFacade actionContext, RestControlFlags flags)
        {
            var actionRepresentationStrategy = AbstractActionRepresentationStrategy.GetStrategy(false, oidStrategy, req, actionContext, flags);

            return(new ActionRepresentation(oidStrategy, actionRepresentationStrategy));
        }