internal RepeatingElementReader(ModelInspector inspector, ITypedElement reader, ParserSettings settings) { _current = reader; _inspector = inspector; Settings = settings; }
public RepeatingElementReader(IFhirReader reader, ParserSettings settings) { _current = reader; _inspector = BaseFhirParser.Inspector; Settings = settings; }
internal RepeatingElementReader(ISourceNode reader, ParserSettings settings) { _current = reader; _inspector = BaseFhirParser.Inspector; Settings = settings; }
public void TestAssemblyInspection() { var inspector = new ModelInspector(); // Inspect the HL7.Fhir.Model assembly inspector.Import(typeof(Resource).Assembly); // Check for presence of some basic ingredients Assert.IsNotNull(inspector.FindClassMappingForResource("patient")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("HumanName")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("code")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("boolean")); // Verify presence of nested enumerations Assert.IsNotNull(inspector.FindEnumMappingByType(typeof(Address.AddressUse))); // Should have skipped abstract classes Assert.IsNull(inspector.FindClassMappingForResource("ComplexElement")); Assert.IsNull(inspector.FindClassMappingForResource("Element")); Assert.IsNull(inspector.FindClassMappingForResource("Resource")); // The open generic Code<> should not be there var codeOfT = inspector.FindClassMappingByType(typeof(Code <>)); Assert.IsNull(codeOfT); }
private void Run() { // Model definition building BuildModelDefinition(); // Applying mapping rules StorageMappingBuilder.Run(context); // Invoke user-defined transformations ApplyCustomDefinitions(); // Clean-up RemoveTemporaryDefinitions(); // Inspecting model definition ModelInspector.Run(context); // Applying fixup actions if (context.ModelInspectionResult.HasActions) { // Add handlers for hierarchies and types that could be created as a result of FixupProcessor work // This is done to inspect them right after construction with the help of ModelInspector var monitor = new TypeGenerationMonitor(context); monitor.Attach(); // Applying fixup actions to the model definition. FixupActionProcessor.Run(context); modelDefBuilder.ProcessTypes(); InspectAndProcessGeneratedEntities(); BuildModel(); monitor.Detach(); } else { // Simply build model BuildModel(); } }
internal DispatchingReader(ISourceNode data, ParserSettings settings, bool arrayMode) { _current = data; _inspector = BaseFhirParser.Inspector; _arrayMode = arrayMode; Settings = settings; }
public DispatchingReader(IFhirReader data, ParserSettings settings, bool arrayMode) { _current = data; _inspector = BaseFhirParser.Inspector; _arrayMode = arrayMode; Settings = settings; }
internal DispatchingReader(ModelInspector inspector, ITypedElement data, ParserSettings settings, bool arrayMode) { _current = data; _inspector = inspector; _arrayMode = arrayMode; Settings = settings; }
private static Lazy <ModelInspector> createDefaultModelInspector() { return(new Lazy <ModelInspector>(() => { var result = new ModelInspector(); result.Import(typeof(Resource).Assembly); return result; })); }
internal PocoElementNode(ModelInspector inspector, Base root, string rootName = null) { Current = root; _inspector = inspector; _myClassMapping = _inspector.ImportType(root.GetType()); InstanceType = ((IStructureDefinitionSummary)_myClassMapping).TypeName; Definition = ElementDefinitionSummary.ForRoot(_myClassMapping, rootName ?? root.TypeName); Location = InstanceType; ShortPath = InstanceType; }
protected virtual void ComponentParentNoSetterToField(IModelInspector modelinspector, PropertyPath member, IComponentAttributesMapper componentMapper) { System.Type componentType = member.LocalMember.GetPropertyOrFieldType(); IEnumerable <MemberInfo> persistentProperties = MembersProvider.GetComponentMembers(componentType).Where(p => ModelInspector.IsPersistentProperty(p)); MemberInfo parentReferenceProperty = GetComponentParentReferenceProperty(persistentProperties, member.LocalMember.ReflectedType); if (parentReferenceProperty != null && MatchNoSetterProperty(parentReferenceProperty)) { componentMapper.Parent(parentReferenceProperty, cp => cp.Access(Accessor.NoSetter)); } }
private static Lazy <ModelInspector> createDefaultModelInspector() { return(new Lazy <ModelInspector>(() => { var result = new ModelInspector(); #if PORTABLE45 result.Import(typeof(Resource).GetTypeInfo().Assembly); #else result.Import(typeof(Resource).Assembly); #endif return result; })); }
private PocoElementNode(ModelInspector inspector, Base instance, PocoElementNode parent, PropertyMapping definition, string location, string shortPath) { Current = instance; _inspector = inspector; var instanceType = determineInstanceType(instance.GetType(), definition); _myClassMapping = _inspector.ImportType(instanceType); InstanceType = ((IStructureDefinitionSummary)_myClassMapping).TypeName; Definition = definition ?? throw Error.ArgumentNull(nameof(definition)); ExceptionHandler = parent.ExceptionHandler; Location = location; ShortPath = shortPath; }
public static IModelUI CreateNodeInspector(this ElementBuilder elementBuilder, CommandDispatcher commandDispatcher, INodeModel model) { var ui = new ModelInspector(); ui.Setup(model, commandDispatcher, elementBuilder.View as ModelInspectorView, elementBuilder.Context); var nodeInspectorFields = NodeFieldsInspector.Create("node-fields", model, ui, ModelInspector.ussClassName); ui.PartList.AppendPart(nodeInspectorFields); ui.BuildUI(); ui.UpdateFromModel(); return(ui); }
public void TestEnumTypeResolving() { var inspector = new ModelInspector(); inspector.ImportEnum(typeof(SomeEnum)); inspector.ImportEnum(typeof(ActResource.SomeOtherEnum)); var result = inspector.FindEnumMappingByType(typeof(SomeEnum)); Assert.IsNotNull(result); Assert.AreEqual(typeof(SomeEnum), result.EnumType); result = inspector.FindEnumMappingByType(typeof(ActResource.SomeOtherEnum)); Assert.IsNotNull(result); Assert.AreEqual(typeof(ActResource.SomeOtherEnum), result.EnumType); }
public void TypeDataTypeNameResolving() { var inspector = new ModelInspector(); inspector.ImportType(typeof(AnimalName)); inspector.ImportType(typeof(NewAnimalName)); var result = inspector.FindClassMappingForFhirDataType("animalname"); Assert.IsNotNull(result); Assert.AreEqual(result.NativeType, typeof(NewAnimalName)); // Validate a mapping for a type will return the newest registration result = inspector.FindClassMappingByType(typeof(AnimalName)); Assert.IsNotNull(result); Assert.AreEqual(typeof(NewAnimalName), result.NativeType); }
private void InspectAndProcessGeneratedEntities() { foreach (var hieararchy in context.ModelInspectionResult.GeneratedHierarchies) { ModelInspector.Inspect(context, hieararchy); } foreach (var type in context.ModelInspectionResult.GeneratedTypes) { ModelInspector.Inspect(context, type); } context.ModelInspectionResult.GeneratedHierarchies.Clear(); context.ModelInspectionResult.GeneratedTypes.Clear(); if (context.ModelInspectionResult.HasActions) { // Applying fixup actions for generated entities. FixupActionProcessor.Run(context); } }
public void TestResourceNameResolving() { var inspector = new ModelInspector(ModelInspector.R3_VERSION); inspector.ImportType(typeof(Way)); inspector.ImportType(typeof(Way2)); var way = inspector.FindClassMappingByName("wAy"); Assert.IsNotNull(way); Assert.AreEqual(way.NativeType, typeof(Way)); var way2 = inspector.FindClassMappingByName("Way2"); Assert.IsNotNull(way2); Assert.AreEqual(way2.NativeType, typeof(Way2)); var noway = inspector.FindClassMappingByName("nonexistent"); Assert.IsNull(noway); }
public void TestResourceNameResolving() { var inspector = new ModelInspector(Specification.FhirRelease.STU3); inspector.ImportType(typeof(Way)); inspector.ImportType(typeof(Way2)); var way = inspector.FindClassMapping("Way"); Assert.IsNotNull(way); Assert.AreEqual(way.NativeType, typeof(Way)); var way2 = inspector.FindClassMapping("Way2"); Assert.IsNotNull(way2); Assert.AreEqual(way2.NativeType, typeof(Way2)); var noway = inspector.FindClassMapping("nonexistent"); Assert.IsNull(noway); }
public void TestAssemblyInspection() { var inspector = new ModelInspector(Specification.FhirRelease.STU3); // Inspect the HL7.Fhir.Model common assembly inspector.Import(typeof(Resource).GetTypeInfo().Assembly); // Check for presence of some basic ingredients Assert.IsNotNull(inspector.FindClassMapping("Meta")); Assert.IsNotNull(inspector.FindClassMapping(typeof(Code))); Assert.IsNotNull(inspector.FindClassMapping("boolean")); // Should also have found the abstract classes Assert.IsNotNull(inspector.FindClassMapping("Element")); Assert.IsNotNull(inspector.FindClassMapping(typeof(Resource))); // The open generic Code<> should not be there var codeOfT = inspector.FindClassMapping(typeof(Code <>)); Assert.IsNull(codeOfT); }
public void TestResourceNameResolving() { var inspector = new ModelInspector(); inspector.ImportType(typeof(Road)); inspector.ImportType(typeof(Way)); inspector.ImportType(typeof(ProfiledWay)); inspector.ImportType(typeof(NewStreet)); //inspector.Process(); var road = inspector.FindClassMappingForResource("roAd"); Assert.IsNotNull(road); Assert.AreEqual(road.NativeType, typeof(Road)); var way = inspector.FindClassMappingForResource("Way"); Assert.IsNotNull(way); Assert.AreEqual(way.NativeType, typeof(Way)); var pway = inspector.FindClassMappingForResource("way", "http://nu.nl/profile#street"); Assert.IsNotNull(pway); Assert.AreEqual(pway.NativeType, typeof(ProfiledWay)); var pway2 = inspector.FindClassMappingForResource("way", "http://nux.nl/profile#street"); Assert.IsNotNull(pway2); Assert.AreEqual(pway2.NativeType, typeof(Way)); var street = inspector.FindClassMappingForResource("Street"); Assert.IsNotNull(street); Assert.AreEqual(street.NativeType, typeof(NewStreet)); var noway = inspector.FindClassMappingForResource("nonexistent"); Assert.IsNull(noway); }
public void TestAssemblyInspection() { var inspector = new ModelInspector(); // Inspect the HL7.Fhir.Model assembly inspector.Import(typeof(Resource).GetTypeInfo().Assembly); // Check for presence of some basic ingredients Assert.IsNotNull(inspector.FindClassMappingForResource("patient")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("HumanName")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("code")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("boolean")); // Should also have found the abstract classes Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("Element")); Assert.IsNotNull(inspector.FindClassMappingForResource("Resource")); // The open generic Code<> should not be there var codeOfT = inspector.FindClassMappingByType(typeof(Code <>)); Assert.IsNull(codeOfT); }
public PrimitiveValueReader(ITypedElement data) { _current = data; _inspector = BaseFhirParser.Inspector; }
public ComplexTypeWriter(IFhirWriter writer) { _current = writer; _inspector = SerializationConfig.Inspector; }
public PrimitiveValueReader(ISourceNode data) { _current = data; _inspector = BaseFhirParser.Inspector; }
public ResourceReader(IFhirReader reader) { _reader = reader; _inspector = SerializationConfig.Inspector; }
public RepeatingElementWriter(IFhirWriter writer) { _current = writer; _inspector = SerializationConfig.Inspector; }
protected MemberInfo GetComponentParentReferenceProperty(IEnumerable <MemberInfo> persistentProperties, Type propertiesContainerType) { return(ModelInspector.IsComponent(propertiesContainerType) ? persistentProperties.FirstOrDefault(pp => pp.GetPropertyOrFieldType() == propertiesContainerType) : null); }
public ComplexTypeReader(IFhirReader reader) { _current = reader; _inspector = SerializationConfig.Inspector; }
public ComplexTypeReader(IFhirReader reader, ParserSettings settings) { _current = reader; _inspector = BaseFhirParser.Inspector; Settings = settings; }