public TETypeLookupStructureDataProvider(IMetamodel metamodel, IQueryableFactoryProvider queryableFactoryProvider, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IEntityBindingsProvider entityBindingsProvider, JsStructureEnricher jsStructureEnricher, IEntitiesLoader entitiesLoader, IUiInfoProvider uiInfoProvider, INamingConventionProvider namingConventionProvider, IDataTableByBindingsFactory dataTableByBindingsFactory, IBindingDataTableFiller bindingDataTableFiller, BindingsCreator bindingsCreator) : base(metamodel, fieldsByBindingsFactory, jsStructureFactory) { Contract.Requires(queryableFactoryProvider != null); Contract.Requires(entityBindingsProvider != null); Contract.Requires(jsStructureEnricher != null); Contract.Requires(entitiesLoader != null); Contract.Requires(dataTableByBindingsFactory != null); Contract.Requires(bindingDataTableFiller != null); Contract.Requires(bindingsCreator != null); _queryableFactoryProvider = queryableFactoryProvider; _entityBindingsProvider = entityBindingsProvider; _jsStructureEnricher = jsStructureEnricher; _entitiesLoader = entitiesLoader; _dataTableByBindingsFactory = dataTableByBindingsFactory; _bindingDataTableFiller = bindingDataTableFiller; _bindingsCreator = bindingsCreator; _linqQueryBuilder = new LinqQueryBuilder(metamodel, uiInfoProvider, namingConventionProvider); SetEntityType(typeof(WmsTEType)); }
public MetamodelManager(SpecFactory specFactory, IMetamodel metamodel) { Assert.AssertNotNull(specFactory); Assert.AssertNotNull(metamodel); this.specFactory = specFactory; this.metamodel = metamodel; }
public static IdentifierImpl FromIdentityString(IMetamodel metamodel, string asString) { Assert.AssertNotNull(asString); int indexOfHash = asString.IndexOf("#", StringComparison.InvariantCulture); int indexOfOpenBracket = asString.IndexOf("(", StringComparison.InvariantCulture); int indexOfCloseBracket = asString.IndexOf(")", StringComparison.InvariantCulture); string className = asString.Substring(0, (indexOfHash == -1 ? asString.Length : indexOfHash) - 0); if (indexOfHash == -1 || indexOfHash == asString.Length - 1) { return(new IdentifierImpl(className)); } string name; if (indexOfOpenBracket == -1) { name = asString.Substring(indexOfHash + 1); return(new IdentifierImpl(className, name)); } name = asString.Substring(indexOfHash + 1, indexOfOpenBracket - (indexOfHash + 1)); string allParms = asString.Substring(indexOfOpenBracket + 1, indexOfCloseBracket - (indexOfOpenBracket + 1)).Trim(); string[] parms = allParms.Length > 0 ? allParms.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) : new string[] {}; return(new IdentifierImpl(className, name, parms)); }
// The special constructor is used to deserialize values. protected MenuImpl(SerializationInfo info, StreamingContext context) { tempItems = info.GetValue <IList <IMenuItemImmutable> >("items"); SuperMenu = info.GetValue <IMenu>("SuperMenu"); Name = info.GetValue <string>("Name"); Id = info.GetValue <string>("Id"); Metamodel = info.GetValue <IMetamodel>("Metamodel"); }
private IdentifierImpl(IMetamodel metamodel, string className, string fieldName, string[] parameterNames, string[] parameterTypeNames, bool isField) { this.className = className; name = fieldName; parameterTypes = parameterTypeNames; MemberParameterSpecifications = parameterTypes.Select(x => metamodel.GetSpecification(TypeNameUtils.DecodeTypeName(x))).ToArray(); this.parameterNames = parameterNames; this.isField = isField; }
public MenuImpl(IMetamodel metamodel, Type type, bool addAllActions, string name) { Metamodel = metamodel; Type = type; Name = name ?? ObjectSpec.GetFacet<INamedFacet>().NaturalName; Id = type.Name; if (addAllActions) { AddRemainingNativeActions(); AddContributedActions(); } }
public MenuImpl(IMetamodel metamodel, string name, string id = null) { Metamodel = metamodel; if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(id)) { throw new Exception($"Menu Name and Id must not be null, unless a default type is specified"); } Name = name; Id = id; }
public ObjectSpecImmutable(Type type, IMetamodel metamodel) { Type = type.IsGenericType && CollectionUtils.IsCollection(type) ? type.GetGenericTypeDefinition() : type; identifier = new IdentifierImpl(metamodel, type.FullName); Interfaces = ImmutableList <IObjectSpecImmutable> .Empty; subclasses = ImmutableList <IObjectSpecImmutable> .Empty; ContributedActions = ImmutableList <IActionSpecImmutable> .Empty; CollectionContributedActions = ImmutableList <IActionSpecImmutable> .Empty; FinderActions = ImmutableList <IActionSpecImmutable> .Empty; }
public virtual void SetUp() { var cache = new ImmutableInMemorySpecCache(); var config = new ReflectorConfiguration(new[] { typeof(List <TestPoco>), typeof(ArrayList) }, new Type[] { }, new Type[] { }, new Type[] { }, new[] { typeof(TestPoco).Namespace }); var menuFactory = new NullMenuFactory(); var classStrategy = new DefaultClassStrategy(config); var metamodel = new Metamodel(classStrategy, cache); var reflector = new Reflector(classStrategy, metamodel, config, menuFactory, new IFacetDecorator[] { }, facetFactories); Specification = LoadSpecification(reflector); Metamodel = metamodel; }
public MenuImpl(IMetamodel metamodel, Type type, bool addAllActions, string name) { Metamodel = metamodel; Type = type; Name = name ?? ObjectSpec.GetFacet <INamedFacet>().NaturalName; Id = type.Name; if (addAllActions) { AddRemainingNativeActions(); AddContributedActions(); } }
public CargoIwbPosByIwbGridStructureDataProvider(IMetamodel metamodel, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IEntityBindingsProvider entityBindingsProvider, JsStructureEnricher jsStructureEnricher, IEntitiesLoader entitiesLoader) : base( metamodel, fieldsByBindingsFactory, jsStructureFactory, entityBindingsProvider, jsStructureEnricher, entitiesLoader) { SetEntityType(typeof(WmsCargoIWBPos)); }
public TransportDocumentStructureDataProvider(IMetamodel metamodel, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IEntitiesLoader entitiesLoader, JsStructureEnricher jsStructureEnricher, BindingsCreator bindingsCreator, EntityBindingsProvider entityBindingsProvider) : base(metamodel, fieldsByBindingsFactory, jsStructureFactory, entityBindingsProvider, jsStructureEnricher, entitiesLoader) { _bindingsCreator = bindingsCreator; SetEntityType(typeof(CstTransportDocument)); }
public CstReqCustomsPosDataProvider(IMetamodel metamodel, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IEntitiesLoader entitiesLoader, JsStructureEnricher jsStructureEnricher, BindingsCreator bindingsCreator, EntityBindingsProvider entityBindingsProvider) : base(metamodel, fieldsByBindingsFactory, jsStructureFactory, entityBindingsProvider, jsStructureEnricher, entitiesLoader) { _bindingsCreator = bindingsCreator; SetEntityType(typeof(CstReqCustomsPos)); }
private static IPolicyEnforcementService GetPolicyEnforcementService(IMetamodel metamodel, IEnumerable <Policy> policies) { var pes = new PolicyEnforcementService(metamodel); foreach (var policy in policies) { pes.AddPolicy(policy.Name, policy.Expression, policy.UserType, policy.ResourceType, policy.EnvironmentType); } return(pes); }
public TypedMenu(IMetamodel metamodel, bool addAllActions, string name) : base(metamodel, name) { if (name == null) { Name = GetFriendlyNameForObject(); } Id = typeof(TObject).Name; if (addAllActions) { AddRemainingNativeActions(); AddContributedActions(); } }
public ExternalTrafficStructureDataProvider(IMetamodel metamodel, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IEntitiesLoader entitiesLoader, JsStructureEnricher jsStructureEnricher, BindingsCreator bindingsCreator) : base(metamodel, fieldsByBindingsFactory, jsStructureFactory) { _entitiesLoader = entitiesLoader; _jsStructureEnricher = jsStructureEnricher; _bindingsCreator = bindingsCreator; SetEntityType(typeof(YExternalTraffic)); }
public IwbGridStructureDataProvider(IMetamodel metamodel, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IEntityBindingsProvider entityBindingsProvider, JsStructureEnricher jsStructureEnricher, IEntitiesLoader entitiesLoader, BindingsCreator bindingsCreator) : base(metamodel, fieldsByBindingsFactory, jsStructureFactory, entityBindingsProvider, jsStructureEnricher, entitiesLoader) { _entitiesLoader = entitiesLoader; _jsStructureEnricher = jsStructureEnricher; _bindingsCreator = bindingsCreator; SetEntityType(typeof(WmsIWB)); }
public PassRequestListStructureDataProvider(IMetamodel metamodel, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IEntitiesLoader entitiesLoader, JsStructureEnricher jsStructureEnricher, BindingsCreator bindingsCreator) : base(metamodel, fieldsByBindingsFactory, jsStructureFactory) { _entitiesLoader = entitiesLoader; _jsStructureEnricher = jsStructureEnricher; _bindingsCreator = bindingsCreator; SetEntityType(typeof(YPassRequest)); }
public string GetIconName(INakedObjectAdapter forObjectAdapter, IMetamodel metamodel) { var iconFacet = GetFacet <IIconFacet>(); string iconName = null; if (iconFacet != null) { iconName = forObjectAdapter == null?iconFacet.GetIconName() : iconFacet.GetIconName(forObjectAdapter); } else if (IsCollection && !IsParseable) { iconName = GetFacet <ITypeOfFacet>().GetValueSpec(forObjectAdapter, metamodel).GetIconName(null, metamodel); } return(string.IsNullOrEmpty(iconName) ? "Default" : iconName); }
public virtual void SetUp() { var cache = new ImmutableInMemorySpecCache(); ReflectorConfiguration.NoValidate = true; var config = new ReflectorConfiguration(new[] { typeof(List <TestPoco>), typeof(ArrayList) }, new Type[] { }, new[] { typeof(TestPoco).Namespace }); var menuFactory = new NullMenuFactory(); var classStrategy = new DefaultClassStrategy(config); var mockLogger = new Mock <ILogger <Metamodel> >().Object; var metamodel = new Metamodel(classStrategy, cache, mockLogger); var mockLogger1 = new Mock <ILogger <Reflector> >().Object; var mockLoggerFactory = new Mock <ILoggerFactory>().Object; var reflector = new Reflector(classStrategy, metamodel, config, menuFactory, new IFacetDecorator[] { }, facetFactories, mockLoggerFactory, mockLogger1); Specification = LoadSpecification(reflector); Metamodel = metamodel; }
public CstReqCustomsReportStructureDataProvider(IMetamodel metamodel, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IEntitiesLoader entitiesLoader, JsStructureEnricher jsStructureEnricher, EntityBindingsProvider entityBindingsProvider, IDataTableByBindingsFactory dataTableByBindingsFactory, IBindingDataTableFiller bindingDataTableFiller, LinqQueryBuilder linqQueryBuilder, ISessionFactory sessionFactory) : base( metamodel, fieldsByBindingsFactory, jsStructureFactory, entityBindingsProvider, jsStructureEnricher, entitiesLoader) { _dataTableByBindingsFactory = dataTableByBindingsFactory; _bindingDataTableFiller = bindingDataTableFiller; _linqQueryBuilder = linqQueryBuilder; _sessionFactory = sessionFactory; SetEntityType(typeof(WmsReport)); }
public OwbGridStructureDataProvider(IMetamodel metamodel, FieldsByBindingsFactory fieldsByBindingsFactory, JsStructureFactory jsStructureFactory, IDataTableByBindingsFactory dataTableByBindingsFactory, IBindingDataTableFiller bindingDataTableFiller, JsStructureEnricher jsStructureEnricher, BindingsCreator bindingsCreator, LinqQueryBuilder linqQueryBuilder, ISessionFactory sessionFactory) : base(metamodel) { _fieldsByBindingsFactory = fieldsByBindingsFactory; _jsStructureFactory = jsStructureFactory; _dataTableByBindingsFactory = dataTableByBindingsFactory; _bindingDataTableFiller = bindingDataTableFiller; _jsStructureEnricher = jsStructureEnricher; _bindingsCreator = bindingsCreator; _linqQueryBuilder = linqQueryBuilder; _sessionFactory = sessionFactory; SetEntityType(typeof(WmsOWB)); }
// The special constructor is used to deserialize values. protected MenuImpl(SerializationInfo info, StreamingContext context) { tempItems = info.GetValue<IList<IMenuItemImmutable>>("items"); SuperMenu = info.GetValue<IMenu>("SuperMenu"); Name = info.GetValue<string>("Name"); Id = info.GetValue<string>("Id"); Metamodel = info.GetValue<IMetamodel>("Metamodel"); }
public static IdentifierImpl FromIdentityString(IMetamodel metamodel, string asString) { Assert.AssertNotNull(asString); int indexOfHash = asString.IndexOf("#", StringComparison.InvariantCulture); int indexOfOpenBracket = asString.IndexOf("(", StringComparison.InvariantCulture); int indexOfCloseBracket = asString.IndexOf(")", StringComparison.InvariantCulture); string className = asString.Substring(0, (indexOfHash == -1 ? asString.Length : indexOfHash) - (0)); if (indexOfHash == -1 || indexOfHash == (asString.Length - 1)) { return new IdentifierImpl(className); } string name; if (indexOfOpenBracket == -1) { name = asString.Substring(indexOfHash + 1); return new IdentifierImpl(className, name); } name = asString.Substring(indexOfHash + 1, (indexOfOpenBracket) - (indexOfHash + 1)); string allParms = asString.Substring(indexOfOpenBracket + 1, (indexOfCloseBracket) - (indexOfOpenBracket + 1)).Trim(); string[] parms = allParms.Length > 0 ? allParms.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries) : new string[] {}; return new IdentifierImpl(className, name, parms); }
public string GetIconName(INakedObjectAdapter forObjectAdapter, IMetamodel metamodel) { var iconFacet = GetFacet<IIconFacet>(); string iconName = null; if (iconFacet != null) { iconName = forObjectAdapter == null ? iconFacet.GetIconName() : iconFacet.GetIconName(forObjectAdapter); } else if (IsCollection && !IsParseable) { iconName = GetFacet<ITypeOfFacet>().GetValueSpec(forObjectAdapter, metamodel).GetIconName(null, metamodel); } return string.IsNullOrEmpty(iconName) ? "Default" : iconName; }
public IObjectSpecImmutable GetValueSpec(INakedObjectAdapter collection, IMetamodel metamodel) => (IObjectSpecImmutable)metamodel.GetSpecification(GetValue(collection));
public IObjectSpecImmutable GetValueSpec(INakedObjectAdapter collection, IMetamodel metamodel) => spec;
public IObjectSpecImmutable GetValueSpec(INakedObject collection, IMetamodel metamodel) { return(spec); }
private void PopulateContributedActions(IObjectSpecBuilder spec, Type[] services, IMetamodel metamodel) { var result = services.AsParallel().Select(serviceType => { var serviceSpecification = (IServiceSpecImmutable)metamodel.GetSpecification(serviceType); IActionSpecImmutable[] serviceActions = serviceSpecification.ObjectActions.Where(sa => sa != null).ToArray(); var matchingActionsForObject = new List <IActionSpecImmutable>(); var matchingActionsForCollection = new List <IActionSpecImmutable>(); var finderActions = new List <IActionSpecImmutable>(); foreach (var sa in serviceActions) { if (serviceType != spec.Type) { if (sa.IsContributedTo(spec)) { matchingActionsForObject.Add(sa); } if (sa.IsContributedToCollectionOf(spec)) { matchingActionsForCollection.Add(sa); } } if (sa.IsFinderMethodFor(spec)) { finderActions.Add(sa); } } return(new Tuple <List <IActionSpecImmutable>, List <IActionSpecImmutable>, List <IActionSpecImmutable> >(matchingActionsForObject, matchingActionsForCollection, finderActions.OrderBy(a => a, new MemberOrderComparator <IActionSpecImmutable>()).ToList())); }).Aggregate(new Tuple <List <IActionSpecImmutable>, List <IActionSpecImmutable>, List <IActionSpecImmutable> >(new List <IActionSpecImmutable>(), new List <IActionSpecImmutable>(), new List <IActionSpecImmutable>()), (a, t) => { a.Item1.AddRange(t.Item1); a.Item2.AddRange(t.Item2); a.Item3.AddRange(t.Item3); return(a); }); // var contribActions = new List <IActionSpecImmutable>(); // group by service - probably do this better - TODO foreach (var service in services) { var matching = result.Item1.Where(i => i.OwnerSpec.Type == service); contribActions.AddRange(matching); } spec.AddContributedActions(contribActions); spec.AddCollectionContributedActions(result.Item2); spec.AddFinderActions(result.Item3); }
private void PopulateContributedActions(IObjectSpecBuilder spec, Type[] services, IMetamodel metamodel) { var result = services. AsParallel(). Select(serviceType => { var serviceSpecification = (IServiceSpecImmutable)metamodel.GetSpecification(serviceType); IActionSpecImmutable[] serviceActions = serviceSpecification.ObjectActions.Where(sa => sa != null).ToArray(); var matchingActionsForObject = serviceType != spec.Type ? serviceActions.Where(sa => sa.IsContributedTo(spec)).ToList() : new List <IActionSpecImmutable>(); var matchingActionsForCollection = serviceType != spec.Type ? serviceActions.Where(sa => sa.IsContributedToCollectionOf(spec)).ToList() : new List <IActionSpecImmutable>(); var finderActions = serviceActions.Where(sa => sa.IsFinderMethodFor(spec)).ToList(); if (finderActions.Any()) { finderActions.Sort(new MemberOrderComparator <IActionSpecImmutable>()); } return(new Tuple <List <IActionSpecImmutable>, List <IActionSpecImmutable>, List <IActionSpecImmutable> >(matchingActionsForObject, matchingActionsForCollection, finderActions)); }). Aggregate(new Tuple <List <IActionSpecImmutable>, List <IActionSpecImmutable>, List <IActionSpecImmutable> >(new List <IActionSpecImmutable>(), new List <IActionSpecImmutable>(), new List <IActionSpecImmutable>()), (a, t) => { a.Item1.AddRange(t.Item1); a.Item2.AddRange(t.Item2); a.Item3.AddRange(t.Item3); return(a); }); spec.AddContributedActions(result.Item1); spec.AddCollectionContributedActions(result.Item2); spec.AddFinderActions(result.Item3); }
private static void PopulateContributedActions(IObjectSpecBuilder spec, Type[] services, IMetamodel metamodel) { var(contribActions, collContribActions, finderActions) = services.AsParallel().Select(serviceType => { var serviceSpecification = (IServiceSpecImmutable)metamodel.GetSpecification(serviceType); var serviceActions = serviceSpecification.ObjectActions.Where(sa => sa != null).ToArray(); var matchingActionsForObject = new List <IActionSpecImmutable>(); var matchingActionsForCollection = new List <IActionSpecImmutable>(); var matchingFinderActions = new List <IActionSpecImmutable>(); foreach (var sa in serviceActions) { if (serviceType != spec.Type) { if (sa.IsContributedTo(spec)) { matchingActionsForObject.Add(sa); } if (sa.IsContributedToCollectionOf(spec)) { matchingActionsForCollection.Add(sa); } } if (sa.IsFinderMethodFor(spec)) { matchingFinderActions.Add(sa); } } return(matchingActionsForObject, matchingActionsForCollection, matchingFinderActions.OrderBy(a => a, new MemberOrderComparator <IActionSpecImmutable>()).ToList()); }).Aggregate((new List <IActionSpecImmutable>(), new List <IActionSpecImmutable>(), new List <IActionSpecImmutable>()), (a, t) => { var(contrib, collContrib, finder) = a; var(ca, cca, fa) = t; contrib.AddRange(ca); collContrib.AddRange(cca); finder.AddRange(fa); return(a); }); var groupedContribActions = contribActions.GroupBy(i => i.OwnerSpec.Type, i => i, (service, actions) => new { service, actions }).OrderBy(a => Array.IndexOf(services, a.service)).SelectMany(a => a.actions).ToList(); spec.AddContributedActions(groupedContribActions); spec.AddCollectionContributedActions(collContribActions); spec.AddFinderActions(finderActions); }
private void PopulateContributedFunctions(ITypeSpecBuilder spec, ITypeSpecImmutable[] functions, IMetamodel metamodel) { var result = functions.AsParallel().SelectMany(functionsSpec => { var serviceActions = functionsSpec.ObjectActions.Where(sa => sa != null).ToArray(); var matchingActionsForObject = new List <IActionSpecImmutable>(); foreach (var sa in serviceActions) { if (IsContributedFunction(sa, spec)) { matchingActionsForObject.Add(sa); } } return(matchingActionsForObject); }).ToList(); spec.AddContributedFunctions(result); }
public static IServiceSpecBuilder CreateServiceSpecImmutable(Type type, IMetamodel metamodel) { return(new ServiceSpecImmutable(type)); }
public static IObjectSpecBuilder CreateObjectSpecImmutable(Type type, IMetamodel metamodel) { return(new ObjectSpecImmutable(type)); }
public static IObjectSpecBuilder CreateObjectSpecImmutable(Type type, IMetamodel metamodel) { return new ObjectSpecImmutable(type); }
public IObjectSpecImmutable GetValueSpec(INakedObjectAdapter collection, IMetamodel metamodel) { return spec; }
public IObjectSpecImmutable GetValueSpec(INakedObjectAdapter collection, IMetamodel metamodel) { return (IObjectSpecImmutable) metamodel.GetSpecification(GetValue(collection)); }
public static IServiceSpecBuilder CreateServiceSpecImmutable(Type type, IMetamodel metamodel) { return new ServiceSpecImmutable(type); }