internal static Resources.ProcessResourceView GetResource( EastFive.Azure.ProcessResourceView view, AzureApplication application, IProvideUrl url) { return(new Resources.ProcessResourceView { Id = url.GetWebId <ProcessResourceView>(view.processViewId), //Actor = application.GetActorLink(view.actorId, url), //Resource = application.GetResourceLink(view.resourceType, view.resourceId, url), ResourceType = application.GetResourceMime(view.resourceType), CurrentProcessStep = url.GetWebId <ProcessStep>(view.currentProcessStepId), Titles = view.titles, Completions = view.completions, Invalidations = view.invalidations, ResourcesDisplayed = view.displayResources, ResourcesProvided = view.resourcesProvided .Select( resourceProvided => new Resources.ProcessResourceView.ConfirmableResource { Key = resourceProvided.key, //Resource = application.GetResourceLink(resourceProvided.type, resourceProvided.resourceId, url), Type = application.GetResourceMime(resourceProvided.type), }) .ToArray(), NextStages = view.nextStages .Select(nextStageId => url.GetWebId <Resources.ProcessStage>(nextStageId.processStageId)) .ToArray(), Editable = view.editable, Completable = view.completable, }); }
internal static Resources.ProcessStageType GetResource( EastFive.Azure.ProcessStageType processStageType, IProvideUrl urlHelper) { return(new Resources.ProcessStageType { Id = urlHelper.GetWebId <EastFive.Api.Azure.Resources.ProcessStageType>(processStageType.processStageTypeId), Group = urlHelper.GetWebId <EastFive.Api.Azure.Resources.ProcessStageGroup>(processStageType.processStageGroupId), Title = processStageType.title, ResourceType = processStageType.resourceType.GetCustomAttribute <EastFive.Api.HttpResourceAttribute, string>( attr => attr.ResourceName, () => processStageType.resourceType.AssemblyQualifiedName), ResourceTypes = processStageType.resourceKeys .SelectValues( type => processStageType.resourceType.GetCustomAttribute <EastFive.Api.HttpResourceAttribute, string>( attr => attr.ResourceName, () => processStageType.resourceType.AssemblyQualifiedName)) .ToArray(), ResourceKeys = processStageType.resourceKeys .SelectKeys() .ToArray(), }); }
internal static Resources.ProcessStage GetResource(EastFive.Azure.ProcessStage processStage, IProvideUrl url) { return(new Resources.ProcessStage { Id = url.GetWebId <ProcessStage>(processStage.processStageId), Owner = Library.configurationManager.GetActorLink(processStage.ownerId, url), Title = processStage.title, Type = url.GetWebId <ProcessStageType>(processStage.processStageTypeId), Confirmable = processStage.confirmableIds .Select( confirmableKvp => new Resources.ProcessStage.ConfirmableResource { Positions = confirmableKvp.Key .Select(actorId => Library.configurationManager.GetActorLink(actorId, url)) .ToArray(), ProcessStageNext = url.GetWebId <ProcessStage>(confirmableKvp.Value), }) .ToArray(), Editable = processStage.editableIds .Select(actorId => Library.configurationManager.GetActorLink(actorId, url)) .ToArray(), Completable = processStage.completableIds .Select(actorId => Library.configurationManager.GetActorLink(actorId, url)) .ToArray(), Viewable = processStage.viewableIds .Select(actorId => Library.configurationManager.GetActorLink(actorId, url)) .ToArray(), }); }
public static IHttpResponse FindAsync( //Security security, HttpApplication application, IHttpRequest request, IProvideUrl url, ContentTypeResponse <WebIdManifest> onFound, ContentTypeResponse <Api.Resources.Manifest> onContent, ViewFileResponse <Api.Resources.Manifest> onHtml) { if (request.GetAcceptTypes().Where(accept => accept.MediaType.ToLower().Contains("html")).Any()) { return(HtmlContent(application, request, url, onHtml)); } LocateControllers(); var endpoints = Manifest.lookup .Select( type => { var endpoint = url.GetWebId(type, "x-com.orderowl:ordering"); return(endpoint); }) .ToArray(); var manifest = new WebIdManifest() { Id = Guid.NewGuid(), Endpoints = endpoints, }; return(onFound(manifest)); }
public static WebId GetWebId <TController>(this IProvideUrl url, Guid?idMaybe, string routeName = "DefaultApi") { if (!idMaybe.HasValue) { return(default(WebId)); } return(url.GetWebId <TController>(idMaybe.Value, routeName)); }
internal static Resources.ProcessStep GetResource(EastFive.Azure.Process process, AzureApplication httpApplication, IProvideUrl urlHelper) { return(new Resources.ProcessStep { Id = urlHelper.GetWebId <ProcessStep>(process.processId), Stage = urlHelper.GetWebId <EastFive.Api.Azure.Resources.ProcessStage>(process.processStageId), //Resource = httpApplication.GetResourceLink(process.resourceType, process.resourceId, urlHelper), CreatedOn = process.createdOn, ConfirmedBy = process.confirmedBy.HasValue ? EastFive.Security.SessionServer.Library.configurationManager.GetActorLink(process.confirmedBy.Value, urlHelper) : default(WebId), ConfirmedWhen = process.confirmedWhen, Previous = urlHelper.GetWebId <ProcessStep>(process.previousStep), //Resources = process.resources // .Select(resource => httpApplication.GetResourceLink(process.resourceType, resource.resourceId, urlHelper)) // .ToArray(), ResourceKeys = process.resources .Select(resource => (resource.key)) .ToArray(), }); }