//Creates a menu based on the definition in the object's Menu method public override void CreateMenu(IMetamodelBuilder metamodel) { var menu = new MenuImpl(metamodel, method.DeclaringType, false, GetMenuName(Spec)); InvokeUtils.InvokeStatic(method, new object[] { menu }); Menu = menu; }
//Creates a menu based on the object's actions and their specified ordering //For backwards compatibility of UI only, it gives the menu an Id of the type name public override void CreateMenu(IMetamodelBuilder metamodel) { if (Spec().Type.FullName.StartsWith("System")) { return; //Menu not relevant, and could cause error below } //The Id is specified as follows purely to facilitate backwards compatibility with existing UI //It is not needed for menus to function string id = null; if (Spec().Service) { id = UniqueShortName(Spec()); } if (!Spec().Service) { id = Spec().ShortName + "-Actions"; } MethodInfo m = GetType().GetMethod("CreateDefaultMenu").MakeGenericMethod(Spec().Type); // possible spec type is generic in which case invoke would fail without this check if (!m.ContainsGenericParameters) { m.Invoke(this, new object[] { metamodel, GetMenuName(Spec()), id }); } }
//Creates a menu based on the object's actions and their specified ordering //For backwards compatibility of UI only, it gives the menu an Id of the type name public override void CreateMenu(IMetamodelBuilder metamodel) { if (TypeUtils.IsSystem(Spec.Type)) return; //Menu not relevant, and could cause error below //The Id is specified as follows purely to facilitate backwards compatibility with existing UI //It is not needed for menus to function string id = Spec is IServiceSpecImmutable ? UniqueShortName(Spec) : Spec.ShortName + "-Actions"; CreateDefaultMenu(metamodel, Spec.Type, GetMenuName(Spec), id); }
private IMetamodelBuilder InstallSpecificationsParallel(Type[] types, IMetamodelBuilder metamodel, IReflectorConfiguration config) { var mm = GetPlaceholders(types); mm = IntrospectPlaceholders(mm); mm.ForEach(i => metamodel.Add(i.Value.Type, i.Value)); return(metamodel); }
//Creates a menu based on the definition in the object's Menu method public override void CreateMenu(IMetamodelBuilder metamodel) { MethodInfo m = GetType().GetMethod("CreateTypedMenu").MakeGenericMethod(method.DeclaringType); var menu = (MenuImpl)m.Invoke(this, new object[] { metamodel, GetMenuName(Spec()) }); InvokeUtils.InvokeStatic(method, new object[] { menu }); Menu = menu; }
private void PopulateAssociatedActions(Type[] services, IMetamodelBuilder metamodel) { var nonServiceSpecs = AllObjectSpecImmutables.OfType <IObjectSpecBuilder>(); foreach (var spec in nonServiceSpecs) { PopulateAssociatedActions(spec, services, metamodel); } }
protected AbstractParallelReflector(IMetamodelBuilder metamodel, IEnumerable <IFacetDecorator> facetDecorators, ILoggerFactory loggerFactory, ILogger <AbstractParallelReflector> logger) { InitialMetamodel = metamodel ?? throw new InitialisationException($"{nameof(metamodel)} is null"); LoggerFactory = loggerFactory ?? throw new InitialisationException($"{nameof(loggerFactory)} is null"); Logger = logger ?? throw new InitialisationException($"{nameof(logger)} is null"); FacetDecoratorSet = new FacetDecoratorSet(facetDecorators.ToArray()); }
private void PopulateAssociatedFunctions(IMetamodelBuilder metamodel) { // todo add facet for this var functions = metamodel.AllSpecifications.Where(IsStatic).ToArray(); var objects = metamodel.AllSpecifications.Where(IsNotStatic).Cast <ITypeSpecBuilder>(); foreach (var spec in objects) { PopulateContributedFunctions(spec, functions, metamodel); } }
public void CreateDefaultMenu(IMetamodelBuilder metamodel, Type type, string menuName, string id) { var menu = new MenuImpl(metamodel, type, false, menuName) { Id = id }; menu.AddRemainingNativeActions(); menu.AddContributedActions(); Menu = menu; }
//Creates a menu based on the object's actions and their specified ordering //For backwards compatibility of UI only, it gives the menu an Id of the type name public override void CreateMenu(IMetamodelBuilder metamodel) { if (TypeUtils.IsSystem(Spec.Type)) { return; //Menu not relevant, and could cause error below } //The Id is specified as follows purely to facilitate backwards compatibility with existing UI //It is not needed for menus to function string id = Spec is IServiceSpecImmutable?UniqueShortName(Spec) : Spec.ShortName + "-Actions"; CreateDefaultMenu(metamodel, Spec.Type, GetMenuName(Spec), id); }
public ModelIntegrator(IMetamodelBuilder metamodelBuilder, IMenuFactory menuFactory, ILogger <ModelIntegrator> logger, ICoreConfiguration coreConfiguration, IObjectReflectorConfiguration objectReflectorConfiguration) { this.metamodelBuilder = metamodelBuilder; this.menuFactory = menuFactory; this.logger = logger; this.coreConfiguration = coreConfiguration; this.objectReflectorConfiguration = objectReflectorConfiguration; }
public ObjectReflector(ObjectFacetFactorySet objectFacetFactorySet, ObjectClassStrategy objectClassStrategy, IMetamodelBuilder metamodel, IObjectReflectorConfiguration objectReflectorConfiguration, IEnumerable <IFacetDecorator> facetDecorators, ILoggerFactory loggerFactory, ILogger <AbstractParallelReflector> logger) : base(metamodel, facetDecorators, loggerFactory, logger) { this.objectReflectorConfiguration = objectReflectorConfiguration; FacetFactorySet = objectFacetFactorySet; ClassStrategy = objectClassStrategy; Order = 1; }
public FunctionalReflector(FunctionalFacetFactorySet functionalFacetFactorySet, FunctionClassStrategy functionClassStrategy, IMetamodelBuilder metamodel, IFunctionalReflectorConfiguration functionalReflectorConfiguration, IEnumerable <IFacetDecorator> facetDecorators, IEnumerable <IFacetFactory> facetFactories, ILoggerFactory loggerFactory, ILogger <AbstractParallelReflector> logger) : base(metamodel, facetDecorators, loggerFactory, logger) { this.functionalReflectorConfiguration = functionalReflectorConfiguration; ClassStrategy = functionClassStrategy; FacetFactorySet = functionalFacetFactorySet; Order = 2; }
public SystemTypeReflector(SystemTypeFacetFactorySet systemTypeFacetFactorySet, SystemTypeClassStrategy systemTypeClassStrategy, IMetamodelBuilder metamodel, ICoreConfiguration coreConfiguration, IEnumerable <IFacetDecorator> facetDecorators, ILoggerFactory loggerFactory, ILogger <AbstractParallelReflector> logger) : base(metamodel, facetDecorators, loggerFactory, logger) { CoreConfiguration = coreConfiguration; FacetFactorySet = systemTypeFacetFactorySet; ClassStrategy = systemTypeClassStrategy; Order = 0; }
public Reflector(IClassStrategy classStrategy, IMetamodelBuilder metamodel, IReflectorConfiguration config, IMenuFactory menuFactory, IEnumerable <IFacetDecorator> facetDecorators, IEnumerable <IFacetFactory> facetFactories, ILoggerFactory loggerFactory, ILogger <Reflector> logger) { ClassStrategy = classStrategy ?? throw new InitialisationException($"{nameof(classStrategy)} is null"); this.metamodel = metamodel ?? throw new InitialisationException($"{nameof(metamodel)} is null"); this.config = config ?? throw new InitialisationException($"{nameof(config)} is null"); this.menuFactory = menuFactory ?? throw new InitialisationException($"{nameof(menuFactory)} is null"); this.loggerFactory = loggerFactory ?? throw new InitialisationException($"{nameof(loggerFactory)} is null"); this.logger = logger ?? throw new InitialisationException($"{nameof(logger)} is null"); facetDecoratorSet = new FacetDecoratorSet(facetDecorators.ToArray()); FacetFactorySet = new FacetFactorySet(facetFactories.ToArray()); }
public Reflector(IClassStrategy classStrategy, IMetamodelBuilder metamodel, IReflectorConfiguration config, IMenuFactory menuFactory, IFacetDecorator[] facetDecorators, IFacetFactory[] facetFactories) { Assert.AssertNotNull(classStrategy); Assert.AssertNotNull(metamodel); Assert.AssertNotNull(config); Assert.AssertNotNull(menuFactory); this.classStrategy = classStrategy; this.metamodel = metamodel; this.config = config; this.menuFactory = menuFactory; facetDecoratorSet = new FacetDecoratorSet(facetDecorators); FacetFactorySet = new FacetFactorySet(facetFactories); }
private void InstallMainMenus(IMetamodelBuilder metamodel) { var menus = config.MainMenus?.Invoke(menuFactory); // Unlike other things specified in config, this one can't be checked when ReflectorConfiguration is constructed. // Allows developer to deliberately not specify any menus if (menus != null) { if (!menus.Any()) { //Catches accidental non-specification of menus throw new ReflectionException(Log.LogAndReturn("No MainMenus specified.")); } foreach (IMenuImmutable menu in menus.OfType <IMenuImmutable>()) { metamodel.AddMainMenu(menu); } } }
public ParallelReflector(IClassStrategy classStrategy, IMetamodelBuilder metamodel, IReflectorConfiguration config, IFunctionalReflectorConfiguration functionalConfig, IMenuFactory menuFactory, IEnumerable <IFacetDecorator> facetDecorators, IEnumerable <IFacetFactory> facetFactories, ILoggerFactory loggerFactory, ILogger <ParallelReflector> logger) { ClassStrategy = classStrategy ?? throw new InitialisationException($"{nameof(classStrategy)} is null"); initialMetamodel = metamodel ?? throw new InitialisationException($"{nameof(metamodel)} is null"); this.config = config ?? throw new InitialisationException($"{nameof(config)} is null"); this.functionalConfig = functionalConfig; this.menuFactory = menuFactory ?? throw new InitialisationException($"{nameof(menuFactory)} is null"); this.loggerFactory = loggerFactory ?? throw new InitialisationException($"{nameof(loggerFactory)} is null"); this.logger = logger ?? throw new InitialisationException($"{nameof(logger)} is null"); facetDecoratorSet = new FacetDecoratorSet(facetDecorators.ToArray()); FacetFactorySet = new FacetFactorySet(facetFactories.Where(f => f.ReflectionTypes.HasFlag(ReflectionType.ObjectOriented)).ToArray()); FunctionalFacetFactorySet = new FacetFactorySet(facetFactories.Where(f => f.ReflectionTypes.HasFlag(ReflectionType.Functional)).ToArray()); }
public abstract void Execute(IMetamodelBuilder metamodelBuilder);
public abstract void CreateMenu(IMetamodelBuilder metamodel);
//Creates a menu based on the definition in the object's Menu method public override void CreateMenu(IMetamodelBuilder metamodel) { var menu = new MenuImpl( metamodel, method.DeclaringType, false, GetMenuName(Spec)); InvokeUtils.InvokeStatic(method, new object[] {menu}); Menu = menu; }
public TypedMenu <T> CreateTypedMenu <T>(IMetamodelBuilder metamodel, string menuName) { return(new TypedMenu <T>(metamodel, false, menuName)); }
public MenuFactory(IMetamodelBuilder metamodel) { this.metamodel = metamodel; }
public void CreateDefaultMenu(IMetamodelBuilder metamodel, Type type, string menuName, string id) { var menu = new MenuImpl(metamodel, type, false, menuName) {Id = id}; menu.AddRemainingNativeActions(); menu.AddContributedActions(); Menu = menu; }
private IMetamodelBuilder InstallSpecifications(Type[] ooTypes, Type[] records, Type[] functions, IMetamodelBuilder metamodel) { // first oo var mm = GetPlaceholders(ooTypes); mm = IntrospectPlaceholders(mm, () => new Introspector(this, FacetFactorySet, loggerFactory.CreateLogger <Introspector>())); // then functional var allFunctionalTypes = records.Union(functions).ToArray(); var mm2 = GetPlaceholders(allFunctionalTypes); if (mm2.Any()) { mm = mm.AddRange(mm2); mm = IntrospectPlaceholders(mm, () => new FunctionalIntrospector(this, FunctionalFacetFactorySet, functions)); } mm.ForEach(i => metamodel.Add(i.Value.Type, i.Value)); return(metamodel); }
private void InstallObjectMenus(IMetamodelBuilder metamodel) { IEnumerable <IMenuFacet> menuFacets = metamodel.AllSpecifications.Where(s => s.ContainsFacet <IMenuFacet>()).Select(s => s.GetFacet <IMenuFacet>()); menuFacets.ForEach(mf => mf.CreateMenu(metamodel)); }
private void PopulateAssociatedActions(IObjectSpecBuilder spec, Type[] services, IMetamodelBuilder metamodel) { if (string.IsNullOrWhiteSpace(spec.FullName)) { string id = (spec.Identifier != null ? spec.Identifier.ClassName : "unknown") ?? "unknown"; Log.WarnFormat("Specification with id : {0} as has null or empty name", id); } if (TypeUtils.IsSystem(spec.FullName) && !spec.IsCollection) { return; } if (TypeUtils.IsNakedObjects(spec.FullName)) { return; } PopulateContributedActions(spec, services, metamodel); //PopulateFinderActions(spec, services, metamodel); }
private void PopulateAssociatedActions(Type[] services, IMetamodelBuilder metamodel) { IEnumerable <IObjectSpecBuilder> nonServiceSpecs = AllObjectSpecImmutables.OfType <IObjectSpecBuilder>(); nonServiceSpecs.ForEach(s => PopulateAssociatedActions(s, services, metamodel)); }
public ModelBuilder(IEnumerable <IReflector> reflectors, IModelIntegrator integrator, IMetamodelBuilder initialMetamodel) { this.reflectors = reflectors; this.integrator = integrator; this.initialMetamodel = initialMetamodel; }
private void PopulateAssociatedActions(IObjectSpecBuilder spec, Type[] services, IMetamodelBuilder metamodel) { if (string.IsNullOrWhiteSpace(spec.FullName)) { var id = spec.Identifier?.ClassName ?? "unknown"; logger.LogWarning($"Specification with id : {id} has null or empty name"); } if (FasterTypeUtils.IsSystem(spec.FullName) && !spec.IsCollection) { return; } if (FasterTypeUtils.IsNakedObjects(spec.FullName)) { return; } PopulateContributedActions(spec, services, metamodel); }