public static MapRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, ContextFacade contextFacade, IList<ContextFacade> contexts, Format format, RestControlFlags flags, MediaTypeHeaderValue mt) {
            var memberValues = contexts.Select(c => new OptionalProperty(c.Id, GetMap(oidStrategy, req, c, flags))).ToList();
            IObjectFacade target = contexts.First().Target;
            MapRepresentation mapRepresentation;

            if (format == Format.Full) {
                var tempProperties = new List<OptionalProperty>();

                if (!string.IsNullOrEmpty(contextFacade?.Reason)) {
                    tempProperties.Add(new OptionalProperty(JsonPropertyNames.XRoInvalidReason, contextFacade.Reason));
                }

                var dt = new OptionalProperty(JsonPropertyNames.DomainType, target.Specification.DomainTypeName(oidStrategy));
                tempProperties.Add(dt);

                var members = new OptionalProperty(JsonPropertyNames.Members, Create(memberValues.ToArray()));
                tempProperties.Add(members);
                mapRepresentation = Create(tempProperties.ToArray());
            }
            else {
                mapRepresentation = Create(memberValues.ToArray());
            }

            mapRepresentation.SetContentType(mt);

            return mapRepresentation;
        }
 protected MemberRepresentationStrategy(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, RestControlFlags flags)
     : base(oidStrategy, flags) {
     Req = req;
     PropertyContext = propertyContext;
     objectUri = new UriMtHelper(oidStrategy, req, propertyContext);
     self = new MemberRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, propertyContext));
 }
 public RestSnapshot(IOidStrategy oidStrategy, MenuContextFacade menus, HttpRequestMessage req, RestControlFlags flags)
     : this(oidStrategy, req, true) {
     populator = () => {
         Representation = ListRepresentation.Create(oidStrategy, menus, req, flags);
         SetHeaders();
     };
 }
 public RestSnapshot(IOidStrategy oidStrategy, ActionResultContextFacade actionResultContext, HttpRequestMessage req, RestControlFlags flags)
     : this(oidStrategy, actionResultContext, req, true) {
     populator = () => {
         Representation = ActionResultRepresentation.Create(oidStrategy, req, actionResultContext, flags);
         SetHeaders();
     };
 }
 protected ParameterRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, IObjectFacade objectFacade, FieldFacadeAdapter parameter, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SetName(parameter);
     SetExtensions(req, objectFacade, parameter, flags);
     SetLinks(req, objectFacade, parameter);
     SetHeader(objectFacade);
 }
 public AttachmentRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SetContentType(propertyContext);
     SetContentDisposition(propertyContext);
     SetStream(propertyContext);
     SetHeader(propertyContext.Target);
 }
        public static InlineCollectionRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, IList<OptionalProperty> optionals, RestControlFlags flags, bool asTableColumn) {
            var collectionRepresentationStrategy = AbstractCollectionRepresentationStrategy.GetStrategy(asTableColumn, true, oidStrategy, req, propertyContext, flags);

            int? size = collectionRepresentationStrategy.GetSize();

            if (size != null) {
                optionals.Add(new OptionalProperty(JsonPropertyNames.Size, size));
            }

            var value = collectionRepresentationStrategy.GetValue();

            if (value != null) {
                optionals.Add(new OptionalProperty(JsonPropertyNames.Value, value));
            }


            var actions = collectionRepresentationStrategy.GetActions();

            if (actions.Length > 0) {
                var members = RestUtils.CreateMap(actions.ToDictionary(m => m.Id, m => (object)m));
                optionals.Add(new OptionalProperty(JsonPropertyNames.Members, members));
            }


            if (optionals.Count == 0) {
                return new InlineCollectionRepresentation(oidStrategy, collectionRepresentationStrategy);
            }
            return CreateWithOptionals<InlineCollectionRepresentation>(new object[] {oidStrategy, collectionRepresentationStrategy}, optionals);
        }
 protected HomePageRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new HomePageRelType(RelValues.Self, new UriMtHelper(oidStrategy, req));
     SetLinks(req);
     SetExtensions();
     SetHeader();
 }
        protected ListRepresentation(IOidStrategy oidStrategy, IObjectFacade list, HttpRequestMessage req, RestControlFlags flags, ActionContextFacade actionContext)
            : base(oidStrategy, flags) {
            Value = list.ToEnumerable().Select(no => CreateObjectLink(oidStrategy, req, no, actionContext)).ToArray();

            SetLinks(req, actionContext);
            SetExtensions(oidStrategy, actionContext);
            SetHeader(false);
        }
 protected ListRepresentation(IOidStrategy oidStrategy, MenuContextFacade menus, HttpRequestMessage req, RestControlFlags flags)
     : base(oidStrategy, flags) {
     Value = menus.List.Where(m => m.MenuItems.Any()).Select(c => CreateMenuLink(oidStrategy, req, c)).ToArray();
     SelfRelType = new ListRelType(RelValues.Self, SegmentValues.Menus, new UriMtHelper(oidStrategy, req, menus.ElementType));
     SetLinks(req);
     SetExtensions();
     SetHeader(true);
 }
 protected ListRepresentation(IOidStrategy oidStrategy, ListContextFacade listContext, HttpRequestMessage req, RestControlFlags flags)
     : base(oidStrategy, flags) {
     Value = listContext.List.Select(c => CreateObjectLink(oidStrategy, req, c)).ToArray();
     SelfRelType = new ListRelType(RelValues.Self, SegmentValues.Services, new UriMtHelper(oidStrategy, req, listContext.ElementType));
     SetLinks(req);
     SetExtensions();
     SetHeader(listContext.IsListOfServices);
 }
 public RestSnapshot(IOidStrategy oidStrategy, IMenuFacade menu, HttpRequestMessage req, RestControlFlags flags, HttpStatusCode httpStatusCode = HttpStatusCode.OK)
     : this(oidStrategy, req, true) {
     populator = () => {
         HttpStatusCode = httpStatusCode;
         Representation = MenuRepresentation.Create(oidStrategy, menu, req, flags);
         SetHeaders();
     };
 }
 protected TypeActionInvokeRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, TypeActionInvokeContext context, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new TypeActionInvokeRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, context));
     SetScalars(context);
     SetLinks(req, context);
     SetExtensions();
     SetHeader();
 }
 protected ActionResultRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, ActionResultContextFacade actionResult, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new ActionResultRelType(RelValues.Self, new UriMtHelper(OidStrategy, req, actionResult.ActionContext));
     SetResultType(actionResult);
     SetLinks(req, actionResult);
     SetExtensions(actionResult);
     SetHeader(actionResult);
 }
 private UserRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, IPrincipal user, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new UserRelType(RelValues.Self, new UriMtHelper(oidStrategy, req));
     SetLinks(new HomePageRelType(RelValues.Up, new UriMtHelper(oidStrategy, req)));
     SetScalars(user);
     SetExtensions();
     SetHeader();
 }
 public RestSnapshot(IOidStrategy oidStrategy, ObjectContextFacade objectContext, HttpRequestMessage req, RestControlFlags flags, HttpStatusCode httpStatusCode = HttpStatusCode.OK)
     : this(oidStrategy, objectContext, req, true) {
     populator = () => {
         HttpStatusCode = httpStatusCode;
         Representation = ObjectRepresentation.Create(oidStrategy, objectContext, req, flags);
         SetHeaders();
     };
 }
 protected PromptRepresentation(IOidStrategy oidStrategy, PropertyContextFacade propertyContext, HttpRequestMessage req, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SetScalars(propertyContext.Property.Id);
     SetChoices(propertyContext, req);
     SelfRelType = new PromptRelType(RelValues.Self, GetSelfHelper(oidStrategy, propertyContext, req));
     SetLinks(req, propertyContext.Completions.ElementType, new ObjectRelType(RelValues.Up, GetParentHelper(oidStrategy, propertyContext, req)));
     SetExtensions();
     SetHeader(propertyContext.Completions.IsListOfServices);
 }
 protected ObjectRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, ObjectContextFacade objectContext, RestControlFlags flags)
     : base(oidStrategy, flags) {
     var objectUri = GetHelper(oidStrategy, req, objectContext);
     SetScalars(objectContext);
     SelfRelType = objectContext.Specification.IsService ? new ServiceRelType(RelValues.Self, objectUri) : new ObjectRelType(RelValues.Self, objectUri);
     SetLinksAndMembers(req, objectContext);
     SetExtensions(objectContext.Target);
     SetHeader(objectContext);
 }
 private VersionRepresentation(IOidStrategy oidStrategy, HttpRequestMessage req, IDictionary<string, string> capabilitiesMap, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SelfRelType = new VersionRelType(RelValues.Self, new UriMtHelper(oidStrategy, req));
     SetScalars();
     SetLinks(new HomePageRelType(RelValues.Up, new UriMtHelper(oidStrategy, req)));
     SetOptionalCapabilities(capabilitiesMap);
     SetExtensions();
     SetHeader();
 }
 protected CollectionValueRepresentation(IOidStrategy oidStrategy, PropertyContextFacade propertyContext, HttpRequestMessage req, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SetScalars(propertyContext);
     SetValue(propertyContext, req, flags);
     SelfRelType = new CollectionValueRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, propertyContext));
     SetLinks(req, propertyContext, new ObjectRelType(RelValues.Up, new UriMtHelper(oidStrategy, req, propertyContext.Target)));
     SetExtensions();
     SetHeader(propertyContext.Target);
 }
        public static PropertyRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, IList<OptionalProperty> optionals, RestControlFlags flags) {
            var strategy = AbstractPropertyRepresentationStrategy.GetStrategy(false, oidStrategy, req, propertyContext, flags);

            if (!RestUtils.IsBlobOrClob(propertyContext.Specification) && !RestUtils.IsAttachment(propertyContext.Specification)) {
                optionals.Add(new OptionalProperty(JsonPropertyNames.Value, strategy.GetPropertyValue(oidStrategy, req, propertyContext.Property, propertyContext.Target, flags, false, strategy.UseDateOverDateTime())));
            }

            RestUtils.AddChoices(oidStrategy, req, propertyContext, optionals, flags);
            
            return CreateWithOptionals<PropertyRepresentation>(new object[] {oidStrategy, strategy}, optionals);
        }
 protected PromptRepresentation(IOidStrategy oidStrategy, ParameterContextFacade parmContext, HttpRequestMessage req, RestControlFlags flags)
     : base(oidStrategy, flags) {
     SetScalars(parmContext.Id);
     SetChoices(parmContext, req);
     SelfRelType = new PromptRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, parmContext));
     var helper = new UriMtHelper(oidStrategy, req, parmContext.Target);
     ObjectRelType parentRelType = parmContext.Target.Specification.IsService ? new ServiceRelType(RelValues.Up, helper) : new ObjectRelType(RelValues.Up, helper);
     SetLinks(req, parmContext.Completions.ElementType, parentRelType);
     SetExtensions();
     SetHeader(parmContext.Completions.IsListOfServices);
 }
        public static InlineMemberAbstractRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, PropertyContextFacade propertyContext, RestControlFlags flags, bool asTableColumn) {
            IConsentFacade consent = propertyContext.Property.IsUsable(propertyContext.Target);
            var optionals = new List<OptionalProperty>();
            if (consent.IsVetoed) {
                optionals.Add(new OptionalProperty(JsonPropertyNames.DisabledReason, consent.Reason));
            }

            if (propertyContext.Property.IsCollection) {
                return InlineCollectionRepresentation.Create(oidStrategy, req, propertyContext, optionals, flags, asTableColumn);
            }

            return InlinePropertyRepresentation.Create(oidStrategy, req, propertyContext, optionals, flags);
        }
        private void SetExtensions(HttpRequestMessage req, IObjectFacade objectFacade, FieldFacadeAdapter parameter, RestControlFlags flags) {
            IDictionary<string, object> custom = null;

            if (IsUnconditionalChoices(parameter)) {
                custom = new Dictionary<string, object>();

                Tuple<IObjectFacade, string>[] choices = parameter.GetChoicesAndTitles(objectFacade, null);
                Tuple<object, string>[] choicesArray = choices.Select(tuple => new Tuple<object, string>(parameter.GetChoiceValue(OidStrategy, req, tuple.Item1, flags), tuple.Item2)).ToArray();

                OptionalProperty[] op = choicesArray.Select(tuple => new OptionalProperty(tuple.Item2, tuple.Item1)).ToArray();
                MapRepresentation map = MapRepresentation.Create(op);
                custom[JsonPropertyNames.CustomChoices] = map;
            }

            string mask = parameter.Mask;

            if (!string.IsNullOrWhiteSpace(mask)) {
                custom = custom ?? new Dictionary<string, object>();
                custom[JsonPropertyNames.CustomMask] = mask;
            }

            var multipleLines = parameter.NumberOfLines;

            if (multipleLines > 1) {
                custom = custom ?? new Dictionary<string, object>();
                custom[JsonPropertyNames.CustomMultipleLines] = multipleLines;
            }

            custom = RestUtils.AddRangeExtension(parameter.AsField, custom);

            Extensions = RestUtils.GetExtensions(friendlyname: parameter.Name,
                                                  description: parameter.Description,
                                                  pluralName: null,
                                                  domainType: null,
                                                  isService: null,
                                                  hasParams: null,
                                                  optional: !parameter.IsMandatory,
                                                  maxLength: parameter.MaxLength,
                                                  pattern: parameter.Pattern,
                                                  memberOrder: null,
                                                  dataType: parameter.DataType,
                                                  presentationHint: parameter.PresentationHint,
                                                  customExtensions: custom,
                                                  returnType: parameter.Specification,
                                                  elementType: parameter.ElementType,
                                                  oidStrategy: OidStrategy,
                                                  useDateOverDateTime: true);
        }
        // custom extension for pagination 
        private void SetPagination(IObjectFacade list, RestControlFlags flags, ActionContextFacade actionContext) {
            Pagination = new MapRepresentation();

            var totalCount = list.Count();
            var pageSize = PageSize(flags, actionContext);
            var page = flags.Page;
            var numPages = (int) Math.Round(totalCount/(decimal) pageSize + 0.5m);
            numPages = numPages == 0 ? 1 : numPages;

            var exts = new Dictionary<string, object> {
                {JsonPropertyNames.Page, page},
                {JsonPropertyNames.PageSize, pageSize},
                {JsonPropertyNames.NumPages, numPages},
                {JsonPropertyNames.TotalCount, totalCount}
            };

            Pagination = RestUtils.CreateMap(exts);
        }
        private static MapRepresentation GetMap(IOidStrategy oidStrategy, HttpRequestMessage req, ContextFacade context, RestControlFlags flags) {
            MapRepresentation value;

            // All reasons why we cannot create a linkrep
            if (context.Specification.IsCollection && context.ElementSpecification != null && !context.ElementSpecification.IsParseable) {
                var proposedObjectFacade = oidStrategy.FrameworkFacade.GetObject(context.ProposedValue);
                var coll = proposedObjectFacade.ToEnumerable().Select(no => CreateObjectRef(oidStrategy, req, no, flags)).ToArray();
                value = CreateMap(context, coll);
            }
            else if (context.Specification.IsParseable ||
                     context.ProposedValue == null ||
                     context.ProposedObjectFacade == null ||
                     context.ProposedObjectFacade.Specification.IsParseable) {
                value = CreateMap(context, context.ProposedValue);
            }
            else {
                value = CreateMap(context, RefValueRepresentation.Create(oidStrategy, new ObjectRelType(RelValues.Self, new UriMtHelper(oidStrategy, req, context.ProposedObjectFacade)), flags));
            }
            return value;
        }
        public static InlineActionRepresentation Create(IOidStrategy oidStrategy, HttpRequestMessage req, ActionContextFacade actionContext, RestControlFlags flags) {
            IConsentFacade 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()));
            }

            if (optionals.Any()) {
                return CreateWithOptionals<InlineActionRepresentation>(new object[] { oidStrategy, strategy }, optionals);
            }

            return new InlineActionRepresentation(oidStrategy, strategy);
        }
Example #28
0
 private string GetParameterValue(RestControlFlags flags, ITypeFacade parameterValueSpec)
 {
     return(RestUtils.SpecToPredefinedTypeString(parameterValueSpec, oidStrategy));
 }
 public RestSnapshot(IOidStrategy oidStrategy, MenuContextFacade menus, HttpRequest req, RestControlFlags flags)
     : this(oidStrategy, req, true)
 {
     populator = logger => {
         Representation = ListRepresentation.Create(oidStrategy, menus, req, flags);
         SetHeaders(logger);
     };
 }
Example #30
0
 public static Func <RestSnapshot> VersionSnapshot(IOidStrategy oidStrategy, Func <IDictionary <string, string> > capabilities, HttpRequest req, RestControlFlags flags)
 => () => new RestSnapshot(oidStrategy, capabilities(), req, flags);
        public static object GetChoiceValue(IOidStrategy oidStrategy, IObjectFacade item, Func <ChoiceRelType> relType, RestControlFlags flags)
        {
            var title = SafeGetTitle(item);
            var value = ObjectToPredefinedType(item.Object);

            return(item.Specification.IsParseable ? value : LinkRepresentation.Create(oidStrategy, relType(), flags, new OptionalProperty(JsonPropertyNames.Title, title)));
        }
Example #32
0
 public override MediaTypeHeaderValue GetMediaType(RestControlFlags flags) => UriMtHelper.GetJsonMediaType(UriMtHelper.GetMenuMediaType());
 public BadPersistArgumentsException(string message, ObjectContextFacade context, IList <ContextFacade> contexts, RestControlFlags flags) : base(message, context, contexts)
 {
     Flags = flags;
 }
Example #34
0
 public static Func <RestSnapshot> MenusSnapshot(IOidStrategy oidStrategy, Func <MenuContextFacade> menus, HttpRequest req, RestControlFlags flags)
 => () => new RestSnapshot(oidStrategy, menus(), req, flags);
 public RestSnapshot(IOidStrategy oidStrategy, IPrincipal user, HttpRequest req, RestControlFlags flags)
     : this(oidStrategy, req, true)
 {
     populator = logger => {
         Representation = UserRepresentation.Create(oidStrategy, req, user, flags);
         SetHeaders(logger);
     };
 }
 public override MediaTypeHeaderValue GetMediaType(RestControlFlags flags) {
     MediaTypeHeaderValue mediaType = UriMtHelper.GetJsonMediaType(Helper.GetMemberMediaType());
     Helper.AddObjectCollectionRepresentationParameter(mediaType, flags);
     return mediaType;
 }
Example #37
0
        public void AddActionResultRepresentationParameter(MediaTypeHeaderValue mediaType, RestControlFlags flags)
        {
            ITypeFacade resultSpec         = action.ReturnType;
            bool        isCollection       = resultSpec.IsCollection && !resultSpec.IsParseable;
            ITypeFacade parameterValueSpec = isCollection ? action.ElementType : resultSpec;
            string      parameterValue     = GetParameterValue(flags, parameterValueSpec);

            if (parameterValue != null)
            {
                string parameterType = isCollection ? RestControlFlags.ElementTypeReserved : RestControlFlags.DomainTypeReserved;
                mediaType.Parameters.Add(new NameValueHeaderValue(parameterType, $"\"{parameterValue}\""));
            }
        }
 public static object GetChoiceValue(IOidStrategy oidStrategy, HttpRequest req, IObjectFacade item, IActionParameterFacade parameter, RestControlFlags flags)
 {
     return(GetChoiceValue(oidStrategy, item, () => new ChoiceRelType(parameter, new UriMtHelper(oidStrategy, req, item)), flags));
 }
Example #39
0
 private string GetParameterValue(RestControlFlags flags, string parameterValue)
 {
     return(parameterValue);
 }
Example #40
0
 public static Func <RestSnapshot> TypeActionSnapshot(IOidStrategy oidStrategy, Func <TypeActionInvokeContext> typeActionInvokeContext, HttpRequest req, RestControlFlags flags)
 => () => new RestSnapshot(oidStrategy, typeActionInvokeContext(), req, flags);
 public override MediaTypeHeaderValue GetMediaType(RestControlFlags flags) => UriMtHelper.GetJsonMediaType(RepresentationTypes.DomainType);
Example #42
0
 public void AddObjectCollectionRepresentationParameter(MediaTypeHeaderValue mediaType, RestControlFlags flags)
 {
     if (assoc != null && assoc.IsCollection)
     {
         string parameterValue = GetParameterValue(flags, assoc.ElementSpecification);
         if (parameterValue != null)
         {
             mediaType.Parameters.Add(new NameValueHeaderValue(RestControlFlags.ElementTypeReserved, $"\"{parameterValue}\""));
         }
     }
 }
Example #43
0
 public override MediaTypeHeaderValue GetMediaType(RestControlFlags flags)
 {
     return(UriMtHelper.GetJsonMediaType(RepresentationTypes.Object));
 }
Example #44
0
 public static Func <RestSnapshot> PropertySnapshot(IOidStrategy oidStrategy, Func <PropertyContextFacade> propertyContext, HttpRequest req, RestControlFlags flags)
 => () => new RestSnapshot(oidStrategy, propertyContext(), req, flags, false);
 public RestSnapshot(IOidStrategy oidStrategy, TypeActionInvokeContext typeActionInvokeContext, HttpRequest req, RestControlFlags flags)
     : this(oidStrategy, req, true)
 {
     populator = logger => {
         Representation = TypeActionInvokeRepresentation.Create(oidStrategy, req, typeActionInvokeContext, flags);
         SetHeaders(logger);
     };
 }
 public static void AddChoices(IOidStrategy oidStrategy, HttpRequest req, PropertyContextFacade propertyContext, IList <OptionalProperty> optionals, RestControlFlags flags)
 {
     if (propertyContext.Property.IsChoicesEnabled != Choices.NotEnabled && !propertyContext.Property.GetChoicesParameters().Any())
     {
         var choices      = propertyContext.Property.GetChoices(propertyContext.Target, null);
         var choicesArray = choices.Select(c => GetChoiceValue(oidStrategy, req, c, propertyContext.Property, flags)).ToArray();
         optionals.Add(new OptionalProperty(JsonPropertyNames.Choices, choicesArray));
     }
 }
 private static void FilterBlobsAndClobs(PropertyContextFacade propertyContext, RestControlFlags flags)
 {
     if (!flags.BlobsClobs)
     {
         if (RestUtils.IsBlobOrClob(propertyContext.Specification) && !RestUtils.IsAttachment(propertyContext.Specification))
         {
             throw new PropertyResourceNotFoundNOSException(propertyContext.Id);
         }
     }
 }
 WithContextNOSException wce when wce.Contexts.Any() => ArgumentsRepresentation.Create(oidStrategy, frameworkFacade, req, wce.Contexts, ArgumentsRepresentation.Format.MembersOnly, RestControlFlags.DefaultFlags(), UriMtHelper.GetJsonMediaType(RepresentationTypes.BadArguments)),
Example #49
0
 public static Func <RestSnapshot> ActionResultSnapshot(IOidStrategy oidStrategy, Func <ActionResultContextFacade> actionResultContext, HttpRequest req, RestControlFlags flags)
 => () => new RestSnapshot(oidStrategy, actionResultContext(), req, flags);
 public RestSnapshot(IOidStrategy oidStrategy, ObjectContextFacade objectContext, HttpRequest req, RestControlFlags flags, HttpStatusCode httpStatusCode = HttpStatusCode.OK)
     : this(oidStrategy, objectContext, req, true)
 {
     populator = logger => {
         HttpStatusCode = httpStatusCode;
         Representation = ObjectRepresentation.Create(oidStrategy, objectContext, req, flags);
         SetHeaders(logger);
     };
 }
Example #51
0
 public static Func <RestSnapshot> CollectionValueSnapshot(IOidStrategy oidStrategy, Func <PropertyContextFacade> propertyContext, HttpRequest req, RestControlFlags flags)
 => () => new RestSnapshot(oidStrategy, propertyContext(), req, flags, true);
 public RestSnapshot(IOidStrategy oidStrategy, IFrameworkFacade frameworkFacade, IMenuFacade menu, HttpRequest req, RestControlFlags flags, HttpStatusCode httpStatusCode = HttpStatusCode.OK)
     : this(oidStrategy, req, true)
 {
     populator = logger => {
         HttpStatusCode = httpStatusCode;
         Representation = MenuRepresentation.Create(oidStrategy, frameworkFacade, menu, req, flags);
         SetHeaders(logger);
     };
 }
Example #53
0
 public static Func <RestSnapshot> PromptSnaphot(IOidStrategy oidStrategy, Func <ParameterContextFacade> parameterContext, HttpRequest req, RestControlFlags flags)
 => () => new RestSnapshot(oidStrategy, parameterContext(), req, flags);
 public RestSnapshot(IOidStrategy oidStrategy, ActionResultContextFacade actionResultContext, HttpRequest req, RestControlFlags flags)
     : this(oidStrategy, actionResultContext, req, true)
 {
     populator = logger => {
         Representation = ActionResultRepresentation.Create(oidStrategy, req, actionResultContext, flags);
         SetHeaders(logger);
     };
 }
 public RestSnapshot(IOidStrategy oidStrategy, ParameterContextFacade parmContext, HttpRequest req, RestControlFlags flags)
     : this(oidStrategy, req, true)
 {
     populator = logger => {
         Representation = PromptRepresentation.Create(oidStrategy, parmContext, req, flags);
         SetHeaders(logger);
     };
 }
Example #56
0
 public override MediaTypeHeaderValue GetMediaType(RestControlFlags flags)
 {
     return(Helper.GetAttachmentMediaType());
 }
 public RestSnapshot(IOidStrategy oidStrategy, ParameterContextFacade parmContext, HttpRequestMessage req, RestControlFlags flags)
     : this(oidStrategy, req, true) {
     populator = () => {
         Representation = PromptRepresentation.Create(oidStrategy, parmContext, req, flags);
         SetHeaders();
     };
 }
        public RestSnapshot(IOidStrategy oidStrategy, PropertyContextFacade propertyContext, HttpRequest req, RestControlFlags flags, bool collectionValue)
            : this(oidStrategy, propertyContext, req, false)
        {
            FilterBlobsAndClobs(propertyContext, flags);
            populator = logger => {
                if (collectionValue)
                {
                    Representation = CollectionValueRepresentation.Create(oidStrategy, propertyContext, req, flags);
                }
                else
                {
                    Representation = RequestingAttachment()
                        ? AttachmentRepresentation.Create(oidStrategy, req, propertyContext, flags)
                        : MemberAbstractRepresentation.Create(oidStrategy, req, propertyContext, flags);
                }

                SetHeaders(logger);
            };
        }
 public FormActionMemberRepresentationStrategy(IOidStrategy oidStrategy, HttpRequestMessage req, ActionContextFacade actionContext, RestControlFlags flags)
     : base(oidStrategy, req, actionContext, flags) {}
 public RestSnapshot(IOidStrategy oidStrategy, IDictionary <string, string> capabilities, HttpRequest req, RestControlFlags flags)
     : this(oidStrategy, req, true)
 {
     populator = logger => {
         Representation = VersionRepresentation.Create(oidStrategy, req, capabilities, flags);
         SetHeaders(logger);
     };
 }